* Where is setup for "goto" in nested function created?
@ 2008-05-22 17:02 hutchinsonandy
2008-05-22 17:17 ` David Daney
2008-05-22 18:27 ` Ian Lance Taylor
0 siblings, 2 replies; 7+ messages in thread
From: hutchinsonandy @ 2008-05-22 17:02 UTC (permalink / raw)
To: gcc
During the process of fixing setjmp for AVR target, I needed to define
targetm.builtin_setjmp_frame_value () to be used in
expand_builtin_setjmp_setup().
This sets the value of the Frame pointer stored in jump buffer.
I set this "value" to virtual_stack_vars_rtx+1 (==frame_pointer)
Receiver defined in target latter restores frame pointer using
virtual_stack_vars_rtx = value - 1
This produce correct code as expected and avoids run-time add/sub of
offsets. (setjmp works!)
However, for a normal goto used inside a nested function, a different
part of gcc creates the code to store frame pointer (not
expand_builtin_setjmp_setup). I can't find this code.
The issue I have is that this "goto_setup" code does NOT use
targetm.builtin_setjmp_frame_value - but seems to use
value=virtual_stack_vars_rtx, which is incompatible with my target
receiver.
So where is the goto setup code created? And is there a bug here?
regards
Andy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Where is setup for "goto" in nested function created?
2008-05-22 17:02 Where is setup for "goto" in nested function created? hutchinsonandy
@ 2008-05-22 17:17 ` David Daney
2008-05-22 17:36 ` hutchinsonandy
2008-05-22 18:27 ` Ian Lance Taylor
1 sibling, 1 reply; 7+ messages in thread
From: David Daney @ 2008-05-22 17:17 UTC (permalink / raw)
To: hutchinsonandy; +Cc: gcc
hutchinsonandy@aim.com wrote:
> During the process of fixing setjmp for AVR target, I needed to define
> targetm.builtin_setjmp_frame_value () to be used in
> expand_builtin_setjmp_setup().
>
> This sets the value of the Frame pointer stored in jump buffer.
>
> I set this "value" to virtual_stack_vars_rtx+1 (==frame_pointer)
> Receiver defined in target latter restores frame pointer using
> virtual_stack_vars_rtx = value - 1
>
> This produce correct code as expected and avoids run-time add/sub of
> offsets. (setjmp works!)
>
> However, for a normal goto used inside a nested function, a different
> part of gcc creates the code to store frame pointer (not
> expand_builtin_setjmp_setup). I can't find this code.
>
> The issue I have is that this "goto_setup" code does NOT use
> targetm.builtin_setjmp_frame_value - but seems to use
> value=virtual_stack_vars_rtx, which is incompatible with my target
> receiver.
>
> So where is the goto setup code created? And is there a bug here?
>
Perhaps you need to implement one or more of: save_stack_nonlocal,
restore_stack_nonlocal, nonlocal_goto, and/or nonlocal_goto_receiver.
David Daney
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Where is setup for "goto" in nested function created?
2008-05-22 17:17 ` David Daney
@ 2008-05-22 17:36 ` hutchinsonandy
0 siblings, 0 replies; 7+ messages in thread
From: hutchinsonandy @ 2008-05-22 17:36 UTC (permalink / raw)
To: ddaney; +Cc: gcc
I already have nonlocal_goto, and nonlocal_goto_receiver.
These expect saved frame pointer to be virtual_stack_vars_rtx+1.
For setjmp the value is determined by
targetm.builtin_setjmp_frame_value - which I defined and is correct.
But for goto the value is created by some other code - which appears to
be wrong but I can't find!
-----Original Message-----
From: David Daney <ddaney@avtrex.com>
To: hutchinsonandy@aim.com
Cc: gcc@gcc.gnu.org
Sent: Thu, 22 May 2008 1:16 pm
Subject: Re: Where is setup for "goto" in nested function created?
hutchinsonandy@aim.com wrote:
> During the process of fixing setjmp for AVR target, I needed to
define > targetm.builtin_setjmp_frame_value () to be used in
> expand_builtin_setjmp_setup().
> > This sets the value of the Frame pointer stored in jump buffer.
> > I set this "value" to virtual_stack_vars_rtx+1 (==frame_pointer)
> Receiver defined in target latter restores frame pointer using >
virtual_stack_vars_rtx = value - 1
> > This produce correct code as expected and avoids run-time add/sub
of > offsets. (setjmp works!)
> > However, for a normal goto used inside a nested function, a
different > part of gcc creates the code to store frame pointer (not >
expand_builtin_setjmp_setup). I can't find this code.
> > The issue I have is that this "goto_setup" code does NOT use >
targetm.builtin_setjmp_frame_value - but seems to use >
value=virtual_stack_vars_rtx, which is incompatible with my target >
receiver.
> > So where is the goto setup code created? And is there a bug here?
>
Perhaps you need to implement one or more of: save_stack_nonlocal,
restore_stack_nonlocal, nonlocal_goto, and/or nonlocal_goto_receiver.
David Daney
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Where is setup for "goto" in nested function created?
2008-05-22 17:02 Where is setup for "goto" in nested function created? hutchinsonandy
2008-05-22 17:17 ` David Daney
@ 2008-05-22 18:27 ` Ian Lance Taylor
2008-05-22 20:40 ` hutchinsonandy
1 sibling, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2008-05-22 18:27 UTC (permalink / raw)
To: hutchinsonandy; +Cc: gcc
hutchinsonandy@aim.com writes:
> However, for a normal goto used inside a nested function, a
> different part of gcc creates the code to store frame pointer (not
> expand_builtin_setjmp_setup). I can't find this code.
I think you are looking for expand_builtin_nonlocal_goto in
builtins.c.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Where is setup for "goto" in nested function created?
2008-05-22 18:27 ` Ian Lance Taylor
@ 2008-05-22 20:40 ` hutchinsonandy
2008-05-22 22:40 ` Ian Lance Taylor
0 siblings, 1 reply; 7+ messages in thread
From: hutchinsonandy @ 2008-05-22 20:40 UTC (permalink / raw)
To: iant; +Cc: gcc
I think my last email crossed your reply - so apolgies for restating:
expand_builtin_nonlocal_goto is fine. This perform stack restore,
extracts frame pointer value and does jump.
reciever is fine - this jump destination does restore of frame pointer.
The problem I have is with frame pointer value that is saved in by
"setup" prior to all this
For goto is does not use expand_builtin_setjmp_setup - (pathetically) I
can't find what it is using.
Andy
-----Original Message-----
From: Ian Lance Taylor <iant@google.com>
To: hutchinsonandy@aim.com
Cc: gcc@gcc.gnu.org
Sent: Thu, 22 May 2008 2:26 pm
Subject: Re: Where is setup for "goto" in nested function created?
hutchinsonandy@aim.com writes:
> However, for a normal goto used inside a nested function, a
> different part of gcc creates the code to store frame pointer (not
> expand_builtin_setjmp_setup). I can't find this code.
I think you are looking for expand_builtin_nonlocal_goto in
builtins.c.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Where is setup for "goto" in nested function created?
2008-05-22 20:40 ` hutchinsonandy
@ 2008-05-22 22:40 ` Ian Lance Taylor
2008-05-22 23:09 ` Andy H
0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2008-05-22 22:40 UTC (permalink / raw)
To: hutchinsonandy; +Cc: gcc
hutchinsonandy@aim.com writes:
> expand_builtin_nonlocal_goto is fine. This perform stack restore,
> extracts frame pointer value and does jump.
>
> reciever is fine - this jump destination does restore of frame pointer.
>
> The problem I have is with frame pointer value that is saved in by
> "setup" prior to all this
>
> For goto is does not use expand_builtin_setjmp_setup - (pathetically)
> I can't find what it is using.
I'm not really sure just what you are after (and I'm not sure that I
would know the answer if I did). Most of the relevant code should be
somewhere in tree-nested.c. Also look at expand_function_start, and
in general any use of cfun->nonlocal_goto_save_area.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Where is setup for "goto" in nested function created?
2008-05-22 22:40 ` Ian Lance Taylor
@ 2008-05-22 23:09 ` Andy H
0 siblings, 0 replies; 7+ messages in thread
From: Andy H @ 2008-05-22 23:09 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc
Thanks Ian!
I found it in function.c (expand_function_start)
emit_move_insn (r_save, virtual_stack_vars_rtx);
Whereas it should be
emit_move_insn (r_save, targetm.builtin_setjmp_frame_value ());
to match same construction used for setjmp.
thanks for help!
Ian Lance Taylor wrote:
> hutchinsonandy@aim.com writes:
>
>
>> expand_builtin_nonlocal_goto is fine. This perform stack restore,
>> extracts frame pointer value and does jump.
>>
>> reciever is fine - this jump destination does restore of frame pointer.
>>
>> The problem I have is with frame pointer value that is saved in by
>> "setup" prior to all this
>>
>> For goto is does not use expand_builtin_setjmp_setup - (pathetically)
>> I can't find what it is using.
>>
>
> I'm not really sure just what you are after (and I'm not sure that I
> would know the answer if I did). Most of the relevant code should be
> somewhere in tree-nested.c. Also look at expand_function_start, and
> in general any use of cfun->nonlocal_goto_save_area.
>
> Ian
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-05-22 23:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22 17:02 Where is setup for "goto" in nested function created? hutchinsonandy
2008-05-22 17:17 ` David Daney
2008-05-22 17:36 ` hutchinsonandy
2008-05-22 18:27 ` Ian Lance Taylor
2008-05-22 20:40 ` hutchinsonandy
2008-05-22 22:40 ` Ian Lance Taylor
2008-05-22 23:09 ` Andy H
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).