[LLVMdev] Stack layout in the x86 back-end

Torvald Riegel torvald at se.inf.tu-dresden.de
Wed Oct 10 10:20:28 PDT 2007


Hi,

what about the llvm.frameaddress, llvm.stacksave, and llvm.stackrestore 
intrinsics? According to the documentation, they give you the current stack 
frame, including the current top of the frame.
I currently use these to do a simple stack-rollback in our STM, and they seem 
to work okay (I haven't looked at the stack contents in example programs to 
validate this, though). Is this a valid approach for stack rollback (paired 
with a setjmp?

Torvald

On Tuesday 09 October 2007 22:53, Chris Lattner wrote:
> On Tue, 9 Oct 2007, Sarah Thompson wrote:
> > ideally, I'd like a block that encompasses everything from the  function
> > parameters up to the current top-of-stack including spilled registers.
> > Is this feasible?
>
> Hi Sarah,
>
> I'm not sure how much of this is possible.  You're guaranteed that each
> function stack frame is itself contiguous (including spilled regs), but
> there isn't really a notion of "top of stack" in the compiler.  To get
> this information, you'll need information from the runtime or OS.
>
> -Chris



More information about the llvm-dev mailing list