Message ID | 1433530834-2426-1-git-send-email-dmalcolm@redhat.com |
---|---|
State | New |
Headers | show |
On 06/05/2015 03:00 PM, David Malcolm wrote: > "jit" isn't part of "all" languages, and currently fails to build on > the aldyh/debug-early branch: The debug-early work is now in mainline. Feel free to commit when you deem appropriate, since you are the jit maintainer ;-). > static void > -jit_langhook_write_globals (void) > +jit_langhook_post_compilation_parsing_cleanups (void) > { > gcc::jit::playback::context *ctxt = gcc::jit::active_playback_ctxt; > gcc_assert (ctxt); > JIT_LOG_SCOPE (ctxt->get_logger ()); > > - ctxt->write_global_decls_1 (); > - > - /* This is the hook that runs the middle and backends: */ > - symtab->finalize_compilation_unit (); > - > - ctxt->write_global_decls_2 (); > + ctxt->finalize_global_decls (); This hook gets called after the compilation proper has run, and we're trying to avoid it. We're trying to get all the front-ends to finish their thing and avoid depending on the compilation proper. Can you not get this to work without running finalize_global_decls after the compilation proper? If not, then I see no problem with your patch....after all, C++ is still using this hook :(. Thanks for working on this. Aldy
On Fri, 2015-06-05 at 15:37 -0400, Aldy Hernandez wrote: > On 06/05/2015 03:00 PM, David Malcolm wrote: > > "jit" isn't part of "all" languages, and currently fails to build on > > the aldyh/debug-early branch: > > The debug-early work is now in mainline. Feel free to commit when you > deem appropriate, since you are the jit maintainer ;-). Given that it fixes the build of the jit, I've gone ahead and committed the patch as-is to trunk (r224170). > > static void > > -jit_langhook_write_globals (void) > > +jit_langhook_post_compilation_parsing_cleanups (void) > > { > > gcc::jit::playback::context *ctxt = gcc::jit::active_playback_ctxt; > > gcc_assert (ctxt); > > JIT_LOG_SCOPE (ctxt->get_logger ()); > > > > - ctxt->write_global_decls_1 (); > > - > > - /* This is the hook that runs the middle and backends: */ > > - symtab->finalize_compilation_unit (); > > - > > - ctxt->write_global_decls_2 (); > > + ctxt->finalize_global_decls (); > > This hook gets called after the compilation proper has run, and we're > trying to avoid it. We're trying to get all the front-ends to finish > their thing and avoid depending on the compilation proper. > > Can you not get this to work without running finalize_global_decls after > the compilation proper? If not, then I see no problem with your > patch....after all, C++ is still using this hook :(. Am investigating. Thanks Dave
diff --git a/gcc/jit/dummy-frontend.c b/gcc/jit/dummy-frontend.c index 8f7d06a..374df6f 100644 --- a/gcc/jit/dummy-frontend.c +++ b/gcc/jit/dummy-frontend.c @@ -222,18 +222,13 @@ jit_langhook_getdecls (void) } static void -jit_langhook_write_globals (void) +jit_langhook_post_compilation_parsing_cleanups (void) { gcc::jit::playback::context *ctxt = gcc::jit::active_playback_ctxt; gcc_assert (ctxt); JIT_LOG_SCOPE (ctxt->get_logger ()); - ctxt->write_global_decls_1 (); - - /* This is the hook that runs the middle and backends: */ - symtab->finalize_compilation_unit (); - - ctxt->write_global_decls_2 (); + ctxt->finalize_global_decls (); } #undef LANG_HOOKS_NAME @@ -263,8 +258,9 @@ jit_langhook_write_globals (void) #undef LANG_HOOKS_GETDECLS #define LANG_HOOKS_GETDECLS jit_langhook_getdecls -#undef LANG_HOOKS_WRITE_GLOBALS -#define LANG_HOOKS_WRITE_GLOBALS jit_langhook_write_globals +#undef LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS +#define LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS \ + jit_langhook_post_compilation_parsing_cleanups struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c index c75c076..0d329b0 100644 --- a/gcc/jit/jit-playback.c +++ b/gcc/jit/jit-playback.c @@ -673,14 +673,13 @@ as_truth_value (tree expr, location *loc) return expr; } -/* For use by jit_langhook_write_globals. +/* For use by jit_langhook_post_compilation_parsing_cleanups Calls varpool_node::finalize_decl on each global. */ void playback::context:: -write_global_decls_1 () +finalize_global_decls () { - /* Compare with e.g. the C frontend's c_write_global_declarations. */ JIT_LOG_SCOPE (get_logger ()); int i; @@ -692,26 +691,6 @@ write_global_decls_1 () } } -/* For use by jit_langhook_write_globals. - Calls debug_hooks->global_decl on each global. */ - -void -playback::context:: -write_global_decls_2 () -{ - /* Compare with e.g. the C frontend's c_write_global_declarations_2. */ - JIT_LOG_SCOPE (get_logger ()); - - int i; - tree decl; - FOR_EACH_VEC_ELT (m_globals, i, decl) - { - gcc_assert (TREE_CODE (decl) == VAR_DECL); - debug_hooks->global_decl (decl); - } -} - - /* Construct a playback::rvalue instance (wrapping a tree) for a unary op. */ diff --git a/gcc/jit/jit-playback.h b/gcc/jit/jit-playback.h index e9832f0..84d99e4 100644 --- a/gcc/jit/jit-playback.h +++ b/gcc/jit/jit-playback.h @@ -215,9 +215,7 @@ public: return m_recording_ctxt->errors_occurred (); } - /* For use by jit_langhook_write_globals. */ - void write_global_decls_1 (); - void write_global_decls_2 (); + void finalize_global_decls (); private: void dump_generated_code ();