summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhananjay R. Deshpande <dhananjayd@kpit.com>2002-06-14 11:06:38 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2002-06-14 12:06:38 +0100
commit03b8ec294f34655d06758e7f65c2c57604632e38 (patch)
tree8c275a1c4955e42e791a15ea109f2cdcb2159a13
parent8e831557e4de285a788d4c80ce0d2139c2a3125e (diff)
downloadgcc-03b8ec294f34655d06758e7f65c2c57604632e38.tar.gz
sh.h: Define HARD_REGNO_RENAME_OK
Fri Jun 14 12:04:02 2002 Dhananjay R. Deshpande <dhananjayd@kpit.com> * sh.h: Define HARD_REGNO_RENAME_OK * sh.c: sh_hard_regno_rename_ok: New. If current function has interrupt_handler attribute, only registers saved on stack are OK. * sh-protos.h: Declare sh_hard_regno_rename_ok. From-SVN: r54612
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/sh/sh-protos.h1
-rw-r--r--gcc/config/sh/sh.c20
-rw-r--r--gcc/config/sh/sh.h6
4 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6176f689856..d5d900f801e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+Fri Jun 14 12:04:02 2002 Dhananjay R. Deshpande <dhananjayd@kpit.com>
+
+ * sh.h: Define HARD_REGNO_RENAME_OK
+ * sh.c: sh_hard_regno_rename_ok: New. If current function has
+ interrupt_handler attribute, only registers saved on stack are OK.
+ * sh-protos.h: Declare sh_hard_regno_rename_ok.
+
2002-06-14 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.md (jump): Emit jump insn.
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index 6abdfe6258d..3503f57948a 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -122,6 +122,7 @@ extern int sh_need_epilogue PARAMS ((void));
extern int initial_elimination_offset PARAMS ((int, int));
extern int fldi_ok PARAMS ((void));
extern int sh_pr_n_sets PARAMS ((void));
+extern int sh_hard_regno_rename_ok PARAMS ((unsigned int, unsigned int));
#ifdef HARD_CONST
extern void fpscr_set_from_mem PARAMS ((int, HARD_REG_SET));
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index a9c2e8250a4..22851372405 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -6701,6 +6701,26 @@ sh_can_redirect_branch (branch1, branch2)
return 0;
}
+/* Return non-zero if register old_reg can be renamed to register new_reg. */
+int
+sh_hard_regno_rename_ok (old_reg, new_reg)
+ unsigned int old_reg ATTRIBUTE_UNUSED;
+ unsigned int new_reg;
+{
+
+/* Interrupt functions can only use registers that have already been
+ saved by the prologue, even if they would normally be
+ call-clobbered. */
+
+ if ((lookup_attribute ("interrupt_handler",
+ DECL_ATTRIBUTES (current_function_decl))
+ != NULL_TREE)
+ && !regs_ever_live[new_reg])
+ return 0;
+
+ return 1;
+}
+
/* A C statement (sans semicolon) to update the integer variable COST
based on the relationship between INSN that is dependent on
DEP_INSN through the dependence LINK. The default is to make no
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index fef996a8f12..6891fd0758b 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -942,6 +942,12 @@ extern char sh_additional_register_names[ADDREGNAMES_SIZE] \
&& (GET_MODE_SIZE (MODE2) <= 4)) \
: ((MODE1) != SFmode && (MODE2) != SFmode))))
+/* A C expression that is nonzero if hard register NEW_REG can be
+ considered for use as a rename register for OLD_REG register */
+
+#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
+ sh_hard_regno_rename_ok (OLD_REG, NEW_REG)
+
/* Specify the registers used for certain standard purposes.
The values of these macros are register numbers. */