[LLVMdev] Controlling the stack layout
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sat Dec 27 14:28:30 PST 2008
Hi everyone,
As a front-end developer, I'd like to add a language-specific
information at a fixed location of each stack frame. The reason is that
I want to retrieve this information when dynamically walking the stack.
For example, X86 has the following stack layout for a function with two
arguments and two locals:
12(%ebp) - second function parameter
8(%ebp) - first function parameter
4(%ebp) - old %EIP (the function's "return address")
0(%ebp) - old %EBP (previous function's base pointer)
-4(%ebp) - first local variable
-8(%ebp) - second local variable
I'd like to generate this layout:
12(%ebp) - second function parameter
8(%ebp) - first function parameter
4(%ebp) - old %EIP (the function's "return address")
0(%ebp) - old %EBP (previous function's base pointer)
-4(%ebp) - My language specific information
-8(%ebp) - first local variable
-12(%ebp) - second local variable
Can I express this in LLVM without modifying llvm internals? I looked at
writing a machine function pass, but I can't register one when JITting.
Is the machine function pass the correct way of implementing this?
Thanks,
Nicolas
More information about the llvm-dev
mailing list