I'm trying to modify llvm X86 backend to use rsp to locate/index local variables rather than rbp. The problem is that the offset between local variables and rsp is not fixed, so I have to calculate it by myself. It's easy to handle it if rsp's location was modified by these instructions as follows:
push
pop
sub rsp, $immediate
In these situations, I can know the offset at compile-time. But nowadays I get stuck in a problem. I find that rsp is not only modified by these instructions mentioned before. For example:
lstr = (char *)alloca(strlen(ss) + 1);
This instruction will modify rsp like this and I can't know the offset at compile-time.
sub rsp, $register
Is it possible or not to use llvm to generate execute file which using stack pointer to locate local variables?