From 80b093dfb8c8b11e30be7468d31f5e0b599f10b3 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Fri, 23 May 2008 20:46:59 -0400 Subject: [PATCH] m32c.c (m32c_return_addr_rtx): Change pointer type for A24 to PSImode. * config/m32c/m32c.c (m32c_return_addr_rtx): Change pointer type for A24 to PSImode. (m32c_address_cost): Detail costs for indirect offsets. From-SVN: r135842 --- gcc/ChangeLog | 6 ++++++ gcc/config/m32c/m32c.c | 29 +++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2eda8f40bda..cde90861276 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-05-23 DJ Delorie + + * config/m32c/m32c.c (m32c_return_addr_rtx): Change pointer type + for A24 to PSImode. + (m32c_address_cost): Detail costs for indirect offsets. + 2008-05-23 Rafael Espindola * see.c (see_get_extension_data): Don't use SUBREG_REG to test diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index 2e5558fd92d..697e42a7948 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -1099,7 +1099,8 @@ m32c_return_addr_rtx (int count) if (TARGET_A24) { - mode = SImode; + /* It's four bytes */ + mode = PSImode; offset = 4; } else @@ -2199,16 +2200,36 @@ m32c_rtx_costs (rtx x, int code, int outer_code, int *total) static int m32c_address_cost (rtx addr) { + int i; /* fprintf(stderr, "\naddress_cost\n"); debug_rtx(addr);*/ switch (GET_CODE (addr)) { case CONST_INT: - return COSTS_N_INSNS(1); + i = INTVAL (addr); + if (i == 0) + return COSTS_N_INSNS(1); + if (0 < i && i <= 255) + return COSTS_N_INSNS(2); + if (0 < i && i <= 65535) + return COSTS_N_INSNS(3); + return COSTS_N_INSNS(4); case SYMBOL_REF: - return COSTS_N_INSNS(3); + return COSTS_N_INSNS(4); case REG: - return COSTS_N_INSNS(2); + return COSTS_N_INSNS(1); + case PLUS: + if (GET_CODE (XEXP (addr, 1)) == CONST_INT) + { + i = INTVAL (XEXP (addr, 1)); + if (i == 0) + return COSTS_N_INSNS(1); + if (0 < i && i <= 255) + return COSTS_N_INSNS(2); + if (0 < i && i <= 65535) + return COSTS_N_INSNS(3); + } + return COSTS_N_INSNS(4); default: return 0; } -- 2.30.2