[avr] gas support for cfi info
Anitha Boyapati
anitha.boyapati@gmail.com
Tue Feb 22 16:52:00 GMT 2011
2011/2/18 Richard Henderson <rth@redhat.com>
>
> On 02/17/2011 08:04 AM, Richard Henderson wrote:
> >> The other scenario is - how about functions with signals/interrupts?
> >> The compiler will give an ICE compiling a function as below:
> >>
> >> void my_interrupt_handler() __attribute__ (("interrupt"));
> >
> > It's a bug in the avr backend; the enable_interrupt insn should not be
> > marked as frame-related. We should fix this separately.
>
> Looking at this closer, it seem that the FRAME_RELATED markers in avr.c
> were sprinkled at random without really knowing what is going on.
This is quite a clean up! I am yet to reach the changes in expand_epilogue.
> There
> were 2 places where UNSPEC_VOLATILE insns were marked frame related,
> somehow expecting the unwinder to do something magical.
>
Just to be on same page, these are the 2 places:
1. gen_enable_interrupt()
2. gen_call_prologue_saves()
For the latter, can you explain why adding reg notes is required?
+ add_reg_note (insn, REG_CFA_ADJUST_CFA,
+ gen_rtx_SET (VOIDmode,
+ (frame_pointer_needed
+ ? frame_pointer_rtx : stack_pointer_rtx),
+ plus_constant (stack_pointer_rtx,
+ -(size + live_seq))));
+
(The comment does say that this is to describe the effect of
UNSPEC_VOLATILE, but how reg notes help?)
> The following cleans all that up. There are a couple of odd points:
>
> (1) SREG and RAMPZ cannot be annotated as saved in the frame of an
> interrupt function without allocating hard register numbers for
> these registers. Not to be confused with "real" registers,
> these need a number in the same way that SP_L and SP_H have
> register numbers.
>
> I've simply ignored unwind info for these for now.
>
In addition to the above, there are atleast 4 more registers RAMPX,
RAMPY, RAMPD and EIND. (Actually the support for these registers is in
the form of patches which aren't upstream yet)
> (2) At present it's possible to use epilogue_restores without
> having used prologue_saves. I.e. use epilogue_restores with
> an inline prologue. The problem being that the inline prologue
> uses an HImode push of REG_Y (i.e. r29 first), whereas the code
> in prologue_saves pushes r28 first and epilogue_restores is
> written to expect that.
>
Is this is the line being referred to ?
if (frame_pointer_needed)
{
...
/* Push frame pointer. */
insn = emit_move_insn (pushword, frame_pointer_rtx);
On the whole, when the patch is applied, an ICE is longer generated
during the compilation of interrupt and signal functions. I am yet to
see the changes due to ARG_POINTER_CFA_OFFSET(FNDECL) definition and
the complete unwind info incase of interrupts.
Anitha
More information about the Gcc-patches
mailing list