diff options
author | Richard Guenther <rguenther@suse.de> | 2009-03-27 23:00:22 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-03-27 23:00:22 +0000 |
commit | 628c189edb5aae6b4e1d416a92cbd0cb9f68586f (patch) | |
tree | 1d480e401b2ea473d780770388aea56b9a1a1c68 /gcc/fold-const.c | |
parent | 0387122d055068bd3f76eb14f3b5f2ee77f21aee (diff) | |
download | gcc-628c189edb5aae6b4e1d416a92cbd0cb9f68586f.tar.gz |
gimplify.c (mark_addressable): Export.
2009-03-27 Richard Guenther <rguenther@suse.de>
* gimplify.c (mark_addressable): Export.
* tree-flow.h (mark_addressable): Declare.
* tree-ssa-loop-manip.c (create_iv): Mark the base addressable.
* tree-ssa.c (verify_phi_args): Verify that address taken
variables have TREE_ADDRESSABLE set.
2009-03-27 Richard Guenther <rguenther@suse.de>
* fold-const.c (build_fold_addr_expr_with_type_1): Rename back to ...
(build_fold_addr_expr_with_type): ... this. Remove in_fold handling.
Do not mark decls TREE_ADDRESSABLE.
(build_fold_addr_expr): Adjust.
(fold_addr_expr): Remove.
(fold_unary): Use build_fold_addr_expr.
(fold_comparison): Likewise.
(split_address_to_core_and_offset): Likewise.
* coverage.c (tree_coverage_counter_addr): Mark the array decl
TREE_ADDRESSABLE.
* gimplify.c (mark_addressable): Do not exclude RESULT_DECLs.
(gimplify_modify_expr_to_memcpy): Mark source and destination
addressable.
* omp-low.c (create_omp_child_function): Mark the object decl
TREE_ADDRESSABLE.
(lower_rec_input_clauses): Mark the var we take the address of
TREE_ADDRESSABLE.
(lower_omp_taskreg): Mark the sender decl TREE_ADDRESSABLE.
fortran/
* trans-array.c (gfc_conv_descriptor_data_addr): Use
gfc_build_addr_expr instead of build_fold_addr_expr.
(gfc_trans_allocate_array_storage, gfc_trans_array_constructor_value,
gfc_trans_constant_array_constructor, gfc_conv_array_data,
gfc_conv_expr_descriptor, gfc_conv_array_parameter): Likewise.
* trans-expr.c (gfc_conv_missing_dummy, gfc_conv_variable,
gfc_conv_function_val, gfc_conv_operator_assign,
gfc_conv_subref_array_arg, gfc_conv_function_call,
gfc_conv_expr_reference, gfc_trans_scalar_assign): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_exponent,
gfc_conv_intrinsic_ctime, gfc_conv_intrinsic_fdate,
gfc_conv_intrinsic_ttynam, gfc_conv_intrinsic_minmax_char,
gfc_conv_intrinsic_fraction, gfc_conv_intrinsic_spacing,
gfc_conv_intrinsic_rrspacing, gfc_conv_intrinsic_set_exponent,
gfc_conv_intrinsic_array_transfer, gfc_conv_intrinsic_transfer,
gfc_conv_intrinsic_si_kind, gfc_conv_intrinsic_trim): Likewise.
* trans-io.c (gfc_trans_io_runtime_check, set_parameter_ref,
gfc_convert_array_to_string, gfc_trans_open, gfc_trans_close,
build_filepos, gfc_trans_inquire, gfc_trans_wait,
nml_get_addr_expr, transfer_namelist_element, build_dt,
gfc_trans_dt_end, transfer_array_component, transfer_expr,
transfer_array_desc, gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_allocate, gfc_trans_deallocate): Likewise.
* trans.c (gfc_build_addr_expr): Mark the base of the address
TREE_ADDRESSABLE.
From-SVN: r145142
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 55 |
1 files changed, 9 insertions, 46 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e38850fd5df..4ca91a22d98 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7937,11 +7937,10 @@ fold_view_convert_expr (tree type, tree expr) } /* Build an expression for the address of T. Folds away INDIRECT_REF - to avoid confusing the gimplify process. When IN_FOLD is true - avoid modifications of T. */ + to avoid confusing the gimplify process. */ -static tree -build_fold_addr_expr_with_type_1 (tree t, tree ptrtype, bool in_fold) +tree +build_fold_addr_expr_with_type (tree t, tree ptrtype) { /* The size of the object is not relevant when talking about its address. */ if (TREE_CODE (t) == WITH_SIZE_EXPR) @@ -7956,56 +7955,20 @@ build_fold_addr_expr_with_type_1 (tree t, tree ptrtype, bool in_fold) if (TREE_TYPE (t) != ptrtype) t = build1 (NOP_EXPR, ptrtype, t); } - else if (!in_fold) - { - tree base = t; - - while (handled_component_p (base)) - base = TREE_OPERAND (base, 0); - - if (DECL_P (base)) - TREE_ADDRESSABLE (base) = 1; - - t = build1 (ADDR_EXPR, ptrtype, t); - } else t = build1 (ADDR_EXPR, ptrtype, t); return t; } -/* Build an expression for the address of T with type PTRTYPE. This - function modifies the input parameter 'T' by sometimes setting the - TREE_ADDRESSABLE flag. */ - -tree -build_fold_addr_expr_with_type (tree t, tree ptrtype) -{ - return build_fold_addr_expr_with_type_1 (t, ptrtype, false); -} - -/* Build an expression for the address of T. This function modifies - the input parameter 'T' by sometimes setting the TREE_ADDRESSABLE - flag. When called from fold functions, use fold_addr_expr instead. */ +/* Build an expression for the address of T. */ tree build_fold_addr_expr (tree t) { - return build_fold_addr_expr_with_type_1 (t, - build_pointer_type (TREE_TYPE (t)), - false); -} - -/* Same as build_fold_addr_expr, builds an expression for the address - of T, but avoids touching the input node 't'. Fold functions - should use this version. */ - -static tree -fold_addr_expr (tree t) -{ tree ptrtype = build_pointer_type (TREE_TYPE (t)); - return build_fold_addr_expr_with_type_1 (t, ptrtype, true); + return build_fold_addr_expr_with_type (t, ptrtype); } /* Fold a unary expression of code CODE and type TYPE with operand @@ -8245,7 +8208,7 @@ fold_unary (enum tree_code code, tree type, tree op0) if (! offset && bitpos == 0 && TYPE_MAIN_VARIANT (TREE_TYPE (type)) == TYPE_MAIN_VARIANT (TREE_TYPE (base))) - return fold_convert (type, fold_addr_expr (base)); + return fold_convert (type, build_fold_addr_expr (base)); } if (TREE_CODE (op0) == MODIFY_EXPR @@ -9155,9 +9118,9 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1) && operand_equal_p (offset0, offset1, 0)))) { if (indirect_base0) - base0 = fold_addr_expr (base0); + base0 = build_fold_addr_expr (base0); if (indirect_base1) - base1 = fold_addr_expr (base1); + base1 = build_fold_addr_expr (base1); return fold_build2 (code, type, base0, base1); } } @@ -15829,7 +15792,7 @@ split_address_to_core_and_offset (tree exp, core = get_inner_reference (TREE_OPERAND (exp, 0), &bitsize, pbitpos, poffset, &mode, &unsignedp, &volatilep, false); - core = fold_addr_expr (core); + core = build_fold_addr_expr (core); } else { |