[Bug rtl-optimization/32475] [4.3 Regression] function with asm() does not setup stack frame

spark at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 2 06:57:00 GMT 2007



------- Comment #20 from spark at gcc dot gnu dot org  2007-07-02 06:56 -------
We already put stack pointer in the exit block use set always.
However, after epilogue is generated, we see the sp restoration code:


    1 NOTE_INSN_DELETED
    4 NOTE_INSN_BASIC_BLOCK
   22 [--sp:SI]=bp:SI
   23 bp:SI=sp:SI
   24 {sp:SI=sp:SI-0x10;clobber flags:CC;clobber [scratch];}
   25 NOTE_INSN_PROLOGUE_END
    3 NOTE_INSN_FUNCTION_BEG
   19 ax:SI=[bp:SI+0x8]
      REG_EQUIV: [bp:SI+0x8]
    6 [bp:SI-0x4]=ax:SI
   21 dx:SI=bp:SI-0x4
   18 ax:SI=0x5a
      REG_EQUIV: 0x5a
    9 {ax:SI=asm_operands;clobber fpsr:QI;clobber flags:QI;clobber [scratch];}
   26 NOTE_INSN_EPILOGUE_BEG
   27 {sp:SI=bp:SI+0x4;bp:SI=[bp:SI];clobber [scratch];}
   28 return
i  29: barrier
   20 NOTE_INSN_DELETED

Insn 27, which restores the sp for the caller, naturally writes to %sp,
and this makes %sp dead at insn 24.
I think the only correct solution is somehow to mark sp as used by insn 27,
or some similar effect. So, although this is a scanning problem, 
we may want to consider adding a use of %sp inside 27 or just before insn 27,
*if* sp is indeed necessary. It is not possible for df to figure this out
alone, as its epilogue generation code that determines whether we want sp or
not.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32475



More information about the Gcc-bugs mailing list