From c87ec0bae2def5ed65950b8fcb54e7225146a7ea Mon Sep 17 00:00:00 2001 From: Nitin Yewale Date: Fri, 5 Sep 2003 20:00:03 +0000 Subject: [PATCH] h8300-protos.h: Declare h8300_hard_regno_rename_ok * config/h8300/h8300-protos.h: Declare h8300_hard_regno_rename_ok * config/h8300/h8300.h (HARD_REGNO_RENAME_OK): New. * config/h8300/h8300.c (h8300_hard_regno_rename_ok): New. From-SVN: r71119 --- gcc/ChangeLog | 6 ++++++ gcc/config/h8300/h8300-protos.h | 1 + gcc/config/h8300/h8300.c | 17 +++++++++++++++++ gcc/config/h8300/h8300.h | 6 ++++++ 4 files changed, 30 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c0b2e2bdfd9..f830816a7cb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-09-05 Nitin Yewale + + * config/h8300/h8300-protos.h: Declare h8300_hard_regno_rename_ok + * config/h8300/h8300.h (HARD_REGNO_RENAME_OK): New. + * config/h8300/h8300.c (h8300_hard_regno_rename_ok): New. + 2003-09-05 Roger Sayle Richard Henderson diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index d99f0dca0b9..e36ae4b719c 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -98,6 +98,7 @@ extern void h8300_expand_prologue (void); extern void h8300_expand_epilogue (void); extern int h8300_current_function_interrupt_function_p (void); extern int h8300_initial_elimination_offset (int, int); +extern int h8300_hard_regno_rename_ok (unsigned int, unsigned int); struct cpp_reader; extern void h8300_pr_interrupt (struct cpp_reader *); diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 5ab2bfac04d..3d874c2c085 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -4489,6 +4489,23 @@ same_cmp_preceding_p (rtx i3) return (INSN_P (i1) && rtx_equal_p (PATTERN (i1), PATTERN (i3)) && any_condjump_p (i2) && onlyjump_p (i2)); } + +/* Return nonzero if register OLD_REG can be renamed to register NEW_REG. */ + +int +h8300_hard_regno_rename_ok (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 (h8300_current_function_interrupt_function_p () + && !regs_ever_live[new_reg]) + return 0; + + return 1; +} /* Initialize the GCC target structure. */ #undef TARGET_ATTRIBUTE_TABLE diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 8e5e96e0e2a..c4103d0464f 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -350,6 +350,12 @@ extern int target_flags; && ((MODE2) == QImode || (MODE2) == HImode \ || ((TARGET_H8300H || TARGET_H8300S) && (MODE2) == SImode)))) +/* 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) \ + h8300_hard_regno_rename_ok (OLD_REG, NEW_REG) + /* Specify the registers used for certain standard purposes. The values of these macros are register numbers. */