rtl.h (PUT_MODE_RAW): New macro.

gcc/
	* rtl.h (PUT_MODE_RAW): New macro.
	(PUT_REG_NOTE_KIND): Use it.
	(set_mode_and_regno): Declare.
	(gen_raw_REG): Change regno to "unsigned int".
	(gen_rtx_REG): Change "unsigned" to "unsigned int".
	(PUT_MODE): Forward to PUT_MODE_RAW for generators, otherwise
	use set_mode_and_regno to change the mode of registers.
	* gengenrtl.c (gendef): Use PUT_MODE_RAW.
	* emit-rtl.c (set_mode_and_regno): New function.
	(gen_raw_REG): Change regno to unsigned int.  Use set_mode_and_regno.
	* caller-save.c (reg_save_code): Use set_mode_and_regno.
	* expr.c (init_expr_target): Likewise.
	* ira.c (setup_prohibited_mode_move_regs): Likewise.
	* postreload.c (reload_cse_simplify_operands): Likewise.

From-SVN: r223341
This commit is contained in:
Richard Sandiford 2015-05-19 07:10:30 +00:00 committed by Richard Sandiford
parent 5d2446b1ed
commit 8deccbb7c8
8 changed files with 53 additions and 19 deletions

View File

@ -1,3 +1,20 @@
2015-05-19 Richard Sandiford <richard.sandiford@arm.com>
* rtl.h (PUT_MODE_RAW): New macro.
(PUT_REG_NOTE_KIND): Use it.
(set_mode_and_regno): Declare.
(gen_raw_REG): Change regno to "unsigned int".
(gen_rtx_REG): Change "unsigned" to "unsigned int".
(PUT_MODE): Forward to PUT_MODE_RAW for generators, otherwise
use set_mode_and_regno to change the mode of registers.
* gengenrtl.c (gendef): Use PUT_MODE_RAW.
* emit-rtl.c (set_mode_and_regno): New function.
(gen_raw_REG): Change regno to unsigned int. Use set_mode_and_regno.
* caller-save.c (reg_save_code): Use set_mode_and_regno.
* expr.c (init_expr_target): Likewise.
* ira.c (setup_prohibited_mode_move_regs): Likewise.
* postreload.c (reload_cse_simplify_operands): Likewise.
2015-05-19 Richard Sandiford <richard.sandiford@arm.com>
* caller-save.c (init_caller_save): Use word_mode and

View File

@ -150,8 +150,7 @@ reg_save_code (int reg, machine_mode mode)
/* Update the register number and modes of the register
and memory operand. */
SET_REGNO_RAW (test_reg, reg);
PUT_MODE (test_reg, mode);
set_mode_and_regno (test_reg, mode, reg);
PUT_MODE (test_mem, mode);
/* Force re-recognition of the modified insns. */

View File

@ -430,16 +430,24 @@ gen_blockage (void)
#endif
/* Set the mode and register number of X to MODE and REGNO. */
void
set_mode_and_regno (rtx x, machine_mode mode, unsigned int regno)
{
PUT_MODE_RAW (x, mode);
SET_REGNO_RAW (x, regno);
}
/* Generate a new REG rtx. Make sure ORIGINAL_REGNO is set properly, and
don't attempt to share with the various global pieces of rtl (such as
frame_pointer_rtx). */
rtx
gen_raw_REG (machine_mode mode, int regno)
gen_raw_REG (machine_mode mode, unsigned int regno)
{
rtx x = rtx_alloc_stat (REG PASS_MEM_STAT);
PUT_MODE (x, mode);
SET_REGNO_RAW (x, regno);
set_mode_and_regno (x, mode, regno);
REG_ATTRS (x) = NULL;
ORIGINAL_REGNO (x) = regno;
return x;

View File

@ -221,7 +221,6 @@ init_expr_target (void)
direct_load[(int) mode] = direct_store[(int) mode] = 0;
PUT_MODE (mem, mode);
PUT_MODE (mem1, mode);
PUT_MODE (reg, mode);
/* See if there is some register that can be used in this mode and
directly loaded or stored from memory. */
@ -234,7 +233,7 @@ init_expr_target (void)
if (! HARD_REGNO_MODE_OK (regno, mode))
continue;
SET_REGNO (reg, regno);
set_mode_and_regno (reg, mode, regno);
SET_SRC (pat) = mem;
SET_DEST (pat) = reg;

View File

@ -252,7 +252,7 @@ gendef (const char *format)
puts (" rtx rt;");
puts (" rt = rtx_alloc_stat (code PASS_MEM_STAT);\n");
puts (" PUT_MODE (rt, mode);");
puts (" PUT_MODE_RAW (rt, mode);");
for (p = format, i = j = 0; *p ; ++p, ++i)
if (*p != '0')

View File

@ -1778,10 +1778,8 @@ setup_prohibited_mode_move_regs (void)
{
if (! HARD_REGNO_MODE_OK (j, (machine_mode) i))
continue;
SET_REGNO_RAW (test_reg1, j);
PUT_MODE (test_reg1, (machine_mode) i);
SET_REGNO_RAW (test_reg2, j);
PUT_MODE (test_reg2, (machine_mode) i);
set_mode_and_regno (test_reg1, (machine_mode) i, j);
set_mode_and_regno (test_reg2, (machine_mode) i, j);
INSN_CODE (move_insn) = -1;
recog_memoized (move_insn);
if (INSN_CODE (move_insn) < 0)

View File

@ -562,8 +562,7 @@ reload_cse_simplify_operands (rtx_insn *insn, rtx testreg)
if (! TEST_HARD_REG_BIT (equiv_regs[i], regno))
continue;
SET_REGNO_RAW (testreg, regno);
PUT_MODE (testreg, mode);
set_mode_and_regno (testreg, mode, regno);
/* We found a register equal to this operand. Now look for all
alternatives that can accept this register and have not been

View File

@ -668,8 +668,8 @@ class GTY(()) rtx_note : public rtx_insn
#define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
#define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
#define GET_MODE(RTX) ((machine_mode) (RTX)->mode)
#define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
#define GET_MODE(RTX) ((machine_mode) (RTX)->mode)
#define PUT_MODE_RAW(RTX, MODE) ((RTX)->mode = (MODE))
/* RTL vector. These appear inside RTX's when there is a need
for a variable number of things. The principle use is inside
@ -1509,7 +1509,7 @@ enum reg_note
/* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
#define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
#define PUT_REG_NOTE_KIND(LINK, KIND) \
PUT_MODE (LINK, (machine_mode) (KIND))
PUT_MODE_RAW (LINK, (machine_mode) (KIND))
/* Names for REG_NOTE's in EXPR_LIST insn's. */
@ -3216,13 +3216,27 @@ gen_rtx_INSN (machine_mode mode, rtx_insn *prev_insn, rtx_insn *next_insn,
rtx reg_notes);
extern rtx gen_rtx_CONST_INT (machine_mode, HOST_WIDE_INT);
extern rtx gen_rtx_CONST_VECTOR (machine_mode, rtvec);
extern rtx gen_raw_REG (machine_mode, int);
extern rtx gen_rtx_REG (machine_mode, unsigned);
extern void set_mode_and_regno (rtx, machine_mode, unsigned int);
extern rtx gen_raw_REG (machine_mode, unsigned int);
extern rtx gen_rtx_REG (machine_mode, unsigned int);
extern rtx gen_rtx_SUBREG (machine_mode, rtx, int);
extern rtx gen_rtx_MEM (machine_mode, rtx);
extern rtx gen_rtx_VAR_LOCATION (machine_mode, tree, rtx,
enum var_init_status);
#ifdef GENERATOR_FILE
#define PUT_MODE(RTX, MODE) PUT_MODE_RAW (RTX, MODE)
#else
static inline void
PUT_MODE (rtx x, machine_mode mode)
{
if (REG_P (x))
set_mode_and_regno (x, mode, REGNO (x));
else
PUT_MODE_RAW (x, mode);
}
#endif
#define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N))
/* Virtual registers are used during RTL generation to refer to locations into