[LLVMdev] Stack implementation
piotrek.kaleta at gmail.com
Mon Jul 25 09:15:39 PDT 2011
I'm translating the source of stack-based virtual machine into LLVM IR and
my plan is to implement the stack in LLVM IR (using alloca/load/store) in
order to emulate the VM's stack and then use the optimization phase
"mem2reg". Therefore I'm going to have a stack pointer that points to the
top of my stack. I'm curious whether I will have to implement that in a
linked-list fashion, i.e. each stack node would contain the pointer to the
previous node as well as the current value of the top of the stack or maybe
alloca instruction works in a way that the subsequent calls to it allocates
the contiguous memory area and I could get rid of the "pointer to previous
thing" and only count the number of calls to alloca instruction.
Another thing is that there might be a better (less expensive or easier) way
of doing the whole stack -> SSA transformation which I didn't came up with,
but someone else did?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev