|
Message
From: Matjaz Breskvar<phoenix@o...>
Date: Tue Jul 29 22:21:40 CEST 2008
Subject: [openrisc] Stack frame alignment on OpenRISC 1000
* Jeremy Bennett (jeremy.bennett@e...) wrote: > The Application Binary Interface (ABI) for the OR1000 specifies that all > stack frames are double word aligned (section 16.2.2): > > "The stack pointer always points to the end of the latest allocated > stack frame. All frames must be double word aligned. In code compiled > for 32-bit implementations, upper halves of all double words are zero." > > I've just been working on some code compiled with GCC 3.4.4, and notice > that the main function is compiled as: > > <main>: l.addi r1,r1,-20 > <main+4>: l.sw 4(r1),r2 > <main+8>: l.addi r2,r1,20 > <main+12>: l.sw 0(r1),r9 > > r1 is the stack pointer, r2 the frame pointer, so this is a stack frame > of size 20 bytes, which is word-aligned, but not double-word aligned. > > I can see no reason why the stack needs to be anything more than single > word aligned. Using double word just wastes stack space. > > Can anyone shed more light on this issue. For now I'll assume the > documentation is in error (it affects the port of GDB 6.8).
No, the documentation is correct.
Having double word aligned stack essentialy wastes no space (would you dare to be so tight with allocated space that it would matter ?), but it enables more efficient code.
r, p.
|
 |