I’m trying to implement something similar to this: http://gcc.gnu.org/wiki/SplitStacks in LLVM.
What I’m hoping to do is to be able to inject the following code (in x86 asm, callee clean-up calling convention):
for each function call:
lea %foo_return, %eax
mov %eax, [%esp - calleestackframesize]
push arg1
push arg2
push …
jmp foo
foo_return:
…
The problem I have is how to force the LLVM to generates the previous code. How could I modify the calling sequence?
Any suggestions are appreciated.
Thanks!
Shucai