Commit 9188b286 by Richard Sandiford Committed by Richard Sandiford

rtl.h (reg_info): Add an nregs field.

gcc/
	* rtl.h (reg_info): Add an nregs field.
	(REG_NREGS): Use it.
	(SET_REGNO_RAW): Delete.
	(set_regno_raw): New function.
	* regs.h (END_HARD_REGNO): Make equivalent to END_REGNO.
	(END_REGNO): Redefine in terms of REG_NREGS.
	* read-rtl.c (read_rtx_code): Call set_regno_raw instead of
	SET_REGNO_RAW.
	* emit-rtl.c (set_mode_and_regno): Likewise.
	* df-scan.c (df_ref_change_reg_with_loc): Use set_mode_and_regno
	instead of SET_REGNO_RAW.

From-SVN: r223342
parent 8deccbb7
2015-05-19 Richard Sandiford <richard.sandiford@arm.com> 2015-05-19 Richard Sandiford <richard.sandiford@arm.com>
* rtl.h (reg_info): Add an nregs field.
(REG_NREGS): Use it.
(SET_REGNO_RAW): Delete.
(set_regno_raw): New function.
* regs.h (END_HARD_REGNO): Make equivalent to END_REGNO.
(END_REGNO): Redefine in terms of REG_NREGS.
* read-rtl.c (read_rtx_code): Call set_regno_raw instead of
SET_REGNO_RAW.
* emit-rtl.c (set_mode_and_regno): Likewise.
* df-scan.c (df_ref_change_reg_with_loc): Use set_mode_and_regno
instead of SET_REGNO_RAW.
2015-05-19 Richard Sandiford <richard.sandiford@arm.com>
* rtl.h (PUT_MODE_RAW): New macro. * rtl.h (PUT_MODE_RAW): New macro.
(PUT_REG_NOTE_KIND): Use it. (PUT_REG_NOTE_KIND): Use it.
(set_mode_and_regno): Declare. (set_mode_and_regno): Declare.
......
...@@ -1930,7 +1930,7 @@ df_ref_change_reg_with_loc (rtx loc, unsigned int new_regno) ...@@ -1930,7 +1930,7 @@ df_ref_change_reg_with_loc (rtx loc, unsigned int new_regno)
DF_REG_EQ_USE_GET (new_regno), DF_REG_EQ_USE_GET (new_regno),
new_regno, loc); new_regno, loc);
} }
SET_REGNO_RAW (loc, new_regno); set_mode_and_regno (loc, GET_MODE (loc), new_regno);
} }
......
...@@ -435,8 +435,11 @@ gen_blockage (void) ...@@ -435,8 +435,11 @@ gen_blockage (void)
void void
set_mode_and_regno (rtx x, machine_mode mode, unsigned int regno) set_mode_and_regno (rtx x, machine_mode mode, unsigned int regno)
{ {
unsigned int nregs = (HARD_REGISTER_NUM_P (regno)
? hard_regno_nregs[regno][mode]
: 1);
PUT_MODE_RAW (x, mode); PUT_MODE_RAW (x, mode);
SET_REGNO_RAW (x, regno); set_regno_raw (x, regno, nregs);
} }
/* Generate a new REG rtx. Make sure ORIGINAL_REGNO is set properly, and /* Generate a new REG rtx. Make sure ORIGINAL_REGNO is set properly, and
......
...@@ -1349,7 +1349,7 @@ read_rtx_code (const char *code_name) ...@@ -1349,7 +1349,7 @@ read_rtx_code (const char *code_name)
case 'r': case 'r':
read_name (&name); read_name (&name);
validate_const_int (name.string); validate_const_int (name.string);
SET_REGNO_RAW (return_rtx, atoi (name.string)); set_regno_raw (return_rtx, atoi (name.string), 1);
REG_ATTRS (return_rtx) = NULL; REG_ATTRS (return_rtx) = NULL;
break; break;
......
...@@ -288,11 +288,11 @@ end_hard_regno (machine_mode mode, unsigned int regno) ...@@ -288,11 +288,11 @@ end_hard_regno (machine_mode mode, unsigned int regno)
/* Likewise for hard register X. */ /* Likewise for hard register X. */
#define END_HARD_REGNO(X) end_hard_regno (GET_MODE (X), REGNO (X)) #define END_HARD_REGNO(X) END_REGNO (X)
/* Likewise for hard or pseudo register X. */ /* Likewise for hard or pseudo register X. */
#define END_REGNO(X) (HARD_REGISTER_P (X) ? END_HARD_REGNO (X) : REGNO (X) + 1) #define END_REGNO(X) (REGNO (X) + REG_NREGS (X))
/* Add to REGS all the registers required to store a value of mode MODE /* Add to REGS all the registers required to store a value of mode MODE
in register REGNO. */ in register REGNO. */
......
...@@ -210,7 +210,9 @@ struct GTY(()) reg_info { ...@@ -210,7 +210,9 @@ struct GTY(()) reg_info {
/* The value of REGNO. */ /* The value of REGNO. */
unsigned int regno; unsigned int regno;
unsigned int unused : 32; /* The value of REG_NREGS. */
unsigned int nregs : 8;
unsigned int unused : 24;
/* The value of REG_ATTRS. */ /* The value of REG_ATTRS. */
reg_attrs *attrs; reg_attrs *attrs;
...@@ -1712,15 +1714,11 @@ inline rtx_insn *JUMP_LABEL_AS_INSN (const rtx_insn *insn) ...@@ -1712,15 +1714,11 @@ inline rtx_insn *JUMP_LABEL_AS_INSN (const rtx_insn *insn)
be used on RHS. Use SET_REGNO to change the value. */ be used on RHS. Use SET_REGNO to change the value. */
#define REGNO(RTX) (rhs_regno(RTX)) #define REGNO(RTX) (rhs_regno(RTX))
#define SET_REGNO(RTX, N) (df_ref_change_reg_with_loc (RTX, N)) #define SET_REGNO(RTX, N) (df_ref_change_reg_with_loc (RTX, N))
#define SET_REGNO_RAW(RTX, N) (REG_CHECK (RTX)->regno = N)
/* Return the number of consecutive registers in a REG. This is always /* Return the number of consecutive registers in a REG. This is always
1 for pseudo registers and is determined by HARD_REGNO_NREGS for 1 for pseudo registers and is determined by HARD_REGNO_NREGS for
hard registers. */ hard registers. */
#define REG_NREGS(RTX) \ #define REG_NREGS(RTX) (REG_CHECK (RTX)->nregs)
(REGNO (RTX) < FIRST_PSEUDO_REGISTER \
? (unsigned int) hard_regno_nregs[REGNO (RTX)][GET_MODE (RTX)] \
: 1)
/* ORIGINAL_REGNO holds the number the register originally had; for a /* ORIGINAL_REGNO holds the number the register originally had; for a
pseudo register turned into a hard reg this will hold the old pseudo pseudo register turned into a hard reg this will hold the old pseudo
...@@ -1735,6 +1733,15 @@ rhs_regno (const_rtx x) ...@@ -1735,6 +1733,15 @@ rhs_regno (const_rtx x)
return REG_CHECK (x)->regno; return REG_CHECK (x)->regno;
} }
/* Change the REGNO and REG_NREGS of REG X to the specified values,
bypassing the df machinery. */
static inline void
set_regno_raw (rtx x, unsigned int regno, unsigned int nregs)
{
reg_info *reg = REG_CHECK (x);
reg->regno = regno;
reg->nregs = nregs;
}
/* 1 if RTX is a reg or parallel that is the current function's return /* 1 if RTX is a reg or parallel that is the current function's return
value. */ value. */
......
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