aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mn10200
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/mn10200')
-rw-r--r--gcc/config/mn10200/mn10200.c60
-rw-r--r--gcc/config/mn10200/mn10200.h45
2 files changed, 60 insertions, 45 deletions
diff --git a/gcc/config/mn10200/mn10200.c b/gcc/config/mn10200/mn10200.c
index 39a378d..4116c01 100644
--- a/gcc/config/mn10200/mn10200.c
+++ b/gcc/config/mn10200/mn10200.c
@@ -65,6 +65,7 @@ rtx zero_dreg;
rtx zero_areg;
static void count_tst_insns PARAMS ((int *));
+static bool mn10200_rtx_costs PARAMS ((rtx, int, int, int *));
/* Note whether or not we need an out of line epilogue. */
static int out_of_line_epilogue;
@@ -73,6 +74,9 @@ static int out_of_line_epilogue;
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
+#undef TARGET_RTX_COSTS
+#define TARGET_RTX_COSTS mn10200_rtx_costs
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Indicate this file was compiled by gcc and what optimization
@@ -1600,3 +1604,59 @@ extendpsi_operand (op, mode)
&& XEXP (op, 0) == stack_pointer_rtx
&& general_operand (XEXP (op, 1), VOIDmode)));
}
+
+static bool
+mn10200_rtx_costs (x, code, outer_code, total)
+ rtx x;
+ int code, outer_code ATTRIBUTE_UNUSED;
+ int *total;
+{
+ switch (code)
+ {
+ case CONST_INT:
+ /* Zeros are extremely cheap. */
+ if (INTVAL (x) == 0)
+ *total = 0;
+ /* If it fits in 8 bits, then it's still relatively cheap. */
+ else if (INT_8_BITS (INTVAL (x)))
+ *total = 1;
+ /* This is the "base" cost, includes constants where either the
+ upper or lower 16bits are all zeros. */
+ else if (INT_16_BITS (INTVAL (x))
+ || (INTVAL (x) & 0xffff) == 0
+ || (INTVAL (x) & 0xffff0000) == 0)
+ *total = 2;
+ else
+ *total = 4;
+ return true;
+
+ case CONST:
+ case LABEL_REF:
+ case SYMBOL_REF:
+ /* These are more costly than a CONST_INT, but we can relax them,
+ so they're less costly than a CONST_DOUBLE. */
+ *total = 6;
+ return true;
+
+ case CONST_DOUBLE:
+ /* We don't optimize CONST_DOUBLEs well nor do we relax them well,
+ so their cost is very high. */
+ *total = 8;
+ return true;
+
+ /* ??? This probably needs more work. The definitions below were first
+ taken from the H8 port, then tweaked slightly to improve code density
+ on various sample codes. */
+ case MOD:
+ case DIV:
+ *total = 8;
+ return true;
+
+ case MULT:
+ *total = (GET_MODE (x) == SImode ? 20 : 8);
+ return true;
+
+ default:
+ return false;
+ }
+}
diff --git a/gcc/config/mn10200/mn10200.h b/gcc/config/mn10200/mn10200.h
index 112b90d..58099cb 100644
--- a/gcc/config/mn10200/mn10200.h
+++ b/gcc/config/mn10200/mn10200.h
@@ -730,55 +730,10 @@ struct cum_arg { int nbytes; };
addresses generally makes code worse due to register pressure. */
#define NO_FUNCTION_CSE
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- /* Zeros are extremely cheap. */ \
- if (INTVAL (RTX) == 0) \
- return 0; \
- /* If it fits in 8 bits, then it's still relatively cheap. */ \
- if (INT_8_BITS (INTVAL (RTX))) \
- return 1; \
- /* This is the "base" cost, includes constants where either the \
- upper or lower 16bits are all zeros. */ \
- if (INT_16_BITS (INTVAL (RTX)) \
- || (INTVAL (RTX) & 0xffff) == 0 \
- || (INTVAL (RTX) & 0xffff0000) == 0) \
- return 2; \
- return 4; \
- /* These are more costly than a CONST_INT, but we can relax them, \
- so they're less costly than a CONST_DOUBLE. */ \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 6; \
- /* We don't optimize CONST_DOUBLEs well nor do we relax them well, \
- so their cost is very high. */ \
- case CONST_DOUBLE: \
- return 8;
-
/* Make moves between different classes more expensive than moves
within the same class. */
#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) (CLASS1 != CLASS2 ? 4 : 2)
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE.
-
- ?!? This probably needs more work. The definitions below were first
- taken from the H8 port, then tweaked slightly to improve code density
- on various sample codes. */
-
-#define RTX_COSTS(RTX,CODE,OUTER_CODE) \
- case MOD: \
- case DIV: \
- return 8; \
- case MULT: \
- return (GET_MODE (RTX) == SImode ? 20 : 8);
-
/* Nonzero if access to memory by bytes or half words is no faster
than accessing full words. */
#define SLOW_BYTE_ACCESS 1