[RS6000] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST
Anatoly Sokolov
aesok@post.ru
Wed Jul 7 22:08:00 GMT 2010
Hi.
This patch removes obsolete REGISTER_MOVE_COST and MEMORY_MOVE_COST macros
from the RS6000 back end in the GCC and introduces equivalent
TARGET_REGISTER_MOVE_COST and TARGET_MEMORY_MOVE_COST target hooks.
Regression tested on powerpc64-unknown-linux-gnu.
OK to install?
* reginfo.h (reg_classes_intersect_p): Change arguments type to
reg_class_t.
* rtl.h (reg_classes_intersect_p): Adjust prototype.
* config/rs6000/rs6000.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST):
Remove macros.
* config/rs6000/rs6000-protos.h (rs6000_register_move_cost,
rs6000_memory_move_cost): Remove
* config/rs6000/rs6000.c (TARGET_REGISTER_MOVE_COST,
TARGET_MEMORY_MOVE_COST): Define.
(rs6000_register_move_cost): Make static. Change arguments type from
enum reg_class to reg_class_t. Adjust rs6000_memory_move_cost calls.
(rs6000_memory_move_cost): Make static. Change arguments type from
'enum reg_class' to reg_class_t.
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h (revision 161854)
+++ gcc/rtl.h (working copy)
@@ -2314,7 +2314,7 @@
extern void mark_elimination (int, int);
/* In reginfo.c */
-extern int reg_classes_intersect_p (enum reg_class, enum reg_class);
+extern int reg_classes_intersect_p (reg_class_t, reg_class_t);
extern int reg_class_subset_p (enum reg_class, enum reg_class);
extern void globalize_reg (int);
extern void init_reg_modes_target (void);
Index: gcc/reginfo.c
===================================================================
--- gcc/reginfo.c (revision 161854)
+++ gcc/reginfo.c (working copy)
@@ -1243,7 +1243,7 @@
/* Return nonzero if there is a register that is in both C1 and C2. */
int
-reg_classes_intersect_p (enum reg_class c1, enum reg_class c2)
+reg_classes_intersect_p (reg_class_t c1, reg_class_t c2)
{
return (c1 == c2
|| c1 == ALL_REGS
Index: gcc/config/rs6000/rs6000-protos.h
===================================================================
--- gcc/config/rs6000/rs6000-protos.h (revision 161854)
+++ gcc/config/rs6000/rs6000-protos.h (working copy)
@@ -170,9 +170,6 @@
extern void rs6000_emit_epilogue (int);
extern void rs6000_emit_eh_reg_restore (rtx, rtx);
extern const char * output_isel (rtx *);
-extern int rs6000_register_move_cost (enum machine_mode,
- enum reg_class, enum reg_class);
-extern int rs6000_memory_move_cost (enum machine_mode, enum reg_class, int);
extern bool rs6000_tls_referenced_p (rtx);
extern void rs6000_conditional_register_usage (void);
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 161854)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -1030,6 +1030,9 @@
static void rs6000_xcoff_file_end (void);
#endif
static int rs6000_variable_issue (FILE *, int, rtx, int);
+static int rs6000_register_move_cost (enum machine_mode,
+ reg_class_t, reg_class_t);
+static int rs6000_memory_move_cost (enum machine_mode, reg_class_t, bool);
static bool rs6000_rtx_costs (rtx, int, int, int *, bool);
static bool rs6000_debug_rtx_costs (rtx, int, int, int *, bool);
static int rs6000_debug_address_cost (rtx, bool);
@@ -1507,6 +1510,10 @@
#undef TARGET_INVALID_WITHIN_DOLOOP
#define TARGET_INVALID_WITHIN_DOLOOP rs6000_invalid_within_doloop
+#undef TARGET_REGISTER_MOVE_COST
+#define TARGET_REGISTER_MOVE_COST rs6000_register_move_cost
+#undef TARGET_MEMORY_MOVE_COST
+#define TARGET_MEMORY_MOVE_COST rs6000_memory_move_cost
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS rs6000_rtx_costs
#undef TARGET_ADDRESS_COST
@@ -25572,9 +25579,9 @@
/* A C expression returning the cost of moving data from a register of class
CLASS1 to one of CLASS2. */
-int
+static int
rs6000_register_move_cost (enum machine_mode mode,
- enum reg_class from, enum reg_class to)
+ reg_class_t from, reg_class_t to)
{
int ret;
@@ -25586,8 +25593,8 @@
from = to;
if (from == FLOAT_REGS || from == ALTIVEC_REGS || from == VSX_REGS)
- ret = (rs6000_memory_move_cost (mode, from, 0)
- + rs6000_memory_move_cost (mode, GENERAL_REGS, 0));
+ ret = (rs6000_memory_move_cost (mode, from, false)
+ + rs6000_memory_move_cost (mode, GENERAL_REGS, false));
/* It's more expensive to move CR_REGS than CR0_REGS because of the
shift. */
@@ -25632,9 +25639,9 @@
/* A C expressions returning the cost of moving data of MODE from a register to
or from memory. */
-int
-rs6000_memory_move_cost (enum machine_mode mode, enum reg_class rclass,
- int in ATTRIBUTE_UNUSED)
+static int
+rs6000_memory_move_cost (enum machine_mode mode, reg_class_t rclass,
+ bool in ATTRIBUTE_UNUSED)
{
int ret;
Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h (revision 161854)
+++ gcc/config/rs6000/rs6000.h (working copy)
@@ -1172,16 +1172,6 @@
#define HARD_REGNO_RENAME_OK(SRC, DST) \
(! ALTIVEC_REGNO_P (DST) || df_regs_ever_live_p (DST))
-/* A C expression returning the cost of moving data from a register of class
- CLASS1 to one of CLASS2. */
-
-#define REGISTER_MOVE_COST rs6000_register_move_cost
-
-/* A C expressions returning the cost of moving data of MODE from a register to
- or from memory. */
-
-#define MEMORY_MOVE_COST rs6000_memory_move_cost
-
/* Specify the cost of a branch insn; roughly the number of extra insns that
should be added to avoid a branch.
Anatoly.
More information about the Gcc-patches
mailing list