[5/10] debug-early merge: Go front-end
diff mbox

Message ID 554C04F6.6000305@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez May 8, 2015, 12:36 a.m. UTC

Comments

Ian Taylor May 8, 2015, 6:08 p.m. UTC | #1
This is fine if it works.  Thanks.

Ian

On Thu, May 7, 2015 at 5:36 PM, Aldy Hernandez <aldyh@redhat.com> wrote:
>
Aldy Hernandez May 8, 2015, 6:55 p.m. UTC | #2
On 05/08/2015 11:08 AM, Ian Lance Taylor wrote:
> This is fine if it works.  Thanks.
>
> Ian
>
> On Thu, May 7, 2015 at 5:36 PM, Aldy Hernandez <aldyh@redhat.com> wrote:
>>

As mentioned, no regressions with --enable-languages=go.

I will mark the Go changes as approved pending on the rest of the 
patches being approved.

Thanks.

Patch
diff mbox

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.

diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 82ce3ee..0654491 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -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;
 }
 
diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c
index fe5b583..370ad65 100644
--- a/gcc/go/go-lang.c
+++ b/gcc/go/go-lang.c
@@ -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
 
diff --git a/gcc/godump.c b/gcc/godump.c
index 4147f75..5de34db 100644
--- a/gcc/godump.c
+++ b/gcc/godump.c
@@ -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,