This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [split] Add CFI ops, fix call/return prediction, other changes
- From: Richard Henderson <rth at redhat dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Ross Ridge <rridge at csclub dot uwaterloo dot ca>
- Date: Wed, 30 Sep 2009 07:38:52 -0700
- Subject: Re: [split] Add CFI ops, fix call/return prediction, other changes
- References: <mcrab0dhqs3.fsf@dhcp-172-17-9-151.mtv.corp.google.com>
+ # Note that %esp is exactly 32 bytes below the CFA -- perfect for
+ # a 16-byte aligned stack. That said, we still ought to compile
+ # generic-morestack.c with -mpreferred-stack-boundary=2. FIXME.
Without the ecx push this isn't true. Not that it really matters; if
the cfa were properly aligned on entry to our caller, we pushed 12 bytes
to get to __morestack, which means our cfa is not aligned.
+ movl -4(%ebp),%eax # Restore registers.
+ movl -8(%ebp),%edx
+ movl 4(%ebp),%ecx # Increment the return address
+ inc %ecx # to skip the ret instruction;
+ # see above.
call *%ecx # Call our caller!
How about using some of that extra space we've got in the frame:
movl -12(%ebp), %ecx # Restore 2 registers
movl -8(%ebp), %edx
movl 4(%ebp), %eax # Increment return address
inc %eax
movl %eax, -8(%ebp) # Store it in an unused slot
movl -4(%ebp), %eax # Restore 3rd register
call *-8(%ebp) # Call our caller via slot
r~