From: amylaar Date: Fri, 14 Jun 2002 11:06:38 +0000 (+0000) Subject: Fri Jun 14 12:04:02 2002 Dhananjay R. Deshpande X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c67138a9174c331b2a3328431fb01b520080910f;p=thirdparty%2Fgcc.git Fri Jun 14 12:04:02 2002 Dhananjay R. Deshpande * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54612 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6176f6898562..d5d900f801e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Fri Jun 14 12:04:02 2002 Dhananjay R. Deshpande + + * 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 * 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 6abdfe6258d9..3503f57948a6 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 a9c2e8250a4c..22851372405a 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 fef996a8f125..6891fd0758b0 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. */