[PATCH] Pass manager: add support for termination of pass list

Martin Liška mliska@suse.cz
Wed Nov 4 10:38:00 GMT 2015


On 11/03/2015 03:44 PM, Richard Biener wrote:
> On Tue, Nov 3, 2015 at 3:13 PM, Martin Liška <mliska@suse.cz> wrote:
>> On 11/03/2015 02:46 PM, Richard Biener wrote:
>>> On Fri, Oct 30, 2015 at 1:53 PM, Martin Liška <mliska@suse.cz> wrote:
>>>> On 10/30/2015 01:13 PM, Richard Biener wrote:
>>>>> So I suggest to do the push/pop of cfun there.
>>>>> do_per_function_toporder can be made static btw.
>>>>>
>>>>> Richard.
>>>>
>>>> Right, I've done that and it works (bootstrap has been currently running),
>>>> feasible for HSA branch too.
>>>>
>>>> tree-pass.h:
>>>>
>>>> /* Declare for plugins.  */
>>>> extern void do_per_function_toporder (void (*) (function *, void *), void *);
>>>>
>>>> Attaching the patch that I'm going to test.
>>>
>>> Err.
>>>
>>> +      cgraph_node::get (current_function_decl)->release_body ();
>>> +
>>> +      current_function_decl = NULL;
>>> +      set_cfun (NULL);
>>>
>>> I'd have expected
>>>
>>>       tree fn = cfun->decl;
>>>       pop_cfun ();
>>>       gcc_assert (!cfun);
>>>       cgraph_node::get (fn)->release_body ();
>>>
>>> here.
>>
>> Yeah, that works, but we have to add following hunk:
>>
>> diff --git a/gcc/function.c b/gcc/function.c
>> index aaf49a4..4718fe1 100644
>> --- a/gcc/function.c
>> +++ b/gcc/function.c
>> @@ -4756,6 +4756,13 @@ push_cfun (struct function *new_cfun)
>>  void
>>  pop_cfun (void)
>>  {
>> +  if (cfun_stack.is_empty ())
>> +    {
>> +      set_cfun (NULL);
>> +      current_function_decl = NULL_TREE;
>> +      return;
>> +    }
>> +
>>    struct function *new_cfun = cfun_stack.pop ();
>>    /* When in_dummy_function, we do have a cfun but current_function_decl is
>>       NULL.  We also allow pushing NULL cfun and subsequently changing
> 
> Why again?  cfun should be set via push_cfun here so what's having cfun == NULL
> at the pop_cfun point?  Or rather, what code used set_cfun () instead
> of push_cfun ()?
> 
>>
>> If you are fine with that, looks we've fixed all issues related to the change, right?
>> Updated version of the is attached.
>>
>> Martin
>>
>>>
>>>> Martin
>>>>
>>

Hi Richard.

There's the patch we talked about yesterday. It contains a few modification that
were necessary to make it working:

1) cgraph_node::expand_thunk uses just set_cfun (NULL) & current_function_decl = NULL because

      bb = then_bb = else_bb = return_bb
	= init_lowered_empty_function (thunk_fndecl, true, count);

in last branch of expand_thunk which calls allocate_struct_function.

2) i386.c and rs6000.c call init_function_start, as I move preamble to callers, I did the same
for these two functions

I've been running regression test and bootstrap.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Test.patch
Type: text/x-patch
Size: 5958 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151104/f91e44ab/attachment.bin>


More information about the Gcc-patches mailing list