m32r.h (HARD_REGNO_RENAME_OK): New.
authorKazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
Tue, 10 Jun 2003 16:30:47 +0000 (16:30 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 10 Jun 2003 16:30:47 +0000 (09:30 -0700)
        * config/m32r/m32r.h (HARD_REGNO_RENAME_OK): New.
        * config/m32r/m32r.c (m32r_hard_regno_rename_ok): New.
        * config/m32r/m32r-protos.h: Prototype it.

From-SVN: r67711

gcc/ChangeLog
gcc/config/m32r/m32r-protos.h
gcc/config/m32r/m32r.c
gcc/config/m32r/m32r.h

index 857027c..877299f 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-10  Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
+
+       * config/m32r/m32r.h (HARD_REGNO_RENAME_OK): New.
+       * config/m32r/m32r.c (m32r_hard_regno_rename_ok): New.
+       * config/m32r/m32r-protos.h: Prototype it.
+
 2003-06-10  Janis Johnson  <janis187@us.ibm.com>
 
        * config/rs6000/eabi.h (TARGET_OS_CPP_BUILTINS): Define builtins
index 3816dd5..ec549ba 100644 (file)
@@ -55,6 +55,8 @@ extern void   m32r_expand_block_move          PARAMS ((rtx *));
 extern void   m32r_print_operand               PARAMS ((FILE *, rtx, int));
 extern void   m32r_print_operand_address       PARAMS ((FILE *, rtx));
 extern int    m32r_not_same_reg                PARAMS ((rtx, rtx));
+extern int    m32r_hard_regno_rename_ok                PARAMS ((unsigned int,
+                                                        unsigned int));
 
 #ifdef HAVE_MACHINE_MODES
 extern int    call_address_operand             PARAMS ((rtx, Mmode));
index a4d3c12..4ea130f 100644 (file)
@@ -2944,3 +2944,23 @@ m32r_block_immediate_operand (op, mode)
 
   return 1;
 }
+
+/* Return true if using NEW_REG in place of OLD_REG is ok.  */
+
+int
+m32r_hard_regno_rename_ok (old_reg, new_reg)
+     unsigned int old_reg ATTRIBUTE_UNUSED;
+     unsigned int new_reg;
+{
+  /* Interrupt routines can't clobber any register that isn't already used.  */
+  if (lookup_attribute ("interrupt", DECL_ATTRIBUTES (current_function_decl))
+      && !regs_ever_live[new_reg])
+    return 0;
+
+  /* We currently emit epilogues as text, not rtl, so the liveness
+     of the return address register isn't visible.  */
+  if (current_function_is_leaf && new_reg == RETURN_ADDR_REGNUM)
+    return 0;
+
+  return 1;
+}
index ab7d5fc..7af28e5 100644 (file)
@@ -657,6 +657,9 @@ extern unsigned int m32r_mode_class[];
  && GET_MODE_CLASS (MODE2) == MODE_INT         \
  && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD    \
  && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
+
+#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
+  m32r_hard_regno_rename_ok (OLD_REG, NEW_REG)
 \f
 /* Register classes and constants.  */