This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
mips register elimination bug ($rap to $fp or $s1)
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 16 Mar 2002 21:01:05 -0300
- Subject: mips register elimination bug ($rap to $fp or $s1)
- Organization: GCC Team, Red Hat
GCC would sometimes eliminate $rap with an offset of $fp even though
$fp is not the frame pointer in mips16. Presumably, it might also do
it the other way round: replacing $rap with an offset of $s1 in
non-mips16 mode, but I doubt this can possibly bite for real. The
former problem did bite in gcc.c-torture/execute/eeprof-1.c, though,
so here's a fix. Tested similarly. Approved by Eric Christopher.
I'm checking this in.
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* config/mips/mips.h (CAN_ELIMINATE): Don't eliminate rap to $fp
(s8), but rather HARD_FRAME_POINTER_REGNUM. Add parentheses
where appropriate. Make the second reference to
leaf_function_p a function call, as intended. Reindented.
Index: gcc/config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mips/mips.h,v
retrieving revision 1.167
diff -u -p -r1.167 mips.h
--- gcc/config/mips/mips.h 2002/03/16 23:58:35 1.167
+++ gcc/config/mips/mips.h 2002/03/17 00:00:25
@@ -2509,14 +2509,17 @@ extern struct mips_frame_info current_fr
*/
#define CAN_ELIMINATE(FROM, TO) \
- (((FROM) == RETURN_ADDRESS_POINTER_REGNUM && (! leaf_function_p () \
- || (TO == GP_REG_FIRST + 31 && leaf_function_p))) \
- || ((FROM) != RETURN_ADDRESS_POINTER_REGNUM \
- && ((TO) == HARD_FRAME_POINTER_REGNUM \
- || ((TO) == STACK_POINTER_REGNUM && ! frame_pointer_needed \
- && ! (TARGET_MIPS16 && TARGET_64BIT) \
- && (! TARGET_MIPS16 \
- || compute_frame_size (get_frame_size ()) < 32768)))))
+ (((FROM) == RETURN_ADDRESS_POINTER_REGNUM \
+ && ((! leaf_function_p () \
+ && ((TO) == STACK_POINTER_REGNUM \
+ || (TO) == HARD_FRAME_POINTER_REGNUM)) \
+ || ((TO) == GP_REG_FIRST + 31 && leaf_function_p ()))) \
+ || ((FROM) != RETURN_ADDRESS_POINTER_REGNUM \
+ && ((TO) == HARD_FRAME_POINTER_REGNUM \
+ || ((TO) == STACK_POINTER_REGNUM && ! frame_pointer_needed \
+ && ! (TARGET_MIPS16 && TARGET_64BIT) \
+ && (! TARGET_MIPS16 \
+ || compute_frame_size (get_frame_size ()) < 32768)))))
/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
specifies the initial difference between the specified pair of
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer