diff options
author | krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-27 13:15:46 +0000 |
---|---|---|
committer | krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-27 13:15:46 +0000 |
commit | 8f1128bbcbd7b9f3d0185b92dd4f4cc3c700be9a (patch) | |
tree | e49ac34d5165f889dc922d691bfa895e8c3abd37 /gcc/config | |
parent | 10e4cee13c63b81803f8a0497559f184c98f08f8 (diff) | |
download | gcc-8f1128bbcbd7b9f3d0185b92dd4f4cc3c700be9a.tar.gz |
2006-03-27 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/s390-protos.h (s390_hard_regno_mode_ok,
s390_class_max_nregs): New function prototypes.
* config/s390/s390.c (REGNO_PAIR_OK): New macro.
(s390_hard_regno_mode_ok, s390_class_max_nregs): New functions.
* config/s390/s390.h (HARD_REGNO_NREGS, HARD_REGNO_MODE_OK,
CLASS_MAX_NREGS): Macro bodies replaced by function calls.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112418 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/s390/s390-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/s390/s390.c | 72 | ||||
-rw-r--r-- | gcc/config/s390/s390.h | 45 |
3 files changed, 83 insertions, 36 deletions
diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h index 460fac6d086..4e432640a57 100644 --- a/gcc/config/s390/s390-protos.h +++ b/gcc/config/s390/s390-protos.h @@ -30,7 +30,9 @@ extern void s390_emit_epilogue (bool); extern void s390_function_profiler (FILE *, int); extern void s390_conditional_register_usage (void); extern void s390_set_has_landing_pad_p (bool); +extern bool s390_hard_regno_mode_ok (unsigned int, enum machine_mode); extern bool s390_hard_regno_rename_ok (unsigned int, unsigned int); +extern bool s390_class_max_nregs (enum reg_class, enum machine_mode); #ifdef RTX_CODE extern int s390_extra_constraint_str (rtx, int, const char *); diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 0d03fa603d7..1ee6fba6add 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -331,6 +331,9 @@ struct machine_function GTY(()) #define CONST_OK_FOR_On(x) \ CONST_OK_FOR_CONSTRAINT_P((x), 'O', "On") +#define REGNO_PAIR_OK(REGNO, MODE) \ + (HARD_REGNO_NREGS ((REGNO), (MODE)) == 1 || !((REGNO) & 1)) + /* Set the has_landing_pad_p flag in struct machine_function to VALUE. */ void @@ -6753,6 +6756,54 @@ s390_update_frame_layout (void) regs_ever_live[REGNO (cfun->machine->base_reg)] = 1; } +/* Return true if it is legal to put a value with MODE into REGNO. */ + +bool +s390_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode) +{ + switch (REGNO_REG_CLASS (regno)) + { + case FP_REGS: + if (REGNO_PAIR_OK (regno, mode)) + { + if (mode == SImode || mode == DImode) + return true; + + if (FLOAT_MODE_P (mode) && GET_MODE_CLASS (mode) != MODE_VECTOR_FLOAT) + return true; + } + break; + case ADDR_REGS: + if (FRAME_REGNO_P (regno) && mode == Pmode) + return true; + + /* fallthrough */ + case GENERAL_REGS: + if (REGNO_PAIR_OK (regno, mode)) + { + if (TARGET_64BIT + || (mode != TFmode && mode != TCmode)) + return true; + } + break; + case CC_REGS: + if (GET_MODE_CLASS (mode) == MODE_CC) + return true; + break; + case ACCESS_REGS: + if (REGNO_PAIR_OK (regno, mode)) + { + if (mode == SImode || mode == Pmode) + return true; + } + break; + default: + return false; + } + + return false; +} + /* Return nonzero if register OLD_REG can be renamed to register NEW_REG. */ bool @@ -6768,6 +6819,27 @@ s390_hard_regno_rename_ok (unsigned int old_reg, unsigned int new_reg) return true; } +/* Maximum number of registers to represent a value of mode MODE + in a register of class CLASS. */ + +bool +s390_class_max_nregs (enum reg_class class, enum machine_mode mode) +{ + switch (class) + { + case FP_REGS: + if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT) + return 2 * ((GET_MODE_SIZE (mode) / 2 + 8 - 1) / 8); + else + return (GET_MODE_SIZE (mode) + 8 - 1) / 8; + case ACCESS_REGS: + return (GET_MODE_SIZE (mode) + 4 - 1) / 4; + default: + break; + } + return (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD; +} + /* Return true if register FROM can be eliminated via register TO. */ bool diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 5feb9d5b7cf..2f9b7d0f527 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -355,36 +355,15 @@ if (INTEGRAL_MODE_P (MODE) && \ Condition code modes fit only into the CC register. */ +/* Because all registers in a class have the same size HARD_REGNO_NREGS + is equivalent to CLASS_MAX_NREGS. */ #define HARD_REGNO_NREGS(REGNO, MODE) \ - (FP_REGNO_P(REGNO)? \ - (GET_MODE_CLASS(MODE) == MODE_COMPLEX_FLOAT ? \ - 2 * ((GET_MODE_SIZE(MODE) / 2 + 8 - 1) / 8) : \ - ((GET_MODE_SIZE(MODE) + 8 - 1) / 8)) : \ - GENERAL_REGNO_P(REGNO)? \ - ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1) / UNITS_PER_WORD) : \ - ACCESS_REGNO_P(REGNO)? \ - ((GET_MODE_SIZE(MODE) + 4 - 1) / 4) : \ - 1) - -#define HARD_REGNO_MODE_OK(REGNO, MODE) \ - (FP_REGNO_P(REGNO)? \ - (((MODE) == SImode || (MODE) == DImode \ - || GET_MODE_CLASS(MODE) == MODE_FLOAT \ - || GET_MODE_CLASS(MODE) == MODE_COMPLEX_FLOAT) \ - && (HARD_REGNO_NREGS(REGNO, MODE) == 1 || !((REGNO) & 1))) : \ - GENERAL_REGNO_P(REGNO)? \ - ((HARD_REGNO_NREGS(REGNO, MODE) == 1 || !((REGNO) & 1)) \ - && (((MODE) != TFmode && (MODE) != TCmode) || TARGET_64BIT)) : \ - CC_REGNO_P(REGNO)? \ - GET_MODE_CLASS (MODE) == MODE_CC : \ - FRAME_REGNO_P(REGNO)? \ - (enum machine_mode) (MODE) == Pmode : \ - ACCESS_REGNO_P(REGNO)? \ - (((MODE) == SImode || ((enum machine_mode) (MODE) == Pmode)) \ - && (HARD_REGNO_NREGS(REGNO, MODE) == 1 || !((REGNO) & 1))) : \ - 0) - -#define HARD_REGNO_RENAME_OK(FROM, TO) \ + s390_class_max_nregs (REGNO_REG_CLASS (REGNO), (MODE)) + +#define HARD_REGNO_MODE_OK(REGNO, MODE) \ + s390_hard_regno_mode_ok ((REGNO), (MODE)) + +#define HARD_REGNO_RENAME_OK(FROM, TO) \ s390_hard_regno_rename_ok (FROM, TO) #define MODES_TIEABLE_P(MODE1, MODE2) \ @@ -394,13 +373,7 @@ if (INTEGRAL_MODE_P (MODE) && \ /* Maximum number of registers to represent a value of mode MODE in a register of class CLASS. */ #define CLASS_MAX_NREGS(CLASS, MODE) \ - ((CLASS) == FP_REGS ? \ - (GET_MODE_CLASS(MODE) == MODE_COMPLEX_FLOAT ? \ - 2 * (GET_MODE_SIZE (MODE) / 2 + 8 - 1) / 8 : \ - (GET_MODE_SIZE (MODE) + 8 - 1) / 8) : \ - (CLASS) == ACCESS_REGS ? \ - (GET_MODE_SIZE (MODE) + 4 - 1) / 4 : \ - (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) + s390_class_max_nregs ((CLASS), (MODE)) /* If a 4-byte value is loaded into a FPR, it is placed into the *upper* half of the register, not the lower. Therefore, we |