[PATCH 9f] Add a way for the C frontend to compile __RTL-tagged functions

Jeff Law law@redhat.com
Sun Jan 22 09:05:00 GMT 2017


On 01/16/2017 04:23 PM, David Malcolm wrote:
> 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.
It happens.  It's the price we pay for asking for patches to be broken 
down into manageable hunks.   Joseph ack'd 9a and since it was just 
front-end stuff, I didn't take the time to look at it.

>
>>
>> Where is get_rest_of_compilation used?
>
> In this patch, in run-rtl-passes.c:run_rtl_passes, thusly:
Yea, I see it how.  Hidden by c++-ification :-)
>
> +  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):
Nevermind.   We refer to pass_clean_state_1 and get_clean_slate.   I 
kept consistently using the wrong state/slate in my searches.  No wonder 
I was so confused.

Patch is OK.  THanks for your patience.

jeff




More information about the Gcc-patches mailing list