public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43513]  New: The stack pointer is adjusted twice
@ 2010-03-25  9:19 carrot at google dot com
  2010-03-25  9:20 ` [Bug target/43513] " carrot at google dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: carrot at google dot com @ 2010-03-25  9:19 UTC (permalink / raw)
  To: gcc-bugs

Compile the attached code with options -march=armv7-a -mthumb -Os -fpic, gcc
generates:

foo3:
        push    {r4, r5, r6, r7, lr}
        sub     sp, sp, #12      // A
        ldr     r3, .L4
        add     r7, sp, #0       // B
        sub     sp, sp, #48      // C
        mov     r0, sp
         ...

Instruction A is used to allocate space for spilled variables. Instruction B
setups a frame pointer. Instruction C allocate space for local variables.
Instruction A and C can be merged into one, so ABC can be rewritten as:

        sub     sp, sp, 60
        add     r7, sp, r8

Instruction C is emitted at the expand phase. But instructions AB is emitted
from function arm_expand_prologue in pro_and_epilogue pass. So one possible
solution is stop emitting code to allocate space for local variables. Instead
record the local variables' space size and allocate the space with spill space
together in pro_and_epilogue pass.


-- 
           Summary: The stack pointer is adjusted twice
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carrot at google dot com
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: arm-eabi


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-26  9:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-25  9:19 [Bug target/43513] New: The stack pointer is adjusted twice carrot at google dot com
2010-03-25  9:20 ` [Bug target/43513] " carrot at google dot com
2010-03-25  9:53 ` steven at gcc dot gnu dot org
2010-03-26  6:42 ` carrot at google dot com
2010-03-26  9:05 ` [Bug middle-end/43513] " rearnsha at gcc dot gnu dot org

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).