Commit a22b794d by Eric Botcazou Committed by Eric Botcazou

gigi.h (note_types_used_by_globals): Delete.

	* gcc-interface/gigi.h (note_types_used_by_globals): Delete.
	(gnat_write_global_declarations): New prototype.
	* gcc-interface/utils.c (type_decls): Rename back to...
	(global_decls): ...this.
	(gnat_pushdecls): Revert previous change.
	(create_var_decl): Do not output global variables.
	(note_types_used_by_globals): Rename back to...
	(gnat_write_global_declarations): ...this.  Output variables on the
	global_decls vector.
	* gcc-interface/misc.c (gnat_parse_file): Adjust to above renaming.

From-SVN: r225003
parent 6249559b
2015-06-26 Eric Botcazou <ebotcazou@adacore.com> 2015-06-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (note_types_used_by_globals): Delete.
(gnat_write_global_declarations): New prototype.
* gcc-interface/utils.c (type_decls): Rename back to...
(global_decls): ...this.
(gnat_pushdecls): Revert previous change.
(create_var_decl): Do not output global variables.
(note_types_used_by_globals): Rename back to...
(gnat_write_global_declarations): ...this. Output variables on the
global_decls vector.
* gcc-interface/misc.c (gnat_parse_file): Adjust to above renaming.
2015-06-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (create_var_decl_1): Rename into... * gcc-interface/gigi.h (create_var_decl_1): Rename into...
(create_var_decl): ...this. Add default value for last parameter. (create_var_decl): ...this. Add default value for last parameter.
(create_type_stub_decl): Adjust. (create_type_stub_decl): Adjust.
......
...@@ -531,9 +531,8 @@ extern tree gnat_type_for_size (unsigned precision, int unsignedp); ...@@ -531,9 +531,8 @@ extern tree gnat_type_for_size (unsigned precision, int unsignedp);
an unsigned type; otherwise a signed type is returned. */ an unsigned type; otherwise a signed type is returned. */
extern tree gnat_type_for_mode (machine_mode mode, int unsignedp); extern tree gnat_type_for_mode (machine_mode mode, int unsignedp);
/* Keep track of types used at the global level and emit debug info /* Perform final processing on global declarations. */
for all global types. */ extern void gnat_write_global_declarations (void);
extern void note_types_used_by_globals (void);
/* Return the unsigned version of a TYPE_NODE, a scalar type. */ /* Return the unsigned version of a TYPE_NODE, a scalar type. */
extern tree gnat_unsigned_type (tree type_node); extern tree gnat_unsigned_type (tree type_node);
......
...@@ -113,7 +113,8 @@ gnat_parse_file (void) ...@@ -113,7 +113,8 @@ gnat_parse_file (void)
/* Call the front end. */ /* Call the front end. */
_ada_gnat1drv (); _ada_gnat1drv ();
note_types_used_by_globals (); /* Write the global declarations. */
gnat_write_global_declarations ();
} }
/* Return language mask for option processing. */ /* Return language mask for option processing. */
......
...@@ -218,8 +218,8 @@ static GTY((deletable)) struct gnat_binding_level *free_binding_level; ...@@ -218,8 +218,8 @@ static GTY((deletable)) struct gnat_binding_level *free_binding_level;
/* The context to be used for global declarations. */ /* The context to be used for global declarations. */
static GTY(()) tree global_context; static GTY(()) tree global_context;
/* An array of global type declarations. */ /* An array of global declarations. */
static GTY(()) vec<tree, va_gc> *type_decls; static GTY(()) vec<tree, va_gc> *global_decls;
/* An array of builtin function declarations. */ /* An array of builtin function declarations. */
static GTY(()) vec<tree, va_gc> *builtin_decls; static GTY(()) vec<tree, va_gc> *builtin_decls;
...@@ -753,10 +753,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) ...@@ -753,10 +753,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
vec_safe_push (builtin_decls, decl); vec_safe_push (builtin_decls, decl);
} }
else if (global_bindings_p ()) else if (global_bindings_p ())
{ vec_safe_push (global_decls, decl);
if (TREE_CODE (decl) == TYPE_DECL)
vec_safe_push (type_decls, decl);
}
else else
{ {
DECL_CHAIN (decl) = BLOCK_VARS (current_binding_level->block); DECL_CHAIN (decl) = BLOCK_VARS (current_binding_level->block);
...@@ -2439,19 +2436,13 @@ create_var_decl (tree name, tree asm_name, tree type, tree init, ...@@ -2439,19 +2436,13 @@ create_var_decl (tree name, tree asm_name, tree type, tree init,
/* Add this decl to the current binding level. */ /* Add this decl to the current binding level. */
gnat_pushdecl (var_decl, gnat_node); gnat_pushdecl (var_decl, gnat_node);
if (TREE_CODE (var_decl) == VAR_DECL) if (TREE_CODE (var_decl) == VAR_DECL && asm_name)
{ {
if (asm_name) /* Let the target mangle the name if this isn't a verbatim asm. */
{ if (*IDENTIFIER_POINTER (asm_name) != '*')
/* Let the target mangle the name if this isn't a verbatim asm. */ asm_name = targetm.mangle_decl_assembler_name (var_decl, asm_name);
if (*IDENTIFIER_POINTER (asm_name) != '*')
asm_name = targetm.mangle_decl_assembler_name (var_decl, asm_name);
SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);
}
if (global_bindings_p ()) SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);
rest_of_decl_compilation (var_decl, true, 0);
} }
return var_decl; return var_decl;
...@@ -5200,13 +5191,12 @@ smaller_form_type_p (tree type, tree orig_type) ...@@ -5200,13 +5191,12 @@ smaller_form_type_p (tree type, tree orig_type)
return tree_int_cst_lt (size, osize) != 0; return tree_int_cst_lt (size, osize) != 0;
} }
/* Keep track of types used at the global level and emit debug info /* Perform final processing on global declarations. */
for all global types. */
static GTY (()) tree dummy_global; static GTY (()) tree dummy_global;
void void
note_types_used_by_globals (void) gnat_write_global_declarations (void)
{ {
unsigned int i; unsigned int i;
tree iter; tree iter;
...@@ -5235,13 +5225,20 @@ note_types_used_by_globals (void) ...@@ -5235,13 +5225,20 @@ note_types_used_by_globals (void)
} }
} }
/* Output debug information for all global type declarations. This ensures /* Output debug information for all global type declarations first. This
that global types whose compilation cannot been finalized earlier, e.g. ensures that global types whose compilation hasn't been finalized yet,
pointers to Taft amendment types, have their compilation finalized in for example pointers to Taft amendment types, have their compilation
the right context. */ finalized in the right context. */
FOR_EACH_VEC_SAFE_ELT (type_decls, i, iter) FOR_EACH_VEC_SAFE_ELT (global_decls, i, iter)
if (!DECL_IGNORED_P (iter)) if (TREE_CODE (iter) == TYPE_DECL && !DECL_IGNORED_P (iter))
debug_hooks->type_decl (iter, false); debug_hooks->type_decl (iter, false);
/* Then output the global variables. We need to do that after the debug
information is emitted above so that "forward" type declarations are
properly merged with their definition in the debug information. */
FOR_EACH_VEC_SAFE_ELT (global_decls, i, iter)
if (TREE_CODE (iter) == VAR_DECL)
rest_of_decl_compilation (iter, true, 0);
} }
/* ************************************************************************ /* ************************************************************************
......
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