This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[S390] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST
- From: Anatoly Sokolov <aesok at post dot ru>
- To: gcc-patches at gcc dot gnu dot org
- Cc: hpenner at de dot ibm dot com, uweigand at de dot ibm dot com, Andreas dot Krebbel at de dot ibm dot com
- Date: Wed, 19 Jan 2011 20:32:10 +0300
- Subject: [S390] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST
Hi.
This patch removes obsolete REGISTER_MOVE_COST and MEMORY_MOVE_COST
macros from the S390 back end in the GCC and introduces equivalent
TARGET_REGISTER_MOVE_COST and TARGET_MEMORY_MOVE_COST target hooks.
Not tested.
OK to install?
* config/s390/s390.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
* config/s390/s390.c (s390_register_move_cost,
s390_memory_move_cost): Make static.
(TARGET_REGISTER_MOVE_COST, TARGET_MEMORY_MOVE_COST): Define.
Index: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c (revision 169002)
+++ gcc/config/s390/s390.c (working copy)
@@ -2426,7 +2426,32 @@
&& value == CONST0_RTX (GET_MODE (value)));
}
+/* Implement TARGET_REGISTER_MOVE_COST. */
+static int
+s390_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+ reg_class_t from, reg_class_t to)
+{
+/* On s390, copy between fprs and gprs is expensive. */
+ if ((reg_classes_intersect_p (from, GENERAL_REGS)
+ && reg_classes_intersect_p (to, FP_REGS))
+ || (reg_classes_intersect_p (from, FP_REGS)
+ && reg_classes_intersect_p (to, GENERAL_REGS)))
+ return 10;
+
+ return 1;
+}
+
+/* Implement TARGET_MEMORY_MOVE_COST. */
+
+static int
+s390_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+ reg_class_t rclass ATTRIBUTE_UNUSED,
+ bool in ATTRIBUTE_UNUSED)
+{
+ return 1;
+}
+
/* Compute a (partial) cost for rtx X. Return true if the complete
cost has been computed, and false if subexpressions should be
scanned. In either case, *TOTAL contains the cost result.
@@ -10640,6 +10665,10 @@
#define TARGET_RTX_COSTS s390_rtx_costs
#undef TARGET_ADDRESS_COST
#define TARGET_ADDRESS_COST s390_address_cost
+#undef TARGET_REGISTER_MOVE_COST
+#define TARGET_REGISTER_MOVE_COST s390_register_move_cost
+#undef TARGET_MEMORY_MOVE_COST
+#define TARGET_MEMORY_MOVE_COST s390_memory_move_cost
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG s390_reorg
Index: gcc/config/s390/s390.h
===================================================================
--- gcc/config/s390/s390.h (revision 169002)
+++ gcc/config/s390/s390.h (working copy)
@@ -780,18 +780,6 @@
/* Relative costs of operations. */
-/* On s390, copy between fprs and gprs is expensive. */
-#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
- (( ( reg_classes_intersect_p ((CLASS1), GENERAL_REGS) \
- && reg_classes_intersect_p ((CLASS2), FP_REGS)) \
- || ( reg_classes_intersect_p ((CLASS1), FP_REGS) \
- && reg_classes_intersect_p ((CLASS2), GENERAL_REGS))) ? 10 : 1)
-
-/* A C expression for the cost of moving data of mode M between a
- register and memory. A value of 2 is the default; this cost is
- relative to those in `REGISTER_MOVE_COST'. */
-#define MEMORY_MOVE_COST(M, C, I) 1
-
/* A C expression for the cost of a branch instruction. A value of 1
is the default; other values are interpreted relative to that. */
#define BRANCH_COST(speed_p, predictable_p) 1
Anatoly.