summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authordj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-24 00:46:59 +0000
committerdj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-24 00:46:59 +0000
commita8651e7dedc2d25d8c39483e8215f17453dcfb26 (patch)
tree3628615dff3fa623a5e493ef624ee543ace52f73 /gcc/config
parent4de86a3cef94b549764890f8f0eb12e4a8c1b3cf (diff)
downloadgcc-a8651e7dedc2d25d8c39483e8215f17453dcfb26.tar.gz
* config/m32c/m32c.c (m32c_return_addr_rtx): Change pointer type
for A24 to PSImode. (m32c_address_cost): Detail costs for indirect offsets. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135842 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/m32c/m32c.c29
1 files changed, 25 insertions, 4 deletions
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;
}