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 | |
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')
-rw-r--r-- | gcc/ada/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/ada/decl.c | 9 | ||||
-rw-r--r-- | gcc/ada/gigi.h | 2 | ||||
-rw-r--r-- | gcc/ada/trans.c | 25 | ||||
-rw-r--r-- | gcc/ada/utils.c | 31 | ||||
-rw-r--r-- | gcc/ada/utils2.c | 105 |
6 files changed, 49 insertions, 138 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0da5c59..ee6e709 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2004-03-21 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> + + * decl.c (gnat_to_gnu_entity): Use SUBSTITUTE_PLACEHOLDER_IN_EXPR. + * trans.c (tree_transform, emit_index_check): Likewise. + * utils.c (build_template): Likewise. + (max_size, convert): Remove handling of WITH_RECORD_EXPR. + (maybe_unconstrained_array, unchecked_convert): Likewise. + * 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. + * gigi.h (build_call_alloc_dealloc): Alignment is unsigned. + 2004-03-20 Joseph S. Myers <jsm@polyomino.org.uk> PR other/14630 diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index fd82da9..458213e 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -565,12 +565,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type))) { if (gnu_expr != 0 && kind == E_Constant) - { - gnu_size = TYPE_SIZE (TREE_TYPE (gnu_expr)); - if (CONTAINS_PLACEHOLDER_P (gnu_size)) - gnu_size = build (WITH_RECORD_EXPR, bitsizetype, - gnu_size, gnu_expr); - } + gnu_size + = SUBSTITUTE_PLACEHOLDER_IN_EXPR + (TYPE_SIZE (TREE_TYPE (gnu_expr)), gnu_expr); /* We may have no GNU_EXPR because No_Initialization is set even though there's an Expression. */ diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h index 4d44671..423b898 100644 --- a/gcc/ada/gigi.h +++ b/gcc/ada/gigi.h @@ -701,7 +701,7 @@ extern tree build_component_ref (tree, tree, tree, int); GNU_SIZE is the size of the object and ALIGN is the alignment. GNAT_PROC, if present is a procedure to call and GNAT_POOL is the storage pool to use. If not preset, malloc and free will be used. */ -extern tree build_call_alloc_dealloc (tree, tree, int, Entity_Id, +extern tree build_call_alloc_dealloc (tree, tree, unsigned int, Entity_Id, Entity_Id, Node_Id); /* Build a GCC tree to correspond to allocating an object of TYPE whose diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index dc7c404..dc34b72 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -1236,8 +1236,8 @@ tree_transform (Node_Id gnat_node) if (CONTAINS_PLACEHOLDER_P (gnu_result)) { if (TREE_CODE (gnu_prefix) != TYPE_DECL) - gnu_result = build (WITH_RECORD_EXPR, TREE_TYPE (gnu_result), - gnu_result, gnu_expr); + gnu_result = substitute_placeholder_in_expr (gnu_result, + gnu_expr); else gnu_result = max_size (gnu_result, 1); } @@ -1381,9 +1381,8 @@ tree_transform (Node_Id gnat_node) /* If this has a PLACEHOLDER_EXPR, qualify it by the object we are handling. Note that these attributes could not have been used on an unconstrained array type. */ - if (CONTAINS_PLACEHOLDER_P (gnu_result)) - gnu_result = build (WITH_RECORD_EXPR, TREE_TYPE (gnu_result), - gnu_result, gnu_prefix); + gnu_result = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_result, + gnu_prefix); break; } @@ -1486,9 +1485,8 @@ tree_transform (Node_Id gnat_node) /* If this has a PLACEHOLDER_EXPR, qualify it by the object we are handling. */ - if (CONTAINS_PLACEHOLDER_P (gnu_result)) - gnu_result = build (WITH_RECORD_EXPR, TREE_TYPE (gnu_result), - gnu_result, gnu_prefix); + gnu_result = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_result, + gnu_prefix); break; } @@ -1496,7 +1494,7 @@ tree_transform (Node_Id gnat_node) case Attr_Min: case Attr_Max: gnu_lhs = gnat_to_gnu (First (Expressions (gnat_node))); - gnu_rhs = gnat_to_gnu (Next (First (Expressions (gnat_node)))); + gnu_rhs = gnat_to_gnu (Next (First (Expressions (gnat_node)))); gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result = build_binary_op (attribute == Attr_Min @@ -4622,13 +4620,8 @@ emit_index_check (tree gnu_array_object, /* If GNU_LOW or GNU_HIGH are a PLACEHOLDER_EXPR, qualify them by the object we are handling. */ - if (CONTAINS_PLACEHOLDER_P (gnu_low)) - gnu_low = build (WITH_RECORD_EXPR, TREE_TYPE (gnu_low), - gnu_low, gnu_array_object); - - if (CONTAINS_PLACEHOLDER_P (gnu_high)) - gnu_high = build (WITH_RECORD_EXPR, TREE_TYPE (gnu_high), - gnu_high, gnu_array_object); + gnu_low = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_low, gnu_array_object); + gnu_high = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_high, gnu_array_object); /* There's no good type to use here, so we might as well use integer_type_node. */ diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index 37a9fbd..cd3f47c 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -2180,8 +2180,6 @@ max_size (tree exp, int max_p) gigi_abort (407); else if (code == COMPOUND_EXPR) return max_size (TREE_OPERAND (exp, 1), max_p); - else if (code == WITH_RECORD_EXPR) - return exp; { tree lhs = max_size (TREE_OPERAND (exp, 0), max_p); @@ -2275,12 +2273,9 @@ build_template (tree template_type, tree array_type, tree expr) max = convert (TREE_TYPE (field), TYPE_MAX_VALUE (bounds)); /* If either MIN or MAX involve a PLACEHOLDER_EXPR, we must - surround them with a WITH_RECORD_EXPR giving EXPR as the - OBJECT. */ - if (CONTAINS_PLACEHOLDER_P (min)) - min = build (WITH_RECORD_EXPR, TREE_TYPE (min), min, expr); - if (CONTAINS_PLACEHOLDER_P (max)) - max = build (WITH_RECORD_EXPR, TREE_TYPE (max), max, expr); + substitute it from OBJECT. */ + min = SUBSTITUTE_PLACEHOLDER_IN_EXPR (min, expr); + max = SUBSTITUTE_PLACEHOLDER_IN_EXPR (max, expr); template_elts = tree_cons (TREE_CHAIN (field), max, tree_cons (field, min, template_elts)); @@ -2865,12 +2860,6 @@ convert (tree type, tree expr) else if (AGGREGATE_TYPE_P (type) && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype)) return build1 (NOP_EXPR, type, expr); - /* If EXPR is a WITH_RECORD_EXPR, do the conversion inside and then make a - new one. */ - else if (TREE_CODE (expr) == WITH_RECORD_EXPR) - return build (WITH_RECORD_EXPR, type, - convert (type, TREE_OPERAND (expr, 0)), - TREE_OPERAND (expr, 1)); /* If the input type has padding, remove it by doing a component reference to the field. If the output type has padding, make a constructor @@ -3250,13 +3239,6 @@ maybe_unconstrained_array (tree exp) (TREE_TYPE (TREE_TYPE (exp))))), TREE_OPERAND (exp, 0)); - else if (code == WITH_RECORD_EXPR - && (TREE_OPERAND (exp, 0) - != (new = maybe_unconstrained_array - (TREE_OPERAND (exp, 0))))) - return build (WITH_RECORD_EXPR, TREE_TYPE (new), new, - TREE_OPERAND (exp, 1)); - case RECORD_TYPE: /* If this is a padded type, convert to the unpadded type and see if it contains a template. */ @@ -3295,13 +3277,6 @@ unchecked_convert (tree type, tree expr, int notrunc_p) if (etype == type) return expr; - /* If EXPR is a WITH_RECORD_EXPR, do the conversion inside and then make a - new one. */ - if (TREE_CODE (expr) == WITH_RECORD_EXPR) - return build (WITH_RECORD_EXPR, type, - unchecked_convert (type, TREE_OPERAND (expr, 0), notrunc_p), - TREE_OPERAND (expr, 1)); - /* If both types types are integral just do a normal conversion. Likewise for a conversion to an unconstrained array. */ if ((((INTEGRAL_TYPE_P (type) 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)); } |