From cc8ca59eb8522a9530e155f38ac616c15412254b Mon Sep 17 00:00:00 2001 From: Julian Brown Date: Mon, 9 Nov 2015 12:16:55 +0000 Subject: [PATCH] Machine modes for address printing. * final.c (output_asm_insn): Pass VOIDmode to output_address. (output_address): Add MODE argument. Pass to print_operand_address hook. * targhooks.c (default_print_operand_address): Add MODE argument. * targhooks.h (default_print_operand_address): Update prototype. * output.h (output_address): Update prototype. * target.def (print_operand_address): Add MODE argument. * config/vax/vax.c (print_operand_address): Pass VOIDmode to output_address. (print_operand): Pass access mode to output_address. * config/mcore/mcore.c (mcore_print_operand_address): Add MODE argument. (mcore_print_operand): Update calls to mcore_print_operand_address. * config/fr30/fr30.c (fr30_print_operand): Pass VOIDmode to output_address. * config/lm32/lm32.c (lm32_print_operand): Pass mode in calls to output_address. * config/tilegx/tilegx.c (output_memory_reference_mode): Remove global. (tilegx_print_operand): Don't set above global. Update calls to output_address. (tilegx_print_operand_address): Add MODE argument. Use instead of output_memory_reference_mode global. * config/frv/frv.c (frv_print_operand_address): Add MODE argument. (frv_print_operand): Pass mode to frv_print_operand_address calls. * config/mn10300/mn10300.c (mn10300_print_operand): Pass mode to output_address. * config/cris/cris.c (cris_print_operand_address): Add MODE argument. (cris_print_operand): Pass mode to output_address calls. * config/spu/spu.c (print_operand): Pass mode to output_address calls. * config/aarch64/aarch64.h (aarch64_print_operand) (aarch64_print_operand_address): Remove prototypes. * config/aarch64/aarch64.c (aarch64_memory_reference_mode): Delete global. (aarch64_print_operand): Make static. Update calls to output_address. (aarch64_print_operand_address): Add MODE argument. Use instead of aarch64_memory_reference_mode global. (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define target hooks. * config/aarch64/aarch64.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS): Delete macro definitions. * config/pa/pa.c (pa_print_operand): Pass mode in output_address calls. * config/xtensa/xtensa.c (print_operand): Pass mode in output_address calls. * config/h8300/h8300.c (h8300_print_operand_address): Add MODE argument. (h83000_print_operand): Update calls to h8300_print_operand_address and output_address. * config/ia64/ia64.c (ia64_print_operand_address): Add MODE argument. * config/tilepro/tilepro.c (output_memory_reference_mode): Delete global. (tilepro_print_operand): Pass mode to output_address. (tilepro_print_operand_address): Add MODE argument. Use instead of output_memory_reference_mode. * config/nvptx/nvptx.c (output_decl_chunk, nvptx_assemble_integer) (nvptx_output_call_insn, nvptx_print_address_operand): Pass VOIDmode to output_address calls. (nvptx_print_operand_address): Add MODE argument. * config/alpha/alpha.c (print_operand): Pass mode argument in output_address calls. * config/m68k/m68k.c (print_operand): Pass mode argument in output_address call. * config/avr/avr.c (avr_print_operand_address): Add MODE argument. (avr_print_operand): Update calls to avr_print_operand_address. * config/sparc/sparc.c (sparc_print_operand_address): Add MODE argument. Update calls to output_address. (sparc_print_operand): Pass mode to output_address. * config/iq2000/iq2000.c (iq2000_print_operand_address): Add MODE argument. (iq2000_print_operand): Pass mode in output_address calls. * config/stormy16/stormy16.c (xstormy16_print_operand_address): Add MODE argument. (xstormy16_print_operand): Pass mode to xstormy16_print_operand_address calls. * config/mips/mips.c (mips_print_operand): Update calls to output_address. (mips_print_operand_address): Add MODE argument. * config/epiphany/epiphany.c (epiphany_print_operand): Update calls to output_address. (epiphany_print_operand_address): Add MODE argument. Add FIXME note. * config/pdp11/pdp11.c (pdp11_asm_print_operand): Update call to output_address. * config/rx/rx.c (rx_print_operand_address): Add MODE argument. (rx_print_operand): Update calls to output_address, rx_print_operand_address. * config/nds32/nds32.c (nds32_print_operand): Update calls to output_address. (nds32_print_operand_address): Add MODE argument. * config/rs6000/rs6000.c (print_operand): Pass mem mode to output_address calls. * config/c6x/c6x.c (print_address_offset): Pass mem mode to output_address call. (c6x_print_address_operand): Update calls to output_address. (c6x_print_operand_address): Pass mode to above. * config/v850/v850.c (v850_print_operand_address): Add MODE argument. (v850_print_operand): Pass mode to v850_print_operand_address, output_address. * config/mmix/mmix.c (mmix_print_operand_address): Add MODE argument. (mmix_print_operand): Pass mode in output_address calls. * config/sh/sh.c (sh_print_operand_address): Add MODE argument. (sh_print_operand): Pass mem mode to output_address, sh_print_operand_address. * config/cr16/cr16.c (cr16_print_operand_address): Add MODE argument. (cr16_print_operand): Pass mode to output_address, cr16_print_operand_address. * config/bfin/bfin.c (print_address_operand): Pass VOIDmode to output_address. * config/microblaze/microblaze.c (print_operand): Pass mode to output_address. * config/nios2/nios2.c (nios2_print_operand): Pass VOIDmode to output_address. (nios2_print_operand_address): Add MODE argument. Update call to nios2_print_operand_address. * config/s390/s390.c (print_operand): Pass mode to output_address. * config/m32c/m32c.c (m32c_print_operand_address): Add MODE argument. * config/arc/arc.c (arc_print_operand): Pass VOIDmode to output_address. * config/arm/arm.c (arm_print_operand_address): Add MODE argument. Use instead of output_memory_reference_mode. (output_memory_reference_mode): Delete global. (arm_print_operand): Pass mem mode to output_address. * config/m32r/m32r.c (m32r_print_operand_address): Add MODE argument. (m32r_print_operand): Pass mode to output_address. * config/msp430/msp430.c (msp430_print_operand_addr): Add MODE argument. (msp430_print_operand): Pass mode to msp430_print_operand_addr. * config/i386/i386.c (ix86_print_operand): Pass mode to output_address calls. (ix86_print_operand_address): Add MODE argument. From-SVN: r230016 --- gcc/ChangeLog | 142 ++++++++++++++++++++++++++++ gcc/config/aarch64/aarch64-protos.h | 2 - gcc/config/aarch64/aarch64.c | 32 +++---- gcc/config/aarch64/aarch64.h | 5 - gcc/config/alpha/alpha.c | 2 +- gcc/config/arc/arc.c | 26 +++-- gcc/config/arm/arm.c | 18 +--- gcc/config/avr/avr.c | 15 +-- gcc/config/bfin/bfin.c | 10 +- gcc/config/c6x/c6x.c | 20 ++-- gcc/config/cr16/cr16.c | 8 +- gcc/config/cris/cris.c | 10 +- gcc/config/epiphany/epiphany.c | 10 +- gcc/config/fr30/fr30.c | 2 +- gcc/config/frv/frv.c | 8 +- gcc/config/h8300/h8300.c | 18 ++-- gcc/config/i386/i386.c | 4 +- gcc/config/ia64/ia64.c | 3 +- gcc/config/iq2000/iq2000.c | 12 ++- gcc/config/lm32/lm32.c | 4 +- gcc/config/m32c/m32c.c | 2 +- gcc/config/m32r/m32r.c | 13 ++- gcc/config/m68k/m68k.c | 2 +- gcc/config/mcore/mcore.c | 8 +- gcc/config/microblaze/microblaze.c | 4 +- gcc/config/mips/mips.c | 7 +- gcc/config/mmix/mmix.c | 6 +- gcc/config/mn10300/mn10300.c | 15 +-- gcc/config/msp430/msp430.c | 4 +- gcc/config/nds32/nds32.c | 4 +- gcc/config/nios2/nios2.c | 6 +- gcc/config/nvptx/nvptx.c | 14 +-- gcc/config/pa/pa.c | 4 +- gcc/config/pdp11/pdp11.c | 2 +- gcc/config/rs6000/rs6000.c | 35 ++++--- gcc/config/rx/rx.c | 12 +-- gcc/config/s390/s390.c | 2 +- gcc/config/sh/sh.c | 21 ++-- gcc/config/sparc/sparc.c | 14 +-- gcc/config/spu/spu.c | 4 +- gcc/config/stormy16/stormy16.c | 7 +- gcc/config/tilegx/tilegx.c | 24 ++--- gcc/config/tilepro/tilepro.c | 24 ++--- gcc/config/v850/v850.c | 22 +++-- gcc/config/vax/vax.c | 4 +- gcc/config/xtensa/xtensa.c | 4 +- gcc/final.c | 6 +- gcc/output.h | 4 +- gcc/target.def | 2 +- gcc/targhooks.c | 1 + gcc/targhooks.h | 2 +- 51 files changed, 385 insertions(+), 245 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2c80165650bd..eb6acd5f6d84 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,145 @@ +2015-11-09 Julian Brown + + * final.c (output_asm_insn): Pass VOIDmode to output_address. + (output_address): Add MODE argument. Pass to print_operand_address + hook. + * targhooks.c (default_print_operand_address): Add MODE argument. + * targhooks.h (default_print_operand_address): Update prototype. + * output.h (output_address): Update prototype. + * target.def (print_operand_address): Add MODE argument. + * config/vax/vax.c (print_operand_address): Pass VOIDmode to + output_address. + (print_operand): Pass access mode to output_address. + * config/mcore/mcore.c (mcore_print_operand_address): Add MODE + argument. + (mcore_print_operand): Update calls to mcore_print_operand_address. + * config/fr30/fr30.c (fr30_print_operand): Pass VOIDmode to + output_address. + * config/lm32/lm32.c (lm32_print_operand): Pass mode in calls to + output_address. + * config/tilegx/tilegx.c (output_memory_reference_mode): Remove + global. + (tilegx_print_operand): Don't set above global. Update calls to + output_address. + (tilegx_print_operand_address): Add MODE argument. Use instead of + output_memory_reference_mode global. + * config/frv/frv.c (frv_print_operand_address): Add MODE argument. + (frv_print_operand): Pass mode to frv_print_operand_address calls. + * config/mn10300/mn10300.c (mn10300_print_operand): Pass mode to + output_address. + * config/cris/cris.c (cris_print_operand_address): Add MODE + argument. + (cris_print_operand): Pass mode to output_address calls. + * config/spu/spu.c (print_operand): Pass mode to output_address + calls. + * config/aarch64/aarch64.h (aarch64_print_operand) + (aarch64_print_operand_address): Remove prototypes. + * config/aarch64/aarch64.c (aarch64_memory_reference_mode): Delete + global. + (aarch64_print_operand): Make static. Update calls to + output_address. + (aarch64_print_operand_address): Add MODE argument. Use instead of + aarch64_memory_reference_mode global. + (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define target + hooks. + * config/aarch64/aarch64.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS): + Delete macro definitions. + * config/pa/pa.c (pa_print_operand): Pass mode in output_address + calls. + * config/xtensa/xtensa.c (print_operand): Pass mode in + output_address calls. + * config/h8300/h8300.c (h8300_print_operand_address): Add MODE + argument. + (h83000_print_operand): Update calls to h8300_print_operand_address + and output_address. + * config/ia64/ia64.c (ia64_print_operand_address): Add MODE + argument. + * config/tilepro/tilepro.c (output_memory_reference_mode): Delete + global. + (tilepro_print_operand): Pass mode to output_address. + (tilepro_print_operand_address): Add MODE argument. Use instead of + output_memory_reference_mode. + * config/nvptx/nvptx.c (output_decl_chunk, nvptx_assemble_integer) + (nvptx_output_call_insn, nvptx_print_address_operand): Pass VOIDmode + to output_address calls. + (nvptx_print_operand_address): Add MODE argument. + * config/alpha/alpha.c (print_operand): Pass mode argument in + output_address calls. + * config/m68k/m68k.c (print_operand): Pass mode argument in + output_address call. + * config/avr/avr.c (avr_print_operand_address): Add MODE argument. + (avr_print_operand): Update calls to avr_print_operand_address. + * config/sparc/sparc.c (sparc_print_operand_address): Add MODE + argument. Update calls to output_address. + (sparc_print_operand): Pass mode to output_address. + * config/iq2000/iq2000.c (iq2000_print_operand_address): Add MODE + argument. + (iq2000_print_operand): Pass mode in output_address calls. + * config/stormy16/stormy16.c (xstormy16_print_operand_address): Add + MODE argument. + (xstormy16_print_operand): Pass mode to + xstormy16_print_operand_address calls. + * config/mips/mips.c (mips_print_operand): Update calls to + output_address. + (mips_print_operand_address): Add MODE argument. + * config/epiphany/epiphany.c (epiphany_print_operand): Update calls + to output_address. + (epiphany_print_operand_address): Add MODE argument. Add FIXME note. + * config/pdp11/pdp11.c (pdp11_asm_print_operand): Update call to + output_address. + * config/rx/rx.c (rx_print_operand_address): Add MODE argument. + (rx_print_operand): Update calls to output_address, + rx_print_operand_address. + * config/nds32/nds32.c (nds32_print_operand): Update calls to + output_address. + (nds32_print_operand_address): Add MODE argument. + * config/rs6000/rs6000.c (print_operand): Pass mem mode to + output_address calls. + * config/c6x/c6x.c (print_address_offset): Pass mem mode to + output_address call. + (c6x_print_address_operand): Update calls to output_address. + (c6x_print_operand_address): Pass mode to above. + * config/v850/v850.c (v850_print_operand_address): Add MODE + argument. + (v850_print_operand): Pass mode to v850_print_operand_address, + output_address. + * config/mmix/mmix.c (mmix_print_operand_address): Add MODE + argument. + (mmix_print_operand): Pass mode in output_address calls. + * config/sh/sh.c (sh_print_operand_address): Add MODE argument. + (sh_print_operand): Pass mem mode to output_address, + sh_print_operand_address. + * config/cr16/cr16.c (cr16_print_operand_address): Add MODE + argument. + (cr16_print_operand): Pass mode to output_address, + cr16_print_operand_address. + * config/bfin/bfin.c (print_address_operand): Pass VOIDmode to + output_address. + * config/microblaze/microblaze.c (print_operand): Pass mode to + output_address. + * config/nios2/nios2.c (nios2_print_operand): Pass VOIDmode to + output_address. + (nios2_print_operand_address): Add MODE argument. Update call to + nios2_print_operand_address. + * config/s390/s390.c (print_operand): Pass mode to output_address. + * config/m32c/m32c.c (m32c_print_operand_address): Add MODE + argument. + * config/arc/arc.c (arc_print_operand): Pass VOIDmode to + output_address. + * config/arm/arm.c (arm_print_operand_address): Add MODE argument. + Use instead of output_memory_reference_mode. + (output_memory_reference_mode): Delete global. + (arm_print_operand): Pass mem mode to output_address. + * config/m32r/m32r.c (m32r_print_operand_address): Add MODE + argument. + (m32r_print_operand): Pass mode to output_address. + * config/msp430/msp430.c (msp430_print_operand_addr): Add MODE + argument. + (msp430_print_operand): Pass mode to msp430_print_operand_addr. + * config/i386/i386.c (ix86_print_operand): Pass mode to + output_address calls. + (ix86_print_operand_address): Add MODE argument. + 2015-11-09 Eric Botcazou PR middle-end/68251 diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 0f20f604481d..7c74f585fb8a 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -345,8 +345,6 @@ void aarch64_init_cumulative_args (CUMULATIVE_ARGS *, const_tree, rtx, const_tree, unsigned); void aarch64_init_expanders (void); void aarch64_init_simd_builtins (void); -void aarch64_print_operand (FILE *, rtx, char); -void aarch64_print_operand_address (FILE *, rtx); void aarch64_emit_call_insn (rtx); void aarch64_register_pragmas (void); void aarch64_relayout_simd_types (void); diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 1b7be838c731..d92ca07eec17 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -558,10 +558,6 @@ static const struct aarch64_option_extension all_extensions[] = {NULL, 0, 0} }; -/* Used to track the size of an address when generating a pre/post - increment address. */ -static machine_mode aarch64_memory_reference_mode; - typedef enum aarch64_cond_code { AARCH64_EQ = 0, AARCH64_NE, AARCH64_CS, AARCH64_CC, AARCH64_MI, AARCH64_PL, @@ -4133,8 +4129,8 @@ aarch64_ccmp_mode_to_code (enum machine_mode mode) } -void -aarch64_print_operand (FILE *f, rtx x, char code) +static void +aarch64_print_operand (FILE *f, rtx x, int code) { switch (code) { @@ -4364,8 +4360,7 @@ aarch64_print_operand (FILE *f, rtx x, char code) break; case MEM: - aarch64_memory_reference_mode = GET_MODE (x); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); break; case CONST: @@ -4555,13 +4550,12 @@ aarch64_print_operand (FILE *f, rtx x, char code) } } -void -aarch64_print_operand_address (FILE *f, rtx x) +static void +aarch64_print_operand_address (FILE *f, machine_mode mode, rtx x) { struct aarch64_address_info addr; - if (aarch64_classify_address (&addr, x, aarch64_memory_reference_mode, - MEM, true)) + if (aarch64_classify_address (&addr, x, mode, MEM, true)) switch (addr.type) { case ADDRESS_REG_IMM: @@ -4604,19 +4598,19 @@ aarch64_print_operand_address (FILE *f, rtx x) { case PRE_INC: asm_fprintf (f, "[%s, %d]!", reg_names [REGNO (addr.base)], - GET_MODE_SIZE (aarch64_memory_reference_mode)); + GET_MODE_SIZE (mode)); return; case POST_INC: asm_fprintf (f, "[%s], %d", reg_names [REGNO (addr.base)], - GET_MODE_SIZE (aarch64_memory_reference_mode)); + GET_MODE_SIZE (mode)); return; case PRE_DEC: asm_fprintf (f, "[%s, -%d]!", reg_names [REGNO (addr.base)], - GET_MODE_SIZE (aarch64_memory_reference_mode)); + GET_MODE_SIZE (mode)); return; case POST_DEC: asm_fprintf (f, "[%s], -%d", reg_names [REGNO (addr.base)], - GET_MODE_SIZE (aarch64_memory_reference_mode)); + GET_MODE_SIZE (mode)); return; case PRE_MODIFY: asm_fprintf (f, "[%s, %wd]!", reg_names [REGNO (addr.base)], @@ -13811,6 +13805,12 @@ aarch64_promoted_type (const_tree t) #undef TARGET_USE_PSEUDO_PIC_REG #define TARGET_USE_PSEUDO_PIC_REG aarch64_use_pseudo_pic_reg +#undef TARGET_PRINT_OPERAND +#define TARGET_PRINT_OPERAND aarch64_print_operand + +#undef TARGET_PRINT_OPERAND_ADDRESS +#define TARGET_PRINT_OPERAND_ADDRESS aarch64_print_operand_address + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-aarch64.h" diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index b041a1e38d06..5429b5703518 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -792,11 +792,6 @@ do { \ /* Jump table alignment is explicit in ASM_OUTPUT_CASE_LABEL. */ #define ADDR_VEC_ALIGN(JUMPTABLE) 0 -#define PRINT_OPERAND(STREAM, X, CODE) aarch64_print_operand (STREAM, X, CODE) - -#define PRINT_OPERAND_ADDRESS(STREAM, X) \ - aarch64_print_operand_address (STREAM, X) - #define MCOUNT_NAME "_mcount" #define NO_PROFILE_COUNTERS 1 diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 11da372fce75..f2ad9d07cb34 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -5327,7 +5327,7 @@ print_operand (FILE *file, rtx x, int code) if (REG_P (x)) fprintf (file, "%s", reg_names[REGNO (x)]); else if (MEM_P (x)) - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); else if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == UNSPEC) { switch (XINT (XEXP (x, 0), 1)) diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 47341d54f90c..01261bc702a9 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -2929,19 +2929,22 @@ arc_print_operand (FILE *file, rtx x, int code) || GET_CODE (XEXP (x, 0)) == POST_INC || GET_CODE (XEXP (x, 0)) == POST_DEC || GET_CODE (XEXP (x, 0)) == POST_MODIFY) - output_address (plus_constant (Pmode, XEXP (XEXP (x, 0), 0), 4)); + output_address (VOIDmode, + plus_constant (Pmode, XEXP (XEXP (x, 0), 0), 4)); else if (output_scaled) { rtx addr = XEXP (x, 0); int size = GET_MODE_SIZE (GET_MODE (x)); - output_address (plus_constant (Pmode, XEXP (addr, 0), + output_address (VOIDmode, + plus_constant (Pmode, XEXP (addr, 0), ((INTVAL (XEXP (addr, 1)) + 4) >> (size == 2 ? 1 : 2)))); output_scaled = 0; } else - output_address (plus_constant (Pmode, XEXP (x, 0), 4)); + output_address (VOIDmode, + plus_constant (Pmode, XEXP (x, 0), 4)); fputc (']', file); } else @@ -3132,28 +3135,31 @@ arc_print_operand (FILE *file, rtx x, int code) switch (GET_CODE (addr)) { case PRE_INC: case POST_INC: - output_address (plus_constant (Pmode, XEXP (addr, 0), size)); break; + output_address (VOIDmode, + plus_constant (Pmode, XEXP (addr, 0), size)); break; case PRE_DEC: case POST_DEC: - output_address (plus_constant (Pmode, XEXP (addr, 0), -size)); + output_address (VOIDmode, + plus_constant (Pmode, XEXP (addr, 0), -size)); break; case PRE_MODIFY: case POST_MODIFY: - output_address (XEXP (addr, 1)); break; + output_address (VOIDmode, XEXP (addr, 1)); break; case PLUS: if (output_scaled) { - output_address (plus_constant (Pmode, XEXP (addr, 0), + output_address (VOIDmode, + plus_constant (Pmode, XEXP (addr, 0), (INTVAL (XEXP (addr, 1)) >> (size == 2 ? 1 : 2)))); output_scaled = 0; } else - output_address (addr); + output_address (VOIDmode, addr); break; default: if (flag_pic && CONSTANT_ADDRESS_P (addr)) arc_output_pic_addr_const (file, addr, code); else - output_address (addr); + output_address (VOIDmode, addr); break; } fputc (']', file); @@ -3239,7 +3245,7 @@ arc_print_operand_address (FILE *file , rtx addr) gcc_assert (GET_CODE (XEXP (c, 0)) == SYMBOL_REF); gcc_assert (GET_CODE (XEXP (c, 1)) == CONST_INT); - output_address(XEXP(addr,0)); + output_address (VOIDmode, XEXP (addr, 0)); break; } diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 61e2aa230063..f4ebbc80f160 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -100,7 +100,7 @@ static bool thumb_force_lr_save (void); static unsigned arm_size_return_regs (void); static bool arm_assemble_integer (rtx, unsigned int, int); static void arm_print_operand (FILE *, rtx, int); -static void arm_print_operand_address (FILE *, rtx); +static void arm_print_operand_address (FILE *, machine_mode, rtx); static bool arm_print_operand_punct_valid_p (unsigned char code); static const char *fp_const_from_val (REAL_VALUE_TYPE *); static arm_cc get_arm_condition_code (rtx); @@ -869,11 +869,6 @@ int prefer_neon_for_64bits = 0; /* Nonzero if we shouldn't use literal pools. */ bool arm_disable_literal_pool = false; -/* In case of a PRE_INC, POST_INC, PRE_DEC, POST_DEC memory reference, - we must report the mode of the memory reference from - TARGET_PRINT_OPERAND to TARGET_PRINT_OPERAND_ADDRESS. */ -machine_mode output_memory_reference_mode; - /* The register number to be used for the PIC offset register. */ unsigned arm_pic_register = INVALID_REGNUM; @@ -22403,8 +22398,7 @@ arm_print_operand (FILE *stream, rtx x, int code) break; case MEM: - output_memory_reference_mode = GET_MODE (x); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); break; case CONST_DOUBLE: @@ -22433,7 +22427,7 @@ arm_print_operand (FILE *stream, rtx x, int code) /* Target hook for printing a memory address. */ static void -arm_print_operand_address (FILE *stream, rtx x) +arm_print_operand_address (FILE *stream, machine_mode mode, rtx x) { if (TARGET_32BIT) { @@ -22491,20 +22485,18 @@ arm_print_operand_address (FILE *stream, rtx x) else if (GET_CODE (x) == PRE_INC || GET_CODE (x) == POST_INC || GET_CODE (x) == PRE_DEC || GET_CODE (x) == POST_DEC) { - extern machine_mode output_memory_reference_mode; - gcc_assert (REG_P (XEXP (x, 0))); if (GET_CODE (x) == PRE_DEC || GET_CODE (x) == PRE_INC) asm_fprintf (stream, "[%r, #%s%d]!", REGNO (XEXP (x, 0)), GET_CODE (x) == PRE_DEC ? "-" : "", - GET_MODE_SIZE (output_memory_reference_mode)); + GET_MODE_SIZE (mode)); else asm_fprintf (stream, "[%r], #%s%d", REGNO (XEXP (x, 0)), GET_CODE (x) == POST_DEC ? "-" : "", - GET_MODE_SIZE (output_memory_reference_mode)); + GET_MODE_SIZE (mode)); } else if (GET_CODE (x) == PRE_MODIFY) { diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index f1c80eec298f..609a42b00e43 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -2158,7 +2158,7 @@ cond_string (enum rtx_code code) /* Output ADDR to FILE as address. */ static void -avr_print_operand_address (FILE *file, rtx addr) +avr_print_operand_address (FILE *file, machine_mode /*mode*/, rtx addr) { switch (GET_CODE (addr)) { @@ -2358,7 +2358,7 @@ avr_print_operand (FILE *file, rtx x, int code) if (GET_CODE (addr) != PLUS) fatal_insn ("bad address, not (reg+disp):", addr); - avr_print_operand_address (file, XEXP (addr, 0)); + avr_print_operand_address (file, VOIDmode, XEXP (addr, 0)); } else if (code == 'p' || code == 'r') { @@ -2366,13 +2366,14 @@ avr_print_operand (FILE *file, rtx x, int code) fatal_insn ("bad address, not post_inc or pre_dec:", addr); if (code == 'p') - avr_print_operand_address (file, XEXP (addr, 0)); /* X, Y, Z */ + /* X, Y, Z */ + avr_print_operand_address (file, VOIDmode, XEXP (addr, 0)); else avr_print_operand (file, XEXP (addr, 0), 0); /* r26, r28, r30 */ } else if (GET_CODE (addr) == PLUS) { - avr_print_operand_address (file, XEXP (addr,0)); + avr_print_operand_address (file, VOIDmode, XEXP (addr,0)); if (REGNO (XEXP (addr, 0)) == REG_X) fatal_insn ("internal compiler error. Bad address:" ,addr); @@ -2380,13 +2381,13 @@ avr_print_operand (FILE *file, rtx x, int code) avr_print_operand (file, XEXP (addr,1), code); } else - avr_print_operand_address (file, addr); + avr_print_operand_address (file, VOIDmode, addr); } else if (code == 'i') { if (GET_CODE (x) == SYMBOL_REF && (SYMBOL_REF_FLAGS (x) & SYMBOL_FLAG_IO)) avr_print_operand_address - (file, plus_constant (HImode, x, -avr_arch->sfr_offset)); + (file, VOIDmode, plus_constant (HImode, x, -avr_arch->sfr_offset)); else fatal_insn ("bad address, not an I/O address:", x); } @@ -2426,7 +2427,7 @@ avr_print_operand (FILE *file, rtx x, int code) else if (code == 'k') fputs (cond_string (reverse_condition (GET_CODE (x))), file); else - avr_print_operand_address (file, x); + avr_print_operand_address (file, VOIDmode, x); } diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 6a5f90a7f1e5..d359fd4341be 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -1300,21 +1300,21 @@ print_address_operand (FILE *file, rtx x) switch (GET_CODE (x)) { case PLUS: - output_address (XEXP (x, 0)); + output_address (VOIDmode, XEXP (x, 0)); fprintf (file, "+"); - output_address (XEXP (x, 1)); + output_address (VOIDmode, XEXP (x, 1)); break; case PRE_DEC: fprintf (file, "--"); - output_address (XEXP (x, 0)); + output_address (VOIDmode, XEXP (x, 0)); break; case POST_INC: - output_address (XEXP (x, 0)); + output_address (VOIDmode, XEXP (x, 0)); fprintf (file, "++"); break; case POST_DEC: - output_address (XEXP (x, 0)); + output_address (VOIDmode, XEXP (x, 0)); fprintf (file, "--"); break; diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index 41816ac8da39..f0d274e765c2 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -1854,7 +1854,7 @@ print_address_offset (FILE *file, rtx off, machine_mode mem_mode) } } fputs ("(", file); - output_address (off); + output_address (mem_mode, off); fputs (")", file); } @@ -1877,7 +1877,7 @@ c6x_print_address_operand (FILE *file, rtx x, machine_mode mem_mode) case PRE_MODIFY: case POST_MODIFY: if (GET_CODE (x) == POST_MODIFY) - output_address (XEXP (x, 0)); + output_address (mem_mode, XEXP (x, 0)); off = XEXP (XEXP (x, 1), 1); if (XEXP (x, 0) == stack_pointer_rtx) { @@ -1894,7 +1894,7 @@ c6x_print_address_operand (FILE *file, rtx x, machine_mode mem_mode) else fprintf (file, "++"); if (GET_CODE (x) == PRE_MODIFY) - output_address (XEXP (x, 0)); + output_address (mem_mode, XEXP (x, 0)); print_address_offset (file, off, mem_mode); break; @@ -1907,28 +1907,28 @@ c6x_print_address_operand (FILE *file, rtx x, machine_mode mem_mode) } else fprintf (file, "+"); - output_address (XEXP (x, 0)); + output_address (mem_mode, XEXP (x, 0)); print_address_offset (file, off, mem_mode); break; case PRE_DEC: gcc_assert (XEXP (x, 0) != stack_pointer_rtx); fprintf (file, "--"); - output_address (XEXP (x, 0)); + output_address (mem_mode, XEXP (x, 0)); fprintf (file, "[1]"); break; case PRE_INC: fprintf (file, "++"); - output_address (XEXP (x, 0)); + output_address (mem_mode, XEXP (x, 0)); fprintf (file, "[1]"); break; case POST_INC: gcc_assert (XEXP (x, 0) != stack_pointer_rtx); - output_address (XEXP (x, 0)); + output_address (mem_mode, XEXP (x, 0)); fprintf (file, "++[1]"); break; case POST_DEC: - output_address (XEXP (x, 0)); + output_address (mem_mode, XEXP (x, 0)); fprintf (file, "--[1]"); break; @@ -2042,9 +2042,9 @@ c6x_print_unit_specifier_field (FILE *file, rtx_insn *insn) /* Output assembly language output for the address ADDR to FILE. */ static void -c6x_print_operand_address (FILE *file, rtx addr) +c6x_print_operand_address (FILE *file, machine_mode mode, rtx addr) { - c6x_print_address_operand (file, addr, VOIDmode); + c6x_print_address_operand (file, addr, mode); } /* Print an operand, X, to FILE, with an optional modifier in CODE. diff --git a/gcc/config/cr16/cr16.c b/gcc/config/cr16/cr16.c index d77e07dc4bd5..8fe836940bd4 100644 --- a/gcc/config/cr16/cr16.c +++ b/gcc/config/cr16/cr16.c @@ -122,7 +122,7 @@ static enum data_model_type data_model = DM_DEFAULT; /* TARGETM Function Prototypes and forward declarations */ static void cr16_print_operand (FILE *, rtx, int); -static void cr16_print_operand_address (FILE *, rtx); +static void cr16_print_operand_address (FILE *, machine_mode, rtx); /* Stack layout and calling conventions. */ #undef TARGET_STRUCT_VALUE_RTX @@ -1494,7 +1494,7 @@ cr16_print_operand (FILE * file, rtx x, int code) return; case MEM: - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); return; case CONST_DOUBLE: @@ -1524,7 +1524,7 @@ cr16_print_operand (FILE * file, rtx x, int code) { putc ('$', file); } - cr16_print_operand_address (file, x); + cr16_print_operand_address (file, VOIDmode, x); return; } default: @@ -1537,7 +1537,7 @@ cr16_print_operand (FILE * file, rtx x, int code) /* Implements the macro PRINT_OPERAND_ADDRESS defined in cr16.h. */ static void -cr16_print_operand_address (FILE * file, rtx addr) +cr16_print_operand_address (FILE * file, machine_mode /*mode*/, rtx addr) { enum cr16_addrtype addrtype; struct cr16_address address; diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 9d62721df2c1..6e40ea148775 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -114,7 +114,7 @@ static int cris_reg_saved_in_regsave_area (unsigned int, bool); static void cris_print_operand (FILE *, rtx, int); -static void cris_print_operand_address (FILE *, rtx); +static void cris_print_operand_address (FILE *, machine_mode, rtx); static bool cris_print_operand_punct_valid_p (unsigned char code); @@ -803,7 +803,7 @@ cris_print_operand (FILE *file, rtx x, int code) return; } } - output_address (addr); + output_address (VOIDmode, addr); } return; @@ -942,7 +942,7 @@ cris_print_operand (FILE *file, rtx x, int code) adj_mem = adjust_address (adj_mem, GET_MODE (adj_mem), size / 2); - output_address (XEXP (adj_mem, 0)); + output_address (VOIDmode, XEXP (adj_mem, 0)); return; } @@ -1129,7 +1129,7 @@ cris_print_operand (FILE *file, rtx x, int code) return; case MEM: - output_address (XEXP (operand, 0)); + output_address (GET_MODE (operand), XEXP (operand, 0)); return; case CONST_DOUBLE: @@ -1200,7 +1200,7 @@ cris_print_operand_punct_valid_p (unsigned char code) /* The PRINT_OPERAND_ADDRESS worker. */ static void -cris_print_operand_address (FILE *file, rtx x) +cris_print_operand_address (FILE *file, machine_mode /*mode*/, rtx x) { /* All these were inside MEM:s so output indirection characters. */ putc ('[', file); diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c index c0578037329f..1313fb44cbd1 100644 --- a/gcc/config/epiphany/epiphany.c +++ b/gcc/config/epiphany/epiphany.c @@ -1317,7 +1317,7 @@ epiphany_print_operand (FILE *file, rtx x, int code) offset = 0; break; } - output_address (addr); + output_address (GET_MODE (x), addr); fputc (']', file); if (offset) { @@ -1338,7 +1338,7 @@ epiphany_print_operand (FILE *file, rtx x, int code) case 1: break; } - output_address (offset); + output_address (GET_MODE (x), offset); } break; case CONST_DOUBLE : @@ -1370,7 +1370,7 @@ epiphany_print_operand (FILE *file, rtx x, int code) /* Print a memory address as an operand to reference that memory location. */ static void -epiphany_print_operand_address (FILE *file, rtx addr) +epiphany_print_operand_address (FILE *file, machine_mode /*mode*/, rtx addr) { register rtx base, index = 0; int offset = 0; @@ -1424,7 +1424,9 @@ epiphany_print_operand_address (FILE *file, rtx addr) break; case PRE_INC: case PRE_DEC: case POST_INC: case POST_DEC: case POST_MODIFY: /* We shouldn't get here as we've lost the mode of the memory object - (which says how much to inc/dec by. */ + (which says how much to inc/dec by. + FIXME: We have the mode now, address printing can be moved into this + function. */ gcc_unreachable (); break; default: diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index b6b02494a925..c52a4e0c3c3f 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -662,7 +662,7 @@ fr30_print_operand (FILE *file, rtx x, int code) break; case SYMBOL_REF: - output_address (x0); + output_address (VOIDmode, x0); break; default: diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 3a3494316d69..275b597b2e88 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -262,7 +262,7 @@ static int frv_default_flags_for_cpu (void); static int frv_string_begins_with (const char *, const char *); static FRV_INLINE bool frv_small_data_reloc_p (rtx, int); static void frv_print_operand (FILE *, rtx, int); -static void frv_print_operand_address (FILE *, rtx); +static void frv_print_operand_address (FILE *, machine_mode, rtx); static bool frv_print_operand_punct_valid_p (unsigned char code); static void frv_print_operand_memory_reference_reg (FILE *, rtx); @@ -2470,7 +2470,7 @@ frv_index_memory (rtx memref, machine_mode mode, int index) /* Print a memory address as an operand to reference that memory location. */ static void -frv_print_operand_address (FILE * stream, rtx x) +frv_print_operand_address (FILE * stream, machine_mode /* mode */, rtx x) { if (GET_CODE (x) == MEM) x = XEXP (x, 0); @@ -3003,10 +3003,10 @@ frv_print_operand (FILE * file, rtx x, int code) frv_output_const_unspec (file, &unspec); else if (GET_CODE (x) == MEM) - frv_print_operand_address (file, XEXP (x, 0)); + frv_print_operand_address (file, GET_MODE (x), XEXP (x, 0)); else if (CONSTANT_ADDRESS_P (x)) - frv_print_operand_address (file, x); + frv_print_operand_address (file, VOIDmode, x); else fatal_insn ("bad insn in frv_print_operand, 0 case", x); diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 4eb2ed8b5277..d5a726e32f3d 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -95,7 +95,7 @@ static unsigned int h8300_asm_insn_count (const char *); static tree h8300_handle_fndecl_attribute (tree *, tree, tree, int, bool *); static tree h8300_handle_eightbit_data_attribute (tree *, tree, tree, int, bool *); static tree h8300_handle_tiny_data_attribute (tree *, tree, tree, int, bool *); -static void h8300_print_operand_address (FILE *, rtx); +static void h8300_print_operand_address (FILE *, machine_mode, rtx); static void h8300_print_operand (FILE *, rtx, int); static bool h8300_print_operand_punct_valid_p (unsigned char code); #ifndef OBJECT_FORMAT_ELF @@ -1647,7 +1647,7 @@ h8300_print_operand (FILE *file, rtx x, int code) } break; case 'o': - h8300_print_operand_address (file, x); + h8300_print_operand_address (file, VOIDmode, x); break; case 's': if (GET_CODE (x) == CONST_INT) @@ -1719,7 +1719,7 @@ h8300_print_operand (FILE *file, rtx x, int code) rtx addr = XEXP (x, 0); fprintf (file, "@"); - output_address (addr); + output_address (GET_MODE (x), addr); /* Add a length suffix to constant addresses. Although this is often unnecessary, it helps to avoid ambiguity in the @@ -1764,7 +1764,7 @@ h8300_print_operand (FILE *file, rtx x, int code) case CONST: case LABEL_REF: fprintf (file, "#"); - h8300_print_operand_address (file, x); + h8300_print_operand_address (file, VOIDmode, x); break; case CONST_DOUBLE: { @@ -1790,7 +1790,7 @@ h8300_print_operand_punct_valid_p (unsigned char code) /* Output assembly language output for the address ADDR to FILE. */ static void -h8300_print_operand_address (FILE *file, rtx addr) +h8300_print_operand_address (FILE *file, machine_mode mode, rtx addr) { rtx index; int size; @@ -1824,12 +1824,12 @@ h8300_print_operand_address (FILE *file, rtx addr) if (GET_CODE (index) == REG) { /* reg,foo */ - h8300_print_operand_address (file, XEXP (addr, 1)); + h8300_print_operand_address (file, mode, XEXP (addr, 1)); fprintf (file, ","); switch (size) { case 0: - h8300_print_operand_address (file, index); + h8300_print_operand_address (file, mode, index); break; case 1: @@ -1852,9 +1852,9 @@ h8300_print_operand_address (FILE *file, rtx addr) else { /* foo+k */ - h8300_print_operand_address (file, XEXP (addr, 0)); + h8300_print_operand_address (file, mode, XEXP (addr, 0)); fprintf (file, "+"); - h8300_print_operand_address (file, XEXP (addr, 1)); + h8300_print_operand_address (file, mode, XEXP (addr, 1)); } fprintf (file, ")"); break; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 0d84cde9cbe9..e93f7a0b41a6 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -16612,7 +16612,7 @@ ix86_print_operand (FILE *file, rtx x, int code) if (TARGET_64BIT) x = gen_rtx_UNSPEC (DImode, gen_rtvec (1, x), UNSPEC_LEA_ADDR); - output_address (x); + output_address (VOIDmode, x); return; case 'L': @@ -17503,7 +17503,7 @@ ix86_print_operand_address_as (FILE *file, rtx addr, addr_space_t as) } static void -ix86_print_operand_address (FILE *file, rtx addr) +ix86_print_operand_address (FILE *file, machine_mode /*mode*/, rtx addr) { ix86_print_operand_address_as (file, addr, ADDR_SPACE_GENERIC); } diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index d92af1770827..08e9cb66cbf1 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -236,7 +236,7 @@ static void ia64_output_function_epilogue (FILE *, HOST_WIDE_INT); static void ia64_output_function_end_prologue (FILE *); static void ia64_print_operand (FILE *, rtx, int); -static void ia64_print_operand_address (FILE *, rtx); +static void ia64_print_operand_address (FILE *, machine_mode, rtx); static bool ia64_print_operand_punct_valid_p (unsigned char code); static int ia64_issue_rate (void); @@ -5239,6 +5239,7 @@ ia64_output_dwarf_dtprel (FILE *file, int size, rtx x) static void ia64_print_operand_address (FILE * stream ATTRIBUTE_UNUSED, + machine_mode /*mode*/, rtx address ATTRIBUTE_UNUSED) { } diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 05167db03a7a..26b9e6741ff1 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -172,7 +172,7 @@ static void iq2000_trampoline_init (rtx, tree, rtx); static rtx iq2000_function_value (const_tree, const_tree, bool); static rtx iq2000_libcall_value (machine_mode, const_rtx); static void iq2000_print_operand (FILE *, rtx, int); -static void iq2000_print_operand_address (FILE *, rtx); +static void iq2000_print_operand_address (FILE *, machine_mode, rtx); static bool iq2000_print_operand_punct_valid_p (unsigned char code); #undef TARGET_INIT_BUILTINS @@ -2896,7 +2896,7 @@ iq2000_setup_incoming_varargs (cumulative_args_t cum_v, reference whose address is ADDR. ADDR is an RTL expression. */ static void -iq2000_print_operand_address (FILE * file, rtx addr) +iq2000_print_operand_address (FILE * file, machine_mode mode, rtx addr) { if (!addr) error ("PRINT_OPERAND_ADDRESS, null pointer"); @@ -2921,7 +2921,7 @@ iq2000_print_operand_address (FILE * file, rtx addr) "PRINT_OPERAND_ADDRESS, LO_SUM with #1 not REG."); fprintf (file, "%%lo("); - iq2000_print_operand_address (file, arg1); + iq2000_print_operand_address (file, mode, arg1); fprintf (file, ")(%s)", reg_names [REGNO (arg0)]); } break; @@ -3169,10 +3169,12 @@ iq2000_print_operand (FILE *file, rtx op, int letter) else if (code == MEM) { + machine_mode mode = GET_MODE (op); + if (letter == 'D') - output_address (plus_constant (Pmode, XEXP (op, 0), 4)); + output_address (mode, plus_constant (Pmode, XEXP (op, 0), 4)); else - output_address (XEXP (op, 0)); + output_address (mode, XEXP (op, 0)); } else if (code == CONST_DOUBLE diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c index 1223d472b254..7a19a8204ca0 100644 --- a/gcc/config/lm32/lm32.c +++ b/gcc/config/lm32/lm32.c @@ -498,7 +498,7 @@ lm32_print_operand (FILE * file, rtx op, int letter) else if (code == HIGH) output_addr_const (file, XEXP (op, 0)); else if (code == MEM) - output_address (XEXP (op, 0)); + output_address (GET_MODE (op), XEXP (op, 0)); else if (letter == 'z' && GET_CODE (op) == CONST_INT && INTVAL (op) == 0) fprintf (file, "%s", reg_names[0]); else if (GET_CODE (op) == CONST_DOUBLE) @@ -551,7 +551,7 @@ lm32_print_operand_address (FILE * file, rtx addr) break; case MEM: - output_address (XEXP (addr, 0)); + output_address (VOIDmode, XEXP (addr, 0)); break; case PLUS: diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index 4a6ca8675674..baf978f2ddff 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -2795,7 +2795,7 @@ m32c_print_operand_punct_valid_p (unsigned char c) #define TARGET_PRINT_OPERAND_ADDRESS m32c_print_operand_address static void -m32c_print_operand_address (FILE * stream, rtx address) +m32c_print_operand_address (FILE * stream, machine_mode /*mode*/, rtx address) { if (GET_CODE (address) == MEM) address = XEXP (address, 0); diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 4a47797dbd42..e4085daf6a56 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -66,7 +66,7 @@ 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 *); static void m32r_print_operand (FILE *, rtx, int); -static void m32r_print_operand_address (FILE *, rtx); +static void m32r_print_operand_address (FILE *, machine_mode, rtx); static bool m32r_print_operand_punct_valid_p (unsigned char code); static void m32r_output_function_prologue (FILE *, HOST_WIDE_INT); static void m32r_output_function_epilogue (FILE *, HOST_WIDE_INT); @@ -2086,6 +2086,8 @@ m32r_print_operand (FILE * file, rtx x, int code) fputs (reg_names[REGNO (x)+1], file); else if (MEM_P (x)) { + machine_mode mode = GET_MODE (x); + fprintf (file, "@("); /* Handle possible auto-increment. Since it is pre-increment and we have already done it, we can just use an offset of four. */ @@ -2093,9 +2095,10 @@ m32r_print_operand (FILE * file, rtx x, int code) currently necessary, but keep it around. */ if (GET_CODE (XEXP (x, 0)) == PRE_INC || GET_CODE (XEXP (x, 0)) == PRE_DEC) - output_address (plus_constant (Pmode, XEXP (XEXP (x, 0), 0), 4)); + output_address (mode, plus_constant (Pmode, + XEXP (XEXP (x, 0), 0), 4)); else - output_address (plus_constant (Pmode, XEXP (x, 0), 4)); + output_address (mode, plus_constant (Pmode, XEXP (x, 0), 4)); fputc (')', file); } else @@ -2255,7 +2258,7 @@ m32r_print_operand (FILE * file, rtx x, int code) else { fputs ("@(", file); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), addr); fputc (')', file); } break; @@ -2282,7 +2285,7 @@ m32r_print_operand (FILE * file, rtx x, int code) /* Print a memory address as an operand to reference that memory location. */ static void -m32r_print_operand_address (FILE * file, rtx addr) +m32r_print_operand_address (FILE * file, machine_mode /*mode*/, rtx addr) { rtx base; rtx index = 0; diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 37b1af2db3ae..7a768d45c306 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -4470,7 +4470,7 @@ print_operand (FILE *file, rtx op, int letter) } else if (GET_CODE (op) == MEM) { - output_address (XEXP (op, 0)); + output_address (GET_MODE (op), XEXP (op, 0)); if (letter == 'd' && ! TARGET_68020 && CONSTANT_ADDRESS_P (XEXP (op, 0)) && !(GET_CODE (XEXP (op, 0)) == CONST_INT diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 9ca23269dc91..d28f2b71ffcc 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -112,7 +112,7 @@ static void mcore_asm_named_section (const char *, unsigned int, tree); #endif static void mcore_print_operand (FILE *, rtx, int); -static void mcore_print_operand_address (FILE *, rtx); +static void mcore_print_operand_address (FILE *, machine_mode, rtx); static bool mcore_print_operand_punct_valid_p (unsigned char code); static void mcore_unique_section (tree, int); static void mcore_encode_section_info (tree, rtx, int); @@ -309,7 +309,7 @@ calc_live_regs (int * count) /* Print the operand address in x to the stream. */ static void -mcore_print_operand_address (FILE * stream, rtx x) +mcore_print_operand_address (FILE * stream, machine_mode /*mode*/, rtx x) { switch (GET_CODE (x)) { @@ -401,7 +401,7 @@ mcore_print_operand (FILE * stream, rtx x, int code) break; case MEM: mcore_print_operand_address - (stream, XEXP (adjust_address (x, SImode, 4), 0)); + (stream, GET_MODE (x), XEXP (adjust_address (x, SImode, 4), 0)); break; default: gcc_unreachable (); @@ -425,7 +425,7 @@ mcore_print_operand (FILE * stream, rtx x, int code) fputs (reg_names[REGNO (x)], (stream)); break; case MEM: - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); break; default: output_addr_const (stream, x); diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index b418506fc79e..aebbc3b03808 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -2317,7 +2317,7 @@ print_operand (FILE * file, rtx op, int letter) if (letter == 'o') { rtx op4 = adjust_address (op, GET_MODE (op), 4); - output_address (XEXP (op4, 0)); + output_address (GET_MODE (op), XEXP (op4, 0)); } else if (letter == 'y') { @@ -2329,7 +2329,7 @@ print_operand (FILE * file, rtx op, int letter) } } else - output_address (XEXP (op, 0)); + output_address (GET_MODE (op), XEXP (op, 0)); else if (letter == 'h' || letter == 'j') { diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 9d6283fe116b..9880b236d6de 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -8595,7 +8595,8 @@ mips_print_operand (FILE *file, rtx op, int letter) case MEM: if (letter == 'D') - output_address (plus_constant (Pmode, XEXP (op, 0), 4)); + output_address (GET_MODE (op), plus_constant (Pmode, + XEXP (op, 0), 4)); else if (letter == 'b') { gcc_assert (REG_P (XEXP (op, 0))); @@ -8604,7 +8605,7 @@ mips_print_operand (FILE *file, rtx op, int letter) else if (letter && letter != 'z') output_operand_lossage ("invalid use of '%%%c'", letter); else - output_address (XEXP (op, 0)); + output_address (GET_MODE (op), XEXP (op, 0)); break; default: @@ -8624,7 +8625,7 @@ mips_print_operand (FILE *file, rtx op, int letter) /* Implement TARGET_PRINT_OPERAND_ADDRESS. */ static void -mips_print_operand_address (FILE *file, rtx x) +mips_print_operand_address (FILE *file, machine_mode /*mode*/, rtx x) { struct mips_address_info addr; diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 2be7f582c2bc..4cafc02d2f3a 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -162,7 +162,7 @@ static bool mmix_frame_pointer_required (void); static void mmix_asm_trampoline_template (FILE *); static void mmix_trampoline_init (rtx, tree, rtx); static void mmix_print_operand (FILE *, rtx, int); -static void mmix_print_operand_address (FILE *, rtx); +static void mmix_print_operand_address (FILE *, machine_mode, rtx); static bool mmix_print_operand_punct_valid_p (unsigned char); static void mmix_conditional_register_usage (void); @@ -1697,7 +1697,7 @@ mmix_print_operand (FILE *stream, rtx x, int code) return; case MEM: - output_address (XEXP (modified_x, 0)); + output_address (GET_MODE (modified_x), XEXP (modified_x, 0)); return; case CONST_INT: @@ -1754,7 +1754,7 @@ mmix_print_operand_punct_valid_p (unsigned char code) /* TARGET_PRINT_OPERAND_ADDRESS. */ static void -mmix_print_operand_address (FILE *stream, rtx x) +mmix_print_operand_address (FILE *stream, machine_mode /*mode*/, rtx x) { if (REG_P (x)) { diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index ff4742785ebb..2f191e416fef 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -239,7 +239,7 @@ mn10300_print_operand (FILE *file, rtx x, int code) { case MEM: fputc ('(', file); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); fputc (')', file); break; @@ -258,7 +258,7 @@ mn10300_print_operand (FILE *file, rtx x, int code) { case MEM: fputc ('(', file); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); fputc (')', file); break; @@ -317,7 +317,7 @@ mn10300_print_operand (FILE *file, rtx x, int code) case MEM: fputc ('(', file); x = adjust_address (x, SImode, 4); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); fputc (')', file); break; @@ -369,9 +369,10 @@ mn10300_print_operand (FILE *file, rtx x, int code) case 'A': fputc ('(', file); if (REG_P (XEXP (x, 0))) - output_address (gen_rtx_PLUS (SImode, XEXP (x, 0), const0_rtx)); + output_address (VOIDmode, gen_rtx_PLUS (SImode, + XEXP (x, 0), const0_rtx)); else - output_address (XEXP (x, 0)); + output_address (VOIDmode, XEXP (x, 0)); fputc (')', file); break; @@ -402,12 +403,12 @@ mn10300_print_operand (FILE *file, rtx x, int code) { case MEM: fputc ('(', file); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); fputc (')', file); break; case PLUS: - output_address (x); + output_address (VOIDmode, x); break; case REG: diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 3fdaab5b041f..8832582af8ef 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -3287,7 +3287,7 @@ msp430_print_operand_raw (FILE * file, rtx op) is ADDR. */ static void -msp430_print_operand_addr (FILE * file, rtx addr) +msp430_print_operand_addr (FILE * file, machine_mode /*mode*/, rtx addr) { switch (GET_CODE (addr)) { @@ -3531,7 +3531,7 @@ msp430_print_operand (FILE * file, rtx op, int letter) case MEM: addr = XEXP (op, 0); - msp430_print_operand_addr (file, addr); + msp430_print_operand_addr (file, GET_MODE (op), addr); break; case CONST: diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index a014e9f75d9b..1bdb518a02e8 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -2311,7 +2311,7 @@ nds32_print_operand (FILE *stream, rtx x, int code) break; case MEM: - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); break; case CODE_LABEL: @@ -2331,7 +2331,7 @@ nds32_print_operand (FILE *stream, rtx x, int code) } static void -nds32_print_operand_address (FILE *stream, rtx x) +nds32_print_operand_address (FILE *stream, machine_mode /*mode*/, rtx x) { rtx op0, op1; diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c index c8c0cc080956..3fd2d0144a00 100644 --- a/gcc/config/nios2/nios2.c +++ b/gcc/config/nios2/nios2.c @@ -2622,7 +2622,7 @@ nios2_print_operand (FILE *file, rtx op, int letter) } if (letter == 0) { - output_address (op); + output_address (VOIDmode, op); return; } break; @@ -2705,7 +2705,7 @@ nios2_output_addr_const_extra (FILE *file, rtx op) /* Implement TARGET_PRINT_OPERAND_ADDRESS. */ static void -nios2_print_operand_address (FILE *file, rtx op) +nios2_print_operand_address (FILE *file, machine_mode mode, rtx op) { switch (GET_CODE (op)) { @@ -2751,7 +2751,7 @@ nios2_print_operand_address (FILE *file, rtx op) case MEM: { rtx base = XEXP (op, 0); - nios2_print_operand_address (file, base); + nios2_print_operand_address (file, mode, base); return; } default: diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 0204ad3383e7..f1ac307b3468 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -1579,7 +1579,7 @@ static void output_decl_chunk (void) { begin_decl_field (); - output_address (gen_int_mode (init_part, decl_chunk_mode)); + output_address (VOIDmode, gen_int_mode (init_part, decl_chunk_mode)); init_part = 0; } @@ -1636,7 +1636,7 @@ nvptx_assemble_integer (rtx x, unsigned int size, int ARG_UNUSED (aligned_p)) { nvptx_record_needed_fndecl (SYMBOL_REF_DECL (x)); fprintf (asm_out_file, "generic("); - output_address (x); + output_address (VOIDmode, x); fprintf (asm_out_file, ")"); } if (off != 0) @@ -1894,7 +1894,7 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee) assemble_name (asm_out_file, name); } else - output_address (callee); + output_address (VOIDmode, callee); if (arg_end > 1 || (decl && DECL_STATIC_CHAIN (decl))) { @@ -1954,9 +1954,9 @@ nvptx_print_address_operand (FILE *file, rtx x, machine_mode) { case PLUS: off = XEXP (x, 1); - output_address (XEXP (x, 0)); + output_address (VOIDmode, XEXP (x, 0)); fprintf (file, "+"); - output_address (off); + output_address (VOIDmode, off); break; case SYMBOL_REF: @@ -1974,9 +1974,9 @@ nvptx_print_address_operand (FILE *file, rtx x, machine_mode) /* Write assembly language output for the address ADDR to FILE. */ static void -nvptx_print_operand_address (FILE *file, rtx addr) +nvptx_print_operand_address (FILE *file, machine_mode mode, rtx addr) { - nvptx_print_address_operand (file, addr, VOIDmode); + nvptx_print_address_operand (file, addr, mode); } /* Print an operand, X, to FILE, with an optional modifier in CODE. diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 4ef20e1c8c14..b8caab523192 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -5413,10 +5413,10 @@ pa_print_operand (FILE *file, rtx x, int code) reg_names [REGNO (index)], reg_names [REGNO (base)]); } else - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); break; default: - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); break; } } diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 548933efd941..9a1aaebb6b55 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -724,7 +724,7 @@ pdp11_asm_print_operand (FILE *file, rtx x, int code) else if (GET_CODE (x) == REG) fprintf (file, "%s", reg_names[REGNO (x)]); else if (GET_CODE (x) == MEM) - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) != SImode) { REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (x), sval); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8bdd64674bf8..13d0193ea55c 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -19259,18 +19259,19 @@ print_operand (FILE *file, rtx x, int code) fputs (reg_names[REGNO (x) + 1], file); else if (MEM_P (x)) { + machine_mode mode = GET_MODE (x); /* Handle possible auto-increment. Since it is pre-increment and we have already done it, we can just use an offset of word. */ if (GET_CODE (XEXP (x, 0)) == PRE_INC || GET_CODE (XEXP (x, 0)) == PRE_DEC) - output_address (plus_constant (Pmode, XEXP (XEXP (x, 0), 0), - UNITS_PER_WORD)); + output_address (mode, plus_constant (Pmode, XEXP (XEXP (x, 0), 0), + UNITS_PER_WORD)); else if (GET_CODE (XEXP (x, 0)) == PRE_MODIFY) - output_address (plus_constant (Pmode, XEXP (XEXP (x, 0), 0), - UNITS_PER_WORD)); + output_address (mode, plus_constant (Pmode, XEXP (XEXP (x, 0), 0), + UNITS_PER_WORD)); else - output_address (XEXP (adjust_address_nv (x, SImode, - UNITS_PER_WORD), + output_address (mode, XEXP (adjust_address_nv (x, SImode, + UNITS_PER_WORD), 0)); if (small_data_operand (x, GET_MODE (x))) @@ -19506,13 +19507,16 @@ print_operand (FILE *file, rtx x, int code) fputs (reg_names[REGNO (x) + 2], file); else if (MEM_P (x)) { + machine_mode mode = GET_MODE (x); if (GET_CODE (XEXP (x, 0)) == PRE_INC || GET_CODE (XEXP (x, 0)) == PRE_DEC) - output_address (plus_constant (Pmode, XEXP (XEXP (x, 0), 0), 8)); + output_address (mode, plus_constant (Pmode, + XEXP (XEXP (x, 0), 0), 8)); else if (GET_CODE (XEXP (x, 0)) == PRE_MODIFY) - output_address (plus_constant (Pmode, XEXP (XEXP (x, 0), 0), 8)); + output_address (mode, plus_constant (Pmode, + XEXP (XEXP (x, 0), 0), 8)); else - output_address (XEXP (adjust_address_nv (x, SImode, 8), 0)); + output_address (mode, XEXP (adjust_address_nv (x, SImode, 8), 0)); if (small_data_operand (x, GET_MODE (x))) fprintf (file, "@%s(%s)", SMALL_DATA_RELOC, reg_names[SMALL_DATA_REG]); @@ -19551,13 +19555,16 @@ print_operand (FILE *file, rtx x, int code) fputs (reg_names[REGNO (x) + 3], file); else if (MEM_P (x)) { + machine_mode mode = GET_MODE (x); if (GET_CODE (XEXP (x, 0)) == PRE_INC || GET_CODE (XEXP (x, 0)) == PRE_DEC) - output_address (plus_constant (Pmode, XEXP (XEXP (x, 0), 0), 12)); + output_address (mode, plus_constant (Pmode, + XEXP (XEXP (x, 0), 0), 12)); else if (GET_CODE (XEXP (x, 0)) == PRE_MODIFY) - output_address (plus_constant (Pmode, XEXP (XEXP (x, 0), 0), 12)); + output_address (mode, plus_constant (Pmode, + XEXP (XEXP (x, 0), 0), 12)); else - output_address (XEXP (adjust_address_nv (x, SImode, 12), 0)); + output_address (mode, XEXP (adjust_address_nv (x, SImode, 12), 0)); if (small_data_operand (x, GET_MODE (x))) fprintf (file, "@%s(%s)", SMALL_DATA_RELOC, reg_names[SMALL_DATA_REG]); @@ -19645,9 +19652,9 @@ print_operand (FILE *file, rtx x, int code) fprintf (file, "%d(%s)", - GET_MODE_SIZE (GET_MODE (x)), reg_names[REGNO (XEXP (XEXP (x, 0), 0))]); else if (GET_CODE (XEXP (x, 0)) == PRE_MODIFY) - output_address (XEXP (XEXP (x, 0), 1)); + output_address (GET_MODE (x), XEXP (XEXP (x, 0), 1)); else - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); } else { diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index b925e7e9b9c4..c2c95917907b 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -379,7 +379,7 @@ rx_mode_dependent_address_p (const_rtx addr, addr_space_t as ATTRIBUTE_UNUSED) reference whose address is ADDR. */ static void -rx_print_operand_address (FILE * file, rtx addr) +rx_print_operand_address (FILE * file, machine_mode /*mode*/, rtx addr) { switch (GET_CODE (addr)) { @@ -690,7 +690,7 @@ rx_print_operand (FILE * file, rtx op, int letter) case MEM: if (! WORDS_BIG_ENDIAN) op = adjust_address (op, SImode, 4); - output_address (XEXP (op, 0)); + output_address (GET_MODE (op), XEXP (op, 0)); break; default: gcc_unreachable (); @@ -714,7 +714,7 @@ rx_print_operand (FILE * file, rtx op, int letter) case MEM: if (WORDS_BIG_ENDIAN) op = adjust_address (op, SImode, 4); - output_address (XEXP (op, 0)); + output_address (GET_MODE (op), XEXP (op, 0)); break; default: gcc_unreachable (); @@ -846,11 +846,11 @@ rx_print_operand (FILE * file, rtx op, int letter) } case MEM: - output_address (XEXP (op, 0)); + output_address (GET_MODE (op), XEXP (op, 0)); break; case PLUS: - output_address (op); + output_address (VOIDmode, op); break; case REG: @@ -915,7 +915,7 @@ rx_print_operand (FILE * file, rtx op, int letter) case SYMBOL_REF: case LABEL_REF: case CODE_LABEL: - rx_print_operand_address (file, op); + rx_print_operand_address (file, VOIDmode, op); break; default: diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 5e3513a6b895..40ee2f77b318 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -7031,7 +7031,7 @@ print_operand (FILE *file, rtx x, int code) break; case MEM: - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); break; case CONST: diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 530fe5307853..919ea1c99c7d 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -212,7 +212,7 @@ static tree sh_handle_sp_switch_attribute (tree *, tree, tree, int, bool *); static tree sh_handle_trap_exit_attribute (tree *, tree, tree, int, bool *); static tree sh_handle_renesas_attribute (tree *, tree, tree, int, bool *); static void sh_print_operand (FILE *, rtx, int); -static void sh_print_operand_address (FILE *, rtx); +static void sh_print_operand_address (FILE *, machine_mode, rtx); static bool sh_print_operand_punct_valid_p (unsigned char code); static bool sh_asm_output_addr_const_extra (FILE *file, rtx x); static void sh_output_function_epilogue (FILE *, HOST_WIDE_INT); @@ -1144,7 +1144,7 @@ sh_override_options_after_change (void) /* Print the operand address in x to the stream. */ static void -sh_print_operand_address (FILE *stream, rtx x) +sh_print_operand_address (FILE *stream, machine_mode /*mode*/, rtx x) { switch (GET_CODE (x)) { @@ -1296,7 +1296,7 @@ sh_print_operand (FILE *stream, rtx x, int code) else if (MEM_P (x)) { x = adjust_address (x, SImode, 4 * SH_REG_LSW_OFFSET); - sh_print_operand_address (stream, XEXP (x, 0)); + sh_print_operand_address (stream, GET_MODE (x), XEXP (x, 0)); } else { @@ -1323,7 +1323,7 @@ sh_print_operand (FILE *stream, rtx x, int code) else if (MEM_P (x)) { x = adjust_address (x, SImode, 4 * SH_REG_MSW_OFFSET); - sh_print_operand_address (stream, XEXP (x, 0)); + sh_print_operand_address (stream, GET_MODE (x), XEXP (x, 0)); } else { @@ -1348,10 +1348,13 @@ sh_print_operand (FILE *stream, rtx x, int code) fputs (reg_names[REGNO (x) + 1], (stream)); break; case MEM: - if (GET_CODE (XEXP (x, 0)) != PRE_DEC - && GET_CODE (XEXP (x, 0)) != POST_INC) - x = adjust_address (x, SImode, 4); - sh_print_operand_address (stream, XEXP (x, 0)); + { + machine_mode mode = GET_MODE (x); + if (GET_CODE (XEXP (x, 0)) != PRE_DEC + && GET_CODE (XEXP (x, 0)) != POST_INC) + x = adjust_address (x, SImode, 4); + sh_print_operand_address (stream, mode, XEXP (x, 0)); + } break; default: break; @@ -1562,7 +1565,7 @@ sh_print_operand (FILE *stream, rtx x, int code) break; case MEM: - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); break; default: diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 28c2c63b6830..7fa702e7d865 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -617,7 +617,7 @@ static machine_mode sparc_preferred_simd_mode (machine_mode); static reg_class_t sparc_preferred_reload_class (rtx x, reg_class_t rclass); static bool sparc_print_operand_punct_valid_p (unsigned char); static void sparc_print_operand (FILE *, rtx, int); -static void sparc_print_operand_address (FILE *, rtx); +static void sparc_print_operand_address (FILE *, machine_mode, rtx); static reg_class_t sparc_secondary_reload (bool, rtx, reg_class_t, machine_mode, secondary_reload_info *); @@ -8802,7 +8802,7 @@ sparc_print_operand (FILE *file, rtx x, int code) return; case 'm': /* Print the operand's address only. */ - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); return; case 'r': /* In this case we need a register. Use %g0 if the @@ -8895,7 +8895,7 @@ sparc_print_operand (FILE *file, rtx x, int code) /* Operand must be a MEM; write its address. */ if (GET_CODE (x) != MEM) output_operand_lossage ("invalid %%f operand"); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); return; case 's': @@ -8933,7 +8933,7 @@ sparc_print_operand (FILE *file, rtx x, int code) /* Poor Sun assembler doesn't understand absolute addressing. */ if (CONSTANT_P (XEXP (x, 0))) fputs ("%g0+", file); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); fputc (']', file); } else if (GET_CODE (x) == HIGH) @@ -8972,7 +8972,7 @@ sparc_print_operand (FILE *file, rtx x, int code) /* Implement TARGET_PRINT_OPERAND_ADDRESS. */ static void -sparc_print_operand_address (FILE *file, rtx x) +sparc_print_operand_address (FILE *file, machine_mode /*mode*/, rtx x) { register rtx base, index = 0; int offset = 0; @@ -8995,7 +8995,7 @@ sparc_print_operand_address (FILE *file, rtx x) && ! TARGET_CM_MEDMID); output_operand (XEXP (base, 0), 0); fputs ("+%lo(", file); - output_address (XEXP (base, 1)); + output_address (VOIDmode, XEXP (base, 1)); fprintf (file, ")+%d", offset); } else @@ -9027,7 +9027,7 @@ sparc_print_operand_address (FILE *file, rtx x) fputs ("+%l44(", file); else fputs ("+%lo(", file); - output_address (XEXP (addr, 1)); + output_address (VOIDmode, XEXP (addr, 1)); fputc (')', file); } else if (flag_pic diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index fa6dbef12331..31502fb67b4b 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -1339,7 +1339,7 @@ print_operand (FILE * file, rtx x, int code) /* Used in indirect function calls. */ fprintf (file, "%s", reg_names[REGNO (XEXP (x, 0))]); else - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); } return; @@ -1432,7 +1432,7 @@ print_operand (FILE * file, rtx x, int code) if (xcode == REG) fprintf (file, "%s", reg_names[REGNO (x)]); else if (xcode == MEM) - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); else if (xcode == CONST_VECTOR) print_operand (file, CONST_VECTOR_ELT (x, 0), 0); else diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 2867c396feb3..f62685322542 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -1662,7 +1662,8 @@ xstormy16_asm_out_constructor (rtx symbol, int priority) Print a memory address as an operand to reference that memory location. */ static void -xstormy16_print_operand_address (FILE *file, rtx address) +xstormy16_print_operand_address (FILE *file, machine_mode /*mode*/, + rtx address) { HOST_WIDE_INT offset; int pre_dec, post_inc; @@ -1769,7 +1770,7 @@ xstormy16_print_operand (FILE *file, rtx x, int code) else if (LABEL_P (x)) output_asm_label (x); else - xstormy16_print_operand_address (file, x); + xstormy16_print_operand_address (file, VOIDmode, x); return; case 'o': @@ -1825,7 +1826,7 @@ xstormy16_print_operand (FILE *file, rtx x, int code) break; case MEM: - xstormy16_print_operand_address (file, XEXP (x, 0)); + xstormy16_print_operand_address (file, GET_MODE (x), XEXP (x, 0)); break; default: diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c index 4ef2ca9375ef..d2210622ae52 100644 --- a/gcc/config/tilegx/tilegx.c +++ b/gcc/config/tilegx/tilegx.c @@ -59,11 +59,6 @@ /* SYMBOL_REF for GOT */ static GTY(()) rtx g_got_symbol = NULL; -/* In case of a POST_INC or POST_DEC memory reference, we must report - the mode of the memory reference from TARGET_PRINT_OPERAND to - TARGET_PRINT_OPERAND_ADDRESS. */ -static machine_mode output_memory_reference_mode; - /* Report whether we're printing out the first address fragment of a POST_INC or POST_DEC memory reference, from TARGET_PRINT_OPERAND to TARGET_PRINT_OPERAND_ADDRESS. */ @@ -5268,10 +5263,8 @@ tilegx_print_operand (FILE *file, rtx x, int code) return; } - output_memory_reference_mode = GET_MODE (x); output_memory_autoinc_first = true; - output_address (XEXP (x, 0)); - output_memory_reference_mode = VOIDmode; + output_address (GET_MODE (x), XEXP (x, 0)); return; case 'i': @@ -5282,10 +5275,8 @@ tilegx_print_operand (FILE *file, rtx x, int code) return; } - output_memory_reference_mode = GET_MODE (x); output_memory_autoinc_first = false; - output_address (XEXP (x, 0)); - output_memory_reference_mode = VOIDmode; + output_address (GET_MODE (x), XEXP (x, 0)); return; case 'j': @@ -5404,8 +5395,7 @@ tilegx_print_operand (FILE *file, rtx x, int code) } else if (MEM_P (x)) { - output_memory_reference_mode = VOIDmode; - output_address (XEXP (x, 0)); + output_address (VOIDmode, XEXP (x, 0)); return; } else @@ -5423,14 +5413,14 @@ tilegx_print_operand (FILE *file, rtx x, int code) /* Implement TARGET_PRINT_OPERAND_ADDRESS. */ static void -tilegx_print_operand_address (FILE *file, rtx addr) +tilegx_print_operand_address (FILE *file, machine_mode mode, rtx addr) { if (GET_CODE (addr) == POST_DEC || GET_CODE (addr) == POST_INC) { - int offset = GET_MODE_SIZE (output_memory_reference_mode); + int offset = GET_MODE_SIZE (mode); - gcc_assert (output_memory_reference_mode != VOIDmode); + gcc_assert (mode != VOIDmode); if (output_memory_autoinc_first) fprintf (file, "%s", reg_names[REGNO (XEXP (addr, 0))]); @@ -5440,7 +5430,7 @@ tilegx_print_operand_address (FILE *file, rtx addr) } else if (GET_CODE (addr) == POST_MODIFY) { - gcc_assert (output_memory_reference_mode != VOIDmode); + gcc_assert (mode != VOIDmode); gcc_assert (GET_CODE (XEXP (addr, 1)) == PLUS); diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c index 4f95f6cb3b86..248b24e83858 100644 --- a/gcc/config/tilepro/tilepro.c +++ b/gcc/config/tilepro/tilepro.c @@ -59,11 +59,6 @@ /* SYMBOL_REF for GOT */ static GTY(()) rtx g_got_symbol = NULL; -/* In case of a POST_INC or POST_DEC memory reference, we must report - the mode of the memory reference from TARGET_PRINT_OPERAND to - TARGET_PRINT_OPERAND_ADDRESS. */ -static machine_mode output_memory_reference_mode; - /* Report whether we're printing out the first address fragment of a POST_INC or POST_DEC memory reference, from TARGET_PRINT_OPERAND to TARGET_PRINT_OPERAND_ADDRESS. */ @@ -4594,10 +4589,8 @@ tilepro_print_operand (FILE *file, rtx x, int code) return; } - output_memory_reference_mode = GET_MODE (x); output_memory_autoinc_first = true; - output_address (XEXP (x, 0)); - output_memory_reference_mode = VOIDmode; + output_address (GET_MODE (x), XEXP (x, 0)); return; case 'i': @@ -4608,10 +4601,8 @@ tilepro_print_operand (FILE *file, rtx x, int code) return; } - output_memory_reference_mode = GET_MODE (x); output_memory_autoinc_first = false; - output_address (XEXP (x, 0)); - output_memory_reference_mode = VOIDmode; + output_address (GET_MODE (x), XEXP (x, 0)); return; case 'j': @@ -4810,8 +4801,7 @@ tilepro_print_operand (FILE *file, rtx x, int code) } else if (MEM_P (x)) { - output_memory_reference_mode = VOIDmode; - output_address (XEXP (x, 0)); + output_address (VOIDmode, XEXP (x, 0)); return; } else @@ -4830,14 +4820,14 @@ tilepro_print_operand (FILE *file, rtx x, int code) /* Implement TARGET_PRINT_OPERAND_ADDRESS. */ static void -tilepro_print_operand_address (FILE *file, rtx addr) +tilepro_print_operand_address (FILE *file, machine_mode mode, rtx addr) { if (GET_CODE (addr) == POST_DEC || GET_CODE (addr) == POST_INC) { - int offset = GET_MODE_SIZE (output_memory_reference_mode); + int offset = GET_MODE_SIZE (mode); - gcc_assert (output_memory_reference_mode != VOIDmode); + gcc_assert (mode != VOIDmode); if (output_memory_autoinc_first) fprintf (file, "%s", reg_names[REGNO (XEXP (addr, 0))]); @@ -4847,7 +4837,7 @@ tilepro_print_operand_address (FILE *file, rtx addr) } else if (GET_CODE (addr) == POST_MODIFY) { - gcc_assert (output_memory_reference_mode != VOIDmode); + gcc_assert (mode != VOIDmode); gcc_assert (GET_CODE (XEXP (addr, 1)) == PLUS); diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 64f80d9e9f9d..d642eca207c6 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -50,7 +50,7 @@ #define streq(a,b) (strcmp (a, b) == 0) #endif -static void v850_print_operand_address (FILE *, rtx); +static void v850_print_operand_address (FILE *, machine_mode, rtx); /* Names of the various data areas used on the v850. */ const char * GHS_default_section_names [(int) COUNT_OF_GHS_SECTION_KINDS]; @@ -540,10 +540,13 @@ v850_print_operand (FILE * file, rtx x, int code) fprintf (file, reg_names[REGNO (x) + 1]); break; case MEM: - x = XEXP (adjust_address (x, SImode, 4), 0); - v850_print_operand_address (file, x); - if (GET_CODE (x) == CONST_INT) - fprintf (file, "[r0]"); + { + machine_mode mode = GET_MODE (x); + x = XEXP (adjust_address (x, SImode, 4), 0); + v850_print_operand_address (file, mode, x); + if (GET_CODE (x) == CONST_INT) + fprintf (file, "[r0]"); + } break; case CONST_INT: @@ -617,10 +620,11 @@ v850_print_operand (FILE * file, rtx x, int code) { case MEM: if (GET_CODE (XEXP (x, 0)) == CONST_INT) - output_address (gen_rtx_PLUS (SImode, gen_rtx_REG (SImode, 0), + output_address (GET_MODE (x), + gen_rtx_PLUS (SImode, gen_rtx_REG (SImode, 0), XEXP (x, 0))); else - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); break; case REG: @@ -638,7 +642,7 @@ v850_print_operand (FILE * file, rtx x, int code) case CONST: case LABEL_REF: case CODE_LABEL: - v850_print_operand_address (file, x); + v850_print_operand_address (file, VOIDmode, x); break; default: gcc_unreachable (); @@ -652,7 +656,7 @@ v850_print_operand (FILE * file, rtx x, int code) /* Output assembly language output for the address ADDR to FILE. */ static void -v850_print_operand_address (FILE * file, rtx addr) +v850_print_operand_address (FILE * file, machine_mode /*mode*/, rtx addr) { switch (GET_CODE (addr)) { diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 26f4ae8527e3..c059751915cc 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -472,7 +472,7 @@ print_operand_address (FILE * file, rtx addr) } - output_address (offset); + output_address (VOIDmode, offset); } if (breg != 0) @@ -527,7 +527,7 @@ print_operand (FILE *file, rtx x, int code) else if (REG_P (x)) fprintf (file, "%s", reg_names[REGNO (x)]); else if (MEM_P (x)) - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == SFmode) { char dstr[30]; diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 8ef1512fede9..0f58655d34e8 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -2318,7 +2318,7 @@ print_operand (FILE *file, rtx x, int letter) && (GET_MODE (x) == DFmode || GET_MODE (x) == DImode)) { x = adjust_address (x, GET_MODE (x) == DFmode ? SFmode : SImode, 4); - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); } else output_operand_lossage ("invalid %%N value"); @@ -2429,7 +2429,7 @@ print_operand (FILE *file, rtx x, int letter) if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG) fprintf (file, "%s", reg_names[xt_true_regnum (x)]); else if (GET_CODE (x) == MEM) - output_address (XEXP (x, 0)); + output_address (GET_MODE (x), XEXP (x, 0)); else if (GET_CODE (x) == CONST_INT) fprintf (file, "%ld", INTVAL (x)); else diff --git a/gcc/final.c b/gcc/final.c index 35522f16125c..30b38267e46b 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -3713,7 +3713,7 @@ output_asm_insn (const char *templ, rtx *operands) else if (letter == 'l') output_asm_label (operands[opnum]); else if (letter == 'a') - output_address (operands[opnum]); + output_address (VOIDmode, operands[opnum]); else if (letter == 'c') { if (CONSTANT_ADDRESS_P (operands[opnum])) @@ -3848,11 +3848,11 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED) machine-dependent assembler syntax. */ void -output_address (rtx x) +output_address (machine_mode mode, rtx x) { bool changed = false; walk_alter_subreg (&x, &changed); - targetm.asm_out.print_operand_address (asm_out_file, x); + targetm.asm_out.print_operand_address (asm_out_file, mode, x); } /* Print an integer constant expression in assembler syntax. diff --git a/gcc/output.h b/gcc/output.h index f9ff85886dbb..f6a576c22b89 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -108,9 +108,9 @@ extern void output_asm_label (rtx); /* Marks SYMBOL_REFs in x as referenced through use of assemble_external. */ extern void mark_symbol_refs_as_used (rtx); -/* Print a memory reference operand for address X +/* Print a memory reference operand for address X with access mode MODE using machine-dependent assembler syntax. */ -extern void output_address (rtx); +extern void output_address (machine_mode, rtx); /* Print an integer constant expression in assembler syntax. Addition and subtraction are the only arithmetic diff --git a/gcc/target.def b/gcc/target.def index 0f7d3e5effb5..61cb14b1b52e 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -893,7 +893,7 @@ DEFHOOK_UNDOC DEFHOOK_UNDOC (print_operand_address, "", - void, (FILE *file, rtx addr), + void, (FILE *file, machine_mode mode, rtx addr), default_print_operand_address) /* Determine whether CODE is a valid punctuation character for the diff --git a/gcc/targhooks.c b/gcc/targhooks.c index c810525be920..c34b4e9ef6ae 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -345,6 +345,7 @@ default_print_operand (FILE *stream ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED, void default_print_operand_address (FILE *stream ATTRIBUTE_UNUSED, + machine_mode /*mode*/, rtx x ATTRIBUTE_UNUSED) { #ifdef PRINT_OPERAND_ADDRESS diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 8747f958535e..c9d745b00d65 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -67,7 +67,7 @@ extern bool hook_callee_copies_named (cumulative_args_t ca, machine_mode, const_tree, bool); extern void default_print_operand (FILE *, rtx, int); -extern void default_print_operand_address (FILE *, rtx); +extern void default_print_operand_address (FILE *, machine_mode, rtx); extern bool default_print_operand_punct_valid_p (unsigned char); extern tree default_mangle_assembler_name (const char *); -- 2.39.2