gcc/go/
* go-gcc.cc (write_global_definitions): Remove call to
finalize_compilation_unit.
Remove Go specific debug generation.
* go-lang.c (go_langhook_parse_file): Call go_write_globals.
(go_langhook_write_globals): Remove.
Remove LANG_HOOKS_WRITE_GLOBALS everywhere.
@@ -3024,7 +3024,8 @@ Gcc_backend::lookup_builtin(const std::string& name)
}
// Write the definitions for all TYPE_DECLS, CONSTANT_DECLS,
-// FUNCTION_DECLS, and VARIABLE_DECLS declared globally.
+// FUNCTION_DECLS, and VARIABLE_DECLS declared globally, as well as
+// emit early debugging information.
void
Gcc_backend::write_global_definitions(
@@ -3097,11 +3098,6 @@ Gcc_backend::write_global_definitions(
wrapup_global_declarations(defs, i);
- symtab->finalize_compilation_unit();
-
- check_global_declarations(defs, i);
- emit_debug_global_declarations(defs, i);
-
delete[] defs;
}
@@ -310,6 +310,9 @@ go_langhook_parse_file (void)
{
go_parse_input_files (in_fnames, num_in_fnames, flag_syntax_only,
go_require_return_statement);
+
+ /* Final processing of globals and early debug info generation. */
+ go_write_globals ();
}
static tree
@@ -455,14 +458,6 @@ go_langhook_getdecls (void)
return NULL;
}
-/* Write out globals. */
-
-static void
-go_langhook_write_globals (void)
-{
- go_write_globals ();
-}
-
/* Go specific gimplification. We need to gimplify
CALL_EXPR_STATIC_CHAIN, because the gimplifier doesn't handle
it. */
@@ -560,7 +555,6 @@ go_localize_identifier (const char *ident)
#undef LANG_HOOKS_GLOBAL_BINDINGS_P
#undef LANG_HOOKS_PUSHDECL
#undef LANG_HOOKS_GETDECLS
-#undef LANG_HOOKS_WRITE_GLOBALS
#undef LANG_HOOKS_GIMPLIFY_EXPR
#undef LANG_HOOKS_EH_PERSONALITY
@@ -577,7 +571,6 @@ go_localize_identifier (const char *ident)
#define LANG_HOOKS_GLOBAL_BINDINGS_P go_langhook_global_bindings_p
#define LANG_HOOKS_PUSHDECL go_langhook_pushdecl
#define LANG_HOOKS_GETDECLS go_langhook_getdecls
-#define LANG_HOOKS_WRITE_GLOBALS go_langhook_write_globals
#define LANG_HOOKS_GIMPLIFY_EXPR go_langhook_gimplify_expr
#define LANG_HOOKS_EH_PERSONALITY go_langhook_eh_personality
@@ -514,13 +514,19 @@ go_function_decl (tree decl)
go_decl (decl);
}
+static void
+go_early_global_decl (tree decl)
+{
+ go_decl (decl);
+ real_debug_hooks->early_global_decl (decl);
+}
+
/* A global variable decl. */
static void
-go_global_decl (tree decl)
+go_late_global_decl (tree decl)
{
- real_debug_hooks->global_decl (decl);
- go_decl (decl);
+ real_debug_hooks->late_global_decl (decl);
}
/* A type declaration. */
@@ -1460,7 +1466,8 @@ dump_go_spec_init (const char *filename, const struct gcc_debug_hooks *hooks)
go_debug_hooks.define = go_define;
go_debug_hooks.undef = go_undef;
go_debug_hooks.function_decl = go_function_decl;
- go_debug_hooks.global_decl = go_global_decl;
+ go_debug_hooks.early_global_decl = go_early_global_decl;
+ go_debug_hooks.late_global_decl = go_late_global_decl;
go_debug_hooks.type_decl = go_type_decl;
macro_hash = htab_create (100, macro_hash_hashval, macro_hash_eq,