[LLVMdev] Determining the base offset of the stack for a function.
echeng at apple.com
Wed Apr 1 13:10:00 PDT 2009
On Mar 30, 2009, at 12:01 PM, Villmow, Micah wrote:
> I am running into an issue where if I have multiple functions
> compiled in the same compilation unit the stack offset is not
> starting at zero. For example:
> Say the first function uses 64 bytes of the stack and an assumed
> offset of 0 and the second function uses 32 bytes of the stack but
> an assumed offset of 64. I’ve found out how to get the size of the
> stack via MachineFrameInfo.StackSize/getObjectSize, however I have
> not found out how to determine the starting offset of the stack for
> that specific function. I need this information so that I can offset
> my stack pointer correctly since all my indices into my stack need
> to start at 0 for each independent function call.
> So, what this means is that if I call func1 or func2 I need to make
> sure all offsets into the stack start at zero.
Micah, stack offset is always relative to the stack pointer which is
unchanged in the function unless you have dynamic stack allocation. So
from the compiler's point of view, the starting offset for a function
is always zero.
> Thanks for any tips/hints,
> Micah Villmow
> Systems Engineer
> Advanced Technology & Performance
> Advanced Micro Devices Inc.
> S1-609 One AMD Place
> Sunnyvale, CA. 94085
> P: 408-749-3966
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev