[LLVMdev] should PEI::calculateFrameObjectOffsets align the stack?

Chris Lattner sabre at nondot.org
Sun Oct 8 13:07:38 PDT 2006

On Sat, 7 Oct 2006, [UTF-8] Rafael Esp?ndola wrote:
>> That is irrelevant.  The PEI code needs to know how much stack space is
>> required for each call to allocate and align the stack frame properly.  It
>> gets this info from the ADJCALLSTACK instructions.
> I see. Looking at PEI::calculateCalleeSavedRegisters shows that the
> ADJCALLSTACK instructions is used to set up MaxCallFrameSize. Adding
> debug prints also show that in the example code the ADJCALLSTACK
> argument is 4. I believe that this is the correct argument for only a
> 32bit integer is passed on the stack.
> The problem is that MaxCallFrameSize is **not** used in
> PEI::calculateFrameObjectOffsets and it must then be used in the
> target specific code. The only architecture that doesn't adds
> MaxCallFrameSize to the value returned by getStackSize is Sparc. This
> is so because the Sparc backend generates add/sub pairs around call
> sites.

Yep, that sounds right.

>> Further, you *do* need to have a frame pointer if the function contains
>> any dynamic allocas.  In that case, the SP isn't fixed within a function.
>> You may not care about this right now, but it is required to support C99
>> VLA's and the 'alloca' C function.
> Sure. Currently I am implementing the next missing feature that causes
> a gcc bootstrap to fail. It shouldn't be long before I hit a VLA :-)




More information about the llvm-dev mailing list