On Mon, 2017-01-16 at 14:54 -0700, Jeff Law wrote: > On 01/09/2017 07:38 PM, David Malcolm wrote: > > The backend is full of singleton state, so we have to compile > > __RTL-functions as soon as we parse them. This means that the > > C frontend needs to invoke the backed. > > > > This patch adds the support needed. > > > > Normally this would be a no-no, and including rtl headers is > > blocked by this within system.h: > > > > /* Front ends should never have to include middle-end headers. > > Enforce > > this by poisoning the header double-include protection defines. > > */ > > #ifdef IN_GCC_FRONTEND > > #pragma GCC poison GCC_RTL_H GCC_EXCEPT_H GCC_EXPR_H > > #endif > > > > Hence the patch puts the decl into a new header (run-rtl-passes.h) > > that's accessible to the C frontend without exposing any RTL > > internals. (If adding a header for just this decl is overkill, is > > there a better place to put the decl?) > > > > gcc/ChangeLog: > > * Makefile.in (OBJS): Add run-rtl-passes.o. > > * pass_manager.h (gcc::pass_manager::get_rest_of_compilation): > > New > > accessor. > > (gcc::pass_manager::get_clean_slate): New accessor. > > * run-rtl-passes.c: New file. > > * run-rtl-passes.h: New file. > It feels like this is dependent upon something that I haven't seen?!?
I may have split things up a bit too much; sorry. The code in this patch is called by patch 9a. > > Where is get_rest_of_compilation used? In this patch, in run-rtl-passes.c:run_rtl_passes, thusly: + opt_pass *rest_of_compilation + = g->get_passes ()->get_rest_of_compilation (); + gcc_assert (rest_of_compilation); + execute_pass_list (cfun, rest_of_compilation); > Where is pass_clean_state_1? (as used in this part of the patch): > * pass_manager.h (gcc::pass_manager::get_rest_of_compilation): > New accessor. + opt_pass *get_clean_slate () const { return pass_clean_state_1; } This is a new accessor method for the pass_manager class. pass_clean_state_1 is private member data of the pass_manager, it's the instance of class pass_clean_state. This field of pass_manager is created by the /* References to all of the individual passes. These fields are generated via macro expansion. (...etc...) #define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM (...etc...) #include "pass-instances.def" code within pass_manager.h. This line within SRC/gcc/passes.def: NEXT_PASS (pass_clean_state); becomes this line within BUILD/gcc/pass-instances.def: NEXT_PASS (pass_clean_state, 1); and this means that we effectively have this field within class pass_manager (along with dozens of others): opt_pass *pass_clean_state_1; They're all private; hence the need for this accessor. Similarly for get_rest_of_compilation.