diff options
author | Kewen Lin <linkw@linux.ibm.com> | 2023-08-09 00:02:26 -0500 |
---|---|---|
committer | Kewen Lin <linkw@linux.ibm.com> | 2023-08-09 01:16:05 -0500 |
commit | 165b1f6ad1d3969e2c23417797362d0528e65c79 (patch) | |
tree | 3144e3d741e4ecd8b97a696b5469db0f8a2aad3b /gcc/config | |
parent | b39f8bdad1c5a2c77b9005f1900cdcb9b66594ad (diff) | |
download | gcc-165b1f6ad1d3969e2c23417797362d0528e65c79.zip gcc-165b1f6ad1d3969e2c23417797362d0528e65c79.tar.gz gcc-165b1f6ad1d3969e2c23417797362d0528e65c79.tar.bz2 |
targhooks: Extend legitimate_address_p with code_helper [PR110248]
As PR110248 shows, some middle-end passes like IVOPTs can
query the target hook legitimate_address_p with some
artificially constructed rtx to determine whether some
addressing modes are supported by target for some gimple
statement. But for now the existing legitimate_address_p
only checks the given mode, it's unable to distinguish
some special cases unfortunately, for example, for LEN_LOAD
ifn on Power port, we would expand it with lxvl hardware
insn, which only supports one register to hold the address
(the other register is holding the length), that is we
don't support base (reg) + index (reg) addressing mode for
sure. But hook legitimate_address_p only considers the
given mode which would be some vector mode for LEN_LOAD
ifn, and we do support base + index addressing mode for
normal vector load and store insns, so the hook will return
true for the query unexpectedly.
This patch is to introduce one extra argument of type
code_helper for hook legitimate_address_p, it makes targets
able to handle some special case like what's described
above.
PR tree-optimization/110248
gcc/ChangeLog:
* coretypes.h (class code_helper): Add forward declaration.
* doc/tm.texi: Regenerate.
* lra-constraints.cc (valid_address_p): Call target hook
targetm.addr_space.legitimate_address_p with an extra parameter
ERROR_MARK as its prototype changes.
* recog.cc (memory_address_addr_space_p): Likewise.
* reload.cc (strict_memory_address_addr_space_p): Likewise.
* target.def (legitimate_address_p, addr_space.legitimate_address_p):
Extend with one more argument of type code_helper, update the
documentation accordingly.
* targhooks.cc (default_legitimate_address_p): Adjust for the
new code_helper argument.
(default_addr_space_legitimate_address_p): Likewise.
* targhooks.h (default_legitimate_address_p): Likewise.
(default_addr_space_legitimate_address_p): Likewise.
* config/aarch64/aarch64.cc (aarch64_legitimate_address_hook_p): Adjust
with extra unnamed code_helper argument with default ERROR_MARK.
* config/alpha/alpha.cc (alpha_legitimate_address_p): Likewise.
* config/arc/arc.cc (arc_legitimate_address_p): Likewise.
* config/arm/arm-protos.h (arm_legitimate_address_p): Likewise.
(tree.h): New include for tree_code ERROR_MARK.
* config/arm/arm.cc (arm_legitimate_address_p): Adjust with extra
unnamed code_helper argument with default ERROR_MARK.
* config/avr/avr.cc (avr_addr_space_legitimate_address_p): Likewise.
* config/bfin/bfin.cc (bfin_legitimate_address_p): Likewise.
* config/bpf/bpf.cc (bpf_legitimate_address_p): Likewise.
* config/c6x/c6x.cc (c6x_legitimate_address_p): Likewise.
* config/cris/cris-protos.h (cris_legitimate_address_p): Likewise.
(tree.h): New include for tree_code ERROR_MARK.
* config/cris/cris.cc (cris_legitimate_address_p): Adjust with extra
unnamed code_helper argument with default ERROR_MARK.
* config/csky/csky.cc (csky_legitimate_address_p): Likewise.
* config/epiphany/epiphany.cc (epiphany_legitimate_address_p):
Likewise.
* config/frv/frv.cc (frv_legitimate_address_p): Likewise.
* config/ft32/ft32.cc (ft32_addr_space_legitimate_address_p): Likewise.
* config/gcn/gcn.cc (gcn_addr_space_legitimate_address_p): Likewise.
* config/h8300/h8300.cc (h8300_legitimate_address_p): Likewise.
* config/i386/i386.cc (ix86_legitimate_address_p): Likewise.
* config/ia64/ia64.cc (ia64_legitimate_address_p): Likewise.
* config/iq2000/iq2000.cc (iq2000_legitimate_address_p): Likewise.
* config/lm32/lm32.cc (lm32_legitimate_address_p): Likewise.
* config/loongarch/loongarch.cc (loongarch_legitimate_address_p):
Likewise.
* config/m32c/m32c.cc (m32c_legitimate_address_p): Likewise.
(m32c_addr_space_legitimate_address_p): Likewise.
* config/m32r/m32r.cc (m32r_legitimate_address_p): Likewise.
* config/m68k/m68k.cc (m68k_legitimate_address_p): Likewise.
* config/mcore/mcore.cc (mcore_legitimate_address_p): Likewise.
* config/microblaze/microblaze-protos.h (tree.h): New include for
tree_code ERROR_MARK.
(microblaze_legitimate_address_p): Adjust with extra unnamed
code_helper argument with default ERROR_MARK.
* config/microblaze/microblaze.cc (microblaze_legitimate_address_p):
Likewise.
* config/mips/mips.cc (mips_legitimate_address_p): Likewise.
* config/mmix/mmix.cc (mmix_legitimate_address_p): Likewise.
* config/mn10300/mn10300.cc (mn10300_legitimate_address_p): Likewise.
* config/moxie/moxie.cc (moxie_legitimate_address_p): Likewise.
* config/msp430/msp430.cc (msp430_legitimate_address_p): Likewise.
(msp430_addr_space_legitimate_address_p): Adjust with extra code_helper
argument with default ERROR_MARK and adjust the call to function
msp430_legitimate_address_p.
* config/nds32/nds32.cc (nds32_legitimate_address_p): Adjust with extra
unnamed code_helper argument with default ERROR_MARK.
* config/nios2/nios2.cc (nios2_legitimate_address_p): Likewise.
* config/nvptx/nvptx.cc (nvptx_legitimate_address_p): Likewise.
* config/or1k/or1k.cc (or1k_legitimate_address_p): Likewise.
* config/pa/pa.cc (pa_legitimate_address_p): Likewise.
* config/pdp11/pdp11.cc (pdp11_legitimate_address_p): Likewise.
* config/pru/pru.cc (pru_addr_space_legitimate_address_p): Likewise.
* config/riscv/riscv.cc (riscv_legitimate_address_p): Likewise.
* config/rl78/rl78-protos.h (rl78_as_legitimate_address): Likewise.
(tree.h): New include for tree_code ERROR_MARK.
* config/rl78/rl78.cc (rl78_as_legitimate_address): Adjust with
extra unnamed code_helper argument with default ERROR_MARK.
* config/rs6000/rs6000.cc (rs6000_legitimate_address_p): Likewise.
(rs6000_debug_legitimate_address_p): Adjust with extra code_helper
argument and adjust the call to function rs6000_legitimate_address_p.
* config/rx/rx.cc (rx_is_legitimate_address): Adjust with extra
unnamed code_helper argument with default ERROR_MARK.
* config/s390/s390.cc (s390_legitimate_address_p): Likewise.
* config/sh/sh.cc (sh_legitimate_address_p): Likewise.
* config/sparc/sparc.cc (sparc_legitimate_address_p): Likewise.
* config/v850/v850.cc (v850_legitimate_address_p): Likewise.
* config/vax/vax.cc (vax_legitimate_address_p): Likewise.
* config/visium/visium.cc (visium_legitimate_address_p): Likewise.
* config/xtensa/xtensa.cc (xtensa_legitimate_address_p): Likewise.
* config/stormy16/stormy16-protos.h (xstormy16_legitimate_address_p):
Likewise.
(tree.h): New include for tree_code ERROR_MARK.
* config/stormy16/stormy16.cc (xstormy16_legitimate_address_p):
Adjust with extra unnamed code_helper argument with default
ERROR_MARK.
Diffstat (limited to 'gcc/config')
54 files changed, 149 insertions, 87 deletions
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 7cd230c..eba5d4a 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -11182,7 +11182,8 @@ aarch64_classify_symbolic_expression (rtx x) /* Return TRUE if X is a legitimate address for accessing memory in mode MODE. */ static bool -aarch64_legitimate_address_hook_p (machine_mode mode, rtx x, bool strict_p) +aarch64_legitimate_address_hook_p (machine_mode mode, rtx x, bool strict_p, + code_helper = ERROR_MARK) { struct aarch64_address_info addr; diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc index beeab06..db6b34b 100644 --- a/gcc/config/alpha/alpha.cc +++ b/gcc/config/alpha/alpha.cc @@ -844,7 +844,8 @@ alpha_linkage_symbol_p (const char *symname) low-order three bits; this is an "unaligned" access. */ static bool -alpha_legitimate_address_p (machine_mode mode, rtx x, bool strict) +alpha_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper = ERROR_MARK) { /* If this is an ldq_u type address, discard the outer AND. */ if (mode == DImode diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc index fef8a50..266ba8b 100644 --- a/gcc/config/arc/arc.cc +++ b/gcc/config/arc/arc.cc @@ -6715,7 +6715,8 @@ arc_legitimate_constant_p (machine_mode mode, rtx x) } static bool -arc_legitimate_address_p (machine_mode mode, rtx x, bool strict) +arc_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper = ERROR_MARK) { if (RTX_OK_FOR_BASE_P (x, strict)) return true; diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 6186921..77e7633 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -23,6 +23,7 @@ #define GCC_ARM_PROTOS_H #include "sbitmap.h" +#include "tree.h" /* For ERROR_MARK. */ rtl_opt_pass *make_pass_insert_bti (gcc::context *ctxt); @@ -83,7 +84,8 @@ extern int arm_split_constant (RTX_CODE, machine_mode, rtx, extern int legitimate_pic_operand_p (rtx); extern rtx legitimize_pic_address (rtx, machine_mode, rtx, rtx, bool); extern rtx legitimize_tls_address (rtx, rtx); -extern bool arm_legitimate_address_p (machine_mode, rtx, bool); +extern bool arm_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); extern int arm_legitimate_address_outer_p (machine_mode, rtx, RTX_CODE, int); extern int thumb_legitimate_offset_p (machine_mode, HOST_WIDE_INT); extern int thumb1_legitimate_address_p (machine_mode, rtx, int); diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index 38f0839..6e933c8 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -9171,7 +9171,7 @@ thumb_legitimate_offset_p (machine_mode mode, HOST_WIDE_INT val) } bool -arm_legitimate_address_p (machine_mode mode, rtx x, bool strict_p) +arm_legitimate_address_p (machine_mode mode, rtx x, bool strict_p, code_helper) { if (TARGET_ARM) return arm_legitimate_address_outer_p (mode, x, SET, strict_p); diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc index 25f3f4c..5e0217d 100644 --- a/gcc/config/avr/avr.cc +++ b/gcc/config/avr/avr.cc @@ -13433,8 +13433,8 @@ avr_reg_ok_for_pgm_addr (rtx reg, bool strict) /* Implement `TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P'. */ static bool -avr_addr_space_legitimate_address_p (machine_mode mode, rtx x, - bool strict, addr_space_t as) +avr_addr_space_legitimate_address_p (machine_mode mode, rtx x, bool strict, + addr_space_t as, code_helper = ERROR_MARK) { bool ok = false; diff --git a/gcc/config/bfin/bfin.cc b/gcc/config/bfin/bfin.cc index 4320ec2..5718bab 100644 --- a/gcc/config/bfin/bfin.cc +++ b/gcc/config/bfin/bfin.cc @@ -2718,7 +2718,8 @@ bfin_valid_reg_p (unsigned int regno, int strict, machine_mode mode, */ static bool -bfin_legitimate_address_p (machine_mode mode, rtx x, bool strict) +bfin_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper = ERROR_MARK) { switch (GET_CODE (x)) { case REG: diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index 4873475..33218b3 100644 --- a/gcc/config/bpf/bpf.cc +++ b/gcc/config/bpf/bpf.cc @@ -625,7 +625,8 @@ bpf_address_base_p (rtx x, bool strict) static bool bpf_legitimate_address_p (machine_mode mode, rtx x, - bool strict) + bool strict, + code_helper = ERROR_MARK) { switch (GET_CODE (x)) { diff --git a/gcc/config/c6x/c6x.cc b/gcc/config/c6x/c6x.cc index 0c9cb82..72e8b4c 100644 --- a/gcc/config/c6x/c6x.cc +++ b/gcc/config/c6x/c6x.cc @@ -2444,7 +2444,8 @@ c6x_legitimate_address_p_1 (machine_mode mode, rtx x, bool strict, } static bool -c6x_legitimate_address_p (machine_mode mode, rtx x, bool strict) +c6x_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper = ERROR_MARK) { return c6x_legitimate_address_p_1 (mode, x, strict, false); } diff --git a/gcc/config/cris/cris-protos.h b/gcc/config/cris/cris-protos.h index 666e04f..5855594 100644 --- a/gcc/config/cris/cris-protos.h +++ b/gcc/config/cris/cris-protos.h @@ -20,6 +20,8 @@ along with GCC; see the file COPYING3. If not see /* Prototypes for the CRIS port. */ +#include "tree.h" /* For ERROR_MARK. */ + extern bool cris_simple_epilogue (void); #ifdef RTX_CODE extern const char *cris_op_str (rtx); @@ -34,7 +36,8 @@ extern bool cris_base_or_autoincr_p (const_rtx, bool); extern bool cris_bdap_index_p (const_rtx, bool); extern void cris_reduce_compare (rtx *, rtx *, rtx *); extern bool cris_biap_index_p (const_rtx, bool); -extern bool cris_legitimate_address_p (machine_mode, rtx, bool); +extern bool cris_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); extern bool cris_store_multiple_op_p (rtx); extern bool cris_movem_load_rest_p (rtx); extern void cris_asm_output_symbol_ref (FILE *, rtx); diff --git a/gcc/config/cris/cris.cc b/gcc/config/cris/cris.cc index f04f501..853c079 100644 --- a/gcc/config/cris/cris.cc +++ b/gcc/config/cris/cris.cc @@ -1537,7 +1537,7 @@ cris_biap_index_p (const_rtx x, bool strict) /* Worker function for TARGET_LEGITIMATE_ADDRESS_P. */ bool -cris_legitimate_address_p (machine_mode mode, rtx x, bool strict) +cris_legitimate_address_p (machine_mode mode, rtx x, bool strict, code_helper) { const_rtx x1, x2; diff --git a/gcc/config/csky/csky.cc b/gcc/config/csky/csky.cc index b4ee3b2..731f47c 100644 --- a/gcc/config/csky/csky.cc +++ b/gcc/config/csky/csky.cc @@ -3186,7 +3186,8 @@ csky_legitimate_index_p (machine_mode mode, rtx index, int strict_p) be recognized. */ static bool -csky_legitimate_address_p (machine_mode mode, rtx addr, bool strict_p) +csky_legitimate_address_p (machine_mode mode, rtx addr, bool strict_p, + code_helper = ERROR_MARK) { enum rtx_code code = GET_CODE (addr); diff --git a/gcc/config/epiphany/epiphany.cc b/gcc/config/epiphany/epiphany.cc index 60a2845..a5460db 100644 --- a/gcc/config/epiphany/epiphany.cc +++ b/gcc/config/epiphany/epiphany.cc @@ -2053,7 +2053,8 @@ epiphany_adjust_cost (rtx_insn *insn, int dep_type, rtx_insn *dep_insn, || RTX_OK_FOR_OFFSET_P (MODE, XEXP (X, 1)))) static bool -epiphany_legitimate_address_p (machine_mode mode, rtx x, bool strict) +epiphany_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper = ERROR_MARK) { #define REG_OK_FOR_BASE_P(X) \ (strict ? GPR_P (REGNO (X)) : GPR_AP_OR_PSEUDO_P (REGNO (X))) diff --git a/gcc/config/frv/frv.cc b/gcc/config/frv/frv.cc index 2dbaa75..03976ba 100644 --- a/gcc/config/frv/frv.cc +++ b/gcc/config/frv/frv.cc @@ -261,7 +261,8 @@ static frv_stack_t *frv_stack_cache = (frv_stack_t *)0; /* Forward references */ static void frv_option_override (void); -static bool frv_legitimate_address_p (machine_mode, rtx, bool); +static bool frv_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static int frv_default_flags_for_cpu (void); static FRV_INLINE bool frv_small_data_reloc_p (rtx, int); static void frv_print_operand (FILE *, rtx, int); @@ -3396,7 +3397,7 @@ frv_legitimate_address_p_1 (machine_mode mode, } bool -frv_legitimate_address_p (machine_mode mode, rtx x, bool strict_p) +frv_legitimate_address_p (machine_mode mode, rtx x, bool strict_p, code_helper) { return frv_legitimate_address_p_1 (mode, x, strict_p, FALSE, FALSE); } diff --git a/gcc/config/ft32/ft32.cc b/gcc/config/ft32/ft32.cc index 806ab76..059243d 100644 --- a/gcc/config/ft32/ft32.cc +++ b/gcc/config/ft32/ft32.cc @@ -856,7 +856,8 @@ reg_ok_for_base_p (rtx r, bool strict) static bool ft32_addr_space_legitimate_address_p (machine_mode mode, rtx x, bool strict, - addr_space_t as ATTRIBUTE_UNUSED) + addr_space_t as ATTRIBUTE_UNUSED, + code_helper = ERROR_MARK) { int max_offset = TARGET_FT32B ? 16384 : 128; diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index 02f4ded..f6cff65 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -1654,7 +1654,7 @@ gcn_global_address_p (rtx addr) static bool gcn_addr_space_legitimate_address_p (machine_mode mode, rtx x, bool strict, - addr_space_t as) + addr_space_t as, code_helper = ERROR_MARK) { /* All vector instructions need to work on addresses in registers. */ if (!TARGET_GCN5_PLUS && (vgpr_vector_mode_p (mode) && !REG_P (x))) diff --git a/gcc/config/h8300/h8300.cc b/gcc/config/h8300/h8300.cc index cdf74c1..4bbb1b7 100644 --- a/gcc/config/h8300/h8300.cc +++ b/gcc/config/h8300/h8300.cc @@ -5312,7 +5312,8 @@ h8300_rtx_ok_for_base_p (rtx x, int strict) CONSTANT_ADDRESS. */ static bool -h8300_legitimate_address_p (machine_mode mode, rtx x, bool strict) +h8300_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper = ERROR_MARK) { /* The register indirect addresses like @er0 is always valid. */ if (h8300_rtx_ok_for_base_p (x, strict)) diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 5d57726..d592ece 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -11040,7 +11040,8 @@ ix86_validate_address_register (rtx op) be recognized. */ static bool -ix86_legitimate_address_p (machine_mode, rtx addr, bool strict) +ix86_legitimate_address_p (machine_mode, rtx addr, bool strict, + code_helper = ERROR_MARK) { struct ix86_address parts; rtx base, index, disp; diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc index 92f34dd..c241e1a 100644 --- a/gcc/config/ia64/ia64.cc +++ b/gcc/config/ia64/ia64.cc @@ -313,7 +313,8 @@ static tree ia64_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *); static bool ia64_scalar_mode_supported_p (scalar_mode mode); static bool ia64_vector_mode_supported_p (machine_mode mode); static bool ia64_legitimate_constant_p (machine_mode, rtx); -static bool ia64_legitimate_address_p (machine_mode, rtx, bool); +static bool ia64_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static bool ia64_cannot_force_const_mem (machine_mode, rtx); static const char *ia64_mangle_type (const_tree); static const char *ia64_invalid_conversion (const_tree, const_tree); @@ -1024,8 +1025,8 @@ ia64_legitimate_address_disp (const_rtx reg, const_rtx disp, bool strict) /* Implement TARGET_LEGITIMATE_ADDRESS_P. */ static bool -ia64_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, - rtx x, bool strict) +ia64_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x, + bool strict, code_helper) { if (ia64_legitimate_address_reg (x, strict)) return true; diff --git a/gcc/config/iq2000/iq2000.cc b/gcc/config/iq2000/iq2000.cc index 733feca..54404e8 100644 --- a/gcc/config/iq2000/iq2000.cc +++ b/gcc/config/iq2000/iq2000.cc @@ -170,7 +170,8 @@ static pad_direction iq2000_function_arg_padding (machine_mode, const_tree); static unsigned int iq2000_function_arg_boundary (machine_mode, const_tree); static void iq2000_va_start (tree, rtx); -static bool iq2000_legitimate_address_p (machine_mode, rtx, bool); +static bool iq2000_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static bool iq2000_can_eliminate (const int, const int); static void iq2000_asm_trampoline_template (FILE *); static void iq2000_trampoline_init (rtx, tree, rtx); @@ -304,7 +305,8 @@ iq2000_reg_mode_ok_for_base_p (rtx reg, function is called during reload. */ bool -iq2000_legitimate_address_p (machine_mode mode, rtx xinsn, bool strict) +iq2000_legitimate_address_p (machine_mode mode, rtx xinsn, bool strict, + code_helper) { if (TARGET_DEBUG_A_MODE) { diff --git a/gcc/config/lm32/lm32.cc b/gcc/config/lm32/lm32.cc index 6528358..9d65d66 100644 --- a/gcc/config/lm32/lm32.cc +++ b/gcc/config/lm32/lm32.cc @@ -69,8 +69,8 @@ static void lm32_setup_incoming_varargs (cumulative_args_t cum, static bool lm32_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno, int *total, bool speed); static bool lm32_can_eliminate (const int, const int); -static bool -lm32_legitimate_address_p (machine_mode mode, rtx x, bool strict); +static bool lm32_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper = ERROR_MARK); static HOST_WIDE_INT lm32_compute_frame_size (int size); static void lm32_option_override (void); static rtx lm32_function_arg (cumulative_args_t, const function_arg_info &); @@ -1192,7 +1192,8 @@ lm32_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to) /* Implement TARGET_LEGITIMATE_ADDRESS_P. */ static bool -lm32_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) +lm32_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x, + bool strict, code_helper) { /* (rM) */ if (strict && REG_P (x) && STRICT_REG_OK_FOR_BASE_P (x)) diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 5b8b93e..86d5878 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -2096,7 +2096,8 @@ loongarch_classify_address (struct loongarch_address_info *info, rtx x, /* Implement TARGET_LEGITIMATE_ADDRESS_P. */ static bool -loongarch_legitimate_address_p (machine_mode mode, rtx x, bool strict_p) +loongarch_legitimate_address_p (machine_mode mode, rtx x, bool strict_p, + code_helper = ERROR_MARK) { struct loongarch_address_info addr; diff --git a/gcc/config/m32c/m32c.cc b/gcc/config/m32c/m32c.cc index 65971d6..e18efc3 100644 --- a/gcc/config/m32c/m32c.cc +++ b/gcc/config/m32c/m32c.cc @@ -75,8 +75,11 @@ static int m32c_comp_type_attributes (const_tree, const_tree); static bool m32c_fixed_condition_code_regs (unsigned int *, unsigned int *); static struct machine_function *m32c_init_machine_status (void); static void m32c_insert_attributes (tree, tree *); -static bool m32c_legitimate_address_p (machine_mode, rtx, bool); -static bool m32c_addr_space_legitimate_address_p (machine_mode, rtx, bool, addr_space_t); +static bool m32c_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); +static bool m32c_addr_space_legitimate_address_p (machine_mode, rtx, bool, + addr_space_t, + code_helper = ERROR_MARK); static rtx m32c_function_arg (cumulative_args_t, const function_arg_info &); static bool m32c_pass_by_reference (cumulative_args_t, const function_arg_info &); @@ -1648,7 +1651,7 @@ m32c_trampoline_init (rtx m_tramp, tree fndecl, rtx chainval) #undef TARGET_LEGITIMATE_ADDRESS_P #define TARGET_LEGITIMATE_ADDRESS_P m32c_legitimate_address_p bool -m32c_legitimate_address_p (machine_mode mode, rtx x, bool strict) +m32c_legitimate_address_p (machine_mode mode, rtx x, bool strict, code_helper) { int mode_adjust; if (CONSTANT_P (x)) @@ -1966,8 +1969,8 @@ m32c_addr_space_address_mode (addr_space_t addrspace) #define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P \ m32c_addr_space_legitimate_address_p static bool -m32c_addr_space_legitimate_address_p (machine_mode mode, rtx x, - bool strict, addr_space_t as) +m32c_addr_space_legitimate_address_p (machine_mode mode, rtx x, bool strict, + addr_space_t as, code_helper ch) { if (as == ADDR_SPACE_FAR) { @@ -2048,7 +2051,7 @@ m32c_addr_space_legitimate_address_p (machine_mode mode, rtx x, else if (as != ADDR_SPACE_GENERIC) gcc_unreachable (); - return m32c_legitimate_address_p (mode, x, strict); + return m32c_legitimate_address_p (mode, x, strict, ch); } /* Like m32c_legitimate_address, except with named address support. */ diff --git a/gcc/config/m32r/m32r.cc b/gcc/config/m32r/m32r.cc index 155a248..63a1798 100644 --- a/gcc/config/m32r/m32r.cc +++ b/gcc/config/m32r/m32r.cc @@ -66,7 +66,8 @@ static void m32r_option_override (void); static void init_reg_tables (void); static void block_move_call (rtx, rtx, rtx); static int m32r_is_insn (rtx); -static bool m32r_legitimate_address_p (machine_mode, rtx, bool); +static bool m32r_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static rtx m32r_legitimize_address (rtx, rtx, machine_mode); static bool m32r_mode_dependent_address_p (const_rtx, addr_space_t); static tree m32r_handle_model_attribute (tree *, tree, tree, int, bool *); @@ -2913,7 +2914,7 @@ m32r_store_preinc_predec_p (machine_mode mode, const_rtx x, bool strict) /* Implement TARGET_LEGITIMATE_ADDRESS_P. */ static bool -m32r_legitimate_address_p (machine_mode mode, rtx x, bool strict) +m32r_legitimate_address_p (machine_mode mode, rtx x, bool strict, code_helper) { if (m32r_rtx_ok_for_base_p (x, strict) || m32r_legitimate_offset_addres_p (mode, x, strict) diff --git a/gcc/config/m68k/m68k.cc b/gcc/config/m68k/m68k.cc index 03db2b6..145a92d 100644 --- a/gcc/config/m68k/m68k.cc +++ b/gcc/config/m68k/m68k.cc @@ -158,7 +158,8 @@ static int m68k_sched_first_cycle_multipass_dfa_lookahead (void); static bool m68k_can_eliminate (const int, const int); static void m68k_conditional_register_usage (void); -static bool m68k_legitimate_address_p (machine_mode, rtx, bool); +static bool m68k_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static void m68k_option_override (void); static void m68k_override_options_after_change (void); static rtx find_addr_reg (rtx); @@ -2311,7 +2312,7 @@ m68k_decompose_address (machine_mode mode, rtx x, STRICT_P says whether strict checking is needed. */ bool -m68k_legitimate_address_p (machine_mode mode, rtx x, bool strict_p) +m68k_legitimate_address_p (machine_mode mode, rtx x, bool strict_p, code_helper) { struct m68k_address address; diff --git a/gcc/config/mcore/mcore.cc b/gcc/config/mcore/mcore.cc index e933b03..6f1d7af 100644 --- a/gcc/config/mcore/mcore.cc +++ b/gcc/config/mcore/mcore.cc @@ -144,7 +144,8 @@ static bool mcore_warn_func_return (tree); static void mcore_option_override (void); static bool mcore_legitimate_constant_p (machine_mode, rtx); static bool mcore_legitimate_address_p (machine_mode, rtx, bool, - addr_space_t); + addr_space_t, + code_helper = ERROR_MARK); static bool mcore_hard_regno_mode_ok (unsigned int, machine_mode); static bool mcore_modes_tieable_p (machine_mode, machine_mode); @@ -3249,7 +3250,7 @@ mcore_legitimate_index_p (machine_mode mode, const_rtx op) static bool mcore_legitimate_address_p (machine_mode mode, rtx x, bool strict_p, - addr_space_t as) + addr_space_t as, code_helper) { gcc_assert (ADDR_SPACE_GENERIC_P (as)); diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h index 31a6515..93fd8d1 100644 --- a/gcc/config/microblaze/microblaze-protos.h +++ b/gcc/config/microblaze/microblaze-protos.h @@ -22,6 +22,8 @@ #ifndef GCC_MICROBLAZE_PROTOS_H #define GCC_MICROBLAZE_PROTOS_H +#include "tree.h" /* For ERROR_MARK. */ + #ifdef RTX_CODE extern int pic_address_needs_scratch (rtx); extern bool microblaze_constant_address_p (rtx x); @@ -40,7 +42,8 @@ extern int microblaze_can_use_return_insn (void); extern void print_operand (FILE *, rtx, int); extern void print_operand_address (FILE *, rtx); extern void init_cumulative_args (CUMULATIVE_ARGS *,tree, rtx); -extern bool microblaze_legitimate_address_p (machine_mode, rtx, bool); +extern bool microblaze_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); extern int microblaze_is_interrupt_variant (void); extern int microblaze_is_break_handler (void); extern int microblaze_break_function_p (tree func); diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc index cbabf1a..c9f6c41 100644 --- a/gcc/config/microblaze/microblaze.cc +++ b/gcc/config/microblaze/microblaze.cc @@ -919,7 +919,8 @@ microblaze_classify_address (struct microblaze_address_info *info, rtx x, is called during reload. */ bool -microblaze_legitimate_address_p (machine_mode mode, rtx x, bool strict) +microblaze_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper) { struct microblaze_address_info addr; diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc index f986102..a304e1c 100644 --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc @@ -2696,7 +2696,8 @@ mips_classify_address (struct mips_address_info *info, rtx x, /* Implement TARGET_LEGITIMATE_ADDRESS_P. */ static bool -mips_legitimate_address_p (machine_mode mode, rtx x, bool strict_p) +mips_legitimate_address_p (machine_mode mode, rtx x, bool strict_p, + code_helper = ERROR_MARK) { struct mips_address_info addr; diff --git a/gcc/config/mmix/mmix.cc b/gcc/config/mmix/mmix.cc index 1d36306..3474309 100644 --- a/gcc/config/mmix/mmix.cc +++ b/gcc/config/mmix/mmix.cc @@ -132,7 +132,8 @@ static void mmix_target_asm_function_end_prologue (FILE *); static void mmix_target_asm_function_epilogue (FILE *); static reg_class_t mmix_preferred_reload_class (rtx, reg_class_t); static reg_class_t mmix_preferred_output_reload_class (rtx, reg_class_t); -static bool mmix_legitimate_address_p (machine_mode, rtx, bool); +static bool mmix_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static bool mmix_legitimate_constant_p (machine_mode, rtx); static void mmix_reorg (void); static void mmix_asm_output_mi_thunk @@ -1109,7 +1110,8 @@ mmix_constant_address_p (rtx x) bool mmix_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x, - bool strict_checking) + bool strict_checking, + code_helper) { #define MMIX_REG_OK(X) \ ((strict_checking \ diff --git a/gcc/config/mn10300/mn10300.cc b/gcc/config/mn10300/mn10300.cc index a8b01a5..cd1de1b 100644 --- a/gcc/config/mn10300/mn10300.cc +++ b/gcc/config/mn10300/mn10300.cc @@ -1932,7 +1932,8 @@ mn10300_legitimate_pic_operand_p (rtx x) function record_unscaled_index_insn_codes. */ static bool -mn10300_legitimate_address_p (machine_mode mode, rtx x, bool strict) +mn10300_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper = ERROR_MARK) { rtx base, index; diff --git a/gcc/config/moxie/moxie.cc b/gcc/config/moxie/moxie.cc index 2132b6e..209d030 100644 --- a/gcc/config/moxie/moxie.cc +++ b/gcc/config/moxie/moxie.cc @@ -577,7 +577,8 @@ moxie_reg_ok_for_base_p (const_rtx reg, bool strict_p) static bool moxie_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict_p, - addr_space_t as) + addr_space_t as, + code_helper = ERROR_MARK) { gcc_assert (ADDR_SPACE_GENERIC_P (as)); diff --git a/gcc/config/msp430/msp430.cc b/gcc/config/msp430/msp430.cc index 6f9c561..061a9c7 100644 --- a/gcc/config/msp430/msp430.cc +++ b/gcc/config/msp430/msp430.cc @@ -927,7 +927,8 @@ reg_ok_for_addr (rtx r, bool strict) bool msp430_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED, - bool strict ATTRIBUTE_UNUSED) + bool strict ATTRIBUTE_UNUSED, + code_helper = ERROR_MARK) { switch (GET_CODE (x)) { @@ -980,9 +981,10 @@ bool msp430_addr_space_legitimate_address_p (machine_mode mode, rtx x, bool strict, - addr_space_t as ATTRIBUTE_UNUSED) + addr_space_t as ATTRIBUTE_UNUSED, + code_helper ch = ERROR_MARK) { - return msp430_legitimate_address_p (mode, x, strict); + return msp430_legitimate_address_p (mode, x, strict, ch); } #undef TARGET_ASM_INTEGER diff --git a/gcc/config/nds32/nds32.cc b/gcc/config/nds32/nds32.cc index 91ed91d..1f8de2a 100644 --- a/gcc/config/nds32/nds32.cc +++ b/gcc/config/nds32/nds32.cc @@ -2565,7 +2565,8 @@ nds32_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) /* Addressing Modes. */ static bool -nds32_legitimate_address_p (machine_mode mode, rtx x, bool strict) +nds32_legitimate_address_p (machine_mode mode, rtx x, bool strict, + code_helper = ERROR_MARK) { if (TARGET_FPU_SINGLE || TARGET_FPU_DOUBLE) { diff --git a/gcc/config/nios2/nios2.cc b/gcc/config/nios2/nios2.cc index 936eb34..b435d74 100644 --- a/gcc/config/nios2/nios2.cc +++ b/gcc/config/nios2/nios2.cc @@ -2141,8 +2141,9 @@ nios2_valid_addr_expr_p (rtx base, rtx offset, bool strict_p) /* Implement TARGET_LEGITIMATE_ADDRESS_P. */ static bool -nios2_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, - rtx operand, bool strict_p) +nios2_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, rtx operand, + bool strict_p, + code_helper = ERROR_MARK) { switch (GET_CODE (operand)) { diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc index 16ed780..edef39f 100644 --- a/gcc/config/nvptx/nvptx.cc +++ b/gcc/config/nvptx/nvptx.cc @@ -2202,7 +2202,7 @@ nvptx_gen_shared_bcast (rtx reg, propagate_mask pm, unsigned rep, /* Returns true if X is a valid address for use in a memory reference. */ static bool -nvptx_legitimate_address_p (machine_mode, rtx x, bool) +nvptx_legitimate_address_p (machine_mode, rtx x, bool, code_helper) { enum rtx_code code = GET_CODE (x); diff --git a/gcc/config/or1k/or1k.cc b/gcc/config/or1k/or1k.cc index ec30bc8..5eeed0e 100644 --- a/gcc/config/or1k/or1k.cc +++ b/gcc/config/or1k/or1k.cc @@ -575,7 +575,8 @@ or1k_initial_elimination_offset (int from, int to) Returns true if X is a legitimate address RTX on OpenRISC. */ static bool -or1k_legitimate_address_p (machine_mode, rtx x, bool strict_p) +or1k_legitimate_address_p (machine_mode, rtx x, bool strict_p, + code_helper = ERROR_MARK) { rtx base, addend; diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc index 0fa9e5f..2e906cf 100644 --- a/gcc/config/pa/pa.cc +++ b/gcc/config/pa/pa.cc @@ -196,7 +196,8 @@ static section *pa_function_section (tree, enum node_frequency, bool, bool); static bool pa_cannot_force_const_mem (machine_mode, rtx); static bool pa_legitimate_constant_p (machine_mode, rtx); static unsigned int pa_section_type_flags (tree, const char *, int); -static bool pa_legitimate_address_p (machine_mode, rtx, bool); +static bool pa_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static bool pa_callee_copies (cumulative_args_t, const function_arg_info &); static unsigned int pa_hard_regno_nregs (unsigned int, machine_mode); static bool pa_hard_regno_mode_ok (unsigned int, machine_mode); @@ -10787,7 +10788,7 @@ pa_section_type_flags (tree decl, const char *name, int reloc) output as REG+SMALLINT. */ static bool -pa_legitimate_address_p (machine_mode mode, rtx x, bool strict) +pa_legitimate_address_p (machine_mode mode, rtx x, bool strict, code_helper) { if ((REG_P (x) && (strict ? STRICT_REG_OK_FOR_BASE_P (x) diff --git a/gcc/config/pdp11/pdp11.cc b/gcc/config/pdp11/pdp11.cc index 311a1d2..78c1927 100644 --- a/gcc/config/pdp11/pdp11.cc +++ b/gcc/config/pdp11/pdp11.cc @@ -1615,8 +1615,8 @@ pdp11_secondary_memory_needed (machine_mode, reg_class_t c1, reg_class_t c2) */ static bool -pdp11_legitimate_address_p (machine_mode mode, - rtx operand, bool strict) +pdp11_legitimate_address_p (machine_mode mode, rtx operand, bool strict, + code_helper = ERROR_MARK) { rtx xfoob; diff --git a/gcc/config/pru/pru.cc b/gcc/config/pru/pru.cc index e855bbb..6e8112b 100644 --- a/gcc/config/pru/pru.cc +++ b/gcc/config/pru/pru.cc @@ -1466,7 +1466,8 @@ int pru_symref2ioregno (rtx op) /* Implement TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P. */ static bool pru_addr_space_legitimate_address_p (machine_mode mode, rtx operand, - bool strict_p, addr_space_t as) + bool strict_p, addr_space_t as, + code_helper = ERROR_MARK) { if (as == ADDR_SPACE_REGIO) { diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index e277c13..77892da 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -1213,7 +1213,8 @@ riscv_classify_address (struct riscv_address_info *info, rtx x, /* Implement TARGET_LEGITIMATE_ADDRESS_P. */ static bool -riscv_legitimate_address_p (machine_mode mode, rtx x, bool strict_p) +riscv_legitimate_address_p (machine_mode mode, rtx x, bool strict_p, + code_helper = ERROR_MARK) { struct riscv_address_info addr; diff --git a/gcc/config/rl78/rl78-protos.h b/gcc/config/rl78/rl78-protos.h index 7d474ff..813459a 100644 --- a/gcc/config/rl78/rl78-protos.h +++ b/gcc/config/rl78/rl78-protos.h @@ -18,6 +18,9 @@ along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ + +#include "tree.h" /* For ERROR_MARK. */ + const char * rl78_addsi3_internal (rtx *, unsigned int); void rl78_emit_eh_epilogue (rtx); void rl78_expand_compare (rtx *); @@ -33,7 +36,8 @@ int rl78_far_p (rtx x); bool rl78_hl_b_c_addr_p (rtx); int rl78_initial_elimination_offset (int, int); bool rl78_as_legitimate_address (machine_mode, rtx, - bool, addr_space_t); + bool, addr_space_t, + code_helper = ERROR_MARK); int rl78_legitimize_reload_address (rtx *, machine_mode, int,int, int); enum reg_class rl78_mode_code_base_reg_class (machine_mode, addr_space_t, int, int); bool rl78_peep_movhi_p (rtx *); diff --git a/gcc/config/rl78/rl78.cc b/gcc/config/rl78/rl78.cc index 9083096..0cbd6bf 100644 --- a/gcc/config/rl78/rl78.cc +++ b/gcc/config/rl78/rl78.cc @@ -1143,7 +1143,8 @@ rl78_is_legitimate_constant (machine_mode mode ATTRIBUTE_UNUSED, rtx x ATTRIBUTE bool rl78_as_legitimate_address (machine_mode mode ATTRIBUTE_UNUSED, rtx x, - bool strict ATTRIBUTE_UNUSED, addr_space_t as ATTRIBUTE_UNUSED) + bool strict ATTRIBUTE_UNUSED, + addr_space_t as ATTRIBUTE_UNUSED, code_helper) { rtx base, index, addend; bool is_far_addr = false; diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 44b448d..3e0417a 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -1109,7 +1109,8 @@ struct processor_costs ppca2_cost = { static tree (*rs6000_veclib_handler) (combined_fn, tree, tree); -static bool rs6000_debug_legitimate_address_p (machine_mode, rtx, bool); +static bool rs6000_debug_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *); static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *); static tree rs6000_handle_struct_attribute (tree *, tree, tree, int, bool *); @@ -9883,7 +9884,8 @@ use_toc_relative_ref (rtx sym, machine_mode mode) because adjacent memory cells are accessed by adding word-sized offsets during assembly output. */ static bool -rs6000_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict) +rs6000_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict, + code_helper = ERROR_MARK) { bool reg_offset_p = reg_offset_addressing_ok_p (mode); bool quad_offset_p = mode_supports_dq_form (mode); @@ -9986,10 +9988,10 @@ rs6000_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict) /* Debug version of rs6000_legitimate_address_p. */ static bool -rs6000_debug_legitimate_address_p (machine_mode mode, rtx x, - bool reg_ok_strict) +rs6000_debug_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict, + code_helper ch) { - bool ret = rs6000_legitimate_address_p (mode, x, reg_ok_strict); + bool ret = rs6000_legitimate_address_p (mode, x, reg_ok_strict, ch); fprintf (stderr, "\nrs6000_legitimate_address_p: return = %s, mode = %s, " "strict = %d, reload = %s, code = %s\n", diff --git a/gcc/config/rx/rx.cc b/gcc/config/rx/rx.cc index 726b00a..245c6a4 100644 --- a/gcc/config/rx/rx.cc +++ b/gcc/config/rx/rx.cc @@ -179,7 +179,8 @@ rx_small_data_operand (rtx op) static bool rx_is_legitimate_address (machine_mode mode, rtx x, - bool strict ATTRIBUTE_UNUSED) + bool strict ATTRIBUTE_UNUSED, + code_helper = ERROR_MARK) { if (RTX_OK_FOR_BASE (x, strict)) /* Register Indirect. */ diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc index 6ae81d6..49ab4fc 100644 --- a/gcc/config/s390/s390.cc +++ b/gcc/config/s390/s390.cc @@ -4914,7 +4914,8 @@ s390_expand_plus_operand (rtx target, rtx src, STRICT specifies whether strict register checking applies. */ static bool -s390_legitimate_address_p (machine_mode mode, rtx addr, bool strict) +s390_legitimate_address_p (machine_mode mode, rtx addr, bool strict, + code_helper = ERROR_MARK) { struct s390_address ad; diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc index 938f7aa..294faf7 100644 --- a/gcc/config/sh/sh.cc +++ b/gcc/config/sh/sh.cc @@ -266,7 +266,8 @@ static reg_class_t sh_preferred_reload_class (rtx, reg_class_t); static reg_class_t sh_secondary_reload (bool, rtx, reg_class_t, machine_mode, struct secondary_reload_info *); -static bool sh_legitimate_address_p (machine_mode, rtx, bool); +static bool sh_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static rtx sh_legitimize_address (rtx, rtx, machine_mode); static rtx sh_delegitimize_address (rtx); static bool sh_cannot_substitute_mem_equiv_p (rtx); @@ -9038,7 +9039,7 @@ sh_legitimate_index_p (machine_mode mode, rtx op, bool consider_sh2a, GBR GBR+disp */ static bool -sh_legitimate_address_p (machine_mode mode, rtx x, bool strict) +sh_legitimate_address_p (machine_mode mode, rtx x, bool strict, code_helper) { if (REG_P (x) && REGNO (x) == GBR_REG) return true; diff --git a/gcc/config/sparc/sparc.cc b/gcc/config/sparc/sparc.cc index 0aade05..82e5795 100644 --- a/gcc/config/sparc/sparc.cc +++ b/gcc/config/sparc/sparc.cc @@ -607,7 +607,8 @@ static void sparc_emit_set_const64 (rtx, rtx); static void sparc_output_addr_vec (rtx); static void sparc_output_addr_diff_vec (rtx); static void sparc_output_deferred_case_vectors (void); -static bool sparc_legitimate_address_p (machine_mode, rtx, bool); +static bool sparc_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static bool sparc_legitimate_constant_p (machine_mode, rtx); static rtx sparc_builtin_saveregs (void); static int epilogue_renumber (rtx *, int); @@ -4529,7 +4530,8 @@ sparc_pic_register_p (rtx x) ordinarily. This changes a bit when generating PIC. */ static bool -sparc_legitimate_address_p (machine_mode mode, rtx addr, bool strict) +sparc_legitimate_address_p (machine_mode mode, rtx addr, bool strict, + code_helper) { rtx rs1 = NULL, rs2 = NULL, imm1 = NULL; diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h index f90d88e..27ae023 100644 --- a/gcc/config/stormy16/stormy16-protos.h +++ b/gcc/config/stormy16/stormy16-protos.h @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ - +#include "tree.h" /* For ERROR_MARK. */ extern struct xstormy16_stack_layout xstormy16_compute_stack_layout (void); extern void xstormy16_expand_prologue (void); @@ -65,6 +65,7 @@ extern const char * xstormy16_output_shift (machine_mode, enum rtx_code, rtx, rtx, rtx); extern bool xstormy16_below100_symbol (rtx, machine_mode); extern bool xstormy16_splittable_below100_operand (rtx, machine_mode); -extern bool xstormy16_legitimate_address_p (machine_mode, rtx, bool); +extern bool xstormy16_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); #endif diff --git a/gcc/config/stormy16/stormy16.cc b/gcc/config/stormy16/stormy16.cc index cd453c2..1088715 100644 --- a/gcc/config/stormy16/stormy16.cc +++ b/gcc/config/stormy16/stormy16.cc @@ -795,8 +795,8 @@ xstormy16_expand_andqi3 (rtx *operands) && (INTVAL (X) + (OFFSET) < 0x100 || INTVAL (X) + (OFFSET) >= 0x7F00)) bool -xstormy16_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, - rtx x, bool strict) +xstormy16_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x, + bool strict, code_helper) { if (LEGITIMATE_ADDRESS_CONST_INT_P (x, 0)) return true; diff --git a/gcc/config/v850/v850.cc b/gcc/config/v850/v850.cc index 0fb7271..416c284 100644 --- a/gcc/config/v850/v850.cc +++ b/gcc/config/v850/v850.cc @@ -3030,7 +3030,8 @@ v850_rtx_ok_for_base_p (const_rtx x, bool strict_p) static bool v850_legitimate_address_p (machine_mode mode, rtx x, bool strict_p, - addr_space_t as ATTRIBUTE_UNUSED) + addr_space_t as ATTRIBUTE_UNUSED, + code_helper = ERROR_MARK) { gcc_assert (ADDR_SPACE_GENERIC_P (as)); diff --git a/gcc/config/vax/vax.cc b/gcc/config/vax/vax.cc index 82a176d..df9478d 100644 --- a/gcc/config/vax/vax.cc +++ b/gcc/config/vax/vax.cc @@ -46,7 +46,8 @@ along with GCC; see the file COPYING3. If not see #include "target-def.h" static void vax_option_override (void); -static bool vax_legitimate_address_p (machine_mode, rtx, bool); +static bool vax_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static void vax_file_start (void); static void vax_init_libfuncs (void); static void vax_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, @@ -1902,7 +1903,7 @@ indexable_address_p (rtx xfoo0, rtx xfoo1, machine_mode mode, bool strict) The MODE argument is the machine mode for the MEM expression that wants to use this address. */ bool -vax_legitimate_address_p (machine_mode mode, rtx x, bool strict) +vax_legitimate_address_p (machine_mode mode, rtx x, bool strict, code_helper) { rtx xfoo0, xfoo1; diff --git a/gcc/config/visium/visium.cc b/gcc/config/visium/visium.cc index 48a6174..5fadbc8 100644 --- a/gcc/config/visium/visium.cc +++ b/gcc/config/visium/visium.cc @@ -194,7 +194,8 @@ static rtx_insn *visium_md_asm_adjust (vec<rtx> &, vec<rtx> &, static bool visium_legitimate_constant_p (machine_mode, rtx); -static bool visium_legitimate_address_p (machine_mode, rtx, bool); +static bool visium_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static bool visium_print_operand_punct_valid_p (unsigned char); static void visium_print_operand (FILE *, rtx, int); @@ -1818,7 +1819,7 @@ rtx_ok_for_offset_p (machine_mode mode, rtx op) kind of register is required. */ static bool -visium_legitimate_address_p (machine_mode mode, rtx x, bool strict) +visium_legitimate_address_p (machine_mode mode, rtx x, bool strict, code_helper) { rtx base; unsigned int regno; diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index 992e80d..af71e21 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -123,7 +123,8 @@ static bool xtensa_mode_dependent_address_p (const_rtx, addr_space_t); static bool xtensa_return_in_msb (const_tree); static void printx (FILE *, signed int); static rtx xtensa_builtin_saveregs (void); -static bool xtensa_legitimate_address_p (machine_mode, rtx, bool); +static bool xtensa_legitimate_address_p (machine_mode, rtx, bool, + code_helper = ERROR_MARK); static unsigned int xtensa_multibss_section_type_flags (tree, const char *, int) ATTRIBUTE_UNUSED; static section *xtensa_select_rtx_section (machine_mode, rtx, @@ -2296,9 +2297,9 @@ xtensa_emit_sibcall (int callop, rtx *operands) return result; } - bool -xtensa_legitimate_address_p (machine_mode mode, rtx addr, bool strict) +xtensa_legitimate_address_p (machine_mode mode, rtx addr, bool strict, + code_helper) { /* Allow constant pool addresses. */ if (mode != BLKmode && GET_MODE_SIZE (mode) >= UNITS_PER_WORD |