diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2004-03-21 18:09:20 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2004-03-21 13:09:20 -0500 |
commit | 6fce44af562fae5ad9275e183abdf6cf87a87f6e (patch) | |
tree | 7935f9b36f94acbc172af472df20b0384eb56ff8 /gcc/ada/utils2.c | |
parent | fc5fccdee994a93c1360b9a2934f0232820f9333 (diff) | |
download | gcc-6fce44af562fae5ad9275e183abdf6cf87a87f6e.zip gcc-6fce44af562fae5ad9275e183abdf6cf87a87f6e.tar.gz gcc-6fce44af562fae5ad9275e183abdf6cf87a87f6e.tar.bz2 |
alias.c (get_alias_set): Remove handling of PLACEHOLDER_EXPR.
* alias.c (get_alias_set): Remove handling of PLACEHOLDER_EXPR.
* emit-rtl.c (component_ref_for_mem_expr): Likewise.
(set_mem_attributes_minus_bitpos): Call SUBSTITUTE_PLACEHOLDER_IN_EXPR.
* explow.c (expr_size): Likewise.
* expr.h (placeholder_list, find_placeholder): Deleted.
* expr.c (store_constructor): Likewise.
(get_inner_reference): Likewise. Also don't call find_placeholder.
(placeholder_list, find_placeholder): Deleted.
(is_aligning_offset): Don't handle WITH_RECORD_EXPR, PLACEHOLDER_EXPR.
(expand_expr_real, cases PLACEHOLDER_EXPR, WITH_RECORD_EXPR): Likewise.
(highest_pow2_factor, case WITH_RECORD_EXPR): Remove.
* dojump.c (do_jump, case WITH_RECORD_EXPR): Likewise.
* dwarf2out.c (loc_descriptor_from_tree, case WITH_RECORD_EXPR):
Likewise.
* fold-const.c (invert_truthvalue, case WITH_RECORD_EXPR): Likewise.
(extract_muldiv, case WITH_RECORD_EXPR): Likewise.
* tree.c (expr_align, case WITH_RECORD_EXPR): Likewise.
(contains_placeholder_p): Don't handle WITH_RECORD_EXPR.
Clean up by using first_rtl_op.
(substitute_in_expr): Use SUBSTITUTE_IN_EXPR for recursive call.
(substitute_placeholder_in_expr): New function.
* tree.def (WITH_RECORD_EXPR): Deleted.
* tree.h (SUBSTITUTE_IN_EXPR, SUBSTITUTE_PLACEHOLDER_IN_EXPR): New.
(substitute_placeholder_in_expr): New.
* ada/decl.c (gnat_to_gnu_entity): Use SUBSTITUTE_PLACEHOLDER_IN_EXPR.
* ada/trans.c (tree_transform, emit_index_check): Likewise.
* ada/utils.c (build_template): Likewise.
(max_size, convert): Remove handling of WITH_RECORD_EXPR.
(maybe_unconstrained_array, unchecked_convert): Likewise.
* ada/utils2.c (gnat_truthvalue_conversion, build_binary_op): Likewise.
(build_unary_op): Likewise.
(compare_arrays, build_allocator): Use SUBSTITUTE_PLACEHOLDER_IN_EXPR.
(fill_vms_descriptor): Likewise.
(build_call_alloc_dealloc): Likewise.
ALIGN is unsigned.
* ada/gigi.h (build_call_alloc_dealloc): Alignment is unsigned.
From-SVN: r79789
Diffstat (limited to 'gcc/ada/utils2.c')
-rw-r--r-- | gcc/ada/utils2.c | 105 |
1 files changed, 18 insertions, 87 deletions
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c index a8f228d..a0d33db 100644 --- a/gcc/ada/utils2.c +++ b/gcc/ada/utils2.c @@ -90,11 +90,6 @@ gnat_truthvalue_conversion (tree expr) gnat_truthvalue_conversion (TREE_OPERAND (expr, 1)), gnat_truthvalue_conversion (TREE_OPERAND (expr, 2)))); - case WITH_RECORD_EXPR: - return build (WITH_RECORD_EXPR, type, - gnat_truthvalue_conversion (TREE_OPERAND (expr, 0)), - TREE_OPERAND (expr, 1)); - default: return build_binary_op (NE_EXPR, type, expr, convert (type, integer_zero_node)); @@ -381,15 +376,10 @@ compare_arrays (tree result_type, tree a1, tree a2) tree lb = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); comparison = build_binary_op (LT_EXPR, result_type, ub, lb); - - if (CONTAINS_PLACEHOLDER_P (comparison)) - comparison = build (WITH_RECORD_EXPR, result_type, - comparison, a1); - if (CONTAINS_PLACEHOLDER_P (length1)) - length1 = build (WITH_RECORD_EXPR, bt, length1, a1); + comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); + length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); length_zero_p = 1; - this_a1_is_null = comparison; this_a2_is_null = convert (result_type, integer_one_node); } @@ -413,10 +403,8 @@ compare_arrays (tree result_type, tree a1, tree a2) /* Note that we know that UB2 and LB2 are constant and hence cannot contain a PLACEHOLDER_EXPR. */ - if (CONTAINS_PLACEHOLDER_P (comparison)) - comparison = build (WITH_RECORD_EXPR, result_type, comparison, a1); - if (CONTAINS_PLACEHOLDER_P (length1)) - length1 = build (WITH_RECORD_EXPR, bt, length1, a1); + comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); + length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); this_a1_is_null = build_binary_op (LT_EXPR, result_type, ub1, lb1); this_a2_is_null = convert (result_type, integer_zero_node); @@ -425,10 +413,8 @@ compare_arrays (tree result_type, tree a1, tree a2) /* Otherwise compare the computed lengths. */ else { - if (CONTAINS_PLACEHOLDER_P (length1)) - length1 = build (WITH_RECORD_EXPR, bt, length1, a1); - if (CONTAINS_PLACEHOLDER_P (length2)) - length2 = build (WITH_RECORD_EXPR, bt, length2, a2); + length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); + length2 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length2, a2); comparison = build_binary_op (EQ_EXPR, result_type, length1, length2); @@ -606,39 +592,6 @@ build_binary_op (enum tree_code op_code, tree result; int has_side_effects = 0; - /* If one (but not both, unless they have the same object) operands are a - WITH_RECORD_EXPR, do the operation and then surround it with the - WITH_RECORD_EXPR. Don't do this for assignment, for an ARRAY_REF, or - for an ARRAY_RANGE_REF because we need to keep track of the - WITH_RECORD_EXPRs on both operands very carefully. */ - if (op_code != MODIFY_EXPR && op_code != ARRAY_REF - && op_code != ARRAY_RANGE_REF - && TREE_CODE (left_operand) == WITH_RECORD_EXPR - && (TREE_CODE (right_operand) != WITH_RECORD_EXPR - || operand_equal_p (TREE_OPERAND (left_operand, 1), - TREE_OPERAND (right_operand, 1), 0))) - { - tree right = right_operand; - - if (TREE_CODE (right) == WITH_RECORD_EXPR) - right = TREE_OPERAND (right, 0); - - result = build_binary_op (op_code, result_type, - TREE_OPERAND (left_operand, 0), right); - return build (WITH_RECORD_EXPR, TREE_TYPE (result), result, - TREE_OPERAND (left_operand, 1)); - } - else if (op_code != MODIFY_EXPR && op_code != ARRAY_REF - && op_code != ARRAY_RANGE_REF - && TREE_CODE (left_operand) != WITH_RECORD_EXPR - && TREE_CODE (right_operand) == WITH_RECORD_EXPR) - { - result = build_binary_op (op_code, result_type, left_operand, - TREE_OPERAND (right_operand, 0)); - return build (WITH_RECORD_EXPR, TREE_TYPE (result), result, - TREE_OPERAND (right_operand, 1)); - } - if (operation_type != 0 && TREE_CODE (operation_type) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (operation_type)) @@ -755,7 +708,6 @@ build_binary_op (enum tree_code op_code, result = TREE_OPERAND (result, 0); else if (TREE_CODE (result) == REALPART_EXPR || TREE_CODE (result) == IMAGPART_EXPR - || TREE_CODE (result) == WITH_RECORD_EXPR || ((TREE_CODE (result) == NOP_EXPR || TREE_CODE (result) == CONVERT_EXPR) && (((TREE_CODE (restype) @@ -1091,17 +1043,6 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) tree result; int side_effects = 0; - /* If we have a WITH_RECORD_EXPR as our operand, do the operation first, - then surround it with the WITH_RECORD_EXPR. This allows GCC to do better - expression folding. */ - if (TREE_CODE (operand) == WITH_RECORD_EXPR) - { - result = build_unary_op (op_code, result_type, - TREE_OPERAND (operand, 0)); - return build (WITH_RECORD_EXPR, TREE_TYPE (result), result, - TREE_OPERAND (operand, 1)); - } - if (operation_type != 0 && TREE_CODE (operation_type) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (operation_type)) @@ -1716,18 +1657,13 @@ build_component_ref (tree record_variable, object dynamically on the stack frame. */ tree -build_call_alloc_dealloc (tree gnu_obj, - tree gnu_size, - int align, - Entity_Id gnat_proc, - Entity_Id gnat_pool, +build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align, + Entity_Id gnat_proc, Entity_Id gnat_pool, Node_Id gnat_node) { tree gnu_align = size_int (align / BITS_PER_UNIT); - if (CONTAINS_PLACEHOLDER_P (gnu_size)) - gnu_size = build (WITH_RECORD_EXPR, sizetype, gnu_size, - build_unary_op (INDIRECT_REF, NULL_TREE, gnu_obj)); + gnu_size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_size, gnu_obj); if (Present (gnat_proc)) { @@ -1868,10 +1804,8 @@ build_allocator (tree type, tree storage; tree template_cons = NULL_TREE; - size = TYPE_SIZE_UNIT (storage_type); - - if (CONTAINS_PLACEHOLDER_P (size)) - size = build (WITH_RECORD_EXPR, sizetype, size, init); + size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_SIZE_UNIT (storage_type), + init); /* If the size overflows, pass -1 so the allocator will raise storage error. */ @@ -1943,7 +1877,7 @@ build_allocator (tree type, if (init == 0) size = max_size (size, 1); else - size = build (WITH_RECORD_EXPR, sizetype, size, init); + size = substitute_placeholder_in_expr (size, init); } /* If the size overflows, pass -1 so the allocator will raise @@ -2012,15 +1946,12 @@ fill_vms_descriptor (tree expr, Entity_Id gnat_formal) gnat_mark_addressable (expr); for (field = TYPE_FIELDS (record_type); field; field = TREE_CHAIN (field)) - { - tree init = DECL_INITIAL (field); - - if (CONTAINS_PLACEHOLDER_P (init)) - init = build (WITH_RECORD_EXPR, TREE_TYPE (init), init, expr); - - const_list = tree_cons (field, convert (TREE_TYPE (field), init), - const_list); - } + const_list + = tree_cons (field, + convert (TREE_TYPE (field), + SUBSTITUTE_PLACEHOLDER_IN_EXPR + (DECL_INITIAL (field), expr)), + const_list); return gnat_build_constructor (record_type, nreverse (const_list)); } |