+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
/* 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. */
#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;
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. */
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;
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')
{
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)
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
#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
/* 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. */
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