diff options
Diffstat (limited to 'gcc/config/v850')
-rw-r--r-- | gcc/config/v850/v850-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/v850/v850.c | 56 | ||||
-rw-r--r-- | gcc/config/v850/v850.h | 58 |
3 files changed, 55 insertions, 60 deletions
diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h index d618aea..296b672 100644 --- a/gcc/config/v850/v850-protos.h +++ b/gcc/config/v850/v850-protos.h @@ -46,7 +46,6 @@ extern int v850_output_addr_const_extra PARAMS ((FILE *, rtx)); extern rtx v850_return_addr PARAMS ((int)); extern void print_operand PARAMS ((FILE *, rtx, int )); extern void print_operand_address PARAMS ((FILE *, rtx)); -extern int const_costs PARAMS ((rtx, enum rtx_code)); extern const char *output_move_double PARAMS ((rtx *)); extern const char *output_move_single PARAMS ((rtx *)); extern void v850_reorg PARAMS ((rtx)); diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index dcbb644..f16114e 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -51,6 +51,8 @@ /* Function prototypes for stupid compilers: */ static void const_double_split PARAMS ((rtx, HOST_WIDE_INT *, HOST_WIDE_INT *)); static int const_costs_int PARAMS ((HOST_WIDE_INT, int)); +static int const_costs PARAMS ((rtx, enum rtx_code)); +static bool v850_rtx_costs PARAMS ((rtx, int, int, int *)); static void substitute_ep_register PARAMS ((rtx, rtx, int, int, rtx *, rtx *)); static int ep_memory_offset PARAMS ((enum machine_mode, int)); static void v850_set_data_area PARAMS ((tree, v850_data_area)); @@ -105,6 +107,9 @@ static int v850_interrupt_p = FALSE; #undef TARGET_STRIP_NAME_ENCODING #define TARGET_STRIP_NAME_ENCODING v850_strip_name_encoding +#undef TARGET_RTX_COSTS +#define TARGET_RTX_COSTS v850_rtx_costs + struct gcc_target targetm = TARGET_INITIALIZER; /* Sometimes certain combinations of command options do not make @@ -322,7 +327,7 @@ const_costs_int (value, zero_cost) return 4; } -int +static int const_costs (r, c) rtx r; enum rtx_code c; @@ -354,6 +359,55 @@ const_costs (r, c) } } +static bool +v850_rtx_costs (x, code, outer_code, total) + rtx x; + int code, outer_code ATTRIBUTE_UNUSED, *total; +{ + switch (code) + { + case CONST_INT: + case CONST_DOUBLE: + case CONST: + case SYMBOL_REF: + case LABEL_REF: + *total = COSTS_N_INSNS (const_costs (x, code)); + return true; + + case MOD: + case DIV: + case UMOD: + case UDIV: + if (TARGET_V850E && optimize_size) + *total = 6; + else + *total = 60; + return true; + + case MULT: + if (TARGET_V850E + && ( GET_MODE (x) == SImode + || GET_MODE (x) == HImode + || GET_MODE (x) == QImode)) + { + if (GET_CODE (XEXP (x, 1)) == REG) + *total = 4; + else if (GET_CODE (XEXP (x, 1)) == CONST_INT) + { + if (CONST_OK_FOR_O (INTVAL (XEXP (x, 1)))) + *total = 6; + else if (CONST_OK_FOR_K (INTVAL (XEXP (x, 1)))) + *total = 10; + } + } + else + *total = 20; + return true; + + default: + return false; + } +} /* Print operand X using operand code CODE to assembly language output file FILE. */ diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 29c9921..447e247 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -1025,64 +1025,6 @@ do { \ #define CC_NO_CARRY CC_NO_OVERFLOW #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN) -/* A part of a C `switch' statement that describes the relative costs - of constant RTL expressions. It must contain `case' labels for - expression codes `const_int', `const', `symbol_ref', `label_ref' - and `const_double'. Each case must ultimately reach a `return' - statement to return the relative cost of the use of that kind of - constant value in an expression. The cost may depend on the - precise value of the constant, which is available for examination - in X, and the rtx code of the expression in which it is contained, - found in OUTER_CODE. - - CODE is the expression code--redundant, since it can be obtained - with `GET_CODE (X)'. */ - -#define CONST_COSTS(RTX,CODE,OUTER_CODE) \ - case CONST_INT: \ - case CONST_DOUBLE: \ - case CONST: \ - case SYMBOL_REF: \ - case LABEL_REF: \ - { \ - int _zxy = const_costs(RTX, CODE); \ - return (_zxy) ? COSTS_N_INSNS (_zxy) : 0; \ - } - -/* A crude cut at RTX_COSTS for the V850. */ - -/* Provide the costs of a rtl expression. This is in the body of a - switch on CODE. - - There aren't DImode MOD, DIV or MULT operations, so call them - very expensive. Everything else is pretty much a constant cost. */ - -#define RTX_COSTS(RTX,CODE,OUTER_CODE) \ - case MOD: \ - case DIV: \ - case UMOD: \ - case UDIV: \ - if (TARGET_V850E && optimize_size) \ - return 6; \ - return 60; \ - case MULT: \ - if (TARGET_V850E \ - && ( GET_MODE (RTX) == SImode \ - || GET_MODE (RTX) == HImode \ - || GET_MODE (RTX) == QImode)) \ - { \ - if (GET_CODE (XEXP (RTX, 1)) == REG) \ - return 4; \ - else if (GET_CODE (XEXP (RTX, 1)) == CONST_INT) \ - { \ - if (CONST_OK_FOR_O (INTVAL (XEXP (RTX, 1)))) \ - return 6; \ - else if (CONST_OK_FOR_K (INTVAL (XEXP (RTX, 1)))) \ - return 10; \ - } \ - } \ - return 20; - /* All addressing modes have the same cost on the V850 series. */ #define ADDRESS_COST(ADDR) 1 |