Stack layout in the x86 back-end

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Stack layout in the x86 back-end

Sarah Thompson-2
Hi all,

I've been quiet for a while, but work on the new model checker has been
going pretty well of late. I do have a question for the team, however.

I've implemented code that manages multiple stacks, with an ability to
version them and roll back and forward between versions so I can
implement backtracking and nontrivial search strategies -- this all
works. However, I'm currently dumbly checking the entire stack (not just
the currently relevant stack frame(s)) for changes, but I'd rather just
be able to check a minimal area. Whenever I context switch, the code
under test calls a function in my run-time-system (mcp_yield(), not that
the details matter much). What I'd like to be able to do is pick up the
address range of the stack frame of the function that called it --
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?

Thank you in advance,
Sarah

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Stack layout in the x86 back-end

Chris Lattner
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

--
http://nondot.org/sabre/
http://llvm.org/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Stack layout in the x86 back-end

Torvald Riegel-3
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
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev