This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Incorrectly using call-clobbered registers
- From: Carlos Sánchez de La Lama <csanchez at teisa dot unican dot es>
- To: gcc at gcc dot gnu dot org
- Date: 06 Mar 2003 13:47:48 +0100
- Subject: Incorrectly using call-clobbered registers
Hi everyone!
I'm working with a port of gcc for the OpenRISC architecture, but I've a
question that I think is better to post here than in OpenRISC forum.
In that architecture, register r11 is used to hold return value from
functions, but I've found that in certain cases the compiler uses it as
a general register and, before a function call, saves its value on the
stack, restoring it *just* after function call, and therefore losing the
returned value. The next instructions try to get the value out of r11,
but it's not longer there, and as it was a pointer it all end in a
Alignment Error.
I've been able to fix it by defining macro CALLED_SAVE_PROFITABLE to be
always 0, so no fuction-clobbered register is ever use as a general
register, but I feel this is not the right way to do it.
So, anyone who knows better how all this stuff works, please tell me
what to do. Should I put r11 in FIXED_REGISTERS macro, so it's never
used? Please help me.
Bye!
Carlos Sánchez de La Lama <csanchez at teisa dot unican dot es>