Commit afc737f0 by Eric Botcazou Committed by Eric Botcazou

gigi.h (gnat_to_gnu_entity): Adjust prototype.

	* gcc-interface/gigi.h (gnat_to_gnu_entity): Adjust prototype.
	(maybe_pad_type): Adjust comment.
	(finish_record_type): Likewise.
	(rest_of_record_type_compilation): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Change DEFINITION type
	parameter from integer to boolean.  Adjust recursive calls.
	<E_Subprogram_Type>: Use copy_type and remove redundant assignments.
	<E_Signed_Integer_Subtype>:  Adjust comment.  Remove call to
	rest_of_record_type_compilation.  Set TYPE_PADDING_P flag earlier.
	Pass false to finish_record_type.  Set the debug type later.
	<E_Record_Subtype>: Remove call to rest_of_record_type_compilation.
	(gnat_to_gnu_component_type): Fix formatting.
	(gnat_to_gnu_field_decl): Adjust call to gnat_to_gnu_entity.
	(gnat_to_gnu_type): Likewise.
	* gcc-interface/trans.c (Identifier_to_gnu): Likewise.
	(Loop_Statement_to_gnu): Likewise.
	(Subprogram_Body_to_gnu): Likewise.
	(Exception_Handler_to_gnu_fe_sjlj): Likewise.
	(Exception_Handler_to_gnu_gcc): Likewise.
	(Compilation_Unit_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.
	(push_exception_label_stack): Likewise.
	(elaborate_all_entities_for_package): Likewise.
	(process_freeze_entity): Likewise.
	(process_decls): Likewise.
	(process_type): Likewise.
	* gcc-interface/utils.c (struct deferred_decl_context_node): Tweak.
	(maybe_pad_type): Adjust comments.  Set the debug type later.  Remove
	call to rest_of_record_type_compilation.
	(rest_of_record_type_compilation): Use copy_type.
	(copy_type): Use correctly typed constants.
	(gnat_signed_or_unsigned_type_for): Use copy_type.
	* gcc-interface/utils2.c (nonbinary_modular_operation): Likewise.
	(build_goto_raise): Adjust call tognat_to_gnu_entity.

From-SVN: r235479
parent a2e76867
2016-04-27 Eric Botcazou <ebotcazou@adacore.com> 2016-04-27 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (gnat_to_gnu_entity): Adjust prototype.
(maybe_pad_type): Adjust comment.
(finish_record_type): Likewise.
(rest_of_record_type_compilation): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity): Change DEFINITION type
parameter from integer to boolean. Adjust recursive calls.
<E_Subprogram_Type>: Use copy_type and remove redundant assignments.
<E_Signed_Integer_Subtype>: Adjust comment. Remove call to
rest_of_record_type_compilation. Set TYPE_PADDING_P flag earlier.
Pass false to finish_record_type. Set the debug type later.
<E_Record_Subtype>: Remove call to rest_of_record_type_compilation.
(gnat_to_gnu_component_type): Fix formatting.
(gnat_to_gnu_field_decl): Adjust call to gnat_to_gnu_entity.
(gnat_to_gnu_type): Likewise.
* gcc-interface/trans.c (Identifier_to_gnu): Likewise.
(Loop_Statement_to_gnu): Likewise.
(Subprogram_Body_to_gnu): Likewise.
(Exception_Handler_to_gnu_fe_sjlj): Likewise.
(Exception_Handler_to_gnu_gcc): Likewise.
(Compilation_Unit_to_gnu): Likewise.
(gnat_to_gnu): Likewise.
(push_exception_label_stack): Likewise.
(elaborate_all_entities_for_package): Likewise.
(process_freeze_entity): Likewise.
(process_decls): Likewise.
(process_type): Likewise.
* gcc-interface/utils.c (struct deferred_decl_context_node): Tweak.
(maybe_pad_type): Adjust comments. Set the debug type later. Remove
call to rest_of_record_type_compilation.
(rest_of_record_type_compilation): Use copy_type.
(copy_type): Use correctly typed constants.
(gnat_signed_or_unsigned_type_for): Use copy_type.
* gcc-interface/utils2.c (nonbinary_modular_operation): Likewise.
(build_goto_raise): Adjust call tognat_to_gnu_entity.
2016-04-27 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/misc.c (gnat_init): Do not call * gcc-interface/misc.c (gnat_init): Do not call
internal_reference_types. internal_reference_types.
......
...@@ -34,14 +34,12 @@ ...@@ -34,14 +34,12 @@
initial value (in GCC tree form). This is optional for variables. initial value (in GCC tree form). This is optional for variables.
For renamed entities, GNU_EXPR gives the object being renamed. For renamed entities, GNU_EXPR gives the object being renamed.
DEFINITION is nonzero if this call is intended for a definition. This is DEFINITION is true if this call is intended for a definition. This is used
used for separate compilation where it necessary to know whether an for separate compilation where it is necessary to know whether an external
external declaration or a definition should be created if the GCC equivalent declaration or a definition must be created if the GCC equivalent was not
was not created previously. The value of 1 is normally used for a nonzero created previously. */
DEFINITION, but a value of 2 is used in special circumstances, defined in
the code. */
extern tree gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, extern tree gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr,
int definition); bool definition);
/* Similar, but if the returned value is a COMPONENT_REF, return the /* Similar, but if the returned value is a COMPONENT_REF, return the
FIELD_DECL. */ FIELD_DECL. */
...@@ -148,7 +146,8 @@ extern tree make_type_from_size (tree type, tree size_tree, bool for_biased); ...@@ -148,7 +146,8 @@ extern tree make_type_from_size (tree type, tree size_tree, bool for_biased);
IS_COMPONENT_TYPE is true if this is being done for the component type of IS_COMPONENT_TYPE is true if this is being done for the component type of
an array. IS_USER_TYPE is true if the original type needs to be completed. an array. IS_USER_TYPE is true if the original type needs to be completed.
DEFINITION is true if this type is being defined. SET_RM_SIZE is true if DEFINITION is true if this type is being defined. SET_RM_SIZE is true if
the RM size of the resulting type is to be set to SIZE too. */ the RM size of the resulting type is to be set to SIZE too; in this case,
the padded type is canonicalized before being returned. */
extern tree maybe_pad_type (tree type, tree size, unsigned int align, extern tree maybe_pad_type (tree type, tree size, unsigned int align,
Entity_Id gnat_entity, bool is_component_type, Entity_Id gnat_entity, bool is_component_type,
bool is_user_type, bool definition, bool is_user_type, bool definition,
...@@ -620,14 +619,13 @@ extern void finish_fat_pointer_type (tree record_type, tree field_list); ...@@ -620,14 +619,13 @@ extern void finish_fat_pointer_type (tree record_type, tree field_list);
laid out already; only set the sizes and alignment. If REP_LEVEL is two, laid out already; only set the sizes and alignment. If REP_LEVEL is two,
this record is derived from a parent record and thus inherits its layout; this record is derived from a parent record and thus inherits its layout;
only make a pass on the fields to finalize them. DEBUG_INFO_P is true if only make a pass on the fields to finalize them. DEBUG_INFO_P is true if
we need to write debug information about this type. */ additional debug info needs to be output for this type. */
extern void finish_record_type (tree record_type, tree field_list, extern void finish_record_type (tree record_type, tree field_list,
int rep_level, bool debug_info_p); int rep_level, bool debug_info_p);
/* Wrap up compilation of RECORD_TYPE, i.e. output all the debug information /* Wrap up compilation of RECORD_TYPE, i.e. output additional debug info
associated with it. It need not be invoked directly in most cases since associated with it. It need not be invoked directly in most cases as
finish_record_type takes care of doing so, but this can be necessary if finish_record_type takes care of doing so. */
a parallel type is to be attached to the record type. */
extern void rest_of_record_type_compilation (tree record_type); extern void rest_of_record_type_compilation (tree record_type);
/* Append PARALLEL_TYPE on the chain of parallel types for TYPE. */ /* Append PARALLEL_TYPE on the chain of parallel types for TYPE. */
......
...@@ -1120,7 +1120,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) ...@@ -1120,7 +1120,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
gnu_result = gnat_to_gnu (Expression (Declaration_Node (gnat_temp))); gnu_result = gnat_to_gnu (Expression (Declaration_Node (gnat_temp)));
} }
else else
gnu_result = gnat_to_gnu_entity (gnat_temp, NULL_TREE, 0); gnu_result = gnat_to_gnu_entity (gnat_temp, NULL_TREE, false);
/* Some objects (such as parameters passed by reference, globals of /* Some objects (such as parameters passed by reference, globals of
variable size, and renamed objects) actually represent the address variable size, and renamed objects) actually represent the address
...@@ -3027,7 +3027,7 @@ Loop_Statement_to_gnu (Node_Id gnat_node) ...@@ -3027,7 +3027,7 @@ Loop_Statement_to_gnu (Node_Id gnat_node)
gnu_loop_iv = NULL_TREE; gnu_loop_iv = NULL_TREE;
/* Declare the iteration variable and set it to its initial value. */ /* Declare the iteration variable and set it to its initial value. */
gnu_loop_var = gnat_to_gnu_entity (gnat_loop_var, gnu_first, 1); gnu_loop_var = gnat_to_gnu_entity (gnat_loop_var, gnu_first, true);
if (DECL_BY_REF_P (gnu_loop_var)) if (DECL_BY_REF_P (gnu_loop_var))
gnu_loop_var = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_loop_var); gnu_loop_var = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_loop_var);
else if (use_iv) else if (use_iv)
...@@ -3792,7 +3792,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) ...@@ -3792,7 +3792,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
gnu_cico_entry = TREE_CHAIN (gnu_cico_entry); gnu_cico_entry = TREE_CHAIN (gnu_cico_entry);
/* Do any needed dereferences for by-ref objects. */ /* Do any needed dereferences for by-ref objects. */
gnu_decl = gnat_to_gnu_entity (gnat_param, NULL_TREE, 1); gnu_decl = gnat_to_gnu_entity (gnat_param, NULL_TREE, true);
gcc_assert (DECL_P (gnu_decl)); gcc_assert (DECL_P (gnu_decl));
if (DECL_BY_REF_P (gnu_decl)) if (DECL_BY_REF_P (gnu_decl))
gnu_decl = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_decl); gnu_decl = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_decl);
...@@ -5193,7 +5193,7 @@ Exception_Handler_to_gnu_fe_sjlj (Node_Id gnat_node) ...@@ -5193,7 +5193,7 @@ Exception_Handler_to_gnu_fe_sjlj (Node_Id gnat_node)
if (Present (Renamed_Object (gnat_ex_id))) if (Present (Renamed_Object (gnat_ex_id)))
gnat_ex_id = Renamed_Object (gnat_ex_id); gnat_ex_id = Renamed_Object (gnat_ex_id);
gnu_expr = gnat_to_gnu_entity (gnat_ex_id, NULL_TREE, 0); gnu_expr = gnat_to_gnu_entity (gnat_ex_id, NULL_TREE, false);
this_choice this_choice
= build_binary_op = build_binary_op
...@@ -5248,7 +5248,7 @@ Exception_Handler_to_gnu_gcc (Node_Id gnat_node) ...@@ -5248,7 +5248,7 @@ Exception_Handler_to_gnu_gcc (Node_Id gnat_node)
if (Present (Renamed_Object (gnat_ex_id))) if (Present (Renamed_Object (gnat_ex_id)))
gnat_ex_id = Renamed_Object (gnat_ex_id); gnat_ex_id = Renamed_Object (gnat_ex_id);
gnu_expr = gnat_to_gnu_entity (gnat_ex_id, NULL_TREE, 0); gnu_expr = gnat_to_gnu_entity (gnat_ex_id, NULL_TREE, false);
gnu_etype = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr); gnu_etype = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr);
} }
else else
...@@ -5303,7 +5303,7 @@ Exception_Handler_to_gnu_gcc (Node_Id gnat_node) ...@@ -5303,7 +5303,7 @@ Exception_Handler_to_gnu_gcc (Node_Id gnat_node)
if (Present (Choice_Parameter (gnat_node))) if (Present (Choice_Parameter (gnat_node)))
{ {
tree gnu_param tree gnu_param
= gnat_to_gnu_entity (Choice_Parameter (gnat_node), NULL_TREE, 1); = gnat_to_gnu_entity (Choice_Parameter (gnat_node), NULL_TREE, true);
add_stmt (build_call_n_expr add_stmt (build_call_n_expr
(set_exception_parameter_decl, 2, (set_exception_parameter_decl, 2,
...@@ -5406,7 +5406,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node) ...@@ -5406,7 +5406,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node)
} }
/* Define the entity first so we set DECL_EXTERNAL. */ /* Define the entity first so we set DECL_EXTERNAL. */
gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0); gnat_to_gnu_entity (gnat_entity, NULL_TREE, false);
add_stmt (gnat_to_gnu (gnat_body)); add_stmt (gnat_to_gnu (gnat_body));
} }
...@@ -6045,7 +6045,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -6045,7 +6045,7 @@ gnat_to_gnu (Node_Id gnat_node)
} }
} }
else else
gnat_to_gnu_entity (gnat_temp, gnu_expr, 1); gnat_to_gnu_entity (gnat_temp, gnu_expr, true);
break; break;
case N_Object_Renaming_Declaration: case N_Object_Renaming_Declaration:
...@@ -6063,7 +6063,8 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -6063,7 +6063,8 @@ gnat_to_gnu (Node_Id gnat_node)
{ {
tree gnu_temp tree gnu_temp
= gnat_to_gnu_entity (gnat_temp, = gnat_to_gnu_entity (gnat_temp,
gnat_to_gnu (Renamed_Object (gnat_temp)), 1); gnat_to_gnu (Renamed_Object (gnat_temp)),
true);
/* See case 2 of renaming in gnat_to_gnu_entity. */ /* See case 2 of renaming in gnat_to_gnu_entity. */
if (TREE_SIDE_EFFECTS (gnu_temp)) if (TREE_SIDE_EFFECTS (gnu_temp))
gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_temp); gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_temp);
...@@ -6079,7 +6080,8 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -6079,7 +6080,8 @@ gnat_to_gnu (Node_Id gnat_node)
{ {
tree gnu_temp tree gnu_temp
= gnat_to_gnu_entity (gnat_temp, = gnat_to_gnu_entity (gnat_temp,
gnat_to_gnu (Renamed_Entity (gnat_temp)), 1); gnat_to_gnu (Renamed_Entity (gnat_temp)),
true);
if (TREE_SIDE_EFFECTS (gnu_temp)) if (TREE_SIDE_EFFECTS (gnu_temp))
gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_temp); gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_temp);
} }
...@@ -6109,12 +6111,12 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -6109,12 +6111,12 @@ gnat_to_gnu (Node_Id gnat_node)
|| Ekind (gnat_renamed) == E_Procedure) || Ekind (gnat_renamed) == E_Procedure)
&& !Is_Intrinsic_Subprogram (gnat_renaming) && !Is_Intrinsic_Subprogram (gnat_renaming)
&& !Is_Intrinsic_Subprogram (gnat_renamed)) && !Is_Intrinsic_Subprogram (gnat_renamed))
gnat_to_gnu_entity (gnat_renaming, gnat_to_gnu (gnat_renamed), 1); gnat_to_gnu_entity (gnat_renaming, gnat_to_gnu (gnat_renamed), true);
break; break;
} }
case N_Implicit_Label_Declaration: case N_Implicit_Label_Declaration:
gnat_to_gnu_entity (Defining_Entity (gnat_node), NULL_TREE, 1); gnat_to_gnu_entity (Defining_Entity (gnat_node), NULL_TREE, true);
gnu_result = alloc_stmt_list (); gnu_result = alloc_stmt_list ();
break; break;
...@@ -7146,7 +7148,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -7146,7 +7148,7 @@ gnat_to_gnu (Node_Id gnat_node)
if (No (Freeze_Node (Defining_Entity (Specification (gnat_node))))) if (No (Freeze_Node (Defining_Entity (Specification (gnat_node)))))
gnat_to_gnu_entity (Defining_Entity (Specification (gnat_node)), gnat_to_gnu_entity (Defining_Entity (Specification (gnat_node)),
NULL_TREE, 1); NULL_TREE, true);
gnu_result = alloc_stmt_list (); gnu_result = alloc_stmt_list ();
break; break;
...@@ -7168,7 +7170,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -7168,7 +7170,7 @@ gnat_to_gnu (Node_Id gnat_node)
gnat_temp = Next_Formal_With_Extras (gnat_temp)) gnat_temp = Next_Formal_With_Extras (gnat_temp))
if (Is_Itype (Etype (gnat_temp)) if (Is_Itype (Etype (gnat_temp))
&& !From_Limited_With (Etype (gnat_temp))) && !From_Limited_With (Etype (gnat_temp)))
gnat_to_gnu_entity (Etype (gnat_temp), NULL_TREE, 0); gnat_to_gnu_entity (Etype (gnat_temp), NULL_TREE, false);
/* Then the result type, set to Standard_Void_Type for procedures. */ /* Then the result type, set to Standard_Void_Type for procedures. */
{ {
...@@ -7176,7 +7178,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -7176,7 +7178,7 @@ gnat_to_gnu (Node_Id gnat_node)
= Etype (Defining_Entity (Specification (gnat_node))); = Etype (Defining_Entity (Specification (gnat_node)));
if (Is_Itype (gnat_temp_type) && !From_Limited_With (gnat_temp_type)) if (Is_Itype (gnat_temp_type) && !From_Limited_With (gnat_temp_type))
gnat_to_gnu_entity (Etype (gnat_temp_type), NULL_TREE, 0); gnat_to_gnu_entity (Etype (gnat_temp_type), NULL_TREE, false);
} }
gnu_result = alloc_stmt_list (); gnu_result = alloc_stmt_list ();
...@@ -7253,7 +7255,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -7253,7 +7255,7 @@ gnat_to_gnu (Node_Id gnat_node)
break; break;
case N_Single_Task_Declaration: case N_Single_Task_Declaration:
gnat_to_gnu_entity (Defining_Entity (gnat_node), NULL_TREE, 1); gnat_to_gnu_entity (Defining_Entity (gnat_node), NULL_TREE, true);
gnu_result = alloc_stmt_list (); gnu_result = alloc_stmt_list ();
break; break;
...@@ -7864,7 +7866,7 @@ static void ...@@ -7864,7 +7866,7 @@ static void
push_exception_label_stack (vec<tree, va_gc> **gnu_stack, Entity_Id gnat_label) push_exception_label_stack (vec<tree, va_gc> **gnu_stack, Entity_Id gnat_label)
{ {
tree gnu_label = (Present (gnat_label) tree gnu_label = (Present (gnat_label)
? gnat_to_gnu_entity (gnat_label, NULL_TREE, 0) ? gnat_to_gnu_entity (gnat_label, NULL_TREE, false)
: NULL_TREE); : NULL_TREE);
vec_safe_push (*gnu_stack, gnu_label); vec_safe_push (*gnu_stack, gnu_label);
...@@ -8470,7 +8472,7 @@ elaborate_all_entities_for_package (Entity_Id gnat_package) ...@@ -8470,7 +8472,7 @@ elaborate_all_entities_for_package (Entity_Id gnat_package)
elaborate_all_entities_for_package (gnat_entity); elaborate_all_entities_for_package (gnat_entity);
} }
else else
gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0); gnat_to_gnu_entity (gnat_entity, NULL_TREE, false);
} }
} }
...@@ -8628,7 +8630,7 @@ process_freeze_entity (Node_Id gnat_node) ...@@ -8628,7 +8630,7 @@ process_freeze_entity (Node_Id gnat_node)
&& Present (Underlying_Full_View (full_view))) && Present (Underlying_Full_View (full_view)))
full_view = Underlying_Full_View (full_view); full_view = Underlying_Full_View (full_view);
gnu_new = gnat_to_gnu_entity (full_view, NULL_TREE, 1); gnu_new = gnat_to_gnu_entity (full_view, NULL_TREE, true);
/* Propagate back-annotations from full view to partial view. */ /* Propagate back-annotations from full view to partial view. */
if (Unknown_Alignment (gnat_entity)) if (Unknown_Alignment (gnat_entity))
...@@ -8653,7 +8655,7 @@ process_freeze_entity (Node_Id gnat_node) ...@@ -8653,7 +8655,7 @@ process_freeze_entity (Node_Id gnat_node)
&& present_gnu_tree (Declaration_Node (gnat_entity))) && present_gnu_tree (Declaration_Node (gnat_entity)))
? get_gnu_tree (Declaration_Node (gnat_entity)) : NULL_TREE; ? get_gnu_tree (Declaration_Node (gnat_entity)) : NULL_TREE;
gnu_new = gnat_to_gnu_entity (gnat_entity, gnu_init, 1); gnu_new = gnat_to_gnu_entity (gnat_entity, gnu_init, true);
} }
if (IN (kind, Type_Kind) if (IN (kind, Type_Kind)
...@@ -8745,7 +8747,7 @@ process_decls (List_Id gnat_decls, List_Id gnat_decls2, ...@@ -8745,7 +8747,7 @@ process_decls (List_Id gnat_decls, List_Id gnat_decls2,
if (Ekind (gnat_subprog_id) != E_Generic_Procedure if (Ekind (gnat_subprog_id) != E_Generic_Procedure
&& Ekind (gnat_subprog_id) != E_Generic_Function) && Ekind (gnat_subprog_id) != E_Generic_Function)
gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE, 1); gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE, true);
} }
} }
...@@ -8760,7 +8762,7 @@ process_decls (List_Id gnat_decls, List_Id gnat_decls2, ...@@ -8760,7 +8762,7 @@ process_decls (List_Id gnat_decls, List_Id gnat_decls2,
if (Ekind (gnat_subprog_id) != E_Subprogram_Body if (Ekind (gnat_subprog_id) != E_Subprogram_Body
&& Ekind (gnat_subprog_id) != E_Generic_Procedure && Ekind (gnat_subprog_id) != E_Generic_Procedure
&& Ekind (gnat_subprog_id) != E_Generic_Function) && Ekind (gnat_subprog_id) != E_Generic_Function)
gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE, 1); gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE, true);
} }
/* Concurrent stubs stand for the corresponding subprogram bodies, /* Concurrent stubs stand for the corresponding subprogram bodies,
...@@ -9509,7 +9511,7 @@ process_type (Entity_Id gnat_entity) ...@@ -9509,7 +9511,7 @@ process_type (Entity_Id gnat_entity)
} }
/* Now fully elaborate the type. */ /* Now fully elaborate the type. */
gnu_new = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 1); gnu_new = gnat_to_gnu_entity (gnat_entity, NULL_TREE, true);
gcc_assert (TREE_CODE (gnu_new) == TYPE_DECL); gcc_assert (TREE_CODE (gnu_new) == TYPE_DECL);
/* If we have an old type and we've made pointers to this type, update those /* If we have an old type and we've made pointers to this type, update those
......
...@@ -239,17 +239,24 @@ static tree convert_to_fat_pointer (tree, tree); ...@@ -239,17 +239,24 @@ static tree convert_to_fat_pointer (tree, tree);
static unsigned int scale_by_factor_of (tree, unsigned int); static unsigned int scale_by_factor_of (tree, unsigned int);
static bool potential_alignment_gap (tree, tree, tree); static bool potential_alignment_gap (tree, tree, tree);
/* A linked list used as a queue to defer the initialization of the /* Linked list used as a queue to defer the initialization of the DECL_CONTEXT
DECL_CONTEXT attribute of ..._DECL nodes and of the TYPE_CONTEXT attribute of ..._DECL nodes and of the TYPE_CONTEXT of ..._TYPE nodes. */
of ..._TYPE nodes. */
struct deferred_decl_context_node struct deferred_decl_context_node
{ {
tree decl; /* The ..._DECL node to work on. */ /* The ..._DECL node to work on. */
Entity_Id gnat_scope; /* The corresponding entity's Scope attribute. */ tree decl;
int force_global; /* force_global value when pushing DECL. */
vec<tree, va_heap, vl_ptr> types; /* A list of ..._TYPE nodes to propagate the /* The corresponding entity's Scope. */
context to. */ Entity_Id gnat_scope;
struct deferred_decl_context_node *next; /* The next queue item. */
/* The value of force_global when DECL was pushed. */
int force_global;
/* The list of ..._TYPE nodes to propagate the context to. */
vec<tree> types;
/* The next queue item. */
struct deferred_decl_context_node *next;
}; };
static struct deferred_decl_context_node *deferred_decl_context_queue = NULL; static struct deferred_decl_context_node *deferred_decl_context_queue = NULL;
...@@ -1217,7 +1224,8 @@ lookup_and_insert_pad_type (tree type) ...@@ -1217,7 +1224,8 @@ lookup_and_insert_pad_type (tree type)
IS_COMPONENT_TYPE is true if this is being done for the component type of IS_COMPONENT_TYPE is true if this is being done for the component type of
an array. IS_USER_TYPE is true if the original type needs to be completed. an array. IS_USER_TYPE is true if the original type needs to be completed.
DEFINITION is true if this type is being defined. SET_RM_SIZE is true if DEFINITION is true if this type is being defined. SET_RM_SIZE is true if
the RM size of the resulting type is to be set to SIZE too. */ the RM size of the resulting type is to be set to SIZE too; in this case,
the padded type is canonicalized before being returned. */
tree tree
maybe_pad_type (tree type, tree size, unsigned int align, maybe_pad_type (tree type, tree size, unsigned int align,
...@@ -1280,8 +1288,6 @@ maybe_pad_type (tree type, tree size, unsigned int align, ...@@ -1280,8 +1288,6 @@ maybe_pad_type (tree type, tree size, unsigned int align,
type and name. */ type and name. */
record = make_node (RECORD_TYPE); record = make_node (RECORD_TYPE);
TYPE_PADDING_P (record) = 1; TYPE_PADDING_P (record) = 1;
if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
SET_TYPE_DEBUG_TYPE (record, type);
/* ??? Padding types around packed array implementation types will be /* ??? Padding types around packed array implementation types will be
considered as root types in the array descriptor language hook (see considered as root types in the array descriptor language hook (see
...@@ -1337,9 +1343,12 @@ maybe_pad_type (tree type, tree size, unsigned int align, ...@@ -1337,9 +1343,12 @@ maybe_pad_type (tree type, tree size, unsigned int align,
bitsize_zero_node, 0, 1); bitsize_zero_node, 0, 1);
DECL_INTERNAL_P (field) = 1; DECL_INTERNAL_P (field) = 1;
/* Do not emit debug info until after the auxiliary record is built. */ /* We will output additional debug info manually below. */
finish_record_type (record, field, 1, false); finish_record_type (record, field, 1, false);
if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
SET_TYPE_DEBUG_TYPE (record, type);
/* Set the RM size if requested. */ /* Set the RM size if requested. */
if (set_rm_size) if (set_rm_size)
{ {
...@@ -1409,8 +1418,6 @@ maybe_pad_type (tree type, tree size, unsigned int align, ...@@ -1409,8 +1418,6 @@ maybe_pad_type (tree type, tree size, unsigned int align,
} }
} }
rest_of_record_type_compilation (record);
built: built:
/* If a simple size was explicitly given, maybe issue a warning. */ /* If a simple size was explicitly given, maybe issue a warning. */
if (!size if (!size
...@@ -1672,7 +1679,7 @@ finish_fat_pointer_type (tree record_type, tree field_list) ...@@ -1672,7 +1679,7 @@ finish_fat_pointer_type (tree record_type, tree field_list)
laid out already; only set the sizes and alignment. If REP_LEVEL is two, laid out already; only set the sizes and alignment. If REP_LEVEL is two,
this record is derived from a parent record and thus inherits its layout; this record is derived from a parent record and thus inherits its layout;
only make a pass on the fields to finalize them. DEBUG_INFO_P is true if only make a pass on the fields to finalize them. DEBUG_INFO_P is true if
we need to write debug information about this type. */ additional debug info needs to be output for this type. */
void void
finish_record_type (tree record_type, tree field_list, int rep_level, finish_record_type (tree record_type, tree field_list, int rep_level,
...@@ -1927,10 +1934,9 @@ has_parallel_type (tree type) ...@@ -1927,10 +1934,9 @@ has_parallel_type (tree type)
return DECL_PARALLEL_TYPE (decl) != NULL_TREE; return DECL_PARALLEL_TYPE (decl) != NULL_TREE;
} }
/* Wrap up compilation of RECORD_TYPE, i.e. output all the debug information /* Wrap up compilation of RECORD_TYPE, i.e. output additional debug info
associated with it. It need not be invoked directly in most cases since associated with it. It need not be invoked directly in most cases as
finish_record_type takes care of doing so, but this can be necessary if finish_record_type takes care of doing so. */
a parallel type is to be attached to the record type. */
void void
rest_of_record_type_compilation (tree record_type) rest_of_record_type_compilation (tree record_type)
...@@ -2072,7 +2078,7 @@ rest_of_record_type_compilation (tree record_type) ...@@ -2072,7 +2078,7 @@ rest_of_record_type_compilation (tree record_type)
field_type = build_pointer_type (field_type); field_type = build_pointer_type (field_type);
if (align != 0 && TYPE_ALIGN (field_type) > align) if (align != 0 && TYPE_ALIGN (field_type) > align)
{ {
field_type = copy_node (field_type); field_type = copy_type (field_type);
SET_TYPE_ALIGN (field_type, align); SET_TYPE_ALIGN (field_type, align);
} }
var = true; var = true;
...@@ -2284,10 +2290,10 @@ copy_type (tree type) ...@@ -2284,10 +2290,10 @@ copy_type (tree type)
aliased with TREE_CHAIN. */ aliased with TREE_CHAIN. */
TYPE_STUB_DECL (new_type) = TYPE_STUB_DECL (type); TYPE_STUB_DECL (new_type) = TYPE_STUB_DECL (type);
TYPE_POINTER_TO (new_type) = 0; TYPE_POINTER_TO (new_type) = NULL_TREE;
TYPE_REFERENCE_TO (new_type) = 0; TYPE_REFERENCE_TO (new_type) = NULL_TREE;
TYPE_MAIN_VARIANT (new_type) = new_type; TYPE_MAIN_VARIANT (new_type) = new_type;
TYPE_NEXT_VARIANT (new_type) = 0; TYPE_NEXT_VARIANT (new_type) = NULL_TREE;
TYPE_CANONICAL (new_type) = new_type; TYPE_CANONICAL (new_type) = new_type;
return new_type; return new_type;
...@@ -3431,14 +3437,14 @@ gnat_signed_or_unsigned_type_for (int unsignedp, tree type_node) ...@@ -3431,14 +3437,14 @@ gnat_signed_or_unsigned_type_for (int unsignedp, tree type_node)
if (TREE_CODE (type_node) == INTEGER_TYPE && TYPE_MODULAR_P (type_node)) if (TREE_CODE (type_node) == INTEGER_TYPE && TYPE_MODULAR_P (type_node))
{ {
type = copy_node (type); type = copy_type (type);
TREE_TYPE (type) = type_node; TREE_TYPE (type) = type_node;
} }
else if (TREE_TYPE (type_node) else if (TREE_TYPE (type_node)
&& TREE_CODE (TREE_TYPE (type_node)) == INTEGER_TYPE && TREE_CODE (TREE_TYPE (type_node)) == INTEGER_TYPE
&& TYPE_MODULAR_P (TREE_TYPE (type_node))) && TYPE_MODULAR_P (TREE_TYPE (type_node)))
{ {
type = copy_node (type); type = copy_type (type);
TREE_TYPE (type) = TREE_TYPE (type_node); TREE_TYPE (type) = TREE_TYPE (type_node);
} }
......
...@@ -560,8 +560,8 @@ nonbinary_modular_operation (enum tree_code op_code, tree type, tree lhs, ...@@ -560,8 +560,8 @@ nonbinary_modular_operation (enum tree_code op_code, tree type, tree lhs,
if (TYPE_PRECISION (op_type) < precision if (TYPE_PRECISION (op_type) < precision
|| TYPE_UNSIGNED (op_type) != unsignedp) || TYPE_UNSIGNED (op_type) != unsignedp)
{ {
/* Copy the node so we ensure it can be modified to make it modular. */ /* Copy the type so we ensure it can be modified to make it modular. */
op_type = copy_node (gnat_type_for_size (precision, unsignedp)); op_type = copy_type (gnat_type_for_size (precision, unsignedp));
modulus = convert (op_type, modulus); modulus = convert (op_type, modulus);
SET_TYPE_MODULUS (op_type, modulus); SET_TYPE_MODULUS (op_type, modulus);
TYPE_MODULAR_P (op_type) = 1; TYPE_MODULAR_P (op_type) = 1;
...@@ -577,7 +577,8 @@ nonbinary_modular_operation (enum tree_code op_code, tree type, tree lhs, ...@@ -577,7 +577,8 @@ nonbinary_modular_operation (enum tree_code op_code, tree type, tree lhs,
possible size. */ possible size. */
if (op_code == MULT_EXPR) if (op_code == MULT_EXPR)
{ {
tree div_type = copy_node (gnat_type_for_size (needed_precision, 1)); /* Copy the type so we ensure it can be modified to make it modular. */
tree div_type = copy_type (gnat_type_for_size (needed_precision, 1));
modulus = convert (div_type, modulus); modulus = convert (div_type, modulus);
SET_TYPE_MODULUS (div_type, modulus); SET_TYPE_MODULUS (div_type, modulus);
TYPE_MODULAR_P (div_type) = 1; TYPE_MODULAR_P (div_type) = 1;
...@@ -1761,9 +1762,10 @@ build_goto_raise (tree label, int msg) ...@@ -1761,9 +1762,10 @@ build_goto_raise (tree label, int msg)
/* If Local_Raise is present, build Local_Raise (Exception'Identity). */ /* If Local_Raise is present, build Local_Raise (Exception'Identity). */
if (Present (local_raise)) if (Present (local_raise))
{ {
tree gnu_local_raise = gnat_to_gnu_entity (local_raise, NULL_TREE, 0); tree gnu_local_raise
= gnat_to_gnu_entity (local_raise, NULL_TREE, false);
tree gnu_exception_entity tree gnu_exception_entity
= gnat_to_gnu_entity (Get_RT_Exception_Entity (msg), NULL_TREE, 0); = gnat_to_gnu_entity (Get_RT_Exception_Entity (msg), NULL_TREE, false);
tree gnu_call tree gnu_call
= build_call_n_expr (gnu_local_raise, 1, = build_call_n_expr (gnu_local_raise, 1,
build_unary_op (ADDR_EXPR, NULL_TREE, build_unary_op (ADDR_EXPR, NULL_TREE,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment