diff options
Diffstat (limited to 'gcc/config/avr/avr.c')
-rw-r--r-- | gcc/config/avr/avr.c | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index dba224d..ed8c977 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -81,8 +81,8 @@ static void avr_reorg (void); static void avr_asm_out_ctor (rtx, int); static void avr_asm_out_dtor (rtx, int); static int avr_operand_rtx_cost (rtx, enum machine_mode, enum rtx_code); -static bool avr_rtx_costs (rtx, int, int, int *); -static int avr_address_cost (rtx); +static bool avr_rtx_costs (rtx, int, int, int *, bool); +static int avr_address_cost (rtx, bool); static bool avr_return_in_memory (const_tree, const_tree); static struct machine_function * avr_init_machine_status (void); static rtx avr_builtin_setjmp_frame_value (void); @@ -1562,7 +1562,7 @@ final_prescan_insn (rtx insn, rtx *operand ATTRIBUTE_UNUSED, fprintf (asm_out_file, "/*DEBUG: 0x%x\t\t%d\t%d */\n", INSN_ADDRESSES (uid), INSN_ADDRESSES (uid) - last_insn_address, - rtx_cost (PATTERN (insn), INSN)); + rtx_cost (PATTERN (insn), INSN, !optimize_size)); } last_insn_address = INSN_ADDRESSES (uid); } @@ -4991,7 +4991,8 @@ order_regs_for_local_alloc (void) operand's parent operator. */ static int -avr_operand_rtx_cost (rtx x, enum machine_mode mode, enum rtx_code outer) +avr_operand_rtx_cost (rtx x, enum machine_mode mode, enum rtx_code outer, + bool speed ATTRIBUTE_UNUSED) { enum rtx_code code = GET_CODE (x); int total; @@ -5021,7 +5022,8 @@ avr_operand_rtx_cost (rtx x, enum machine_mode mode, enum rtx_code outer) case, *TOTAL contains the cost result. */ static bool -avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) +avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total, + bool speed) { enum machine_mode mode = GET_MODE (x); HOST_WIDE_INT val; @@ -5153,8 +5155,8 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) { case QImode: if (AVR_HAVE_MUL) - *total = COSTS_N_INSNS (optimize_size ? 3 : 4); - else if (optimize_size) + *total = COSTS_N_INSNS (!speed ? 3 : 4); + else if (!speed) *total = COSTS_N_INSNS (AVR_HAVE_JMP_CALL ? 2 : 1); else return false; @@ -5162,8 +5164,8 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case HImode: if (AVR_HAVE_MUL) - *total = COSTS_N_INSNS (optimize_size ? 7 : 10); - else if (optimize_size) + *total = COSTS_N_INSNS (!speed ? 7 : 10); + else if (!speed) *total = COSTS_N_INSNS (AVR_HAVE_JMP_CALL ? 2 : 1); else return false; @@ -5180,7 +5182,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case MOD: case UDIV: case UMOD: - if (optimize_size) + if (!speed) *total = COSTS_N_INSNS (AVR_HAVE_JMP_CALL ? 2 : 1); else return false; @@ -5194,7 +5196,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case QImode: if (GET_CODE (XEXP (x, 1)) != CONST_INT) { - *total = COSTS_N_INSNS (optimize_size ? 4 : 17); + *total = COSTS_N_INSNS (!speed ? 4 : 17); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } else @@ -5212,7 +5214,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case HImode: if (GET_CODE (XEXP (x, 1)) != CONST_INT) { - *total = COSTS_N_INSNS (optimize_size ? 5 : 41); + *total = COSTS_N_INSNS (!speed ? 5 : 41); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } else @@ -5240,16 +5242,16 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) *total = COSTS_N_INSNS (5); break; case 4: - *total = COSTS_N_INSNS (optimize_size ? 5 : 8); + *total = COSTS_N_INSNS (!speed ? 5 : 8); break; case 6: - *total = COSTS_N_INSNS (optimize_size ? 5 : 9); + *total = COSTS_N_INSNS (ptimize_size ? 5 : 9); break; case 5: - *total = COSTS_N_INSNS (optimize_size ? 5 : 10); + *total = COSTS_N_INSNS (!speed ? 5 : 10); break; default: - *total = COSTS_N_INSNS (optimize_size ? 5 : 41); + *total = COSTS_N_INSNS (!speed ? 5 : 41); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } break; @@ -5257,7 +5259,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case SImode: if (GET_CODE (XEXP (x, 1)) != CONST_INT) { - *total = COSTS_N_INSNS (optimize_size ? 7 : 113); + *total = COSTS_N_INSNS (!speed ? 7 : 113); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } else @@ -5278,10 +5280,10 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) *total = COSTS_N_INSNS (6); break; case 2: - *total = COSTS_N_INSNS (optimize_size ? 7 : 8); + *total = COSTS_N_INSNS (!speed ? 7 : 8); break; default: - *total = COSTS_N_INSNS (optimize_size ? 7 : 113); + *total = COSTS_N_INSNS (!speed ? 7 : 113); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } break; @@ -5298,7 +5300,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case QImode: if (GET_CODE (XEXP (x, 1)) != CONST_INT) { - *total = COSTS_N_INSNS (optimize_size ? 4 : 17); + *total = COSTS_N_INSNS (!speed ? 4 : 17); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } else @@ -5318,7 +5320,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case HImode: if (GET_CODE (XEXP (x, 1)) != CONST_INT) { - *total = COSTS_N_INSNS (optimize_size ? 5 : 41); + *total = COSTS_N_INSNS (!speed ? 5 : 41); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } else @@ -5344,17 +5346,17 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) *total = COSTS_N_INSNS (5); break; case 11: - *total = COSTS_N_INSNS (optimize_size ? 5 : 6); + *total = COSTS_N_INSNS (!speed ? 5 : 6); break; case 12: - *total = COSTS_N_INSNS (optimize_size ? 5 : 7); + *total = COSTS_N_INSNS (!speed ? 5 : 7); break; case 6: case 13: - *total = COSTS_N_INSNS (optimize_size ? 5 : 8); + *total = COSTS_N_INSNS (!speed ? 5 : 8); break; default: - *total = COSTS_N_INSNS (optimize_size ? 5 : 41); + *total = COSTS_N_INSNS (!speed ? 5 : 41); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } break; @@ -5362,7 +5364,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case SImode: if (GET_CODE (XEXP (x, 1)) != CONST_INT) { - *total = COSTS_N_INSNS (optimize_size ? 7 : 113); + *total = COSTS_N_INSNS (!speed ? 7 : 113); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } else @@ -5380,13 +5382,13 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) *total = COSTS_N_INSNS (6); break; case 2: - *total = COSTS_N_INSNS (optimize_size ? 7 : 8); + *total = COSTS_N_INSNS (!speed ? 7 : 8); break; case 31: *total = COSTS_N_INSNS (AVR_HAVE_MOVW ? 4 : 5); break; default: - *total = COSTS_N_INSNS (optimize_size ? 7 : 113); + *total = COSTS_N_INSNS (!speed ? 7 : 113); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } break; @@ -5403,7 +5405,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case QImode: if (GET_CODE (XEXP (x, 1)) != CONST_INT) { - *total = COSTS_N_INSNS (optimize_size ? 4 : 17); + *total = COSTS_N_INSNS (!speed ? 4 : 17); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } else @@ -5421,7 +5423,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case HImode: if (GET_CODE (XEXP (x, 1)) != CONST_INT) { - *total = COSTS_N_INSNS (optimize_size ? 5 : 41); + *total = COSTS_N_INSNS (!speed ? 5 : 41); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } else @@ -5450,17 +5452,17 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case 12: case 13: case 14: - *total = COSTS_N_INSNS (optimize_size ? 5 : 6); + *total = COSTS_N_INSNS (!speed ? 5 : 6); break; case 4: - *total = COSTS_N_INSNS (optimize_size ? 5 : 7); + *total = COSTS_N_INSNS (!speed ? 5 : 7); break; case 5: case 6: - *total = COSTS_N_INSNS (optimize_size ? 5 : 9); + *total = COSTS_N_INSNS (!speed ? 5 : 9); break; default: - *total = COSTS_N_INSNS (optimize_size ? 5 : 41); + *total = COSTS_N_INSNS (!speed ? 5 : 41); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } break; @@ -5468,7 +5470,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) case SImode: if (GET_CODE (XEXP (x, 1)) != CONST_INT) { - *total = COSTS_N_INSNS (optimize_size ? 7 : 113); + *total = COSTS_N_INSNS (!speed ? 7 : 113); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } else @@ -5481,7 +5483,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) *total = COSTS_N_INSNS (4); break; case 2: - *total = COSTS_N_INSNS (optimize_size ? 7 : 8); + *total = COSTS_N_INSNS (!speed ? 7 : 8); break; case 8: case 16: @@ -5492,7 +5494,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) *total = COSTS_N_INSNS (6); break; default: - *total = COSTS_N_INSNS (optimize_size ? 7 : 113); + *total = COSTS_N_INSNS (!speed ? 7 : 113); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code); } break; @@ -5543,7 +5545,7 @@ avr_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) /* Calculate the cost of a memory address. */ static int -avr_address_cost (rtx x) +avr_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED) { if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x,1)) == CONST_INT |