Calling convention that gets frame pointer register clobbered

Jim Wilson wilson@specifixinc.com
Tue Dec 16 02:28:00 GMT 2003


Latchesar Ionkov wrote:
> I am trying to port gcc (the i386 target) to an operating system. The
> calling convention is an extreme caller-saves one. It does not guarantee
> that any register (except the stack pointer) will be preserved.

If the stack pointer is the only preserved register, then the only place 
you can put the frame pointer is to push it on the stack before the 
call, and pop it off the stack after the call.

That is such a badly designed ABI that there doesn't seem to be much 
point in adding generic support for it.

You can handle this manually by modifying your call patterns to emit 
multiple assembler insns, or alternatively, make your call patterns into 
expanders that emit multiple RTL insns.  You can then emit the push/pop 
along with the call.  You will also probably have to handle some other 
registers the same way, the static chain pointer for instance.  The pic 
base register if you want pic support.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list