aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/avr
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-01-28 10:08:56 -0800
committerRichard Henderson <rth@gcc.gnu.org>2003-01-28 10:08:56 -0800
commitdcefdf6717c42e30b0058fe26780188ff5978821 (patch)
tree2f6fbc07999c9923c492e499429bdd22d90f295a /gcc/config/avr
parentf2ce60b88d09c376e9862b78e5d37045b2e92351 (diff)
downloadgcc-dcefdf6717c42e30b0058fe26780188ff5978821.zip
gcc-dcefdf6717c42e30b0058fe26780188ff5978821.tar.gz
gcc-dcefdf6717c42e30b0058fe26780188ff5978821.tar.bz2
target.h (targetm.address_cost): New.
* target.h (targetm.address_cost): New. * target-def.h (TARGET_ADDRESS_COST): New. (TARGET_RTX_COSTS): Uncomment. Oops. * cse.c (address_cost): Use new target hook. (default_address_cost): New. * output.h (default_address_cost): Declare. * hooks.c (hook_int_rtx_0): New. * hooks.h (hook_int_rtx_0): Declare. * loop.c (combine_givs_p): Remove if 0 code. * system.h (ADDRESS_COST): Poison. * config/alpha/alpha.c, config/alpha/alpha.h, config/d30v/d30v.c, config/d30v/d30v.h, config/ia64/ia64.c, config/ia64/ia64.h, config/m32r/m32r.c, config/m32r/m32r.h, config/mcore/mcore.c, config/mcore/mcore.h, config/mmix/mmix.c, config/mmix/mmix.h, config/rs6000/rs6000.c, config/rs6000/rs6000.h, config/sparc/sparc.c, config/sparc/sparc.h, config/v850/v850.c, config/v850/v850.h, config/xtensa/xtensa.c, config/xtensa/xtensa.h (TARGET_ADDRESS_COST): Define as hook_int_rtx_0. (ADDRESS_COST): Remove. * config/arc/arc-protos.h, config/arc/arc.c, config/arc/arc.h, config/avr/avr-protos.h, config/avr/avr.c, config/avr/avr.h, config/c4x/c4x-protos.h, config/c4x/c4x.c, config/c4x/c4x.h, config/dsp16xx/dsp16xx-protos.h, config/dsp16xx/dsp16xx.c, config/dsp16xx/dsp16xx.h, config/i386/i386-protos.h, config/i386/i386.c, config/i386/i386.h, config/i960/i960-protos.h, config/i960/i960.c, config/i960/i960.h, config/ip2k/ip2k-protos.h, config/ip2k/ip2k.c, config/ip2k/ip2k.h, config/mips/mips-protos.h, config/mips/mips.c, config/mips/mips.h, config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c, config/m68hc11/m68hc11.h, config/ns32k/ns32k-protos.h, config/ns32k/ns32k.c, config/ns32k/ns32k.h, config/pa/pa-protos.h, config/pa/pa.c, config/pa/pa.h, config/s390/s390-protos.h, config/s390/s390.c, config/s390/s390.h, config/vax/vax-protos.h, config/vax/vax.c, config/vax/vax.h (foo_address_cost): Make static. (TARGET_ADDRESS_COST): New. (ADDRESS_COST): Remove. * config/arm/arm.h, config/arm/arm.c, config/m88k/m88k.h, config/m88k/m88k.c, config/romp/romp.h, config/romp/romp.c, config/sh/sh.c, config/sh/sh.h, config/stormy16/stormy16.c, config/stormy16/stormy16.h (ADDRESS_COST): Move code ... (foo_address_cost): ... here. (TARGET_ADDRESS_COST): New. * config/m32r/m32r.c (m32r_address_cost): Remove. * config/m32r/m32r-protos.h: Update. * config/mmix/mmix.c (mmix_address_cost): Remove. * config/mmix/mmix-protos.h: Update. * config/mn10300/mn10300.c (mn10300_address_cost_1): Rename from mn10300_address_cost; move unsig allocation ... (mn10300_address_cost): ... here. (TARGET_ADDRESS_COST): New. * config/mn10300/mn10300-protos.h: Update. * config/mn10300/mn10300.h (ADDRESS_COST): Remove. From-SVN: r61988
Diffstat (limited to 'gcc/config/avr')
-rw-r--r--gcc/config/avr/avr-protos.h1
-rw-r--r--gcc/config/avr/avr.c5
-rw-r--r--gcc/config/avr/avr.h43
3 files changed, 4 insertions, 45 deletions
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index b721b3e..35ac232 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -104,7 +104,6 @@ extern const char *avr_out_sbxx_branch PARAMS ((rtx insn, rtx operands[]));
extern enum reg_class preferred_reload_class PARAMS ((rtx x,
enum reg_class class));
-extern int avr_address_cost PARAMS ((rtx x));
extern int extra_constraint PARAMS ((rtx x, int c));
extern rtx legitimize_address PARAMS ((rtx x, rtx oldx,
enum machine_mode mode));
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 0378012..017308b 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -73,6 +73,7 @@ static void avr_asm_out_ctor PARAMS ((rtx, int));
static void avr_asm_out_dtor PARAMS ((rtx, int));
static int default_rtx_costs PARAMS ((rtx, enum rtx_code, enum rtx_code));
static bool avr_rtx_costs PARAMS ((rtx, int, int, int *));
+static int avr_address_cost PARAMS ((rtx));
/* Allocate registers from r25 to r8 for parameters for function calls */
#define FIRST_CUM_REG 26
@@ -231,6 +232,8 @@ int avr_case_values_threshold = 30000;
#define TARGET_SECTION_TYPE_FLAGS avr_section_type_flags
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS avr_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST avr_address_cost
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -5093,7 +5096,7 @@ avr_rtx_costs (x, code, outer_code, total)
/* Calculate the cost of a memory address */
-int
+static int
avr_address_cost (x)
rtx x;
{
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 126a6fd..6b3d677 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -1521,49 +1521,6 @@ do { \
is a suitable definition for this macro on machines where anything
`CONSTANT_P' is valid. */
-#define ADDRESS_COST(ADDRESS) avr_address_cost (ADDRESS)
-
-/* An expression giving the cost of an addressing mode that contains
- ADDRESS. If not defined, the cost is computed from the ADDRESS
- expression and the `CONST_COSTS' values.
-
- For most CISC machines, the default cost is a good approximation
- of the true cost of the addressing mode. However, on RISC
- machines, all instructions normally have the same length and
- execution time. Hence all addresses will have equal costs.
-
- In cases where more than one form of an address is known, the form
- with the lowest cost will be used. If multiple forms have the
- same, lowest, cost, the one that is the most complex will be used.
-
- For example, suppose an address that is equal to the sum of a
- register and a constant is used twice in the same basic block.
- When this macro is not defined, the address will be computed in a
- register and memory references will be indirect through that
- register. On machines where the cost of the addressing mode
- containing the sum is no higher than that of a simple indirect
- reference, this will produce an additional instruction and
- possibly require an additional register. Proper specification of
- this macro eliminates this overhead for such machines.
-
- Similar use of this macro is made in strength reduction of loops.
-
- ADDRESS need not be valid as an address. In such a case, the cost
- is not relevant and can be any value; invalid addresses need not be
- assigned a different cost.
-
- On machines where an address involving more than one register is as
- cheap as an address computation involving only one register,
- defining `ADDRESS_COST' to reflect this can cause two registers to
- be live over a region of code where only one would have been if
- `ADDRESS_COST' were not defined in that manner. This effect should
- be considered in the definition of this macro. Equivalent costs
- should probably only be given to addresses with different numbers
- of registers on machines with lots of registers.
-
- This macro will normally either not be defined or be defined as a
- constant. */
-
#define REGISTER_MOVE_COST(MODE, FROM, TO) ((FROM) == STACK_REG ? 6 \
: (TO) == STACK_REG ? 12 \
: 2)