[LLVMdev] [cfe-dev] Odd PPC inline asm constraint

Jakob Stoklund Olesen stoklund at 2pi.dk
Sat May 12 08:54:49 PDT 2012


On May 12, 2012, at 6:44 AM, Peter Bergner <bergner at vnet.ibm.com> wrote:

> On Sat, 2012-05-12 at 00:47 -0500, Hal Finkel wrote:
>> On Tue, 01 May 2012 21:25:29 -0500
>> Peter Bergner <bergner at vnet.ibm.com> wrote:
>>> By the strict letter of the 32-bit ABI, the save and restore of
>>> r31 at a negative offset of r1 is verboten.  The ABI states the
>>> the stack space below the stack pointer is declared as volatile.
>>> I actually debugged a similar problem way back in my Blue Gene/L
>>> days, where gcc had a bug and was doing the same thing.  We ended
>>> up taking a signal between the restore of the stack pointer and
>>> the restore of the nonvolatile reg and the BGL compute node kernel
>>> trashed the stack below the stack pointer.
>> 
>> Just to confirm, this is an issue specific to the 32-bit ABI, correct?
>> gcc (4.4.6) seems to do the same thing for PPC64.
> 
> Correct, this is a specific 32-bit ABI issue.  The 64-bit ABI allows
> some access below the stack pointer.  From the 64-bit ABI:
> 
>    The 288 bytes below the stack pointer is available as volatile
>    storage which is not preserved across function calls. Interrupt
>    handlers and any other functions that might run without an explicit
>    call must take care to preserve this region. If a function does not
>    need more stack space than is available in this area, it does not
>    need to have a stack frame.

The Darwin ppc32 ABI also has a 224 byte red zone, see https://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/LowLevelABI/100-32-bit_PowerPC_Function_Calling_Conventions/32bitPowerPC.html

I don't know if LLVM knows about other 32-bit ABIs.

/jakob



More information about the llvm-dev mailing list