On Fri, 06 Jan 2012 07:22:55 +0100, Walter Bright
<[email protected]> wrote:
On 1/5/2012 7:42 PM, Manu wrote:
Perhaps I misunderstand, I can't see the problem?
In the function preamble, you just align it... something like:
mov reg, esp ; take a backup of the stack pointer
and esp, -16 ; align it
... function
mov esp, reg ; restore the stack pointer
ret 0
And now you cannot access the function's parameters anymore, because the
stack offset for them is now variable rather than fixed.
Aah, I knew there was something that wouldn't work.
One could possibly change from RBP relative addressing
to RSP relative addressing for the inner variables.
But that would fail with alloca.
So this won't work without a second frame register, does it?
@manu: Instead of using the RegionAllocator you could
write an aligning allocator using alloca memory. This
will be about the closest you get to that magic compiler
alignment.