summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-05 17:31:17 +0000
committerolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-05 17:31:17 +0000
commitd9c5e5f4b0d0e1606d4a060a271ebd7db420cd92 (patch)
tree5b3b7d58a5b8b755cabc510e2ed59a4ede359a01 /gcc
parent5883f4f3cd15826854d839b6df02418a0f841baf (diff)
downloadgcc-d9c5e5f4b0d0e1606d4a060a271ebd7db420cd92.tar.gz
* hooks.c (hook_int_rtx_mode_as_bool_0): New function.
* hooks.h (hook_int_rtx_mode_as_bool_0): Declare it. * output.h (default_address_cost): Add machine_mode and address space arguments. * target.def (address_cost): Likewise. * rtlanal.c (address_cost): Pass mode and address space to target hook. (default_address_cost): Add unnamed machine_mode and address space arguments. * doc/tm.texi: Regenerate. * config/alpha/alpha.c (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0. * config/arm/arm.c (arm_address_cost): Add machine_mode and address space arguments. * config/avr/avr.c (avr_address_cost): Likewise. * config/bfin/bfin.c (bfin_address_cost): Likewise. * config/cr16/cr16.c (cr16_address_cost): Likewise. * config/cris/cris.c (cris_address_cost): Likewise. * config/epiphany/epiphany.c (epiphany_address_cost): Likewise. * config/i386/i386.c (ix86_address_cost): Likewise. * config/ia64/ia64.c (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0. * config/iq2000/iq2000.c (iq2000_address_cost): Add machine_mode and address space arguments. Pass them on in recursive invocation. * config/lm32/lm32.c (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0. * config/m32c/m32c.c (m32c_address_cost): Add machine_mode and address space arguments. * config/m32r/m32r.c (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0. * config/mcore/mcore.c (TARGET_ADDRESS_COST): Likewise. * config/mep/mep.c (mep_address_cost): Add machine_mode and address space arguments. * config/microblaze/microblaze.c (microblaze_address_cost): Likewise. * config/mips/mips.c (mips_address_cost): Likewise. * config/mmix/mmix.c (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0. * config/mn10300/mn10300.c (mn10300_address_cost): Add machine_mode and address space arguments. (mn10300_rtx_costs): Pass GET_MODE (x) and MEM_ADDR_SPACE (x) to mn10300_address_cost. * config/pa/pa.c (hppa_address_cost): Add machine_mode and address space arguments. * config/rs6000/rs6000.c (rs6000_debug_address_cost): Likewise. (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0. * config/rx/rx.c (rx_address_cost): Add machine_mode and address space arguments. * config/s390/s390.c (s390_address_cost): Likewise. * config/score/score-protos.h (score_address_cost): Likewise. * config/score/score.c (score_address_cost): Likewise. * config/sh/sh.c (sh_address_cost): Likewise. * config/sparc/sparc.c (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0. * config/spu/spu.c (TARGET_ADDRESS_COST): Likewise. * config/stormy16/stormy16.c (xstormy16_address_cost): Add machine_mode and address space arguments. * config/v850/v850.c (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0. * config/vax/vax.c (vax_address_cost): Add machine_mode and address space arguments. * config/xtensa/xtensa (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190990 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog65
-rw-r--r--gcc/config/alpha/alpha.c2
-rw-r--r--gcc/config/arm/arm.c5
-rw-r--r--gcc/config/avr/avr.c4
-rw-r--r--gcc/config/bfin/bfin.c5
-rw-r--r--gcc/config/cr16/cr16.c4
-rw-r--r--gcc/config/cris/cris.c6
-rw-r--r--gcc/config/epiphany/epiphany.c3
-rw-r--r--gcc/config/i386/i386.c4
-rw-r--r--gcc/config/ia64/ia64.c2
-rw-r--r--gcc/config/iq2000/iq2000.c8
-rw-r--r--gcc/config/lm32/lm32.c2
-rw-r--r--gcc/config/m32c/m32c.c4
-rw-r--r--gcc/config/m32r/m32r.c2
-rw-r--r--gcc/config/mcore/mcore.c2
-rw-r--r--gcc/config/mep/mep.c7
-rw-r--r--gcc/config/microblaze/microblaze.c4
-rw-r--r--gcc/config/mips/mips.c6
-rw-r--r--gcc/config/mmix/mmix.c2
-rw-r--r--gcc/config/mn10300/mn10300.c6
-rw-r--r--gcc/config/pa/pa.c5
-rw-r--r--gcc/config/rs6000/rs6000.c8
-rw-r--r--gcc/config/rx/rx.c3
-rw-r--r--gcc/config/s390/s390.c4
-rw-r--r--gcc/config/score/score-protos.h3
-rw-r--r--gcc/config/score/score.c3
-rw-r--r--gcc/config/sh/sh.c5
-rw-r--r--gcc/config/sparc/sparc.c2
-rw-r--r--gcc/config/spu/spu.c2
-rw-r--r--gcc/config/stormy16/stormy16.c6
-rw-r--r--gcc/config/v850/v850.c2
-rw-r--r--gcc/config/vax/vax.c6
-rw-r--r--gcc/config/xtensa/xtensa.c2
-rw-r--r--gcc/doc/tm.texi2
-rw-r--r--gcc/hooks.c6
-rw-r--r--gcc/hooks.h2
-rw-r--r--gcc/output.h2
-rw-r--r--gcc/rtlanal.c4
-rw-r--r--gcc/target.def2
39 files changed, 162 insertions, 50 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 978b47d7fc7..384d9fe7ec8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,68 @@
+2012-09-05 Oleg Endo <olegendo@gcc.gnu.org>
+
+ * hooks.c (hook_int_rtx_mode_as_bool_0): New function.
+ * hooks.h (hook_int_rtx_mode_as_bool_0): Declare it.
+ * output.h (default_address_cost): Add machine_mode and address space
+ arguments.
+ * target.def (address_cost): Likewise.
+ * rtlanal.c (address_cost): Pass mode and address space to target hook.
+ (default_address_cost): Add unnamed machine_mode and address space
+ arguments.
+ * doc/tm.texi: Regenerate.
+ * config/alpha/alpha.c (TARGET_ADDRESS_COST): Use
+ hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0.
+ * config/arm/arm.c (arm_address_cost): Add machine_mode and address
+ space arguments.
+ * config/avr/avr.c (avr_address_cost): Likewise.
+ * config/bfin/bfin.c (bfin_address_cost): Likewise.
+ * config/cr16/cr16.c (cr16_address_cost): Likewise.
+ * config/cris/cris.c (cris_address_cost): Likewise.
+ * config/epiphany/epiphany.c (epiphany_address_cost): Likewise.
+ * config/i386/i386.c (ix86_address_cost): Likewise.
+ * config/ia64/ia64.c (TARGET_ADDRESS_COST): Use
+ hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0.
+ * config/iq2000/iq2000.c (iq2000_address_cost): Add machine_mode and
+ address space arguments. Pass them on in recursive invocation.
+ * config/lm32/lm32.c (TARGET_ADDRESS_COST): Use
+ hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0.
+ * config/m32c/m32c.c (m32c_address_cost): Add machine_mode and address
+ space arguments.
+ * config/m32r/m32r.c (TARGET_ADDRESS_COST): Use
+ hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0.
+ * config/mcore/mcore.c (TARGET_ADDRESS_COST): Likewise.
+ * config/mep/mep.c (mep_address_cost): Add machine_mode and address
+ space arguments.
+ * config/microblaze/microblaze.c (microblaze_address_cost): Likewise.
+ * config/mips/mips.c (mips_address_cost): Likewise.
+ * config/mmix/mmix.c (TARGET_ADDRESS_COST): Use
+ hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0.
+ * config/mn10300/mn10300.c (mn10300_address_cost): Add machine_mode and
+ address space arguments.
+ (mn10300_rtx_costs): Pass GET_MODE (x) and MEM_ADDR_SPACE (x) to
+ mn10300_address_cost.
+ * config/pa/pa.c (hppa_address_cost): Add machine_mode and address
+ space arguments.
+ * config/rs6000/rs6000.c (rs6000_debug_address_cost): Likewise.
+ (TARGET_ADDRESS_COST): Use hook_int_rtx_mode_as_bool_0 instead of
+ hook_int_rtx_bool_0.
+ * config/rx/rx.c (rx_address_cost): Add machine_mode and address
+ space arguments.
+ * config/s390/s390.c (s390_address_cost): Likewise.
+ * config/score/score-protos.h (score_address_cost): Likewise.
+ * config/score/score.c (score_address_cost): Likewise.
+ * config/sh/sh.c (sh_address_cost): Likewise.
+ * config/sparc/sparc.c (TARGET_ADDRESS_COST): Use
+ hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0.
+ * config/spu/spu.c (TARGET_ADDRESS_COST): Likewise.
+ * config/stormy16/stormy16.c (xstormy16_address_cost): Add machine_mode
+ and address space arguments.
+ * config/v850/v850.c (TARGET_ADDRESS_COST): Use
+ hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0.
+ * config/vax/vax.c (vax_address_cost): Add machine_mode and address
+ space arguments.
+ * config/xtensa/xtensa (TARGET_ADDRESS_COST): Use
+ hook_int_rtx_mode_as_bool_0 instead of hook_int_rtx_bool_0.
+
2012-09-05 Diego Novillo <dnovillo@google.com>
PR bootstrap/54484
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 0aab4539b50..6b9fd156a60 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -9795,7 +9795,7 @@ alpha_conditional_register_usage (void)
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS alpha_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG alpha_reorg
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 4001f350f2f..2e9003189b1 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -162,7 +162,7 @@ static bool arm_fastmul_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, boo
static bool arm_xscale_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, bool);
static bool arm_9e_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, bool);
static bool arm_rtx_costs (rtx, int, int, int, int *, bool);
-static int arm_address_cost (rtx, bool);
+static int arm_address_cost (rtx, enum machine_mode, addr_space_t, bool);
static int arm_register_move_cost (enum machine_mode, reg_class_t, reg_class_t);
static int arm_memory_move_cost (enum machine_mode, reg_class_t, bool);
static void arm_init_builtins (void);
@@ -8411,7 +8411,8 @@ arm_thumb_address_cost (rtx x)
}
static int
-arm_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
+arm_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED, bool speed ATTRIBUTE_UNUSED)
{
return TARGET_32BIT ? arm_arm_address_cost (x) : arm_thumb_address_cost (x);
}
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 95892ade448..e69e35aaecf 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -8896,7 +8896,9 @@ avr_rtx_costs (rtx x, int codearg, int outer_code,
/* Implement `TARGET_ADDRESS_COST'. */
static int
-avr_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
+avr_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
int cost = 4;
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 3a4b8af9f9b..709cea39fce 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -1288,7 +1288,10 @@ bfin_dsp_memref_p (rtx x)
All addressing modes are equally cheap on the Blackfin. */
static int
-bfin_address_cost (rtx addr ATTRIBUTE_UNUSED, bool speed ATTRIBUTE_UNUSED)
+bfin_address_cost (rtx addr ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
return 1;
}
diff --git a/gcc/config/cr16/cr16.c b/gcc/config/cr16/cr16.c
index b9305701923..7e6f1d2a41c 100644
--- a/gcc/config/cr16/cr16.c
+++ b/gcc/config/cr16/cr16.c
@@ -1286,7 +1286,9 @@ cr16_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
/* Return cost of the memory address x. */
static int
-cr16_address_cost (rtx addr, bool speed ATTRIBUTE_UNUSED)
+cr16_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
enum cr16_addrtype addrtype;
struct cr16_address address;
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 4a73c816833..6378c622a25 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -130,7 +130,7 @@ static reg_class_t cris_preferred_reload_class (rtx, reg_class_t);
static int cris_register_move_cost (enum machine_mode, reg_class_t, reg_class_t);
static int cris_memory_move_cost (enum machine_mode, reg_class_t, bool);
static bool cris_rtx_costs (rtx, int, int, int, int *, bool);
-static int cris_address_cost (rtx, bool);
+static int cris_address_cost (rtx, enum machine_mode, addr_space_t, bool);
static bool cris_pass_by_reference (cumulative_args_t, enum machine_mode,
const_tree, bool);
static int cris_arg_partial_bytes (cumulative_args_t, enum machine_mode,
@@ -2149,7 +2149,9 @@ cris_rtx_costs (rtx x, int code, int outer_code, int opno, int *total,
/* The ADDRESS_COST worker. */
static int
-cris_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
+cris_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
/* The metric to use for the cost-macros is unclear.
The metric used here is (the number of cycles needed) / 2,
diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c
index b4a193a7e1a..65bb1c8ee88 100644
--- a/gcc/config/epiphany/epiphany.c
+++ b/gcc/config/epiphany/epiphany.c
@@ -729,7 +729,8 @@ epiphany_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
If ADDR is not a valid address, its cost is irrelevant. */
static int
-epiphany_address_cost (rtx addr, bool speed)
+epiphany_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED, bool speed)
{
rtx reg;
rtx off = const0_rtx;
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index e2e1d220302..62d3a8c990b 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12027,7 +12027,9 @@ ix86_decompose_address (rtx addr, struct ix86_address *out)
requires to two regs - that would mean more pseudos with longer
lifetimes. */
static int
-ix86_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
+ix86_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
struct ix86_address parts;
int cost = 1;
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index f2f02c8e97a..984082cb775 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -524,7 +524,7 @@ static const struct attribute_spec ia64_attribute_table[] =
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS ia64_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_UNSPEC_MAY_TRAP_P
#define TARGET_UNSPEC_MAY_TRAP_P ia64_unspec_may_trap_p
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index ab55a154f06..da0b43da35b 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -152,7 +152,8 @@ static void iq2000_setup_incoming_varargs (cumulative_args_t,
enum machine_mode, tree, int *,
int);
static bool iq2000_rtx_costs (rtx, int, int, int, int *, bool);
-static int iq2000_address_cost (rtx, bool);
+static int iq2000_address_cost (rtx, enum machine_mode, addr_space_t,
+ bool);
static section *iq2000_select_section (tree, int, unsigned HOST_WIDE_INT);
static rtx iq2000_legitimize_address (rtx, rtx, enum machine_mode);
static bool iq2000_pass_by_reference (cumulative_args_t, enum machine_mode,
@@ -779,7 +780,8 @@ iq2000_move_1word (rtx operands[], rtx insn, int unsignedp)
/* Provide the costs of an addressing mode that contains ADDR. */
static int
-iq2000_address_cost (rtx addr, bool speed)
+iq2000_address_cost (rtx addr, enum machine_mode mode, addr_space_t as,
+ bool speed)
{
switch (GET_CODE (addr))
{
@@ -830,7 +832,7 @@ iq2000_address_cost (rtx addr, bool speed)
case LABEL_REF:
case HIGH:
case LO_SUM:
- return iq2000_address_cost (plus1, speed) + 1;
+ return iq2000_address_cost (plus1, mode, as, speed) + 1;
default:
break;
diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c
index 376df051090..d9c9e19b0da 100644
--- a/gcc/config/lm32/lm32.c
+++ b/gcc/config/lm32/lm32.c
@@ -86,7 +86,7 @@ static bool lm32_legitimate_constant_p (enum machine_mode, rtx);
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE lm32_option_override
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS lm32_rtx_costs
#undef TARGET_IN_SMALL_DATA_P
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index 23791788522..100c16fe391 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -2278,7 +2278,9 @@ m32c_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
#undef TARGET_ADDRESS_COST
#define TARGET_ADDRESS_COST m32c_address_cost
static int
-m32c_address_cost (rtx addr, bool speed ATTRIBUTE_UNUSED)
+m32c_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
int i;
/* fprintf(stderr, "\naddress_cost\n");
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index 27386468844..4d899666f2b 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -161,7 +161,7 @@ static const struct attribute_spec m32r_attribute_table[] =
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS m32r_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index c592964e96b..501c8cee814 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -191,7 +191,7 @@ static const struct attribute_spec mcore_attribute_table[] =
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS mcore_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG mcore_reorg
diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c
index 5089e033316..1f712344312 100644
--- a/gcc/config/mep/mep.c
+++ b/gcc/config/mep/mep.c
@@ -212,7 +212,7 @@ static int mep_sched_reorder (FILE *, int, rtx *, int *, int);
static rtx mep_make_bundle (rtx, rtx);
static void mep_bundle_insns (rtx);
static bool mep_rtx_cost (rtx, int, int, int, int *, bool);
-static int mep_address_cost (rtx, bool);
+static int mep_address_cost (rtx, enum machine_mode, addr_space_t, bool);
static void mep_setup_incoming_varargs (cumulative_args_t, enum machine_mode,
tree, int *, int);
static bool mep_pass_by_reference (cumulative_args_t cum, enum machine_mode,
@@ -7152,7 +7152,10 @@ mep_rtx_cost (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
}
static int
-mep_address_cost (rtx addr ATTRIBUTE_UNUSED, bool ATTRIBUTE_UNUSED speed_p)
+mep_address_cost (rtx addr ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool ATTRIBUTE_UNUSED speed_p)
{
return 1;
}
diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index 199d1b8d46f..d774e54ca33 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -1043,7 +1043,9 @@ microblaze_address_insns (rtx x, enum machine_mode mode)
/* Provide the costs of an addressing mode that contains ADDR.
If ADDR is not a valid address, its cost is irrelevant. */
static int
-microblaze_address_cost (rtx addr, bool speed ATTRIBUTE_UNUSED)
+microblaze_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
return COSTS_N_INSNS (microblaze_address_insns (addr, GET_MODE (addr)));
}
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 06b2ff4d0c3..09322f15926 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3943,9 +3943,11 @@ mips_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
/* Implement TARGET_ADDRESS_COST. */
static int
-mips_address_cost (rtx addr, bool speed ATTRIBUTE_UNUSED)
+mips_address_cost (rtx addr, enum machine_mode mode,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
- return mips_address_insns (addr, SImode, false);
+ return mips_address_insns (addr, mode, false);
}
/* Information about a single instruction in a multi-instruction
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index 3a99cb626af..eaf5f2ed437 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -223,7 +223,7 @@ static void mmix_conditional_register_usage (void);
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS mmix_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_REGISTER_MOVE_COST
#define TARGET_REGISTER_MOVE_COST mmix_register_move_cost
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 769e883f01b..7ec2459052f 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -2142,7 +2142,8 @@ mn10300_delegitimize_address (rtx orig_x)
with an address register. */
static int
-mn10300_address_cost (rtx x, bool speed)
+mn10300_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED, bool speed)
{
HOST_WIDE_INT i;
rtx base, index;
@@ -2457,7 +2458,8 @@ mn10300_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
break;
case MEM:
- total = mn10300_address_cost (XEXP (x, 0), speed);
+ total = mn10300_address_cost (XEXP (x, 0), GET_MODE (x),
+ MEM_ADDR_SPACE (x), speed);
if (speed)
total = COSTS_N_INSNS (2 + total);
goto alldone;
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index e692e485f37..bb54c6e1bfe 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -91,7 +91,7 @@ static void copy_reg_pointer (rtx, rtx);
static void fix_range (const char *);
static int hppa_register_move_cost (enum machine_mode mode, reg_class_t,
reg_class_t);
-static int hppa_address_cost (rtx, bool);
+static int hppa_address_cost (rtx, enum machine_mode mode, addr_space_t, bool);
static bool hppa_rtx_costs (rtx, int, int, int, int *, bool);
static inline rtx force_mode (enum machine_mode, rtx);
static void pa_reorg (void);
@@ -1397,7 +1397,8 @@ hppa_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
as GO_IF_LEGITIMATE_ADDRESS. */
static int
-hppa_address_cost (rtx X,
+hppa_address_cost (rtx X, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
bool speed ATTRIBUTE_UNUSED)
{
switch (GET_CODE (X))
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 6c58307a60f..430125f719f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -928,7 +928,8 @@ static tree rs6000_builtin_vectorized_libmass (tree, tree, tree);
static rtx rs6000_emit_set_long_const (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
static int rs6000_memory_move_cost (enum machine_mode, reg_class_t, bool);
static bool rs6000_debug_rtx_costs (rtx, int, int, int, int *, bool);
-static int rs6000_debug_address_cost (rtx, bool);
+static int rs6000_debug_address_cost (rtx, enum machine_mode, addr_space_t,
+ bool);
static int rs6000_debug_adjust_cost (rtx, rtx, rtx, int);
static bool is_microcoded_insn (rtx);
static bool is_nonpipeline_insn (rtx);
@@ -1294,7 +1295,7 @@ static const struct attribute_spec rs6000_attribute_table[] =
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS rs6000_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_DWARF_REGISTER_SPAN
#define TARGET_DWARF_REGISTER_SPAN rs6000_dwarf_register_span
@@ -26070,7 +26071,8 @@ rs6000_debug_rtx_costs (rtx x, int code, int outer_code, int opno, int *total,
/* Debug form of ADDRESS_COST that is selected if -mdebug=cost. */
static int
-rs6000_debug_address_cost (rtx x, bool speed)
+rs6000_debug_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED, bool speed)
{
int ret = TARGET_ADDRESS_COST (x, speed);
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index e2e61b2c883..472625e4af6 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -2724,7 +2724,8 @@ rx_is_legitimate_constant (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x)
}
static int
-rx_address_cost (rtx addr, bool speed)
+rx_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED, bool speed)
{
rtx a, b;
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 976d4cbc8a7..f0141d0c4be 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -2613,7 +2613,9 @@ s390_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
/* Return the cost of an address rtx ADDR. */
static int
-s390_address_cost (rtx addr, bool speed ATTRIBUTE_UNUSED)
+s390_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
struct s390_address ad;
if (!s390_decompose_address (addr, &ad))
diff --git a/gcc/config/score/score-protos.h b/gcc/config/score/score-protos.h
index 8dbebcbe241..04b67def33d 100644
--- a/gcc/config/score/score-protos.h
+++ b/gcc/config/score/score-protos.h
@@ -39,7 +39,8 @@ extern const char * score_move (rtx *ops);
extern bool score_unaligned_load (rtx* ops);
extern bool score_unaligned_store (rtx* ops);
extern bool score_block_move (rtx* ops);
-extern int score_address_cost (rtx addr, bool speed);
+extern int score_address_cost (rtx addr, enum machine_mode mode,
+ addr_space_t as, bool speed);
extern int score_address_p (enum machine_mode mode, rtx x, int strict);
extern int score_reg_class (int regno);
extern int score_hard_regno_mode_ok (unsigned int, enum machine_mode);
diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c
index 6d81cd60901..2eeeab9f872 100644
--- a/gcc/config/score/score.c
+++ b/gcc/config/score/score.c
@@ -1232,7 +1232,8 @@ score_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
/* Implement TARGET_ADDRESS_COST macro. */
int
-score_address_cost (rtx addr,
+score_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
bool speed ATTRIBUTE_UNUSED)
{
return score_address_insns (addr, SImode);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 5055d1ff929..10dad62b8f7 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -255,7 +255,7 @@ static int multcosts (rtx);
static bool unspec_caller_rtx_p (rtx);
static bool sh_cannot_copy_insn_p (rtx);
static bool sh_rtx_costs (rtx, int, int, int, int *, bool);
-static int sh_address_cost (rtx, bool);
+static int sh_address_cost (rtx, enum machine_mode, addr_space_t, bool);
static int sh_pr_n_sets (void);
static rtx sh_allocate_initial_value (rtx);
static reg_class_t sh_preferred_reload_class (rtx, reg_class_t);
@@ -3430,7 +3430,8 @@ disp_addr_displacement (rtx x)
/* Compute the cost of an address. */
static int
-sh_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
+sh_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED, bool speed ATTRIBUTE_UNUSED)
{
/* 'reg + disp' addressing. */
if (satisfies_constraint_Sdd (x))
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 140332eb899..fff17de9e67 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -689,7 +689,7 @@ char sparc_hard_reg_printed[8];
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS sparc_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_REGISTER_MOVE_COST
#define TARGET_REGISTER_MOVE_COST sparc_register_move_cost
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 51e0dfbb083..2fe1f3f51a0 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -7161,7 +7161,7 @@ static const struct attribute_spec spu_attribute_table[] =
#define TARGET_RTX_COSTS spu_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_SCHED_ISSUE_RATE
#define TARGET_SCHED_ISSUE_RATE spu_sched_issue_rate
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index fb0844c69f3..a6f2b5447b7 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -58,7 +58,7 @@ static void xstormy16_asm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
static void xstormy16_init_builtins (void);
static rtx xstormy16_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
static bool xstormy16_rtx_costs (rtx, int, int, int, int *, bool);
-static int xstormy16_address_cost (rtx, bool);
+static int xstormy16_address_cost (rtx, enum machine_mode, addr_space_t, bool);
static bool xstormy16_return_in_memory (const_tree, const_tree);
static GTY(()) section *bss100_section;
@@ -103,7 +103,9 @@ xstormy16_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
}
static int
-xstormy16_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
+xstormy16_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
return (CONST_INT_P (x) ? 2
: GET_CODE (x) == PLUS ? 7
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index f74c7ed49f0..95cdcb47702 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -3130,7 +3130,7 @@ static const struct attribute_spec v850_attribute_table[] =
#define TARGET_RTX_COSTS v850_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG v850_reorg
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index aa848108cf7..239b82c3895 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -53,7 +53,7 @@ static void vax_init_libfuncs (void);
static void vax_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
HOST_WIDE_INT, tree);
static int vax_address_cost_1 (rtx);
-static int vax_address_cost (rtx, bool);
+static int vax_address_cost (rtx, enum machine_mode, addr_space_t, bool);
static bool vax_rtx_costs (rtx, int, int, int, int *, bool);
static rtx vax_function_arg (cumulative_args_t, enum machine_mode,
const_tree, bool);
@@ -738,7 +738,9 @@ vax_address_cost_1 (rtx addr)
}
static int
-vax_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
+vax_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t as ATTRIBUTE_UNUSED,
+ bool speed ATTRIBUTE_UNUSED)
{
return (1 + (REG_P (x) ? 0 : vax_address_cost_1 (x)));
}
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 6fbb3f6fe31..987b6d7020f 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -211,7 +211,7 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS xtensa_rtx_costs
#undef TARGET_ADDRESS_COST
-#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
+#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
#undef TARGET_MEMBER_TYPE_FORCES_BLK
#define TARGET_MEMBER_TYPE_FORCES_BLK xtensa_member_type_forces_blk
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index a4dc7c1f5fc..11b2f9aa567 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -6440,7 +6440,7 @@ The hook returns true when all subexpressions of @var{x} have been
processed, and false when @code{rtx_cost} should recurse.
@end deftypefn
-@deftypefn {Target Hook} int TARGET_ADDRESS_COST (rtx @var{address}, bool @var{speed})
+@deftypefn {Target Hook} int TARGET_ADDRESS_COST (rtx @var{address}, enum machine_mode @var{mode}, addr_space_t @var{as}, bool @var{speed})
This hook computes the cost of an addressing mode that contains
@var{address}. If not defined, the cost is computed from
the @var{address} expression and the @code{TARGET_RTX_COST} hook.
diff --git a/gcc/hooks.c b/gcc/hooks.c
index c0046398d72..775da3c3d2f 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -200,6 +200,12 @@ hook_int_rtx_bool_0 (rtx a ATTRIBUTE_UNUSED, bool b ATTRIBUTE_UNUSED)
return 0;
}
+int
+hook_int_rtx_mode_as_bool_0 (rtx, enum machine_mode, addr_space_t, bool)
+{
+ return 0;
+}
+
unsigned int
hook_uint_void_0 (void)
{
diff --git a/gcc/hooks.h b/gcc/hooks.h
index 8eec169e78c..1774816d4e9 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -75,6 +75,8 @@ extern int hook_int_const_tree_0 (const_tree);
extern int hook_int_const_tree_const_tree_1 (const_tree, const_tree);
extern int hook_int_rtx_0 (rtx);
extern int hook_int_rtx_bool_0 (rtx, bool);
+extern int hook_int_rtx_mode_as_bool_0 (rtx, enum machine_mode, addr_space_t,
+ bool);
extern tree hook_tree_const_tree_null (const_tree);
diff --git a/gcc/output.h b/gcc/output.h
index 4a811633a44..705c02e3dc8 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -606,7 +606,7 @@ extern void default_elf_init_array_asm_out_constructor (rtx, int);
extern void default_elf_fini_array_asm_out_destructor (rtx, int);
extern int maybe_assemble_visibility (tree);
-extern int default_address_cost (rtx, bool);
+extern int default_address_cost (rtx, enum machine_mode, addr_space_t, bool);
/* Output stack usage information. */
extern void output_stack_usage (void);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 0f791e2e4df..89ca226ccab 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -3820,13 +3820,13 @@ address_cost (rtx x, enum machine_mode mode, addr_space_t as, bool speed)
if (!memory_address_addr_space_p (mode, x, as))
return 1000;
- return targetm.address_cost (x, speed);
+ return targetm.address_cost (x, mode, as, speed);
}
/* If the target doesn't override, compute the cost as with arithmetic. */
int
-default_address_cost (rtx x, bool speed)
+default_address_cost (rtx x, enum machine_mode, addr_space_t, bool speed)
{
return rtx_cost (x, MEM, 0, speed);
}
diff --git a/gcc/target.def b/gcc/target.def
index 321d64fa989..0d23c57a3fb 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1758,7 +1758,7 @@ DEFHOOK
DEFHOOK
(address_cost,
"",
- int, (rtx address, bool speed),
+ int, (rtx address, enum machine_mode mode, addr_space_t as, bool speed),
default_address_cost)
/* Return where to allocate pseudo for a given hard register initial value. */