This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
More Ada changes for tree-ssa conversion
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 20 Jun 04 07:22:42 EDT
- Subject: More Ada changes for tree-ssa conversion
These are only useful with my pending changes in the middle-end, but I
might as well get them out of my tree nonetheless.
2004-06-20 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* decl.c (elaborate_expression, elaborate_expression_1): Arguments
now bool instead of int.
(gnat_to_gnu_entity, elaborate_expression_1): New arg to COMPONENT_REF.
* trans.c (gnu_switch_label_stack): New function.
(gnat_to_gnu, N_Object_Renaming_Declaration): Result is what the
elaboration of renamed entity returns.
(gnat_to_gnu, case N_Case_Statement): Add branches to end label.
(add_decl_stmt): Don't add TYPE_DECL for UNCONSTRAINED_ARRAY_TYPE.
(gnat_gimplify_stmt): Use alloc_stmt_list, not build_empty_stmt.
(gnat_gimplify_stmt, case DECL_STMT): gimplify DECL_SIZE and
DECL_SIZE_UNIT and simplify variable-sized case.
(gnat_gimplify_type_sizes, gnat_gimplify_one_sizepos): Deleted.
Callers changes to call gimplify_type_sizes and gimplify_one_sizepos.
(gnat_stabilize_reference): Add arg to COMPONENT_REF.
(build_unit_elab): Disable for now.
* utils.c (mark_visited): New function.
(pushdecl): Walk tree to call it for global decl.
(update_pointer_to): Update all variants of pointer and ref types.
Add arg to COMPONENT_REF.
(convert): Likewise.
Move check for converting between variants lower down.
* utils2.c (build_simple_component_ref): Add arg to COMPONENT_REF.
(build_allocator): Don't force type of MODIFY_EXPR.
(gnat_mark_addressable, case VAR_DECL): Unconditionally call
put_var_into_stack.
*** decl.c 14 Jun 2004 15:14:51 -0000 1.63.2.58
--- decl.c 20 Jun 2004 11:01:30 -0000
*************** static tree substitution_list (Entity_Id
*** 85,91 ****
static int allocatable_size_p (tree, int);
static struct attrib *build_attr_list (Entity_Id);
! static tree elaborate_expression (Node_Id, Entity_Id, tree, int, int, int);
static int is_variable_size (tree);
! static tree elaborate_expression_1 (Node_Id, Entity_Id, tree, tree, int, int);
static tree make_packable_type (tree);
static tree maybe_pad_type (tree, tree, unsigned int, Entity_Id, const char *,
--- 85,92 ----
static int allocatable_size_p (tree, int);
static struct attrib *build_attr_list (Entity_Id);
! static tree elaborate_expression (Node_Id, Entity_Id, tree, bool, bool, bool);
static int is_variable_size (tree);
! static tree elaborate_expression_1 (Node_Id, Entity_Id, tree, tree,
! bool, bool);
static tree make_packable_type (tree);
static tree maybe_pad_type (tree, tree, unsigned int, Entity_Id, const char *,
*************** gnat_to_gnu_entity (Entity_Id gnat_entit
*** 1488,1492 ****
tem = build (COMPONENT_REF, gnu_ptr_template,
build (PLACEHOLDER_EXPR, gnu_fat_type),
! TREE_CHAIN (TYPE_FIELDS (gnu_fat_type)));
gnu_template_reference
= build_unary_op (INDIRECT_REF, gnu_template_type, tem);
--- 1489,1493 ----
tem = build (COMPONENT_REF, gnu_ptr_template,
build (PLACEHOLDER_EXPR, gnu_fat_type),
! TREE_CHAIN (TYPE_FIELDS (gnu_fat_type)), NULL_TREE);
gnu_template_reference
= build_unary_op (INDIRECT_REF, gnu_template_type, tem);
*************** gnat_to_gnu_entity (Entity_Id gnat_entit
*** 1533,1539 ****
type isn't complete yet. */
gnu_min = build (COMPONENT_REF, gnu_ind_subtype,
! gnu_template_reference, gnu_min_field);
gnu_max = build (COMPONENT_REF, gnu_ind_subtype,
! gnu_template_reference, gnu_max_field);
TREE_READONLY (gnu_min) = TREE_READONLY (gnu_max) = 1;
--- 1534,1540 ----
type isn't complete yet. */
gnu_min = build (COMPONENT_REF, gnu_ind_subtype,
! gnu_template_reference, gnu_min_field, NULL_TREE);
gnu_max = build (COMPONENT_REF, gnu_ind_subtype,
! gnu_template_reference, gnu_max_field, NULL_TREE);
TREE_READONLY (gnu_min) = TREE_READONLY (gnu_max) = 1;
*************** gnat_to_gnu_entity (Entity_Id gnat_entit
*** 2332,2336 ****
build (PLACEHOLDER_EXPR, gnu_type),
build_decl (FIELD_DECL, NULL_TREE,
! NULL_TREE));
if (Has_Discriminants (gnat_entity))
--- 2333,2338 ----
build (PLACEHOLDER_EXPR, gnu_type),
build_decl (FIELD_DECL, NULL_TREE,
! NULL_TREE),
! NULL_TREE);
if (Has_Discriminants (gnat_entity))
*************** gnat_to_gnu_entity (Entity_Id gnat_entit
*** 2346,2350 ****
gnat_to_gnu_entity (Corresponding_Discriminant
(gnat_field),
! NULL_TREE, 0)),
1);
--- 2348,2353 ----
gnat_to_gnu_entity (Corresponding_Discriminant
(gnat_field),
! NULL_TREE, 0),
! NULL_TREE),
1);
*************** gnat_to_gnu_entity (Entity_Id gnat_entit
*** 2388,2392 ****
build (PLACEHOLDER_EXPR,
DECL_CONTEXT (gnu_field)),
! gnu_field),
1);
--- 2391,2395 ----
build (PLACEHOLDER_EXPR,
DECL_CONTEXT (gnu_field)),
! gnu_field, NULL_TREE),
1);
*************** maybe_variable (tree gnu_operand)
*** 4454,4463 ****
static tree
! elaborate_expression (Node_Id gnat_expr,
! Entity_Id gnat_entity,
! tree gnu_name,
! int definition,
! int need_value,
! int need_debug)
{
tree gnu_expr;
--- 4457,4463 ----
static tree
! elaborate_expression (Node_Id gnat_expr, Entity_Id gnat_entity,
! tree gnu_name, bool definition, bool need_value,
! bool need_debug)
{
tree gnu_expr;
*************** elaborate_expression (Node_Id gnat_expr,
*** 4481,4488 ****
gnu_name, definition, need_debug);
! /* Save the expression in case we try to elaborate this entity again.
! Since this is not a DECL, don't check it. If this is a constant,
! don't save it since GNAT_EXPR might be used more than once. Also,
! don't save if it's a discriminant. */
if (! CONTAINS_PLACEHOLDER_P (gnu_expr))
save_gnu_tree (gnat_expr, gnu_expr, 1);
--- 4481,4486 ----
gnu_name, definition, need_debug);
! /* Save the expression in case we try to elaborate this entity again. Since
! this is not a DECL, don't check it. Don't save if it's a discriminant. */
if (! CONTAINS_PLACEHOLDER_P (gnu_expr))
save_gnu_tree (gnat_expr, gnu_expr, 1);
*************** elaborate_expression (Node_Id gnat_expr,
*** 4494,4503 ****
static tree
! elaborate_expression_1 (Node_Id gnat_expr,
! Entity_Id gnat_entity,
! tree gnu_expr,
! tree gnu_name,
! int definition,
! int need_debug)
{
tree gnu_decl = 0;
--- 4492,4498 ----
static tree
! elaborate_expression_1 (Node_Id gnat_expr, Entity_Id gnat_entity,
! tree gnu_expr, tree gnu_name, bool definition,
! bool need_debug)
{
tree gnu_decl = 0;
*************** elaborate_expression_1 (Node_Id gnat_exp
*** 4518,4522 ****
gnu_expr = build (COMPONENT_REF, TREE_TYPE (gnu_expr),
build (PLACEHOLDER_EXPR, DECL_CONTEXT (gnu_expr)),
! gnu_expr);
/* If GNU_EXPR is neither a placeholder nor a constant, nor a variable
--- 4513,4517 ----
gnu_expr = build (COMPONENT_REF, TREE_TYPE (gnu_expr),
build (PLACEHOLDER_EXPR, DECL_CONTEXT (gnu_expr)),
! gnu_expr, NULL_TREE);
/* If GNU_EXPR is neither a placeholder nor a constant, nor a variable
*** trans.c 14 Jun 2004 15:16:21 -0000 1.68.2.55
--- trans.c 20 Jun 2004 11:01:33 -0000
*************** static GTY(()) tree gnu_return_label_sta
*** 110,113 ****
--- 110,117 ----
static GTY(()) tree gnu_loop_label_stack;
+ /* List of TREE_LIST nodes representing labels for switch statements.
+ TREE_VALUE of each entry is the label at the end of the switch. */
+ static GTY(()) tree gnu_switch_label_stack;
+
/* List of TREE_LIST nodes containing pending elaborations lists.
used to prevent the elaborations being reclaimed by GC. */
*************** gnat_to_gnu (Node_Id gnat_node)
*** 747,755 ****
case N_Object_Renaming_Declaration:
gnat_temp = Defining_Entity (gnat_node);
- gnu_result = alloc_stmt_list ();
! /* Don't do anything if this renaming is handled by the front end.
! or if we are just annotating types and this object has a
! composite or task type, don't elaborate it. */
if (! Is_Renaming_Of_Object (gnat_temp)
&& ! (type_annotate_only
--- 751,759 ----
case N_Object_Renaming_Declaration:
gnat_temp = Defining_Entity (gnat_node);
! /* Don't do anything if this renaming is handled by the front end. or if
! we are just annotating types and this object has a composite or task
! type, don't elaborate it. We return the result in case it has any
! SAVE_EXPRs in it that need to be evaluated here. */
if (! Is_Renaming_Of_Object (gnat_temp)
&& ! (type_annotate_only
*************** gnat_to_gnu (Node_Id gnat_node)
*** 757,762 ****
|| Is_Record_Type (Etype (gnat_temp))
|| Is_Concurrent_Type (Etype (gnat_temp)))))
! gnat_to_gnu_entity (gnat_temp,
! gnat_to_gnu (Renamed_Object (gnat_temp)), 1);
break;
--- 761,769 ----
|| Is_Record_Type (Etype (gnat_temp))
|| Is_Concurrent_Type (Etype (gnat_temp)))))
! gnu_result
! = gnat_to_gnu_entity (gnat_temp,
! gnat_to_gnu (Renamed_Object (gnat_temp)), 1);
! else
! gnu_result = alloc_stmt_list ();
break;
*************** gnat_to_gnu (Node_Id gnat_node)
*** 2054,2057 ****
--- 2060,2065 ----
CASE_LABEL_EXPRs for each label. */
+ push_stack (&gnu_switch_label_stack, NULL_TREE,
+ create_artificial_label ());
start_stmt_group ();
for (gnat_when = First_Non_Pragma (Alternatives (gnat_node));
*************** gnat_to_gnu (Node_Id gnat_node)
*** 2122,2129 ****
--- 2130,2144 ----
the block containing the Case statement. */
add_stmt (build_stmt_group (Statements (gnat_when), true));
+ add_stmt (build1 (GOTO_EXPR, void_type_node,
+ TREE_VALUE (gnu_switch_label_stack)));
+
}
+ /* Now emit a definition of the label all the cases branched to. */
+ add_stmt (build1 (LABEL_EXPR, void_type_node,
+ TREE_VALUE (gnu_switch_label_stack)));
gnu_result = build (SWITCH_EXPR, TREE_TYPE (gnu_expr), gnu_expr,
end_stmt_group (), NULL_TREE);
+ pop_stack (&gnu_switch_label_stack);
break;
}
*************** add_decl_stmt (tree gnu_decl, Entity_Id
*** 4052,4057 ****
/* If this is a variable that Gigi is to ignore, we may have been given
an ERROR_MARK. So test for it. We also might have been given a
! reference for a renaming. So only do something for a decl. */
! if (!DECL_P (gnu_decl))
return;
--- 4065,4073 ----
/* If this is a variable that Gigi is to ignore, we may have been given
an ERROR_MARK. So test for it. We also might have been given a
! reference for a renaming. So only do something for a decl. Also
! ignore a TYPE_DECL for an UNCONSTRAINED_ARRAY_TYPE. */
! if (!DECL_P (gnu_decl)
! || (TREE_CODE (gnu_decl) == TYPE_DECL
! && TREE_CODE (TREE_TYPE (gnu_decl)) == UNCONSTRAINED_ARRAY_TYPE))
return;
*************** gnat_gimplify_stmt (tree *stmt_p)
*** 4255,4259 ****
case USE_STMT:
! *stmt_p = build_empty_stmt ();
return GS_ALL_DONE;
--- 4271,4275 ----
case USE_STMT:
! *stmt_p = alloc_stmt_list ();
return GS_ALL_DONE;
*************** gnat_gimplify_stmt (tree *stmt_p)
*** 4263,4291 ****
if (TREE_CODE (var) == TYPE_DECL)
! *stmt_p = gnat_gimplify_type_sizes (TREE_TYPE (var));
! else if (TREE_CODE (var) == VAR_DECL && !DECL_EXTERNAL (var)
! && !TREE_CONSTANT (DECL_SIZE_UNIT (var)))
{
- tree pt_type = build_pointer_type (TREE_TYPE (var));
- tree size, pre = NULL_TREE, post = NULL_TREE;
-
- /* This is a variable-sized decl. Simplify its size and mark it
- for deferred expansion. Note that mudflap depends on the format
- of the emitted code: see mx_register_decls. */
*stmt_p = NULL_TREE;
! size = get_initialized_tmp_var (DECL_SIZE_UNIT (var), &pre, &post);
! DECL_DEFER_OUTPUT (var) = 1;
! append_to_statement_list (pre, stmt_p);
! append_to_statement_list
! (build_function_call_expr
! (implicit_built_in_decls[BUILT_IN_STACK_ALLOC],
! tree_cons (NULL_TREE,
! build1 (ADDR_EXPR, pt_type, var),
! tree_cons (NULL_TREE, size, NULL_TREE))),
! stmt_p);
! append_to_statement_list (post, stmt_p);
}
else
! *stmt_p = build_empty_stmt ();
return GS_ALL_DONE;
}
--- 4279,4309 ----
if (TREE_CODE (var) == TYPE_DECL)
! *stmt_p = gimplify_type_sizes (TREE_TYPE (var));
! else if (TREE_CODE (var) == VAR_DECL)
{
*stmt_p = NULL_TREE;
! gimplify_one_sizepos (&DECL_SIZE (var), stmt_p);
! gimplify_one_sizepos (&DECL_SIZE_UNIT (var), stmt_p);
!
! if (!DECL_EXTERNAL (var) && !TREE_CONSTANT (DECL_SIZE_UNIT (var)))
! {
! DECL_DEFER_OUTPUT (var) = 1;
! append_to_statement_list
! (build_function_call_expr
! (implicit_built_in_decls[BUILT_IN_STACK_ALLOC],
! tree_cons (NULL_TREE,
! build1 (ADDR_EXPR,
! build_pointer_type (TREE_TYPE (var)),
! var),
! tree_cons (NULL_TREE, DECL_SIZE_UNIT (var),
! NULL_TREE))),
! stmt_p);
! }
!
! if (*stmt_p == NULL_TREE)
! *stmt_p = alloc_stmt_list ();
}
else
! *stmt_p = alloc_stmt_list ();
return GS_ALL_DONE;
}
*************** gnat_gimplify_stmt (tree *stmt_p)
*** 4353,4426 ****
}
}
-
- /* Look through GNU_TYPE for variable-sized objects and gimplify each such
- size that we find. Return a STATEMENT_LIST containing the result. */
-
- static tree
- gnat_gimplify_type_sizes (tree gnu_type)
- {
- tree gnu_stmts = NULL_TREE;
- tree gnu_field;
-
- switch (TREE_CODE (gnu_type))
- {
- case ERROR_MARK:
- case UNCONSTRAINED_ARRAY_TYPE:
- return alloc_stmt_list ();
-
- case INTEGER_TYPE:
- case ENUMERAL_TYPE:
- case BOOLEAN_TYPE:
- case CHAR_TYPE:
- case REAL_TYPE:
- gnat_gimplify_one_sizepos (&TYPE_MIN_VALUE (gnu_type), &gnu_stmts);
- gnat_gimplify_one_sizepos (&TYPE_MAX_VALUE (gnu_type), &gnu_stmts);
- break;
-
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- for (gnu_field = TYPE_FIELDS (gnu_type); gnu_field;
- gnu_field = TREE_CHAIN (gnu_field))
- if (TREE_CODE (gnu_field) == FIELD_DECL)
- gnat_gimplify_one_sizepos (&DECL_FIELD_OFFSET (gnu_field),
- &gnu_stmts);
- break;
-
- default:
- break;
- }
-
- gnat_gimplify_one_sizepos (&TYPE_SIZE (gnu_type), &gnu_stmts);
- gnat_gimplify_one_sizepos (&TYPE_SIZE_UNIT (gnu_type), &gnu_stmts);
-
- if (!gnu_stmts)
- gnu_stmts = alloc_stmt_list ();
-
- return gnu_stmts;
- }
-
- /* Subroutine of the above to gimplify one size or position, *GNU_EXPR_P.
- We add any required statements to GNU_STMT_P. */
-
- static void
- gnat_gimplify_one_sizepos (tree *gnu_expr_p, tree *gnu_stmt_p)
- {
- tree gnu_pre = NULL_TREE, gnu_post = NULL_TREE;
-
- /* We don't do anything if the value isn't there, is constant, or
- contains a PLACEHOLDER_EXPR. */
- if (*gnu_expr_p == NULL_TREE
- || TREE_CONSTANT (*gnu_expr_p)
- || CONTAINS_PLACEHOLDER_P (*gnu_expr_p))
- return;
-
- gimplify_expr (gnu_expr_p, &gnu_pre, &gnu_post, is_gimple_val, fb_rvalue);
-
- if (gnu_pre)
- append_to_statement_list (gnu_pre, gnu_stmt_p);
- if (gnu_post)
- append_to_statement_list (gnu_post, gnu_stmt_p);
- }
/* Generate the RTL for the body of GNU_DECL. If NESTED_P is nonzero,
--- 4371,4374 ----
*************** gnat_stabilize_reference (tree ref, int
*** 5473,5477 ****
gnat_stabilize_reference (TREE_OPERAND (ref, 0),
force),
! TREE_OPERAND (ref, 1));
break;
--- 5421,5425 ----
gnat_stabilize_reference (TREE_OPERAND (ref, 0),
force),
! TREE_OPERAND (ref, 1), NULL_TREE);
break;
*************** build_unit_elab (Entity_Id gnat_unit, in
*** 5593,5596 ****
--- 5541,5547 ----
rtx insn;
int result = 1;
+
+ /* ??? For now, force nothing to do. */
+ gnu_elab_list = 0;
/* If we have nothing to do, return. */
*** utils.c 14 Jun 2004 15:17:02 -0000 1.48.2.51
--- utils.c 20 Jun 2004 11:01:34 -0000
*************** struct language_function GTY(())
*** 134,137 ****
--- 134,138 ----
};
+ static tree mark_visited (tree *, int *, void *);
static void gnat_define_builtin (const char *, tree, int, const char *, bool);
static void gnat_install_builtins (void);
*************** block_has_vars ()
*** 339,342 ****
--- 340,358 ----
}
+ /* Utility function to mark nodes with TREE_VISITED. Called from walk_tree.
+ We use this to indicate all variable sizes and positions in global types
+ may not be shared by any subprogram. */
+
+ static tree
+ mark_visited (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
+ {
+ if (TREE_VISITED (*tp))
+ *walk_subtrees = 0;
+ else
+ TREE_VISITED (*tp) = 1;
+
+ return NULL_TREE;
+ }
+
/* Records a ..._DECL node DECL as belonging to the current lexical scope.
Returns the ..._DECL node. */
*************** pushdecl (tree decl)
*** 346,352 ****
{
/* If at top level, there is no context. But PARM_DECLs always go in the
! level of its function. */
if (global_bindings_p () && TREE_CODE (decl) != PARM_DECL)
! DECL_CONTEXT (decl) = 0;
else
DECL_CONTEXT (decl) = current_function_decl;
--- 362,372 ----
{
/* If at top level, there is no context. But PARM_DECLs always go in the
! level of its function. Also, at toplevel we must protect all trees
! that are part of sizes and positions. */
if (global_bindings_p () && TREE_CODE (decl) != PARM_DECL)
! {
! DECL_CONTEXT (decl) = 0;
! walk_tree (&decl, mark_visited, NULL, NULL);
! }
else
DECL_CONTEXT (decl) = current_function_decl;
*************** create_index_type (tree min, tree max, t
*** 1262,1270 ****
tree
! create_type_decl (tree type_name,
! tree type,
! struct attrib *attr_list,
! int artificial_p,
! int debug_info_p)
{
tree type_decl = build_decl (TYPE_DECL, type_name, type);
--- 1282,1287 ----
tree
! create_type_decl (tree type_name, tree type, struct attrib *attr_list,
! int artificial_p, int debug_info_p)
{
tree type_decl = build_decl (TYPE_DECL, type_name, type);
*************** gnat_gimplify_function (tree fndecl)
*** 1930,1934 ****
correct function. */
cgn = cgraph_node (fndecl);
! for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
gnat_gimplify_function (cgn->decl);
}
--- 1947,1951 ----
correct function. */
cgn = cgraph_node (fndecl);
! for (cgn = cgn->nested; cgn; cgn = cgn->next_nested)
gnat_gimplify_function (cgn->decl);
}
*************** update_pointer_to (tree old_type, tree n
*** 2616,2619 ****
--- 2633,2637 ----
tree ptr = TYPE_POINTER_TO (old_type);
tree ref = TYPE_REFERENCE_TO (old_type);
+ tree ptr1, ref1;
tree type;
*************** update_pointer_to (tree old_type, tree n
*** 2663,2686 ****
for (; ptr; ptr = TYPE_NEXT_PTR_TO (ptr))
! {
! TREE_TYPE (ptr) = new_type;
! if (TYPE_NAME (ptr) != 0
! && TREE_CODE (TYPE_NAME (ptr)) == TYPE_DECL
! && TREE_CODE (new_type) != ENUMERAL_TYPE)
! rest_of_decl_compilation (TYPE_NAME (ptr), NULL,
! global_bindings_p (), 0);
! }
for (; ref; ref = TYPE_NEXT_PTR_TO (ref))
! {
! TREE_TYPE (ref) = new_type;
! if (TYPE_NAME (ref) != 0
! && TREE_CODE (TYPE_NAME (ref)) == TYPE_DECL
! && TREE_CODE (new_type) != ENUMERAL_TYPE)
! rest_of_decl_compilation (TYPE_NAME (ref), NULL,
! global_bindings_p (), 0);
! }
}
--- 2681,2708 ----
for (; ptr; ptr = TYPE_NEXT_PTR_TO (ptr))
! for (ptr1 = TYPE_MAIN_VARIANT (ptr); ptr1;
! ptr1 = TYPE_NEXT_VARIANT (ptr1))
! {
! TREE_TYPE (ptr1) = new_type;
! if (TYPE_NAME (ptr1) != 0
! && TREE_CODE (TYPE_NAME (ptr1)) == TYPE_DECL
! && TREE_CODE (new_type) != ENUMERAL_TYPE)
! rest_of_decl_compilation (TYPE_NAME (ptr1), NULL,
! global_bindings_p (), 0);
! }
for (; ref; ref = TYPE_NEXT_PTR_TO (ref))
! for (ref1 = TYPE_MAIN_VARIANT (ref); ref1;
! ref1 = TYPE_NEXT_VARIANT (ref1))
! {
! TREE_TYPE (ref1) = new_type;
! if (TYPE_NAME (ref1) != 0
! && TREE_CODE (TYPE_NAME (ref1)) == TYPE_DECL
! && TREE_CODE (new_type) != ENUMERAL_TYPE)
! rest_of_decl_compilation (TYPE_NAME (ref1), NULL,
! global_bindings_p (), 0);
! }
}
*************** update_pointer_to (tree old_type, tree n
*** 2712,2716 ****
new_ref = build (COMPONENT_REF, ptr_temp_type,
build (PLACEHOLDER_EXPR, ptr),
! TREE_CHAIN (TYPE_FIELDS (ptr)));
update_pointer_to
--- 2734,2738 ----
new_ref = build (COMPONENT_REF, ptr_temp_type,
build (PLACEHOLDER_EXPR, ptr),
! TREE_CHAIN (TYPE_FIELDS (ptr)), NULL_TREE);
update_pointer_to
*************** convert (tree type, tree expr)
*** 2855,2863 ****
if (type == etype)
return expr;
- /* If we're converting between two aggregate types that have the same main
- variant, just make a VIEW_CONVER_EXPR. */
- else if (AGGREGATE_TYPE_P (type)
- && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype))
- return build1 (VIEW_CONVERT_EXPR, type, expr);
/* If the input type has padding, remove it by doing a component reference
--- 2877,2880 ----
*************** convert (tree type, tree expr)
*** 2996,3000 ****
&& get_alias_set (type) == get_alias_set (etype))
return build (COMPONENT_REF, type, TREE_OPERAND (expr, 0),
! TREE_OPERAND (expr, 1));
break;
--- 3013,3017 ----
&& get_alias_set (type) == get_alias_set (etype))
return build (COMPONENT_REF, type, TREE_OPERAND (expr, 0),
! TREE_OPERAND (expr, 1), NULL_TREE);
break;
*************** convert (tree type, tree expr)
*** 3044,3050 ****
return convert_to_fat_pointer (type, expr);
! if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype)
! || (code == INTEGER_CST && ecode == INTEGER_CST
! && (type == TREE_TYPE (etype) || etype == TREE_TYPE (type))))
return fold (build1 (NOP_EXPR, type, expr));
--- 3061,3074 ----
return convert_to_fat_pointer (type, expr);
! /* If we're converting between two aggregate types that have the same main
! variant, just make a VIEW_CONVER_EXPR. */
! else if (AGGREGATE_TYPE_P (type)
! && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype))
! return build1 (VIEW_CONVERT_EXPR, type, expr);
!
! /* In all other cases of related types, make a NOP_EXPR. */
! else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype)
! || (code == INTEGER_CST && ecode == INTEGER_CST
! && (type == TREE_TYPE (etype) || etype == TREE_TYPE (type))))
return fold (build1 (NOP_EXPR, type, expr));
*** utils2.c 14 Jun 2004 15:17:39 -0000 1.21.4.20
--- utils2.c 20 Jun 2004 11:01:35 -0000
*************** gnat_build_constructor (tree type, tree
*** 1536,1543 ****
static tree
! build_simple_component_ref (tree record_variable,
! tree component,
! tree field,
! int no_fold_p)
{
tree record_type = TYPE_MAIN_VARIANT (TREE_TYPE (record_variable));
--- 1536,1541 ----
static tree
! build_simple_component_ref (tree record_variable, tree component,
! tree field, int no_fold_p)
{
tree record_type = TYPE_MAIN_VARIANT (TREE_TYPE (record_variable));
*************** build_simple_component_ref (tree record_
*** 1611,1615 ****
/* It would be nice to call "fold" here, but that can lose a type
we need to tag a PLACEHOLDER_EXPR with, so we can't do it. */
! ref = build (COMPONENT_REF, TREE_TYPE (field), record_variable, field);
if (TREE_READONLY (record_variable) || TREE_READONLY (field))
--- 1609,1614 ----
/* It would be nice to call "fold" here, but that can lose a type
we need to tag a PLACEHOLDER_EXPR with, so we can't do it. */
! ref = build (COMPONENT_REF, TREE_TYPE (field), record_variable, field,
! NULL_TREE);
if (TREE_READONLY (record_variable) || TREE_READONLY (field))
*************** build_simple_component_ref (tree record_
*** 1626,1633 ****
tree
! build_component_ref (tree record_variable,
! tree component,
! tree field,
! int no_fold_p)
{
tree ref = build_simple_component_ref (record_variable, component, field,
--- 1625,1630 ----
tree
! build_component_ref (tree record_variable, tree component,
! tree field, int no_fold_p)
{
tree ref = build_simple_component_ref (record_variable, component, field,
*************** build_allocator (tree type,
*** 1931,1935 ****
= build (COMPOUND_EXPR, TREE_TYPE (result),
build_binary_op
! (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (result)),
build_unary_op (INDIRECT_REF, TREE_TYPE (TREE_TYPE (result)),
result),
--- 1928,1932 ----
= build (COMPOUND_EXPR, TREE_TYPE (result),
build_binary_op
! (MODIFY_EXPR, NULL_TREE,
build_unary_op (INDIRECT_REF, TREE_TYPE (TREE_TYPE (result)),
result),
*************** gnat_mark_addressable (tree expr_node)
*** 1994,2010 ****
case PARM_DECL:
case RESULT_DECL:
! /* If we have already made a REG for this decl, we must put it
! directly into the stack. Likewise for a MEM whose address is a
! pseudo. Otherwise, set a flag to mark us to do it later. */
! if (DECL_RTL_SET_P (expr_node)
! && (GET_CODE (DECL_RTL (expr_node)) == REG
! || (GET_CODE (DECL_RTL (expr_node)) == MEM
! && GET_CODE (XEXP (DECL_RTL (expr_node), 0)) == REG
! && (REGNO (XEXP (DECL_RTL (expr_node), 0))
! > LAST_VIRTUAL_REGISTER))))
! put_var_into_stack (expr_node, 1);
! else
! TREE_ADDRESSABLE (expr_node) = 1;
!
return true;
--- 1991,1996 ----
case PARM_DECL:
case RESULT_DECL:
! put_var_into_stack (expr_node, 1);
! TREE_ADDRESSABLE (expr_node) = 1;
return true;