aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/caller-save.c3
-rw-r--r--gcc/emit-rtl.c14
-rw-r--r--gcc/expr.c3
-rw-r--r--gcc/gengenrtl.c2
-rw-r--r--gcc/ira.c6
-rw-r--r--gcc/postreload.c3
-rw-r--r--gcc/rtl.h24
8 files changed, 53 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f2ce42b..c18b736 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,22 @@
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
FIRST_PSEUDO_REGISTER when creating temporary rtxes.
* expr.c (init_expr_target): Likewise.
diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index fcc3648..2cb77e6 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -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. */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index ae67e7a..03bd76a 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -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;
diff --git a/gcc/expr.c b/gcc/expr.c
index 80e6350..e91383f 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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;
diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c
index 7df99e8..34f0de3 100644
--- a/gcc/gengenrtl.c
+++ b/gcc/gengenrtl.c
@@ -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')
diff --git a/gcc/ira.c b/gcc/ira.c
index 0c7c6ac..f409a81 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -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)
diff --git a/gcc/postreload.c b/gcc/postreload.c
index a0026db..525c661 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -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
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 88aab6d..955ce7d 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -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