aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-09-10 18:56:21 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-09-10 18:56:21 +0000
commit031e8857886b91da290ffb03d9027424566e5da3 (patch)
tree38e3ad9468d0607ef4c594d9fc2c8e0252773763 /gcc
parent0f8b14ee8ae787d7fba104dbdeb31e0400f6b7d2 (diff)
downloadgcc-031e8857886b91da290ffb03d9027424566e5da3.zip
gcc-031e8857886b91da290ffb03d9027424566e5da3.tar.gz
gcc-031e8857886b91da290ffb03d9027424566e5da3.tar.bz2
Move c6x REGNO_REG_CLASS out of line
I have a series of patches that hides call_used_regs from target- independent code, a knock-on effect of which is that (public) target macros can't use call_used_regs either. This patch fixes the only case in which that was a problem. 2019-09-10 Richard Sandiford <richard.sandiford@arm.com> gcc/ * config/c6x/c6x-protos.h (c6x_set_return_address): Declare. * config/c6x/c6x.h (REGNO_REG_CLASS): Move implementation to * config/c6x/c6x.c (c6x_regno_reg_class): ...this new function. From-SVN: r275597
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/c6x/c6x-protos.h2
-rw-r--r--gcc/config/c6x/c6x.c22
-rw-r--r--gcc/config/c6x/c6x.h7
4 files changed, 31 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0ec847c..56f99f0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2019-09-10 Richard Sandiford <richard.sandiford@arm.com>
+ * config/c6x/c6x-protos.h (c6x_set_return_address): Declare.
+ * config/c6x/c6x.h (REGNO_REG_CLASS): Move implementation to
+ * config/c6x/c6x.c (c6x_regno_reg_class): ...this new function.
+
+2019-09-10 Richard Sandiford <richard.sandiford@arm.com>
+
* rtl.h (get_call_rtx_from): Take a const rtx_insn * instead of an rtx.
* rtlanal.c (get_call_rtx_from): Likewise.
* dwarf2out.c (dwarf2out_var_location): Pass the insn rather
diff --git a/gcc/config/c6x/c6x-protos.h b/gcc/config/c6x/c6x-protos.h
index 8c04c31..b2043cb 100644
--- a/gcc/config/c6x/c6x-protos.h
+++ b/gcc/config/c6x/c6x-protos.h
@@ -53,6 +53,8 @@ extern void c6x_expand_epilogue (bool);
extern rtx c6x_return_addr_rtx (int);
extern void c6x_set_return_address (rtx, rtx);
+
+enum reg_class c6x_regno_reg_class (int);
#endif
extern void c6x_override_options (void);
diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c
index f6a4518..852373b 100644
--- a/gcc/config/c6x/c6x.c
+++ b/gcc/config/c6x/c6x.c
@@ -6677,6 +6677,28 @@ c6x_modes_tieable_p (machine_mode mode1, machine_mode mode2)
&& GET_MODE_SIZE (mode2) <= UNITS_PER_WORD));
}
+/* Implement REGNO_REG_CLASS. */
+
+enum reg_class
+c6x_regno_reg_class (int reg)
+{
+ if (reg >= REG_A1 && reg <= REG_A2)
+ return PREDICATE_A_REGS;
+
+ if (reg == REG_A0 && TARGET_INSNS_64)
+ return PREDICATE_A_REGS;
+
+ if (reg >= REG_B0 && reg <= REG_B2)
+ return PREDICATE_B_REGS;
+
+ if (A_REGNO_P (reg))
+ return NONPREDICATE_A_REGS;
+
+ if (call_used_regs[reg])
+ return CALL_USED_B_REGS;
+
+ return B_REGS;
+}
/* Target Structure. */
diff --git a/gcc/config/c6x/c6x.h b/gcc/config/c6x/c6x.h
index c605b73..e93a544 100644
--- a/gcc/config/c6x/c6x.h
+++ b/gcc/config/c6x/c6x.h
@@ -259,12 +259,7 @@ enum reg_class
#define CROSS_OPERANDS(X0,X1) \
(A_REG_P (X0) == A_REG_P (X1) ? CROSS_N : CROSS_Y)
-#define REGNO_REG_CLASS(reg) \
- ((reg) >= REG_A1 && (reg) <= REG_A2 ? PREDICATE_A_REGS \
- : (reg) == REG_A0 && TARGET_INSNS_64 ? PREDICATE_A_REGS \
- : (reg) >= REG_B0 && (reg) <= REG_B2 ? PREDICATE_B_REGS \
- : A_REGNO_P (reg) ? NONPREDICATE_A_REGS \
- : call_used_regs[reg] ? CALL_USED_B_REGS : B_REGS)
+#define REGNO_REG_CLASS(reg) c6x_regno_reg_class (reg)
#define BASE_REG_CLASS ALL_REGS
#define INDEX_REG_CLASS ALL_REGS