mn10300-protos.h (mn10300_address_cost): Declare.

* config/mn10300/mn10300-protos.h (mn10300_address_cost): Declare.
* config/mn10300/mn10300.h (ADDRESS_COST): New macro.
* config/mn10300/mn10300.c (mn10300_address_cost): New function.

From-SVN: r33323
This commit is contained in:
Alexandre Oliva 2000-04-21 21:19:55 +00:00 committed by Alexandre Oliva
parent 40a20da422
commit 460ad32502
4 changed files with 91 additions and 0 deletions

View File

@ -1,3 +1,9 @@
Fri Apr 21 18:17:12 2000 Alexandre Oliva <aoliva@cygnus.com>
* config/mn10300/mn10300-protos.h (mn10300_address_cost): Declare.
* config/mn10300/mn10300.h (ADDRESS_COST): New macro.
* config/mn10300/mn10300.c (mn10300_address_cost): New function.
Fri Apr 21 18:11:56 2000 Alexandre Oliva <aoliva@cygnus.com>
* config/mn10300/mn10300.md (movdi, movdf): Do not use `movu' when

View File

@ -36,6 +36,8 @@ extern int symbolic_operand PARAMS ((rtx, enum machine_mode));
extern int call_address_operand PARAMS ((rtx, enum machine_mode));
extern int impossible_plus_operand PARAMS ((rtx, enum machine_mode));
extern int const_8bit_operand PARAMS ((rtx, enum machine_mode));
extern int mn10300_address_cost PARAMS ((rtx, int *));
#endif /* RTX_CODE */
#ifdef TREE_CODE

View File

@ -1049,3 +1049,84 @@ legitimize_address (x, oldx, mode)
}
return x;
}
int
mn10300_address_cost (x, unsig)
rtx x;
int *unsig;
{
int _s = 0;
if (unsig == 0)
unsig = &_s;
switch (GET_CODE (x))
{
case REG:
switch (REGNO_REG_CLASS (REGNO (x)))
{
case SP_REGS:
*unsig = 1;
return 0;
case ADDRESS_REGS:
return 1;
case DATA_REGS:
case EXTENDED_REGS:
return 3;
case NO_REGS:
return 5;
default:
abort ();
}
case PLUS:
case MINUS:
case IOR:
return (mn10300_address_cost (XEXP (x, 0), unsig)
+ mn10300_address_cost (XEXP (x, 1), unsig));
case EXPR_LIST:
case SUBREG:
case MEM:
return ADDRESS_COST (XEXP (x, 0));
case ZERO_EXTEND:
*unsig = 1;
return mn10300_address_cost (XEXP (x, 0), unsig);
case CONST_INT:
if (INTVAL (x) == 0)
return 0;
if (INTVAL (x) + (*unsig ? 0 : 0x80) < 0x100)
return 1;
if (INTVAL (x) + (*unsig ? 0 : 0x8000) < 0x10000)
return 3;
if (INTVAL (x) + (*unsig ? 0 : 0x800000) < 0x1000000)
return 5;
return 7;
case CONST:
case SYMBOL_REF:
return 8;
case ADDRESSOF:
switch (GET_CODE (XEXP (x, 0)))
{
case MEM:
return ADDRESS_COST (XEXP (x, 0));
case REG:
return 1;
default:
abort ();
}
default:
abort ();
}
}

View File

@ -818,6 +818,8 @@ struct cum_arg {int nbytes; };
((CLASS1 == CLASS2 && (CLASS1 == ADDRESS_REGS || CLASS1 == DATA_REGS)) ? 2 :\
CLASS1 == CLASS2 && CLASS1 == EXTENDED_REGS ? 6 : 4)
#define ADDRESS_COST(X) mn10300_address_cost((X), 0)
/* A crude cut at RTX_COSTS for the MN10300. */
/* Provide the costs of a rtl expression. This is in the body of a