[PATCH, DWARF] re-init dw_frame_pointer_regnum between functions

Richard Henderson rth@redhat.com
Tue Oct 14 18:30:00 GMT 2014


On 10/14/2014 11:25 AM, Richard Henderson wrote:
> On 10/14/2014 06:02 AM, Christian Bruel wrote:
>> 2014-09-23  Christian Bruel  <christian.bruel@st.com>
>>
>> 	* execute_dwarf2_frame (dw_frame_pointer_regnum): Reinitialize for each function.
> 
> It's tempting to make this a local variable within dwarf2out_frame_debug_expr
> and not try to cache it at all.
> 
> But this is ok.

For the record, this also points out that the arm backend ought to be weaned
away from using dwarf2out_frame_debug_expr and use the REG_CFA_* notes
exclusively.  That would also fix an apparent error in arm_expand_prologue:

      if (IS_INTERRUPT (func_type))
        {
          /* Interrupt functions must not corrupt any registers.
             Creating a frame pointer however, corrupts the IP
             register, so we must push it first.  */
          emit_multi_reg_push (1 << IP_REGNUM, 1 << IP_REGNUM);

          /* Do not set RTX_FRAME_RELATED_P on this insn.
             The dwarf stack unwinding code only wants to see one
             stack decrement per function, and this is not it.  If
             this instruction is labeled as being part of the frame
             creation sequence then dwarf2out_frame_debug_expr will
             die when it encounters the assignment of IP to FP
             later on, since the use of SP here establishes SP as
             the CFA register and not IP.

             Anyway this instruction is not really part of the stack
             frame creation although it is part of the prologue.  */

Certainly dwarf2cfi can handle arbitrary REG_CFA_ADJUST_CFA notes;
it's just the frame_debug_expr state machine that gets confused.


r~



More information about the Gcc-patches mailing list