Commit 74aa8b4b by Andreas Krebbel Committed by Andreas Krebbel

s390-protos.h (s390_hard_regno_mode_ok, [...]): New function prototypes.

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.

From-SVN: r112418
parent 8370d5bc
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.
2006-03-26 Geoffrey Keating <geoffk@apple.com>
* dwarf2out.c (add_location_or_const_value_attribute): Call
......
......@@ -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 *);
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment