From 301d03af8a3cbf51e79ff35c1aa71a6f353709c5 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 17 Dec 2001 15:05:40 +0000 Subject: [PATCH] target.h (asm_out.byte_op, [...]): New fields. * target.h (asm_out.byte_op, asm_out.aligned_op, asm_out.unaligned_op, asm_out.integer): New fields. * target-def.h (TARGET_ASM_BYTE_OP, TARGET_ASM_ALIGNED_[HSDT]I_OP, TARGET_ASM_UNALIGNED_[HSDT]I_OP, TARGET_ASM_INTEGER): New initialisers. (TARGET_ASM_ALIGNED_INT_OP, TARGET_ASM_UNALIGNED_INT_OP): Collect the individual initialisers together. (TARGET_ASM_OUT): Add the new initialisers. * output.h (assemble_integer): Return bool. (integer_asm_op): Declare. (default_assemble_integer): Declare. (assemble_aligned_integer): New interface to assemble_integer. * varasm.c (integer_asm_op): New function to select pseudo-op. (default_assemble_integer): Default implementation of asm_out.integer. (assemble_integer): Use the new target hook. Split objects into words or bytes if the target hook fails. Return bool. * doc/tm.texi (ASM_OUTPUT_CHAR, ASM_OUTPUT_BYTE, ASM_OUTPUT_SHORT, ASM_OUTPUT_INT, ASM_OUTPUT_DOUBLE_INT, ASM_OUTPUT_QUADRUPLE_INT, UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP, UNALIGNED_DOUBLE_INT_ASM_OP): Undocument. Document new target hooks. * defaults.h (ASM_OUTPUT_ADDR_VEC_ELT): Use integer_asm_op. * dwarf2asm.c (unaligned_integer_asm_op): Remove. (dw2_assemble_integer): New. (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_encoded_addr_rtx): Use it. (dw2_asm_output_nstring): Use assemble_integer for the null terminator. (dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128): Use integer_asm_op to get the byte pseudo-op. Use assemble_integer if it returns NULL. * dwarf2asm.h (dw2_assemble_integer): Declare. * dwarfout.c: Include dwarf2asm.h. Use dwarf2 functions for the default implementation of most macros. (output_unsigned_leb128): Use dw2_asm_output_data. (output_signed_leb128, dwarfout_source_line): Likewise. (output_reg_number): Use dw2_assemble_integer. (generate_macinfo_entry): Separate the type and offset arguments. Use assemble_integer to write the value. (dwarfout_start_source_file): Update generate_macinfo_entry usage. (dwarfout_end_source_file, dwarfout_define, dwarfout_undef): Likewise. * final.c (output_addr_const): Don't put brackets round a subtracted symbol value or ".". * halfpic.c (half_pic_finish): Use assemble_aligned_integer. * config/1750a/1750a.c (assemble_integer_1750a): New, * config/alpha/alpha.h (literal_section): Avoid ASM_OUTPUT_INT. * config/arc/arc.c (arc_assemble_integer): New. * config/arc/arc.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. * config/arm/arm.c (arm_poke_function_name): Likewise. (arm_assemble_integer): New, extracted from... * config/arm/arm.h (OUTPUT_INT_ADDR_CONST): ...here, now removed. (ARM_TRAMPOLINE_TEMPLATE, ARM_FUNCTION_PROFILER): Avoid ASM_OUTPUT_INT. (ARM_FUNCTION_PROFILER): Likewise. * config/avr/avr-protos.h (asm_output_byte): Remove. (asm_output_char, asm_output_short): Remove. * config/avr/avr.c (avr_assemble_integer): New. (asm_output_byte, asm_output_char, asm_output_short): Remove. * config/clipper/clipper.h (ASM_LONG): Remove. * config/dsp16xx/dsp16xx-protos.h (asm_output_long): Remove. * config/dsp16xx/dsp16xx.c (asm_output_long): Remove. * config/elxsi/elxsi.c (elxsi_assemble_integer): New. * config/i370/i370.c (i370_hlasm_assemble_integer): New. * config/i370/i370.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_SHORT. (ASM_BYTE, ASM_SHORT, ASM_LONG): Delete. * config/i386/att.h, (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. * config/i386/linux.h (ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Use ASM_LONG instead of UNALIGNED_INT_ASM_OP. * config/i386/sco5.h (ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Likewise. (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. * config/i386/sysv4.h (ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Use ASM_LONG instead of UNALIGNED_INT_ASM_OP. * config/i860/fx2800.h (ASM_FILE_END): Avoid ASM_LONG. * config/i860/i860.c (i860_output_function_epilogue): Likewise. * config/i860/i860.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. (ASM_SHORT, ASM_LONG): Undefine. * config/i860/paragon.h (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. * config/i860/sysv3.h (ASM_OUTPUT_ASCII): Likewise. * config/i960/i960.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. * config/ia64/ia64.c (ia64_assemble_integer): New. * config/ia64/ia64.h (ASM_OUTPUT_DWARF_OFFSET): Use integer_asm_op. (ASM_OUTPUT_DWARF_PCREL): Likewise. * config/m68hc11/m68hc11.h (ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT, ASM_OUTPUT_ADDR_DIFF_ELT, ASM_OUTPUT_ADDR_VEC_ELT): Avoid ASM_LONG. (ASM_SHORT, ASM_LONG): Remove. * config/m68k/m68k.h (INT_OP_GROUP): New macro. (INT_OP_STANDARD, INT_OP_DOT_WORD, INT_OP_NO_DOT, INT_OP_DC): New macros, the allowed values for INT_OP_GROUP. * config/m68k/amix.h (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP * config/m68k/atari.h (ASM_OUTPUT_ASCII): Likewise * config/m68k/m68kelf.h (ASM_OUTPUT_ASCII): Likewise * config/m68k/auxas.h (BYTE_ASM_OP, WORD_ASM_OP, LONG_ASM_OP): Remove. (INT_OP_GROUP): Define to INT_OP_NO_DOT. * config/m68k/dpx2.h (ASM_LONG): Undefine. (INT_OP_GROUP): Define to INT_OP_DC. * config/m68k/dpx2g.h (ASM_LONG): Undefine. * config/m68k/hp320.h (INT_OP_GROUP): Define to INT_OP_NO_DOT. * config/m68k/lynx.h (ASM_LONG): Undefine. * config/m68k/dpx2g.h (ASM_LONG): Undefine. * config/m68k/m68kelf.h (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. * config/m68k/m68kv4.h (ASM_OUTPUT_ASCII): Likewise. (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_*. * config/m68k/mot3300.h (INT_OP_GROUP): Define to INT_OP_STANDARD for GAS and INT_OP_NO_DOT otherwise. (ASM_CHAR, ASM_BYTE, ASM_SHORT, ASM_LONG): Remove. (ASM_OUTPUT_LONG_DOUBLE, ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT, ASM_OUTPUT_ADDR_VEC_ELT, ASM_OUTPUT_ADDR_DIFF_ELT): Avoid ASM_LONG. (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. * config/m68k/sgs.h (BYTE_ASM_OP, WORD_ASM_OP, LONG_ASM_OP): Remove. (INT_OP_GROUP): Define to INT_OP_STANDARD. (ASM_OUTPUT_LONG_DOUBLE, ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT, ASM_OUTPUT_ADDR_VEC_ELT, ASM_OUTPUT_ADDR_DIFF_ELT): Avoid LONG_ASM_OP. (ASM_OUTPUT_ASCII): Avoid BYTE_ASM_OP. * config/m68k/tower-as.h (ASM_LONG): Remove. (INT_OP_GROUP): Define to INT_OP_NO_DOT. * config/m88k/m88k.c (output_tdesc): Avoid ASM_LONG. * config/m88k/m88k.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. (ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT): Avoid ASM_LONG. * config/mips/iris5.h (TARGET_IRIX5): Define. * config/mips/mips.c (mips_assemble_integer): New. * config/mips/sni-svr4.h (ASM_LONG): Undefine. * config/mmix/mmix-protos.h (mmix_asm_output_double_int): Remove. * config/mmix/mmix.c (mmix_assemble_integer): New. (mmix_asm_output_double_int): Remove. (mmix_print_operand): Call mmix_output_octa directly. * config/mmix/mmix.h (ASM_LONG): Remove. * config/ns32k/ns32k.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. * config/pa/pa.c (pa_assemble_integer): New. (pa_override_options): Only use aligned DI ops on 64-bit targets. Only use the unaligned ops if TARGET_GAS. * config/pdp11/pdp11.c (pdp11_assemble_integer): New. * config/pdp11/pdp11.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_SHORT. * config/pj/pj.h (ASM_LONG): Undefine. * config/rs6000/linux64.h (RELOCATABLE_NEEDS_FIXUP): Undefine. * config/rs6000/rs6000.c (rs6000_assemble_integer): New, mostly extracted from ASM_OUTPUT_INT in sysv4.h. Use in_text_section() and in_toc_section() rather than the in_section variable. (rs6000_override_options): Only use DI ops when TARGET_POWERPC64. * config/rs6000/sysv4.h (TOC_SECTION_FUNCTION): Add in_toc_section(). (RELOCATABLE_NEEDS_FIXUP): Define. * config/rs6000/xcoff.h (DOUBLE_INT_ASM_OP): Change space to tab. * config/s390/linux.h (ASM_SHORT, ASM_LONG, ASM_QUAD): Remove. (ASM_OUTPUT_ADDR_VEC_ELT, ASM_OUTPUT_ADDR_DIFF_ELT): Use integer_asm_op to get the word directive. (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. * config/s390/s390.c (s390_assemble_integer): New. * config/s390/s390.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY): Use integer_asm_op to get the word directive. * config/sparc/sol2.h (ASM_SHORT, ASM_LONG): Remove. * config/sparc/sparc-protos.h (output_double_int): Remove. * config/sparc/sparc.c (output_double_int): Move to... (sparc_assemble_integer): ...this new function. (sparc_override_options): Only use .uaxword if TARGET_ARCH64. * config/sparc/sparc.h (ASM_SHORT, ASM_LONG, ASM_LONGLONG): Remove. * config/sparc/sysv4.h (ASM_LONG): Remove. (ASM_OUTPUT_LONG_DOUBLE, ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT): Avoid ASM_LONG. * config/vax/vax.h (TRAMPOLINE_TEMPLATE): Use assemble_aligned_integer. * config/we32k/we32k.h (TRAMPOLINE_TEMPLATE): Likewise. * config/1750a/1750a.c, config/a29k/a29k.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/clipper/clipper.c, config/convex/convex.c, config/cris/cris.c, config/d30v/d30v.c, config/dsp16xx/dsp16xx.c, config/elxsi/elxsi.c, config/fr30/fr30.c, config/h8300/h8300.c, config/i370/i370.c, config/i386/i386.c, config/i860/i860.c, config/i960/i960.c, config/ia64/ia64.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m88k/m88k.c, config/mips/mips.c, config/mmix/mmix.c, config/mn10200/mn10200.c, config/mn10300/mn10300.c, config/ns32k/ns32k.c, config/pa/pa.c, config/pdp11/pdp11.c, config/sh/sh.c, config/sparc/sparc.c, config/stormy16/stormy16.c, config/v850/v850.c, config/vax/vax.c, config/we32k/we32k.c (TARGET_ASM_BYTE_OP, TARGET_ASM_ALIGNED_HI_OP, TARGET_ASM_ALIGNED_SI_OP, TARGET_ASM_ALIGNED_DI_OP, TARGET_ASM_UNALIGNED_HI_OP, TARGET_ASM_UNALIGNED_SI_OP, TARGET_ASM_UNALIGNED_DI_OP, TARGET_ASM_INTEGER): Redefine as appropriate. * config/defaults.h, config/darwin.h, config/elfos.h, config/svr3.h, config/1750a/1750a.h, config/a29k/a29k.h, config/alpha/alpha.h, config/arc/arc.h, config/arm/arm.h, config/avr/avr.h, config/c4x/c4x.h, config/clipper/clipper.h, config/convex/convex.h, config/cris/cris.h, config/d30v/d30v.h, config/dsp16xx/dsp16xx.h, config/elxsi/elxsi.h, config/fr30/fr30.h, config/h8300/h8300.h, config/i370/i370.h, config/i386/bsd.h, config/i386/djgpp.h, config/i386/i386.h, config/i386/sco5.h, config/i386/sol2.h, config/i386/sun386.h, config/i860/i860.h, config/i960/i960.h, config/ia64/ia64.h, config/m32r/m32r.h, config/m68hc11/m68hc11.h, config/m68k/auxas.h, config/m68k/dpx2.h, config/m68k/hp320.h, config/m68k/m68k.h, config/m68k/mot3300.h, config/m68k/sgs.h, config/m68k/tower-as.h, config/m88k/m88k.h, config/mcore/mcore-elf.h, config/mcore/mcore.h, config/mips/iris5.h, config/mips/iris6.h, config/mips/mips.h, config/mmix/mmix.h, config/mn10200/mn10200.h, config/mn10300/mn10300.h config/ns32k/encore.h, config/ns32k/ns32k.h, config/pa/pa-64.h, config/pa/pa.h, config/pdp11/pdp11.h, config/pj/pj.h, config/romp/romp.h, config/rs6000/linux64.h, config/rs6000/rs6000.h, config/rs6000/sysv4.h, config/rs6000/xcoff.h, config/s390/linux.h, config/sh/sh.h, config/sparc/linux64.h, config/sparc/sol2.h, config/sparc/sp64-elf.h, config/sparc/sparc.h, config/sparc/sysv4.h, config/stormy16/stormy16.h, config/v850/v850.h, config/vax/vax.h, config/we32k/we32k.h (ASM_OUTPUT_CHAR, ASM_OUTPUT_BYTE, ASM_BYTE_OP, ASM_BYTE, ASM_OUTPUT_SHORT, ASM_OUTPUT_INT, ASM_OUTPUT_DOUBLE_INT, UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP, UNALIGNED_DOUBLE_INT_ASM_OP): Undefine, where defined. From-SVN: r48101 --- gcc/ChangeLog | 207 ++++++++++++++++++++++++++++ gcc/config/1750a/1750a.c | 29 ++++ gcc/config/1750a/1750a.h | 40 ------ gcc/config/a29k/a29k.c | 5 + gcc/config/a29k/a29k.h | 24 ---- gcc/config/alpha/alpha.c | 16 +++ gcc/config/alpha/alpha.h | 38 +---- gcc/config/alpha/elf.h | 6 - gcc/config/arc/arc.c | 30 ++++ gcc/config/arc/arc.h | 43 +----- gcc/config/arm/aof.h | 18 --- gcc/config/arm/aout.h | 30 ---- gcc/config/arm/arm.c | 54 +++++++- gcc/config/arm/arm.h | 36 ++--- gcc/config/avr/avr-protos.h | 3 - gcc/config/avr/avr.c | 60 +++----- gcc/config/avr/avr.h | 33 ----- gcc/config/c4x/c4x.c | 7 + gcc/config/c4x/c4x.h | 13 -- gcc/config/clipper/clipper.c | 3 + gcc/config/clipper/clipper.h | 24 ---- gcc/config/clipper/clix.h | 1 - gcc/config/convex/convex.c | 7 + gcc/config/convex/convex.h | 42 ------ gcc/config/cris/cris.c | 19 +++ gcc/config/cris/cris.h | 48 ------- gcc/config/d30v/d30v.c | 5 + gcc/config/d30v/d30v.h | 50 +------ gcc/config/darwin.h | 7 - gcc/config/dsp16xx/dsp16xx-protos.h | 1 - gcc/config/dsp16xx/dsp16xx.c | 21 +-- gcc/config/dsp16xx/dsp16xx.h | 15 -- gcc/config/elfos.h | 3 - gcc/config/elxsi/elxsi.c | 34 +++++ gcc/config/elxsi/elxsi.h | 44 ------ gcc/config/fr30/fr30.c | 4 + gcc/config/fr30/fr30.h | 37 ----- gcc/config/h8300/h8300.c | 3 + gcc/config/h8300/h8300.h | 23 ---- gcc/config/i370/i370.c | 64 ++++++++- gcc/config/i370/i370.h | 78 ++--------- gcc/config/i386/att.h | 2 +- gcc/config/i386/bsd.h | 1 - gcc/config/i386/djgpp.h | 12 -- gcc/config/i386/i386.c | 16 +++ gcc/config/i386/i386.h | 36 ----- gcc/config/i386/linux.h | 2 +- gcc/config/i386/sco5.h | 8 +- gcc/config/i386/sol2.h | 4 - gcc/config/i386/sun386.h | 3 +- gcc/config/i386/sysv4.h | 2 +- gcc/config/i860/fx2800.h | 7 +- gcc/config/i860/i860.c | 17 ++- gcc/config/i860/i860.h | 37 +---- gcc/config/i860/paragon.h | 2 +- gcc/config/i860/sysv3.h | 2 +- gcc/config/i960/i960.c | 3 + gcc/config/i960/i960.h | 34 +---- gcc/config/ia64/ia64.c | 40 ++++++ gcc/config/ia64/ia64.h | 73 +--------- gcc/config/ia64/sysv4.h | 3 - gcc/config/m32r/m32r.c | 5 + gcc/config/m32r/m32r.h | 35 ----- gcc/config/m68hc11/m68hc11.c | 3 + gcc/config/m68hc11/m68hc11.h | 32 +---- gcc/config/m68k/amix.h | 4 +- gcc/config/m68k/atari.h | 4 +- gcc/config/m68k/auxas.h | 18 +-- gcc/config/m68k/dpx2.h | 35 +---- gcc/config/m68k/dpx2g.h | 3 - gcc/config/m68k/hp320.h | 31 +---- gcc/config/m68k/lynx.h | 2 - gcc/config/m68k/m68k.c | 29 ++++ gcc/config/m68k/m68k.h | 34 ++--- gcc/config/m68k/m68kelf.h | 4 +- gcc/config/m68k/m68kv4.h | 18 +-- gcc/config/m68k/mot3300.h | 68 ++------- gcc/config/m68k/sgs.h | 31 ++--- gcc/config/m68k/tower-as.h | 32 +---- gcc/config/m88k/m88k.c | 14 +- gcc/config/m88k/m88k.h | 38 +---- gcc/config/mcore/mcore-elf.h | 5 - gcc/config/mcore/mcore.c | 7 + gcc/config/mcore/mcore.h | 18 --- gcc/config/mips/iris5.h | 6 +- gcc/config/mips/iris6.h | 2 - gcc/config/mips/mips.c | 37 +++++ gcc/config/mips/mips.h | 63 --------- gcc/config/mips/sni-svr4.h | 1 - gcc/config/mmix/mmix-protos.h | 1 - gcc/config/mmix/mmix.c | 70 +++++++--- gcc/config/mmix/mmix.h | 42 ------ gcc/config/mn10200/mn10200.c | 2 + gcc/config/mn10200/mn10200.h | 23 ---- gcc/config/mn10300/mn10300.c | 2 + gcc/config/mn10300/mn10300.h | 23 ---- gcc/config/ns32k/encore.h | 6 - gcc/config/ns32k/ns32k.c | 8 ++ gcc/config/ns32k/ns32k.h | 26 +--- gcc/config/pa/pa-64.h | 14 -- gcc/config/pa/pa.c | 50 +++++++ gcc/config/pa/pa.h | 37 ----- gcc/config/pdp11/pdp11.c | 40 +++++- gcc/config/pdp11/pdp11.h | 27 +--- gcc/config/pj/pj.h | 19 --- gcc/config/romp/romp.h | 24 ---- gcc/config/rs6000/linux64.h | 27 +--- gcc/config/rs6000/rs6000.c | 102 ++++++++++++++ gcc/config/rs6000/rs6000.h | 44 ------ gcc/config/rs6000/sysv4.h | 62 ++------- gcc/config/rs6000/xcoff.h | 13 +- gcc/config/s390/linux.h | 45 +----- gcc/config/s390/s390.c | 30 ++++ gcc/config/s390/s390.h | 2 +- gcc/config/sh/sh.c | 6 + gcc/config/sh/sh.h | 22 --- gcc/config/sparc/linux64.h | 8 -- gcc/config/sparc/sol2.h | 7 - gcc/config/sparc/sp64-elf.h | 5 - gcc/config/sparc/sparc-protos.h | 1 - gcc/config/sparc/sparc.c | 94 ++++++------- gcc/config/sparc/sparc.h | 49 ++----- gcc/config/sparc/sun4gas.h | 5 - gcc/config/sparc/sysv4.h | 7 - gcc/config/stormy16/stormy16.c | 5 + gcc/config/stormy16/stormy16.h | 54 +------- gcc/config/svr3.h | 6 - gcc/config/v850/v850.c | 3 + gcc/config/v850/v850.h | 25 +--- gcc/config/vax/vax.c | 3 + gcc/config/vax/vax.h | 40 ++---- gcc/config/we32k/we32k.c | 5 + gcc/config/we32k/we32k.h | 46 ++----- gcc/defaults.h | 19 +-- gcc/doc/tm.texi | 81 +++++------ gcc/dwarf2asm.c | 156 ++++++++------------- gcc/dwarf2asm.h | 2 + gcc/dwarfout.c | 165 ++++++---------------- gcc/final.c | 10 +- gcc/halfpic.c | 3 +- gcc/output.h | 24 +++- gcc/target-def.h | 38 +++++ gcc/target.h | 17 +++ gcc/varasm.c | 202 +++++++++++---------------- 144 files changed, 1498 insertions(+), 2457 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff720d1bb30..211386bc34a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,210 @@ +2001-12-17 Richard Sandiford + + * target.h (asm_out.byte_op, asm_out.aligned_op, asm_out.unaligned_op, + asm_out.integer): New fields. + * target-def.h (TARGET_ASM_BYTE_OP, TARGET_ASM_ALIGNED_[HSDT]I_OP, + TARGET_ASM_UNALIGNED_[HSDT]I_OP, TARGET_ASM_INTEGER): New initialisers. + (TARGET_ASM_ALIGNED_INT_OP, TARGET_ASM_UNALIGNED_INT_OP): Collect + the individual initialisers together. + (TARGET_ASM_OUT): Add the new initialisers. + * output.h (assemble_integer): Return bool. + (integer_asm_op): Declare. + (default_assemble_integer): Declare. + (assemble_aligned_integer): New interface to assemble_integer. + * varasm.c (integer_asm_op): New function to select pseudo-op. + (default_assemble_integer): Default implementation of asm_out.integer. + (assemble_integer): Use the new target hook. Split objects into + words or bytes if the target hook fails. Return bool. + * doc/tm.texi (ASM_OUTPUT_CHAR, ASM_OUTPUT_BYTE, ASM_OUTPUT_SHORT, + ASM_OUTPUT_INT, ASM_OUTPUT_DOUBLE_INT, ASM_OUTPUT_QUADRUPLE_INT, + UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP, + UNALIGNED_DOUBLE_INT_ASM_OP): Undocument. + Document new target hooks. + + * defaults.h (ASM_OUTPUT_ADDR_VEC_ELT): Use integer_asm_op. + * dwarf2asm.c (unaligned_integer_asm_op): Remove. + (dw2_assemble_integer): New. + (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, + dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, + dw2_asm_output_encoded_addr_rtx): Use it. + (dw2_asm_output_nstring): Use assemble_integer for the null terminator. + (dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128): Use + integer_asm_op to get the byte pseudo-op. Use assemble_integer + if it returns NULL. + * dwarf2asm.h (dw2_assemble_integer): Declare. + * dwarfout.c: Include dwarf2asm.h. Use dwarf2 functions for the + default implementation of most macros. + (output_unsigned_leb128): Use dw2_asm_output_data. + (output_signed_leb128, dwarfout_source_line): Likewise. + (output_reg_number): Use dw2_assemble_integer. + (generate_macinfo_entry): Separate the type and offset arguments. + Use assemble_integer to write the value. + (dwarfout_start_source_file): Update generate_macinfo_entry usage. + (dwarfout_end_source_file, dwarfout_define, dwarfout_undef): Likewise. + * final.c (output_addr_const): Don't put brackets round a subtracted + symbol value or ".". + * halfpic.c (half_pic_finish): Use assemble_aligned_integer. + + * config/1750a/1750a.c (assemble_integer_1750a): New, + * config/alpha/alpha.h (literal_section): Avoid ASM_OUTPUT_INT. + * config/arc/arc.c (arc_assemble_integer): New. + * config/arc/arc.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. + * config/arm/arm.c (arm_poke_function_name): Likewise. + (arm_assemble_integer): New, extracted from... + * config/arm/arm.h (OUTPUT_INT_ADDR_CONST): ...here, now removed. + (ARM_TRAMPOLINE_TEMPLATE, ARM_FUNCTION_PROFILER): Avoid ASM_OUTPUT_INT. + (ARM_FUNCTION_PROFILER): Likewise. + * config/avr/avr-protos.h (asm_output_byte): Remove. + (asm_output_char, asm_output_short): Remove. + * config/avr/avr.c (avr_assemble_integer): New. + (asm_output_byte, asm_output_char, asm_output_short): Remove. + * config/clipper/clipper.h (ASM_LONG): Remove. + * config/dsp16xx/dsp16xx-protos.h (asm_output_long): Remove. + * config/dsp16xx/dsp16xx.c (asm_output_long): Remove. + * config/elxsi/elxsi.c (elxsi_assemble_integer): New. + * config/i370/i370.c (i370_hlasm_assemble_integer): New. + * config/i370/i370.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_SHORT. + (ASM_BYTE, ASM_SHORT, ASM_LONG): Delete. + * config/i386/att.h, (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. + * config/i386/linux.h (ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Use + ASM_LONG instead of UNALIGNED_INT_ASM_OP. + * config/i386/sco5.h (ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Likewise. + (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. + * config/i386/sysv4.h (ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Use + ASM_LONG instead of UNALIGNED_INT_ASM_OP. + * config/i860/fx2800.h (ASM_FILE_END): Avoid ASM_LONG. + * config/i860/i860.c (i860_output_function_epilogue): Likewise. + * config/i860/i860.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. + (ASM_SHORT, ASM_LONG): Undefine. + * config/i860/paragon.h (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. + * config/i860/sysv3.h (ASM_OUTPUT_ASCII): Likewise. + * config/i960/i960.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. + * config/ia64/ia64.c (ia64_assemble_integer): New. + * config/ia64/ia64.h (ASM_OUTPUT_DWARF_OFFSET): Use integer_asm_op. + (ASM_OUTPUT_DWARF_PCREL): Likewise. + * config/m68hc11/m68hc11.h (ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT, + ASM_OUTPUT_ADDR_DIFF_ELT, ASM_OUTPUT_ADDR_VEC_ELT): Avoid ASM_LONG. + (ASM_SHORT, ASM_LONG): Remove. + * config/m68k/m68k.h (INT_OP_GROUP): New macro. + (INT_OP_STANDARD, INT_OP_DOT_WORD, INT_OP_NO_DOT, INT_OP_DC): New + macros, the allowed values for INT_OP_GROUP. + * config/m68k/amix.h (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP + * config/m68k/atari.h (ASM_OUTPUT_ASCII): Likewise + * config/m68k/m68kelf.h (ASM_OUTPUT_ASCII): Likewise + * config/m68k/auxas.h (BYTE_ASM_OP, WORD_ASM_OP, LONG_ASM_OP): Remove. + (INT_OP_GROUP): Define to INT_OP_NO_DOT. + * config/m68k/dpx2.h (ASM_LONG): Undefine. + (INT_OP_GROUP): Define to INT_OP_DC. + * config/m68k/dpx2g.h (ASM_LONG): Undefine. + * config/m68k/hp320.h (INT_OP_GROUP): Define to INT_OP_NO_DOT. + * config/m68k/lynx.h (ASM_LONG): Undefine. + * config/m68k/dpx2g.h (ASM_LONG): Undefine. + * config/m68k/m68kelf.h (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. + * config/m68k/m68kv4.h (ASM_OUTPUT_ASCII): Likewise. + (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_*. + * config/m68k/mot3300.h (INT_OP_GROUP): Define to INT_OP_STANDARD + for GAS and INT_OP_NO_DOT otherwise. + (ASM_CHAR, ASM_BYTE, ASM_SHORT, ASM_LONG): Remove. + (ASM_OUTPUT_LONG_DOUBLE, ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT, + ASM_OUTPUT_ADDR_VEC_ELT, ASM_OUTPUT_ADDR_DIFF_ELT): Avoid ASM_LONG. + (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. + * config/m68k/sgs.h (BYTE_ASM_OP, WORD_ASM_OP, LONG_ASM_OP): Remove. + (INT_OP_GROUP): Define to INT_OP_STANDARD. + (ASM_OUTPUT_LONG_DOUBLE, ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT, + ASM_OUTPUT_ADDR_VEC_ELT, ASM_OUTPUT_ADDR_DIFF_ELT): Avoid LONG_ASM_OP. + (ASM_OUTPUT_ASCII): Avoid BYTE_ASM_OP. + * config/m68k/tower-as.h (ASM_LONG): Remove. + (INT_OP_GROUP): Define to INT_OP_NO_DOT. + * config/m88k/m88k.c (output_tdesc): Avoid ASM_LONG. + * config/m88k/m88k.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. + (ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT): Avoid ASM_LONG. + * config/mips/iris5.h (TARGET_IRIX5): Define. + * config/mips/mips.c (mips_assemble_integer): New. + * config/mips/sni-svr4.h (ASM_LONG): Undefine. + * config/mmix/mmix-protos.h (mmix_asm_output_double_int): Remove. + * config/mmix/mmix.c (mmix_assemble_integer): New. + (mmix_asm_output_double_int): Remove. + (mmix_print_operand): Call mmix_output_octa directly. + * config/mmix/mmix.h (ASM_LONG): Remove. + * config/ns32k/ns32k.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_INT. + * config/pa/pa.c (pa_assemble_integer): New. + (pa_override_options): Only use aligned DI ops on 64-bit targets. + Only use the unaligned ops if TARGET_GAS. + * config/pdp11/pdp11.c (pdp11_assemble_integer): New. + * config/pdp11/pdp11.h (TRAMPOLINE_TEMPLATE): Avoid ASM_OUTPUT_SHORT. + * config/pj/pj.h (ASM_LONG): Undefine. + * config/rs6000/linux64.h (RELOCATABLE_NEEDS_FIXUP): Undefine. + * config/rs6000/rs6000.c (rs6000_assemble_integer): New, mostly + extracted from ASM_OUTPUT_INT in sysv4.h. Use in_text_section() + and in_toc_section() rather than the in_section variable. + (rs6000_override_options): Only use DI ops when TARGET_POWERPC64. + * config/rs6000/sysv4.h (TOC_SECTION_FUNCTION): Add in_toc_section(). + (RELOCATABLE_NEEDS_FIXUP): Define. + * config/rs6000/xcoff.h (DOUBLE_INT_ASM_OP): Change space to tab. + * config/s390/linux.h (ASM_SHORT, ASM_LONG, ASM_QUAD): Remove. + (ASM_OUTPUT_ADDR_VEC_ELT, ASM_OUTPUT_ADDR_DIFF_ELT): Use integer_asm_op + to get the word directive. + (ASM_OUTPUT_ASCII): Avoid ASM_BYTE_OP. + * config/s390/s390.c (s390_assemble_integer): New. + * config/s390/s390.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY): Use + integer_asm_op to get the word directive. + * config/sparc/sol2.h (ASM_SHORT, ASM_LONG): Remove. + * config/sparc/sparc-protos.h (output_double_int): Remove. + * config/sparc/sparc.c (output_double_int): Move to... + (sparc_assemble_integer): ...this new function. + (sparc_override_options): Only use .uaxword if TARGET_ARCH64. + * config/sparc/sparc.h (ASM_SHORT, ASM_LONG, ASM_LONGLONG): Remove. + * config/sparc/sysv4.h (ASM_LONG): Remove. + (ASM_OUTPUT_LONG_DOUBLE, ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT): Avoid + ASM_LONG. + * config/vax/vax.h (TRAMPOLINE_TEMPLATE): Use assemble_aligned_integer. + * config/we32k/we32k.h (TRAMPOLINE_TEMPLATE): Likewise. + + * config/1750a/1750a.c, config/a29k/a29k.c, config/alpha/alpha.c, + config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, + config/clipper/clipper.c, config/convex/convex.c, config/cris/cris.c, + config/d30v/d30v.c, config/dsp16xx/dsp16xx.c, config/elxsi/elxsi.c, + config/fr30/fr30.c, config/h8300/h8300.c, config/i370/i370.c, + config/i386/i386.c, config/i860/i860.c, config/i960/i960.c, + config/ia64/ia64.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, + config/m68k/m68k.c, config/m88k/m88k.c, config/mips/mips.c, + config/mmix/mmix.c, config/mn10200/mn10200.c, config/mn10300/mn10300.c, + config/ns32k/ns32k.c, config/pa/pa.c, config/pdp11/pdp11.c, + config/sh/sh.c, config/sparc/sparc.c, config/stormy16/stormy16.c, + config/v850/v850.c, config/vax/vax.c, config/we32k/we32k.c + (TARGET_ASM_BYTE_OP, TARGET_ASM_ALIGNED_HI_OP, + TARGET_ASM_ALIGNED_SI_OP, TARGET_ASM_ALIGNED_DI_OP, + TARGET_ASM_UNALIGNED_HI_OP, TARGET_ASM_UNALIGNED_SI_OP, + TARGET_ASM_UNALIGNED_DI_OP, TARGET_ASM_INTEGER): Redefine as + appropriate. + + * config/defaults.h, config/darwin.h, config/elfos.h, config/svr3.h, + config/1750a/1750a.h, config/a29k/a29k.h, config/alpha/alpha.h, + config/arc/arc.h, config/arm/arm.h, config/avr/avr.h, config/c4x/c4x.h, + config/clipper/clipper.h, config/convex/convex.h, config/cris/cris.h, + config/d30v/d30v.h, config/dsp16xx/dsp16xx.h, config/elxsi/elxsi.h, + config/fr30/fr30.h, config/h8300/h8300.h, config/i370/i370.h, + config/i386/bsd.h, config/i386/djgpp.h, config/i386/i386.h, + config/i386/sco5.h, config/i386/sol2.h, config/i386/sun386.h, + config/i860/i860.h, config/i960/i960.h, config/ia64/ia64.h, + config/m32r/m32r.h, config/m68hc11/m68hc11.h, config/m68k/auxas.h, + config/m68k/dpx2.h, config/m68k/hp320.h, config/m68k/m68k.h, + config/m68k/mot3300.h, config/m68k/sgs.h, config/m68k/tower-as.h, + config/m88k/m88k.h, config/mcore/mcore-elf.h, config/mcore/mcore.h, + config/mips/iris5.h, config/mips/iris6.h, config/mips/mips.h, + config/mmix/mmix.h, config/mn10200/mn10200.h, config/mn10300/mn10300.h + config/ns32k/encore.h, config/ns32k/ns32k.h, config/pa/pa-64.h, + config/pa/pa.h, config/pdp11/pdp11.h, config/pj/pj.h, + config/romp/romp.h, config/rs6000/linux64.h, config/rs6000/rs6000.h, + config/rs6000/sysv4.h, config/rs6000/xcoff.h, config/s390/linux.h, + config/sh/sh.h, config/sparc/linux64.h, config/sparc/sol2.h, + config/sparc/sp64-elf.h, config/sparc/sparc.h, config/sparc/sysv4.h, + config/stormy16/stormy16.h, config/v850/v850.h, config/vax/vax.h, + config/we32k/we32k.h (ASM_OUTPUT_CHAR, ASM_OUTPUT_BYTE, ASM_BYTE_OP, + ASM_BYTE, ASM_OUTPUT_SHORT, ASM_OUTPUT_INT, ASM_OUTPUT_DOUBLE_INT, + UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP, + UNALIGNED_DOUBLE_INT_ASM_OP): Undefine, where defined. + 2001-12-17 Stan Shebs * config/rs6000/darwin.h (SUBTARGET_OVERRIDE_OPTIONS): Define. diff --git a/gcc/config/1750a/1750a.c b/gcc/config/1750a/1750a.c index a5ad52a15fd..54a2216b789 100644 --- a/gcc/config/1750a/1750a.c +++ b/gcc/config/1750a/1750a.c @@ -47,10 +47,20 @@ const char *const sectname[4] = {"Init", "Normal", "Konst", "Static"}; static int which_bit PARAMS ((int)); +static bool assemble_integer_1750a PARAMS ((rtx, unsigned int, int)); static void output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); /* Initialize the GCC target structure. */ +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP "\tdata\t" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\tdatal\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP NULL +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER assemble_integer_1750a + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -807,6 +817,25 @@ print_operand_address (file, addr) addr_inc = 0; } +/* Target hook for assembling integer objects. The 1750a version needs to + keep track of how many bytes have been written. */ + +static bool +assemble_integer_1750a (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + if (default_assemble_integer (x, size, aligned_p)) + { + if (label_pending) + label_pending = 0; + datalbl[datalbl_ndx].size += size; + return true; + } + return false; +} + /* * Return non zero if the LS 16 bits of the given value has just one bit set, diff --git a/gcc/config/1750a/1750a.h b/gcc/config/1750a/1750a.h index 9d05863a860..90903c9aa0e 100644 --- a/gcc/config/1750a/1750a.h +++ b/gcc/config/1750a/1750a.h @@ -1118,46 +1118,6 @@ enum reg_class { NO_REGS, R2, R0_1, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLA fprintf(FILE,"\n"); \ } while (0) -/* This is how to output an assembler line defining a `char', `short', or - `int' constant. - 1750 NOTE: The reason why this macro also outputs `short' and `int' - constants is that for the 1750, BITS_PER_UNIT is 16 (as opposed to the - usual 8.) This behavior is different from the usual, where - ASM_OUTPUT_CHAR only outputs character constants. The name - of this macro should perhaps be `ASM_OUTPUT_QUARTER_INT' or so. - */ - -#define ASM_OUTPUT_CHAR(FILE,VALUE) do { \ - if (label_pending) \ - label_pending = 0; \ - datalbl[datalbl_ndx].size++; \ - fprintf(FILE, "\tdata\t"); \ - output_addr_const(FILE, VALUE); \ - fprintf(FILE, "\n"); \ - } while (0) - -/* This is how to output an assembler line defining a `long int' constant. - 1750 NOTE: The reason why this macro outputs `long' instead of `short' - constants is that for the 1750, BITS_PER_UNIT is 16 (as opposed to the - usual 8.) The name of this macro should perhaps be `ASM_OUTPUT_HALF_INT'. - */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) do { \ - if (label_pending) \ - label_pending = 0; \ - datalbl[datalbl_ndx].size += 2; \ - fprintf(FILE, "\tdatal\t%d\n",INTVAL(VALUE)); \ - } while (0) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) do { \ - if (label_pending) \ - label_pending = 0; \ - datalbl[datalbl_ndx].size++; \ - fprintf(FILE, "\tdata\t#%x\n", VALUE); \ - } while (0) - /* This is how to output an insn to push a register on the stack. It need not be very fast code. */ diff --git a/gcc/config/a29k/a29k.c b/gcc/config/a29k/a29k.c index 531247154fc..3291bab5b24 100644 --- a/gcc/config/a29k/a29k.c +++ b/gcc/config/a29k/a29k.c @@ -97,6 +97,11 @@ rtx a29k_compare_op0, a29k_compare_op1; int a29k_compare_fp_p; /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/a29k/a29k.h b/gcc/config/a29k/a29k.h index 27b33be9cd5..775179dfb2f 100644 --- a/gcc/config/a29k/a29k.h +++ b/gcc/config/a29k/a29k.h @@ -1470,25 +1470,6 @@ extern int a29k_debug_reg_map[]; #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ fprintf (FILE, "\t.float %.20e\n", (VALUE)) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.hword "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - /* This is how to output an insn to push a register on the stack. It need not be very fast code. */ @@ -1505,11 +1486,6 @@ extern int a29k_debug_reg_map[]; reg_names[REGNO], reg_names[R_MSP], reg_names[R_MSP], \ reg_names[R_MSP]); -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This is how to output an element of a case-vector that is absolute. */ #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 7dcb4a6bc4d..2588f5f4371 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -205,6 +205,22 @@ static unsigned int unicosmk_section_type_flags PARAMS ((tree, const char *, # define TARGET_SECTION_TYPE_FLAGS unicosmk_section_type_flags #endif +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t" + +/* Default unaligned ops are provided for ELF systems. To get unaligned + data for non-ELF systems, we have to turn off auto alignment. */ +#ifndef OBJECT_FORMAT_ELF +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.align 0\n\t.word\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.align 0\n\t.long\t" +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP "\t.align 0\n\t.quad\t" +#endif + #undef TARGET_ASM_FUNCTION_END_PROLOGUE #define TARGET_ASM_FUNCTION_END_PROLOGUE alpha_output_function_end_prologue diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 43dabceca6e..db23a57b54f 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -1845,7 +1845,7 @@ literal_section () \ if (firsttime) \ { \ firsttime = 0; \ - ASM_OUTPUT_DOUBLE_INT (asm_out_file, const0_rtx); \ + assemble_aligned_integer (8, const0_rtx); \ } \ \ in_section = readonly_data; \ @@ -1978,32 +1978,6 @@ do { \ fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line defining a `long' constant. */ - -#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.quad "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ - fprintf (FILE, "\t.word %d\n", \ - (int)(GET_CODE (VALUE) == CONST_INT \ - ? INTVAL (VALUE) & 0xffff : (abort (), 0))) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ - fprintf (FILE, "\t.byte %d\n", \ - (int)(GET_CODE (VALUE) == CONST_INT \ - ? INTVAL (VALUE) & 0xff : (abort (), 0))) - /* We use the default ASCII-output routine, except that we don't write more than 50 characters since the assembler doesn't support very long lines. */ @@ -2048,11 +2022,6 @@ do { \ } \ while (0) -/* To get unaligned data, we have to turn off auto alignment. */ -#define UNALIGNED_SHORT_ASM_OP "\t.align 0\n\t.word\t" -#define UNALIGNED_INT_ASM_OP "\t.align 0\n\t.long\t" -#define UNALIGNED_DOUBLE_INT_ASM_OP "\t.align 0\n\t.quad\t" - /* This is how to output an insn to push a register on the stack. It need not be very fast code. */ @@ -2069,11 +2038,6 @@ do { \ (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \ (REGNO) & 31); -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (int) ((VALUE) & 0xff)) - /* This is how to output an element of a case-vector that is absolute. (Alpha does not use such vectors, but we must define this macro anyway.) */ diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h index 7c882291672..7e9b4d84b4b 100644 --- a/gcc/config/alpha/elf.h +++ b/gcc/config/alpha/elf.h @@ -624,12 +624,6 @@ do { \ /* We support #pragma. */ #define HANDLE_SYSV_PRAGMA -/* Undo the auto-alignment stuff from alpha.h. ELF has unaligned data - pseudos natively. */ -#undef UNALIGNED_SHORT_ASM_OP -#undef UNALIGNED_INT_ASM_OP -#undef UNALIGNED_DOUBLE_INT_ASM_OP - /* Select a format to encode pointers in exception handling data. CODE is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is true if the symbol may be affected by dynamic relocations. diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 5ecc1eceef8..62ed01097bf 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -89,10 +89,18 @@ static void arc_init_reg_tables PARAMS ((void)); static int get_arc_condition_code PARAMS ((rtx)); const struct attribute_spec arc_attribute_table[]; static tree arc_handle_interrupt_attribute PARAMS ((tree *, tree, tree, int, bool *)); +static bool arc_assemble_integer PARAMS ((rtx, unsigned int, int)); static void arc_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void arc_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER arc_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE arc_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -1107,6 +1115,28 @@ arc_save_restore (file, base_reg, offset, gmask, op) } } +/* Target hook to assemble an integer object. The ARC version needs to + emit a special directive for references to labels and function + symbols. */ + +static bool +arc_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + if (size == UNITS_PER_WORD && aligned_p + && ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FLAG (x)) + || GET_CODE (x) == LABEL_REF)) + { + fputs ("\t.word\t%st(", asm_out_file); + output_addr_const (asm_out_file, x); + fputs (")\n", asm_out_file); + return true; + } + return default_assemble_integer (x, size, aligned_p); +} + /* Set up the stack and frame pointer (if desired) for the function. */ static void diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index ddd989b6a45..d7db3bd66db 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -863,10 +863,10 @@ arc_eligible_for_epilogue_delay (TRIAL, SLOTS_FILLED) */ #define TRAMPOLINE_TEMPLATE(FILE) \ do { \ - ASM_OUTPUT_INT (FILE, GEN_INT (0x631f7c00)); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ - ASM_OUTPUT_INT (FILE, GEN_INT (0x381f0000)); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x631f7c00)); \ + assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x381f0000)); \ + assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ } while (0) /* Length in units of the trampoline for entering a nested function. */ @@ -1238,36 +1238,6 @@ do { \ no longer contain unusual constructs. */ #define ASM_APP_OFF "" -/* This is how to output an assembler line defining a `char' constant. */ -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ -( fprintf (FILE, "\t.byte\t"), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line defining a `short' constant. */ -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ -( fprintf (FILE, "\t.hword\t"), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line defining an `int' constant. - We also handle symbol output here. Code addresses must be right shifted - by 2 because that's how the jump instruction wants them. */ -#define ASM_OUTPUT_INT(FILE, VALUE) \ -do { \ - fprintf (FILE, "\t.word\t"); \ - if ((GET_CODE (VALUE) == SYMBOL_REF && SYMBOL_REF_FLAG (VALUE)) \ - || GET_CODE (VALUE) == LABEL_REF) \ - { \ - fprintf (FILE, "%%st("); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, ")"); \ - } \ - else \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ -} while (0) - /* This is how to output an assembler line defining a `float' constant. */ #define ASM_OUTPUT_FLOAT(FILE, VALUE) \ { \ @@ -1290,11 +1260,6 @@ do { \ t[0], ASM_COMMENT_START, str, t[1]); \ } -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_BYTE_OP "\t.byte\t" -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf (FILE, "%s0x%x\n", ASM_BYTE_OP, (VALUE)) - /* This is how to output the definition of a user-level label named NAME, such as the label on a static function or variable NAME. */ #define ASM_OUTPUT_LABEL(FILE, NAME) \ diff --git a/gcc/config/arm/aof.h b/gcc/config/arm/aof.h index 387788d3bd5..01826b81727 100644 --- a/gcc/config/arm/aof.h +++ b/gcc/config/arm/aof.h @@ -206,24 +206,6 @@ do { \ l, ASM_COMMENT_START, dstr); \ } while (0) -#define ASM_OUTPUT_INT(STREAM,VALUE) \ - (fprintf ((STREAM), "\tDCD\t"), \ - output_addr_const ((STREAM), (VALUE)), \ - fputc ('\n', (STREAM))) - -#define ASM_OUTPUT_SHORT(STREAM,VALUE) \ - (fprintf ((STREAM), "\tDCW\t"), \ - output_addr_const ((STREAM), (VALUE)), \ - fputc ('\n', (STREAM))) - -#define ASM_OUTPUT_CHAR(STREAM,VALUE) \ - (fprintf ((STREAM), "\tDCB\t"), \ - output_addr_const ((STREAM), (VALUE)), \ - fputc ('\n', (STREAM))) - -#define ASM_OUTPUT_BYTE(STREAM,VALUE) \ - fprintf ((STREAM), "\tDCB\t%d\n", (VALUE)) - #define ASM_OUTPUT_ASCII(STREAM,PTR,LEN) \ { \ int i; \ diff --git a/gcc/config/arm/aout.h b/gcc/config/arm/aout.h index fbdbba072f5..9832eda9260 100644 --- a/gcc/config/arm/aout.h +++ b/gcc/config/arm/aout.h @@ -226,36 +226,6 @@ Boston, MA 02111-1307, USA. */ } \ while (0) -#define ASM_OUTPUT_INT(STREAM, EXP) \ - do \ - { \ - fprintf (STREAM, "\t.word\t"); \ - OUTPUT_INT_ADDR_CONST (STREAM, EXP); \ - fputc ('\n', STREAM); \ - } \ - while (0) - -#define ASM_OUTPUT_SHORT(STREAM, EXP) \ - do \ - { \ - fprintf (STREAM, "\t.short\t"); \ - output_addr_const (STREAM, EXP); \ - fputc ('\n', STREAM); \ - } \ - while (0) - -#define ASM_OUTPUT_CHAR(STREAM, EXP) \ - do \ - { \ - fprintf (STREAM, "\t.byte\t"); \ - output_addr_const (STREAM, EXP); \ - fputc ('\n', STREAM); \ - } \ - while (0) - -#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ - fprintf (STREAM, "\t.byte\t%d\n", VALUE) - #undef ASM_OUTPUT_ASCII #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \ output_ascii_pseudo_op (STREAM, (const unsigned char *)(PTR), LEN) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 7ede6666314..7a5f03ae4ec 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -68,6 +68,10 @@ static int const_ok_for_op PARAMS ((Hint, enum rtx_code)); static int eliminate_lr2ip PARAMS ((rtx *)); static rtx emit_multi_reg_push PARAMS ((int)); static rtx emit_sfm PARAMS ((int, int)); +#ifndef AOF_ASSEMBLER +static bool arm_assemble_integer PARAMS ((rtx, unsigned int, + int)); +#endif static Ccstar fp_const_from_val PARAMS ((REAL_VALUE_TYPE *)); static arm_cc get_arm_condition_code PARAMS ((rtx)); static void init_fpa_table PARAMS ((void)); @@ -134,6 +138,20 @@ static int arm_adjust_cost PARAMS ((rtx, rtx, rtx, int)); #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE arm_attribute_table +#ifdef AOF_ASSEMBLER +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP "\tDCB\t" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\tDCW\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\tDCD\t" +#else +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP NULL +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER arm_assemble_integer +#endif + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE arm_output_function_prologue @@ -7320,7 +7338,7 @@ arm_poke_function_name (stream, name) ASM_OUTPUT_ASCII (stream, name, length); ASM_OUTPUT_ALIGN (stream, 2); x = GEN_INT ((unsigned HOST_WIDE_INT) 0xff000000 + alignlength); - ASM_OUTPUT_INT (stream, x); + assemble_aligned_integer (UNITS_PER_WORD, x); } /* Place some comments into the assembler stream @@ -8509,6 +8527,40 @@ arm_print_operand (stream, x, code) } } +#ifndef AOF_ASSEMBLER +/* Target hook for assembling integer objects. The ARM version needs to + handle word-sized values specially. */ + +static bool +arm_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + if (size == UNITS_PER_WORD && aligned_p) + { + fputs ("\t.word\t", asm_out_file); + output_addr_const (asm_out_file, x); + + /* Mark symbols as position independent. We only do this in the + .text segment, not in the .data segment. */ + if (NEED_GOT_RELOC && flag_pic && making_const_table && + (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)) + { + if (GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x)) + fputs ("(GOTOFF)", asm_out_file); + else if (GET_CODE (x) == LABEL_REF) + fputs ("(GOTOFF)", asm_out_file); + else + fputs ("(GOT)", asm_out_file); + } + fputc ('\n', asm_out_file); + return true; + } + return default_assemble_integer (x, size, aligned_p); +} +#endif + /* A finite state machine takes care of noticing whether or not instructions can be conditionally executed, and thus decrease execution time and code size by deleting branch instructions. The fsm is controlled by diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index eefa198150d..6060275d6bb 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1579,7 +1579,7 @@ typedef struct fputc ('\n', STREAM); \ ASM_GENERATE_INTERNAL_LABEL (temp, "LP", LABELNO); \ sym = gen_rtx (SYMBOL_REF, Pmode, temp); \ - ASM_OUTPUT_INT (STREAM, sym); \ + assemble_aligned_integer (UNITS_PER_WORD, sym); \ } #endif @@ -1716,14 +1716,14 @@ typedef struct .word static chain value .word function's address ??? FIXME: When the trampoline returns, r8 will be clobbered. */ -#define ARM_TRAMPOLINE_TEMPLATE(FILE) \ -{ \ - asm_fprintf (FILE, "\tldr\t%r, [%r, #0]\n", \ - STATIC_CHAIN_REGNUM, PC_REGNUM); \ - asm_fprintf (FILE, "\tldr\t%r, [%r, #0]\n", \ - PC_REGNUM, PC_REGNUM); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ +#define ARM_TRAMPOLINE_TEMPLATE(FILE) \ +{ \ + asm_fprintf (FILE, "\tldr\t%r, [%r, #0]\n", \ + STATIC_CHAIN_REGNUM, PC_REGNUM); \ + asm_fprintf (FILE, "\tldr\t%r, [%r, #0]\n", \ + PC_REGNUM, PC_REGNUM); \ + assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ + assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ } /* On the Thumb we always switch into ARM mode to execute the trampoline. @@ -2781,24 +2781,6 @@ extern int making_const_table; else \ THUMB_PRINT_OPERAND_ADDRESS (STREAM, X) -#define OUTPUT_INT_ADDR_CONST(STREAM, X) \ - { \ - output_addr_const (STREAM, X); \ - \ - /* Mark symbols as position independent. We only do this in the \ - .text segment, not in the .data segment. */ \ - if (NEED_GOT_RELOC && flag_pic && making_const_table && \ - (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == LABEL_REF)) \ - { \ - if (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X)) \ - fprintf (STREAM, "(GOTOFF)"); \ - else if (GET_CODE (X) == LABEL_REF) \ - fprintf (STREAM, "(GOTOFF)"); \ - else \ - fprintf (STREAM, "(GOT)"); \ - } \ - } - /* Output code to add DELTA to the first argument, and then jump to FUNCTION. Used for C++ multiple inheritance. */ #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index b6f4d74cb00..e47b7e0ea64 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -115,9 +115,6 @@ extern const char * output_reload_insisf PARAMS ((rtx insn, rtx *operands, int *len)); extern int default_rtx_costs PARAMS ((rtx X, RTX_CODE code, RTX_CODE outer_code)); -extern void asm_output_char PARAMS ((FILE *file, rtx value)); -extern void asm_output_short PARAMS ((FILE *file, rtx value)); -extern void asm_output_byte PARAMS ((FILE *file, int value)); extern enum reg_class secondary_input_reload_class PARAMS ((enum reg_class, enum machine_mode, rtx)); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 8b7e1a12861..7e20748220c 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -61,6 +61,7 @@ void debug_hard_reg_set PARAMS ((HARD_REG_SET set)); static tree avr_handle_progmem_attribute PARAMS ((tree *, tree, tree, int, bool *)); static tree avr_handle_fndecl_attribute PARAMS ((tree *, tree, tree, int, bool *)); const struct attribute_spec avr_attribute_table[]; +static bool avr_assemble_integer PARAMS ((rtx, unsigned int, int)); static void avr_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void avr_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); @@ -174,6 +175,11 @@ static const struct mcu_type_s avr_mcu_types[] = { int avr_case_values_threshold = 30000; /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER avr_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE avr_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -4458,49 +4464,25 @@ _reg_unused_after (insn, reg) return 1; } -/* Output rtx VALUE as .byte to file FILE */ +/* Target hook for assembling integer objects. The AVR version needs + special handling for references to certain labels. */ -void -asm_output_char (file, value) - FILE *file; - rtx value; +static bool +avr_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; { - fprintf (file, "\t.byte "); - output_addr_const (file, value); - fprintf (file, "\n"); -} - - -/* Output VALUE as .byte to file FILE */ - -void -asm_output_byte (file, value) - FILE *file; - int value; -{ - fprintf (file, "\t.byte 0x%x\n", value & 0xff); -} - - -/* Output rtx VALUE as .word to file FILE */ - -void -asm_output_short (file, value) - FILE *file; - rtx value; -{ - if (SYMBOL_REF_FLAG (value) || GET_CODE (value) == LABEL_REF) + if (size == POINTER_SIZE / BITS_PER_UNIT && aligned_p + && ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FLAG (x)) + || GET_CODE (x) == LABEL_REF)) { - fprintf (file, "\t.word pm("); - output_addr_const (file, (value)); - fprintf (file, ")\n"); - } - else - { - fprintf (file, "\t.word "); - output_addr_const (file, (value)); - fprintf (file, "\n"); + fputs ("\t.word\tpm(", asm_out_file); + output_addr_const (asm_out_file, x); + fputs (")\n", asm_out_file); + return true; } + return default_assemble_integer (x, size, aligned_p); } diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 23810bf4629..fac7e46901a 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -2025,39 +2025,6 @@ progmem_section (void) \ definitions. */ -#define ASM_OUTPUT_INT(FILE, VALUE) \ - ( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fputs ("\n", FILE)) - - /* Likewise for `short' and `char' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) asm_output_short(FILE,VALUE) -#define ASM_OUTPUT_CHAR(FILE,VALUE) asm_output_char(FILE,VALUE) - -/* `ASM_OUTPUT_QUADRUPLE_INT (STREAM, EXP)' - A C statement to output to the stdio stream STREAM an assembler - instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes, - respectively, whose value is VALUE. The argument EXP will be an - RTL expression which represents a constant value. Use - `output_addr_const (STREAM, EXP)' to output this value as an - assembler expression. - - For sizes larger than `UNITS_PER_WORD', if the action of a macro - would be identical to repeatedly calling the macro corresponding to - a size of `UNITS_PER_WORD', once for each word, you need not define - the macro. */ - - -#define ASM_OUTPUT_BYTE(FILE,VALUE) asm_output_byte (FILE,VALUE) -/* A C statement to output to the stdio stream STREAM an assembler - instruction to assemble a single byte containing the number VALUE. */ - -#define ASM_BYTE_OP "\t.byte " -/* A C string constant giving the pseudo-op to use for a sequence of - single-byte constants. If this macro is not defined, the default - is `"\t.byte\t"'. */ - #define ASM_OUTPUT_ASCII(FILE, P, SIZE) gas_output_ascii (FILE,P,SIZE) /* `ASM_OUTPUT_ASCII (STREAM, PTR, LEN)' output_ascii (FILE, P, SIZE) diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 3559652fe40..ee878dd7098 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -195,6 +195,13 @@ static void c4x_asm_named_section PARAMS ((const char *, unsigned int)); static int c4x_adjust_cost PARAMS ((rtx, rtx, rtx, int)); /* Initialize the GCC target structure. */ +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP "\t.word\t" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP NULL +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP NULL + #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE c4x_attribute_table diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 5dd4a122c24..824fa2ce7ff 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -1888,19 +1888,6 @@ const_section () \ l[0], str, l[1]); \ } while (0); -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ - do { \ - fprintf (FILE, "\t.word\t"); \ - output_addr_const (FILE, VALUE); \ - if (GET_CODE (VALUE) != SYMBOL_REF) \ - fprintf (FILE, " ; 0%08xh\n", INTVAL (VALUE)); \ - else \ - fputc ('\n', FILE); \ - } while (0); - -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf (FILE, "\t.word\t0%xh\n", (VALUE)) - #define ASM_OUTPUT_ASCII(FILE, PTR, LEN) c4x_output_ascii (FILE, PTR, LEN) /* Output and Generation of Labels. */ diff --git a/gcc/config/clipper/clipper.c b/gcc/config/clipper/clipper.c index 7e6bd1330ef..96c1caa7a6e 100644 --- a/gcc/config/clipper/clipper.c +++ b/gcc/config/clipper/clipper.c @@ -54,6 +54,9 @@ extern int frame_pointer_needed; static int frame_size; /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE clipper_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/clipper/clipper.h b/gcc/config/clipper/clipper.h index 1d202c08f7a..48671b02c3e 100644 --- a/gcc/config/clipper/clipper.h +++ b/gcc/config/clipper/clipper.h @@ -979,30 +979,6 @@ do \ #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This is how to output an insn to push a register on the stack. It need not be very fast code. */ diff --git a/gcc/config/clipper/clix.h b/gcc/config/clipper/clix.h index 45f92646cc7..cd625c1e827 100644 --- a/gcc/config/clipper/clix.h +++ b/gcc/config/clipper/clix.h @@ -70,7 +70,6 @@ do { \ fprintf(FILE, "\t.align %d\n", 1 << (LOG)) -#define ASM_LONG ".long" #define BSS_SECTION_ASM_OP "\t.bss" #undef INIT_SECTION_ASM_OP #define INIT_SECTION_ASM_OP "\t.section .init,\"x\"" diff --git a/gcc/config/convex/convex.c b/gcc/config/convex/convex.c index f77ed67efd1..bee0f173076 100644 --- a/gcc/config/convex/convex.c +++ b/gcc/config/convex/convex.c @@ -69,6 +69,13 @@ static void convex_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static int convex_adjust_cost PARAMS ((rtx, rtx, rtx, int)); /* Initialize the GCC target structure. */ +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP "\tds.b\t" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\tds.h\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\tds.w\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE convex_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/convex/convex.h b/gcc/config/convex/convex.h index c6e02550735..d8fa6836956 100644 --- a/gcc/config/convex/convex.h +++ b/gcc/config/convex/convex.h @@ -1267,48 +1267,6 @@ enum reg_class { #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ outfloat (FILE, VALUE, "%.9e", "\tds.s ", "\n") -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -{ \ - fprintf (FILE, "\tds.w "); \ - output_addr_const (FILE, simplify_for_convex (VALUE)); \ - fprintf (FILE, "\n"); \ -} - -/* Likewise for a `long long int' constant. */ - -#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ -{ \ - if (GET_CODE (VALUE) == CONST_DOUBLE) \ - fprintf (FILE, "\tds.w %d,%d\n", \ - const_double_high_int (VALUE), const_double_low_int (VALUE)); \ - else if (GET_CODE (VALUE) == CONST_INT) \ - { \ - int val = INTVAL (VALUE); \ - fprintf (FILE, "\tds.w %d,%d\n", val < 0 ? -1 : 0, val); \ - } \ - else \ - abort (); \ -} - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\tds.h "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\tds.b "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\tds.b %#x\n", (int)(VALUE)) - /* This is how to output a string */ #define ASM_OUTPUT_ASCII(FILE,STR,SIZE) do { \ diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 5e297921fca..8d2afa82d06 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -123,6 +123,25 @@ int cris_max_stackframe = 0; /* This is the parsed result of the "-march=" option, if given. */ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION; +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.dword\t" +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t" + +/* We need to define these, since the 2byte, 4byte, 8byte op:s are only + available in ELF. These "normal" pseudos do not have any alignment + constraints or side-effects. */ +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP + +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP + +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE cris_target_asm_function_prologue diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 38a92ae607c..c7e2cba6053 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -1537,56 +1537,8 @@ struct cum_args {int regs;}; ASM_OUTPUT_LONG_DOUBLE (FILE, VALUE) -/* This is a kludge for a.out+ELF support: For non-ELF prioritized - [cd]tors, globalize the function so collect2 can collect it. This is - due to short-sightedness guided by defined (ASM_OUTPUT_SECTION_NAME) - && defined (ASM_OUTPUT_CONSTRUCTOR). */ - -#define ASM_OUTPUT_INT(FILE, VALUE) \ - do \ - { \ - fprintf (FILE, "\t.dword "); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ - do \ - { \ - fprintf (FILE, "\t.word "); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ - do \ - { \ - fprintf (FILE, "\t.byte "); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) (C) == '@' -/* FIXME: These are undocumented. */ -/* We need to define these, since the 2byte, 4byte, 8byte op:s are only - available in ELF. These "normal" pseudos do not have any alignment - constraints or side-effects. */ -#undef UNALIGNED_SHORT_ASM_OP -#define UNALIGNED_SHORT_ASM_OP "\t.word\t" - -#undef UNALIGNED_INT_ASM_OP -#define UNALIGNED_INT_ASM_OP "\t.dword\t" - -#undef UNALIGNED_DOUBLE_INT_ASM_OP -#define UNALIGNED_DOUBLE_INT_ASM_OP "\t.quad\t" - /* Node: Uninitialized Data */ /* Remember to round off odd values if we want data alignment, diff --git a/gcc/config/d30v/d30v.c b/gcc/config/d30v/d30v.c index 9eea5f5ef6e..f359d3d71c0 100644 --- a/gcc/config/d30v/d30v.c +++ b/gcc/config/d30v/d30v.c @@ -85,6 +85,11 @@ enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER]; enum reg_class reg_class_from_letter[256]; /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE d30v_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h index af641b35bc2..ebdefb598ed 100644 --- a/gcc/config/d30v/d30v.h +++ b/gcc/config/d30v/d30v.h @@ -3778,53 +3778,6 @@ extern const char *d30v_branch_cost_string; /* #define ASM_OUTPUT_SHORT_FLOAT(STREAM, VALUE) */ /* #define ASM_OUTPUT_BYTE_FLOAT(STREAM, VALUE) */ -/* A C statement to output to the stdio stream STREAM an assembler instruction - to assemble an integer of 16, 8, 4, 2 or 1 bytes, respectively, whose value - is VALUE. The argument EXP will be an RTL expression which represents a - constant value. Use `output_addr_const (STREAM, EXP)' to output this value - as an assembler expression. - - For sizes larger than `UNITS_PER_WORD', if the action of a macro would be - identical to repeatedly calling the macro corresponding to a size of - `UNITS_PER_WORD', once for each word, you need not define the macro. */ - -/* #define ASM_OUTPUT_QUADRUPLE_INT(STREAM, EXP) */ -/* #define ASM_OUTPUT_DOUBLE_INT(STREAM, EXP) */ - -#define ASM_OUTPUT_INT(STREAM, EXP) \ -do { \ - fputs ("\t.word ", STREAM); \ - output_addr_const (STREAM, EXP); \ - putc ('\n', STREAM); \ -} while (0) - -#define ASM_OUTPUT_SHORT(STREAM, EXP) \ -do { \ - fputs ("\t.hword ", STREAM); \ - output_addr_const (STREAM, EXP); \ - putc ('\n', STREAM); \ -} while (0) - -#define ASM_OUTPUT_CHAR(STREAM, EXP) \ -do { \ - fputs ("\t.byte ", STREAM); \ - output_addr_const (STREAM, EXP); \ - putc ('\n', STREAM); \ -} while (0) - -/* A C statement to output to the stdio stream STREAM an assembler instruction - to assemble a single byte containing the number VALUE. */ - -#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ - fprintf (STREAM, "%s%d\n", ASM_BYTE_OP, (int)(VALUE)) - -/* A C string constant giving the pseudo-op to use for a sequence of - single-byte constants. If this macro is not defined, the default - is `"byte"'. - - Defined in svr4.h. */ -/* #define ASM_BYTE_OP */ - /* A C statement to output to the stdio stream STREAM an assembler instruction to assemble a string constant containing the LEN bytes at PTR. PTR will be a C expression of type `char *' and LEN a C expression of type `int'. @@ -4675,8 +4628,7 @@ fprintf (STREAM, "\t.word .L%d\n", VALUE) /* Define this macro to 0 if your target supports DWARF 2 frame unwind information, but it does not yet work with exception handling. Otherwise, if your target supports this information (if it defines - `INCOMING_RETURN_ADDR_RTX' and either `UNALIGNED_INT_ASM_OP' or - `OBJECT_FORMAT_ELF'), GCC will provide a default definition of 1. + `INCOMING_RETURN_ADDR_RTX'), GCC will provide a default definition of 1. If this macro is defined to 1, the DWARF 2 unwinder will be the default exception handling mechanism; otherwise, setjmp/longjmp will be used by diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index cfa2bd5745f..7988b61a393 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -262,13 +262,6 @@ do { text_section (); \ fprintf (FILE, "_%s", NAME); \ } while (0) -/* The standard fillin directives are unaligned. */ - -#define UNALIGNED_SHORT_ASM_OP "\t.short\t" -#define UNALIGNED_INT_ASM_OP "\t.long\t" -/* Don't try to use this before the assembler knows about it. */ -/* #define UNALIGNED_DOUBLE_INT_ASM_OP "\t.quad\t" */ - #undef ALIGN_ASM_OP #define ALIGN_ASM_OP ".align" diff --git a/gcc/config/dsp16xx/dsp16xx-protos.h b/gcc/config/dsp16xx/dsp16xx-protos.h index ea1ea6b6610..a2f68afbc3e 100644 --- a/gcc/config/dsp16xx/dsp16xx-protos.h +++ b/gcc/config/dsp16xx/dsp16xx-protos.h @@ -78,7 +78,6 @@ extern int initial_frame_pointer_offset PARAMS ((void)); extern void asm_output_common PARAMS ((FILE *, const char *, int, int)); extern void asm_output_local PARAMS ((FILE *, const char *, int, int)); extern void asm_output_float PARAMS ((FILE *, double)); -extern void asm_output_long PARAMS ((FILE *, long)); extern void dsp16xx_file_start PARAMS ((void)); extern void coff_dsp16xx_file_start PARAMS ((FILE *)); extern void luxworks_dsp16xx_file_start PARAMS ((FILE *)); diff --git a/gcc/config/dsp16xx/dsp16xx.c b/gcc/config/dsp16xx/dsp16xx.c index 5e67f710e29..5cd1012e944 100644 --- a/gcc/config/dsp16xx/dsp16xx.c +++ b/gcc/config/dsp16xx/dsp16xx.c @@ -151,6 +151,13 @@ static void dsp16xx_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void dsp16xx_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); /* Initialize the GCC target structure. */ +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP "\tint\t" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP NULL +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP NULL + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE dsp16xx_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -2281,20 +2288,6 @@ asm_output_float (file, fp_const) #endif } -void -asm_output_long (file, value) - FILE *file; - long value; -{ - fputs ("\tint ", file); -#ifdef WORDS_BIG_ENDIAN - fprintf (file, "0x%-4.4lx, 0x%-4.4lx", (value >> 16) & 0xffff, (value & 0xffff)); -#else - fprintf (file, "0x%-4.4lx, 0x%-4.4lx", (value & 0xffff), (value >> 16) & 0xffff); -#endif - fputs ("\n", file); -} - int dsp16xx_address_cost (addr) rtx addr; diff --git a/gcc/config/dsp16xx/dsp16xx.h b/gcc/config/dsp16xx/dsp16xx.h index 215b45237c3..af05183d0d4 100644 --- a/gcc/config/dsp16xx/dsp16xx.h +++ b/gcc/config/dsp16xx/dsp16xx.h @@ -1648,21 +1648,6 @@ const_section () \ size HFmode. */ #define ASM_OUTPUT_SHORT_FLOAT(FILE,VALUE) asm_output_float (FILE, VALUE) -/* This is how to output an assembler line defining an `char' constant. */ -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\tint "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line defining an `short' constant. */ -#define ASM_OUTPUT_SHORT(FILE,EXP) asm_output_long(FILE,INTVAL(EXP)) - -/* This is how to output an assembler line defining a 'int' constant. */ -#define ASM_OUTPUT_INT(FILE, EXP) asm_output_long(FILE,INTVAL(EXP)) - -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_OUTPUT_BYTE(FILE,VALUE) ASM_OUTPUT_CHAR(FILE,GEN_INT(VALUE)) - /* This is how we output a 'c' character string. For the 16xx assembler we have to do it one letter at a time */ diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h index 003fca26d9a..d09bdbc8d91 100644 --- a/gcc/config/elfos.h +++ b/gcc/config/elfos.h @@ -88,9 +88,6 @@ Boston, MA 02111-1307, USA. */ #define IDENT_ASM_OP "\t.ident\t" -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\t.byte\t" - #undef SET_ASM_OP #define SET_ASM_OP "\t.set\t" diff --git a/gcc/config/elxsi/elxsi.c b/gcc/config/elxsi/elxsi.c index 7e8a24c1205..c2b9c57e2d5 100644 --- a/gcc/config/elxsi/elxsi.c +++ b/gcc/config/elxsi/elxsi.c @@ -42,10 +42,20 @@ static const char *const cmp_tab[] = { "gt", "gt", "eq", "eq", "ge", "ge", "lt", "lt", "ne", "ne", "le", "le" }; +static bool elxsi_assemble_integer PARAMS ((rtx, unsigned int, int)); static void elxsi_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void elxsi_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); /* Initialize the GCC target structure. */ +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP NULL +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP NULL +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP NULL +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER elxsi_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE elxsi_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -53,6 +63,30 @@ static void elxsi_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); struct gcc_target targetm = TARGET_INITIALIZER; +/* Target hook for assembling integer objects. The ELXSI assembler + syntax uses a suffix to indicate the size of data, so we can't use + the usual string hooks. */ + +static bool +elxsi_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + if (aligned_p) + switch (size) + { + case 1: + case 2: + case 4: + fputs ("\t.data\t", asm_out_file); + output_addr_const (asm_out_file, x); + fprintf (asm_out_file, "{%d}\n", size * BITS_PER_UNIT); + return true; + } + return default_assemble_integer (x, size, aligned_p); +} + /* Generate the assembly code for function entry. FILE is a stdio stream to output the code to. SIZE is an int: how many units of temporary storage to allocate. diff --git a/gcc/config/elxsi/elxsi.h b/gcc/config/elxsi/elxsi.h index 16cd8981a6c..13e39d8b7f0 100644 --- a/gcc/config/elxsi/elxsi.h +++ b/gcc/config/elxsi/elxsi.h @@ -747,50 +747,6 @@ enum reg_class { NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES }; tem.f = (VALUE); \ fprintf (FILE, "\t.data %d{32}\n", tem.i); } -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( \ - fprintf (FILE, "\t.data\t"), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "{32}\n")) - -#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ -{ \ - fprintf (FILE, "\t.data\t"); \ - if (GET_CODE (VALUE) == CONST_DOUBLE) \ - { \ - fprintf (FILE, "%d", CONST_DOUBLE_HIGH (VALUE)); \ - fprintf (FILE, "{32}, "); \ - fprintf (FILE, "%d", CONST_DOUBLE_LOW (VALUE)); \ - fprintf (FILE, "{32}\n"); \ - } else if (GET_CODE (VALUE) == CONST_INT) \ - { \ - int val = INTVAL (VALUE); \ - fprintf (FILE, "%d", val < 0 ? -1 : 0); \ - fprintf (FILE, "{32}, "); \ - fprintf (FILE, "%d", val); \ - fprintf (FILE, "{32}\n"); \ - } else abort (); \ -} - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.data\t"), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "{16}\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.data\t"), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "{8}\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.data\t%d{8}\n", (VALUE)) - /* This is how to output an insn to push a register on the stack. It need not be very fast code. */ diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index d50499150d7..c386297a646 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -141,6 +141,10 @@ static rtx fr30_pass_by_value PARAMS ((tree, tree)); #endif /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h index 3c7b46bfb27..b8f84f7d834 100644 --- a/gcc/config/fr30/fr30.h +++ b/gcc/config/fr30/fr30.h @@ -1444,43 +1444,6 @@ do \ t[0], ASM_COMMENT_START, str, t[1]); \ } \ while (0) - -/* This is how to output an assembler line defining a `char' constant. */ -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ - do \ - { \ - fprintf (FILE, "\t.byte\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - -/* This is how to output an assembler line defining a `short' constant. */ -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ - do \ - { \ - fprintf (FILE, "\t.hword\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - -/* This is how to output an assembler line defining an `int' constant. - We also handle symbol output here. */ -#define ASM_OUTPUT_INT(FILE, VALUE) \ - do \ - { \ - fprintf (FILE, "\t.word\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - -/* A C statement to output to the stdio stream STREAM an assembler instruction - to assemble a single byte containing the number VALUE. */ -#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ - fprintf (STREAM, "%s0x%x\n", ASM_BYTE_OP, (VALUE)) - /*}}}*/ /*{{{ Output and Generation of Labels. */ diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 2df15e2945d..e16c54ca3f6 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -106,6 +106,9 @@ const char *h8_push_op, *h8_pop_op, *h8_mov_op; #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE h8300_attribute_table +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE h8300_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index d27c987a2d9..0535d5f2c0d 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -1270,29 +1270,6 @@ readonly_data () \ } \ while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE, VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This is how to output an insn to push a register on the stack. It need not be very fast code. */ diff --git a/gcc/config/i370/i370.c b/gcc/config/i370/i370.c index bbe27823e0a..81be7bd9026 100644 --- a/gcc/config/i370/i370.c +++ b/gcc/config/i370/i370.c @@ -99,6 +99,9 @@ static FILE *assembler_source = 0; static label_node_t * mvs_get_label PARAMS ((int)); static void i370_label_scan PARAMS ((void)); +#ifdef TARGET_HLASM +static bool i370_hlasm_assemble_integer PARAMS ((rtx, unsigned int, int)); +#endif static void i370_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void i370_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); #ifdef LONGEXTERNAL @@ -288,6 +291,17 @@ static const unsigned char ebcasc[256] = }; /* Initialize the GCC target structure. */ +#ifdef TARGET_HLASM +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP NULL +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP NULL +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP NULL +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER i370_hlasm_assemble_integer +#endif + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE i370_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -1176,6 +1190,54 @@ unsigned_jump_follows_p (insn) } } +#ifdef TARGET_HLASM + +/* Target hook for assembling integer objects. This version handles all + objects when TARGET_HLASM is defined. */ + +static bool +i370_hlasm_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + const char *int_format = NULL; + + if (aligned_p) + switch (size) + { + case 1: + int_format = "\tDC\tX'%02X'\n"; + break; + + case 2: + int_format = "\tDC\tX'%04X'\n"; + break; + + case 4: + if (GET_CODE (x) == CONST_INT) + { + fputs ("\tDC\tF'", asm_out_file); + output_addr_const (asm_out_file, x); + fputs ("'\n", asm_out_file); + } + else + { + fputs ("\tDC\tA(", asm_out_file); + output_addr_const (asm_out_file, x); + fputs (")\n", asm_out_file); + } + return true; + } + + if (int_format && GET_CODE (x) == CONST_INT) + { + fprintf (asm_out_file, int_format, INTVAL (x)); + return true; + } + return default_assemble_integer (x, size, aligned_p); +} + /* Generate the assembly code for function entry. FILE is a stdio stream to output the code to. SIZE is an int: how many units of temporary storage to allocate. @@ -1185,8 +1247,6 @@ unsigned_jump_follows_p (insn) used in the function. This function is responsible for knowing which registers should not be saved even if used. */ -#ifdef TARGET_HLASM - static void i370_output_function_prologue (f, l) FILE *f; diff --git a/gcc/config/i370/i370.h b/gcc/config/i370/i370.h index 044fd5ac3d0..826382fbe60 100644 --- a/gcc/config/i370/i370.h +++ b/gcc/config/i370/i370.h @@ -629,16 +629,16 @@ enum reg_class #define TRAMPOLINE_TEMPLATE(FILE) \ { \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x05E0)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x5800 | STATIC_CHAIN_REGNUM << 4)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0xE00A)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x58F0)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0xE00E)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x07FF)); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ + assemble_aligned_integer (2, GEN_INT (0x05E0)); \ + assemble_aligned_integer (2, GEN_INT (0x5800 | STATIC_CHAIN_REGNUM << 4)); \ + assemble_aligned_integer (2, GEN_INT (0xE00A)); \ + assemble_aligned_integer (2, GEN_INT (0x58F0)); \ + assemble_aligned_integer (2, GEN_INT (0xE00E)); \ + assemble_aligned_integer (2, GEN_INT (0x07FF)); \ + assemble_aligned_integer (2, const0_rtx); \ + assemble_aligned_integer (2, const0_rtx); \ + assemble_aligned_integer (2, const0_rtx); \ + assemble_aligned_integer (2, const0_rtx); \ } /* Length in units of the trampoline for entering a nested function. */ @@ -1191,39 +1191,6 @@ enum reg_class #define ASM_OUTPUT_FLOAT(FILE, VALUE) \ fprintf (FILE, "\tDC\tE'%.9G'\n", (VALUE)) -/* This outputs an integer, if not a CONST_INT must be address constant. */ - -#define ASM_OUTPUT_INT(FILE, EXP) \ -{ \ - if (GET_CODE (EXP) == CONST_INT) \ - { \ - fprintf (FILE, "\tDC\tF'"); \ - output_addr_const (FILE, EXP); \ - fprintf (FILE, "'\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tDC\tA("); \ - output_addr_const (FILE, EXP); \ - fprintf (FILE, ")\n"); \ - } \ -} - -/* This outputs a short integer. */ - -#define ASM_OUTPUT_SHORT(FILE, EXP) \ -{ \ - fprintf (FILE, "\tDC\tX'%04X'\n", INTVAL(EXP) & 0xFFFF); \ -} - -/* This outputs a byte sized integer. */ - -#define ASM_OUTPUT_CHAR(FILE, EXP) \ - fprintf (FILE, "\tDC\tX'%02X'\n", INTVAL (EXP) ) - -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf (FILE, "\tDC\tX'%02X'\n", VALUE) - /* This outputs a text string. The string are chopped up to fit into an 80 byte record. Also, control and special characters, interpreted by the IBM assembler, are output numerically. */ @@ -1898,9 +1865,6 @@ abort(); \ #undef ASM_OUTPUT_EXTERNAL #define ASM_DOUBLE "\t.double" -#define ASM_LONG "\t.long" -#define ASM_SHORT "\t.short" -#define ASM_BYTE "\t.byte" /* Argument to the flt pt. macros is a REAL_VALUE_TYPE which may or may not be a float/double, depending on whther we @@ -1920,28 +1884,6 @@ abort(); \ } -/* This is how to output an assembler line defining an `int' constant. */ -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "%s ", ASM_LONG), \ - output_addr_const (FILE,(VALUE)), \ - putc('\n',FILE)) - -/* Likewise for `char' and `short' constants. */ -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "%s ", ASM_SHORT), \ - output_addr_const (FILE,(VALUE)), \ - putc('\n',FILE)) - - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "%s", ASM_BYTE_OP), \ - output_addr_const (FILE, (VALUE)), \ - putc ('\n', FILE)) - -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf ((FILE), "%s0x%x\n", ASM_BYTE_OP, (VALUE)) - /* This is how to output the definition of a user-level label named NAME, such as the label on a static function or variable NAME. */ #define ASM_OUTPUT_LABEL(FILE,NAME) \ diff --git a/gcc/config/i386/att.h b/gcc/config/i386/att.h index 2726f7ba5b9..df47f891cfd 100644 --- a/gcc/config/i386/att.h +++ b/gcc/config/i386/att.h @@ -41,7 +41,7 @@ do \ { size_t i = 0, limit = (SIZE); \ while (i < limit) \ { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n"); \ - fprintf ((FILE), "%s", ASM_BYTE_OP); } \ + fputs ("\t.byte\t", (FILE)); } \ else fprintf ((FILE), ","); \ fprintf ((FILE), "0x%x", ((PTR)[i++] & 0377)) ;} \ fprintf ((FILE), "\n"); \ diff --git a/gcc/config/i386/bsd.h b/gcc/config/i386/bsd.h index 6473cae88f7..c58db1b3e8e 100644 --- a/gcc/config/i386/bsd.h +++ b/gcc/config/i386/bsd.h @@ -40,7 +40,6 @@ Boston, MA 02111-1307, USA. */ /* Assembler pseudos to introduce constants of various size. */ -#define ASM_BYTE_OP "\t.byte\t" #define ASM_SHORT "\t.word\t" #define ASM_LONG "\t.long\t" #define ASM_QUAD "\t.quad\t" /* Should not be used for 32bit compilation. */ diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h index cc4aa5c765b..36b4639346f 100644 --- a/gcc/config/i386/djgpp.h +++ b/gcc/config/i386/djgpp.h @@ -62,18 +62,6 @@ Boston, MA 02111-1307, USA. */ #undef TEXT_SECTION_ASM_OP #define TEXT_SECTION_ASM_OP "\t.section .text" -/* How to output an unaligned integer. */ -#undef UNALIGNED_INT_ASM_OP -#define UNALIGNED_INT_ASM_OP "\t.long\t" - -/* How to output an unaligned double length integer. */ -#undef UNALIGNED_DOUBLE_INT_ASM_OP -#define UNALIGNED_DOUBLE_INT_ASM_OP "\t.quad\t" - -/* How to output an unaligned half length intenger. */ -#undef UNALIGNED_SHORT_ASM_OP -#define UNALIGNED_SHORT_ASM_OP "\t.short\t" - /* Define standard DJGPP installation paths. */ /* We override default /usr or /usr/local part with /dev/env/DJDIR which */ /* points to actual DJGPP instalation directory. */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index aa65281cf5f..0c60bdafd8d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -784,6 +784,22 @@ static enum x86_64_reg_class merge_classes PARAMS ((enum x86_64_reg_class, #undef TARGET_ASM_CLOSE_PAREN #define TARGET_ASM_CLOSE_PAREN "" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP ASM_SHORT +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP ASM_LONG +#ifdef ASM_QUAD +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP ASM_QUAD +#endif + +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP + #undef TARGET_SCHED_ADJUST_COST #define TARGET_SCHED_ADJUST_COST ix86_adjust_cost #undef TARGET_SCHED_ISSUE_RATE diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index a95a23e7770..b38bdcaa629 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2912,42 +2912,6 @@ do { long l; \ ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fputs (ASM_LONG, FILE), \ - output_addr_const (FILE,(VALUE)), \ - putc('\n',FILE)) - -#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ -( fprintf (FILE, "%s\t", ASM_QUAD), \ - output_addr_const (FILE,(VALUE)), \ - putc('\n',FILE)) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fputs (ASM_SHORT, FILE), \ - output_addr_const (FILE,(VALUE)), \ - putc('\n',FILE)) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fputs (ASM_BYTE_OP, FILE), \ - output_addr_const (FILE, (VALUE)), \ - putc ('\n', FILE)) - -/* Given that x86 natively supports unaligned data, it's reasonable to - assume that all x86 assemblers don't auto-align data. Thus the - unaligned output macros required by dwarf2 frame unwind information - degenerate to the macros used above. */ -#define UNALIGNED_SHORT_ASM_OP ASM_SHORT -#define UNALIGNED_INT_ASM_OP ASM_LONG - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - asm_fprintf ((FILE), "%s0x%x\n", ASM_BYTE_OP, (int) (VALUE)) - /* This is how to output an insn to push a register on the stack. It need not be very fast code. */ diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index 42bfcd30a13..b7d7b3d079b 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -189,7 +189,7 @@ Boston, MA 02111-1307, USA. */ do { \ if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ { \ - fputs (UNALIGNED_INT_ASM_OP, FILE); \ + fputs (ASM_LONG, FILE); \ assemble_name (FILE, XSTR (ADDR, 0)); \ fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ goto DONE; \ diff --git a/gcc/config/i386/sco5.h b/gcc/config/i386/sco5.h index 16861a85bf2..211ca366ab7 100644 --- a/gcc/config/i386/sco5.h +++ b/gcc/config/i386/sco5.h @@ -35,9 +35,6 @@ Boston, MA 02111-1307, USA. */ #undef ASCII_DATA_ASM_OP #define ASCII_DATA_ASM_OP "\t.ascii\t" -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\t.byte\t" - #undef IDENT_ASM_OP #define IDENT_ASM_OP "\t.ident\t" @@ -57,7 +54,6 @@ Boston, MA 02111-1307, USA. */ #define ASM_LONG "\t.long\t" #undef ASM_QUAD -#undef ASM_OUTPUT_DOUBLE_INT #undef TYPE_ASM_OP #define TYPE_ASM_OP "\t.type\t" @@ -349,7 +345,7 @@ do { \ else \ { \ if (bytes_in_chunk == 0) \ - fprintf ((FILE), "%s", ASM_BYTE_OP); \ + fputs ("\t.byte\t", (FILE)); \ else \ fputc (',', (FILE)); \ fprintf ((FILE), "0x%02x", *_ascii_bytes); \ @@ -846,7 +842,7 @@ do { \ do { \ if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ { \ - fputs (UNALIGNED_INT_ASM_OP, FILE); \ + fputs (ASM_LONG, FILE); \ assemble_name (FILE, XSTR (ADDR, 0)); \ fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ goto DONE; \ diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h index da3ad8f18eb..ff1585e05d8 100644 --- a/gcc/config/i386/sol2.h +++ b/gcc/config/i386/sol2.h @@ -156,7 +156,3 @@ Boston, MA 02111-1307, USA. */ #undef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX "." - -/* Override defaults.h and insist that Solaris/Intel doesn't have - an eight byte data output directive. */ -#define UNALIGNED_DOUBLE_INT_ASM_OP NULL diff --git a/gcc/config/i386/sun386.h b/gcc/config/i386/sun386.h index 0487aa510fe..d280d583cbe 100644 --- a/gcc/config/i386/sun386.h +++ b/gcc/config/i386/sun386.h @@ -33,7 +33,6 @@ Boston, MA 02111-1307, USA. */ /* Assembler pseudos to introduce constants of various size. */ -#define ASM_BYTE_OP "\t.byte\t" #define ASM_SHORT "\t.value\t" #define ASM_LONG "\t.long\t" #define ASM_QUAD "\t.quad\t" /* Should not be used for 32bit compilation. */ @@ -46,7 +45,7 @@ do \ { size_t i = 0, limit = (SIZE); \ while (i < limit) \ { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n"); \ - fprintf ((FILE), "%s", ASM_BYTE_OP); } \ + fputs ("\t.byte\t", (FILE)); } \ else fprintf ((FILE), ","); \ fprintf ((FILE), "0x%x", ((PTR)[i++] & 0377)) ;} \ fprintf ((FILE), "\n"); \ diff --git a/gcc/config/i386/sysv4.h b/gcc/config/i386/sysv4.h index 4ccd74bc245..0d44b1a23e4 100644 --- a/gcc/config/i386/sysv4.h +++ b/gcc/config/i386/sysv4.h @@ -170,7 +170,7 @@ do { long value[3]; \ do { \ if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ { \ - fputs (UNALIGNED_INT_ASM_OP, FILE); \ + fputs (ASM_LONG, FILE); \ assemble_name (FILE, XSTR (ADDR, 0)); \ fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ goto DONE; \ diff --git a/gcc/config/i860/fx2800.h b/gcc/config/i860/fx2800.h index e86a91e2c2a..b12cb123742 100644 --- a/gcc/config/i860/fx2800.h +++ b/gcc/config/i860/fx2800.h @@ -339,9 +339,12 @@ Boston, MA 02111-1307, USA. */ #define ASM_FILE_END(FILE) \ do { \ if (current_function_original_name != NULL) { \ + const char *long_op = integer_asm_op (4, FALSE); \ tdesc_section(); \ - fprintf ((FILE), "%s __ETEXT\n", ASM_LONG); \ - fprintf ((FILE), "%s 0\n", ASM_LONG); \ + fprintf ((FILE), "%s __ETEXT\n", long_op); \ + fprintf ((FILE), "%s 0\n", long_op); \ + fputs ("\t.long\t__ETEXT\n", (FILE)); \ + fputs ("\t.long\t0\n", (FILE)); \ text_section(); \ fputs("__ETEXT:\n", (FILE)); \ } \ diff --git a/gcc/config/i860/i860.c b/gcc/config/i860/i860.c index 29ee2884fc5..dfc9f0d1ea3 100644 --- a/gcc/config/i860/i860.c +++ b/gcc/config/i860/i860.c @@ -2003,6 +2003,9 @@ i860_output_function_epilogue (asm_file, local_bytes) register unsigned mask; unsigned intflags=0; register TDESC_flags *flags = (TDESC_flags *) &intflags; +#ifdef OUTPUT_TDESC /* Output an ABI-compliant TDESC entry */ + const char *long_op = integer_asm_op (4, TRUE); +#endif flags->version = 4; flags->reg_packing = 1; @@ -2092,23 +2095,23 @@ i860_output_function_epilogue (asm_file, local_bytes) } assemble_name(asm_file,current_function_original_name); fputs(".TDESC:\n", asm_file); - fprintf(asm_file, "%s 0x%0x\n", ASM_LONG, intflags); - fprintf(asm_file, "%s %d\n", ASM_LONG, + fprintf(asm_file, "%s 0x%0x\n", long_op, intflags); + fprintf(asm_file, "%s %d\n", long_op, int_restored ? must_preserve_bytes : 0); if (flags->version > 1) { - fprintf(asm_file, "%s %d\n", ASM_LONG, + fprintf(asm_file, "%s %d\n", long_op, (restored_so_far == int_restored) ? 0 : must_preserve_bytes + (4 * int_restored)); if (flags->version > 2) { - fprintf(asm_file, "%s %d\n", ASM_LONG, frame_upper_bytes); + fprintf(asm_file, "%s %d\n", long_op, frame_upper_bytes); if (flags->version > 3) - fprintf(asm_file, "%s %d\n", ASM_LONG, frame_lower_bytes); + fprintf(asm_file, "%s %d\n", long_op, frame_lower_bytes); } } tdesc_section(); - fprintf(asm_file, "%s ", ASM_LONG); + fprintf(asm_file, "%s ", long_op); assemble_name(asm_file, current_function_original_name); - fprintf(asm_file, "\n%s ", ASM_LONG); + fprintf(asm_file, "\n%s ", long_op); assemble_name(asm_file, current_function_original_name); fputs(".TDESC\n", asm_file); text_section(); diff --git a/gcc/config/i860/i860.h b/gcc/config/i860/i860.h index 106d512b068..aec2f2c0a75 100644 --- a/gcc/config/i860/i860.h +++ b/gcc/config/i860/i860.h @@ -614,11 +614,11 @@ struct cumulative_args { int ints, floats; }; or #BOTTOM_OF_STATIC,r29,r29 */ #define TRAMPOLINE_TEMPLATE(FILE) \ { \ - ASM_OUTPUT_INT (FILE, GEN_INT (0xec1f0000)); \ - ASM_OUTPUT_INT (FILE, GEN_INT (0xe7ff0000)); \ - ASM_OUTPUT_INT (FILE, GEN_INT (0xec1d0000)); \ - ASM_OUTPUT_INT (FILE, GEN_INT (0x4000f800)); \ - ASM_OUTPUT_INT (FILE, GEN_INT (0xe7bd0000)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0xec1f0000)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0xe7ff0000)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0xec1d0000)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x4000f800)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0xe7bd0000)); \ } /* Length in units of the trampoline for entering a nested function. */ @@ -975,9 +975,6 @@ struct cumulative_args { int ints, floats; }; /* Assembler pseudos to introduce constants of various size. */ -#define ASM_BYTE_OP "\t.byte\t" -#define ASM_SHORT "\t.short" -#define ASM_LONG "\t.long" #define ASM_DOUBLE "\t.double" /* Output at beginning of assembler file. */ @@ -1085,30 +1082,6 @@ do { ASM_OUTPUT_ALIGN ((FILE), 2); \ #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ fprintf (FILE, "\t.float %.12e\n", (VALUE)) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.short "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This is how to output code to push a register on the stack. It need not be very fast code. */ diff --git a/gcc/config/i860/paragon.h b/gcc/config/i860/paragon.h index f0f925bcb4a..2a374fc5ff6 100644 --- a/gcc/config/i860/paragon.h +++ b/gcc/config/i860/paragon.h @@ -133,7 +133,7 @@ Boston, MA 02111-1307, USA. */ fprintf ((FILE), "\"\n"); \ bytes_in_chunk = 0; \ } \ - fprintf ((FILE), "%s%d\n", ASM_BYTE_OP, ch); \ + assemble_aligned_integer (1, GEN_INT (ch)); \ } \ else \ { \ diff --git a/gcc/config/i860/sysv3.h b/gcc/config/i860/sysv3.h index 840da5a0dff..cc26176c963 100644 --- a/gcc/config/i860/sysv3.h +++ b/gcc/config/i860/sysv3.h @@ -113,7 +113,7 @@ extern const char *current_function_original_name; fprintf ((FILE), "\"\n"); \ bytes_in_chunk = 0; \ } \ - fprintf ((FILE), "%s%d\n", ASM_BYTE_OP, ch); \ + assemble_aligned_integer (1, GEN_INT (ch)); \ } \ else \ { \ diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c index 68d9edac69d..ffa28d58161 100644 --- a/gcc/config/i960/i960.c +++ b/gcc/config/i960/i960.c @@ -93,6 +93,9 @@ static int ret_label = 0; || current_function_varargs) /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE i960_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/i960/i960.h b/gcc/config/i960/i960.h index 11842959987..12cf09c787f 100644 --- a/gcc/config/i960/i960.h +++ b/gcc/config/i960/i960.h @@ -1401,30 +1401,6 @@ extern struct rtx_def *i960_compare_op0, *i960_compare_op1; #define ASM_OUTPUT_FLOAT(FILE,VALUE) i960_output_float(FILE, VALUE) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.short "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ fprintf (FILE, "\tst\t%s,(sp)\n\taddo\t4,sp,sp\n", reg_names[REGNO]) @@ -1558,11 +1534,11 @@ extern struct rtx_def *i960_compare_op0, *i960_compare_op1; #define TRAMPOLINE_TEMPLATE(FILE) \ { \ - ASM_OUTPUT_INT (FILE, GEN_INT (0x8C203000)); \ - ASM_OUTPUT_INT (FILE, GEN_INT (0x00000000)); \ - ASM_OUTPUT_INT (FILE, GEN_INT (0x8CE03000)); \ - ASM_OUTPUT_INT (FILE, GEN_INT (0x00000000)); \ - ASM_OUTPUT_INT (FILE, GEN_INT (0x84212000)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x8C203000)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x00000000)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x8CE03000)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x00000000)); \ + assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x84212000)); \ } /* Length in units of the trampoline for entering a nested function. */ diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index b7d3919bd4b..c46fe1262ca 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -139,6 +139,7 @@ static rtx ia64_expand_lock_test_and_set PARAMS ((enum machine_mode, tree, rtx)); static rtx ia64_expand_lock_release PARAMS ((enum machine_mode, tree, rtx)); const struct attribute_spec ia64_attribute_table[]; +static bool ia64_assemble_integer PARAMS ((rtx, unsigned int, int)); static void ia64_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void ia64_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static void ia64_output_function_end_prologue PARAMS ((FILE *)); @@ -165,6 +166,23 @@ static rtx ia64_cycle_display PARAMS ((int, rtx)); #undef TARGET_EXPAND_BUILTIN #define TARGET_EXPAND_BUILTIN ia64_expand_builtin +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP "\tdata1\t" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\tdata2\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\tdata4\t" +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP "\tdata8\t" +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\tdata2.ua\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\tdata4.ua\t" +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP "\tdata8.ua\t" +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER ia64_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE ia64_output_function_prologue #undef TARGET_ASM_FUNCTION_END_PROLOGUE @@ -2589,6 +2607,28 @@ ia64_hard_regno_rename_ok (from, to) return 1; } +/* Target hook for assembling integer objects. Handle word-sized + aligned objects and detect the cases when @fptr is needed. */ + +static bool +ia64_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + if (size == UNITS_PER_WORD && aligned_p + && !(TARGET_NO_PIC || TARGET_AUTO_PIC) + && GET_CODE (x) == SYMBOL_REF + && SYMBOL_REF_FLAG (x)) + { + fputs ("\tdata8\t@fptr(", asm_out_file); + output_addr_const (asm_out_file, x); + fputs (")\n", asm_out_file); + return true; + } + return default_assemble_integer (x, size, aligned_p); +} + /* Emit the function prologue. */ static void diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 49e50a44ff5..24fdba1483d 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1944,54 +1944,6 @@ do { \ fprintf (FILE, "\tdata4 0x%lx\n", t & 0xffffffff); \ } while (0) -/* A C statement to output to the stdio stream STREAM an assembler instruction - to assemble an integer of 1, 2, 4, or 8 bytes, respectively, whose value - is VALUE. */ - -/* This is how to output an assembler line defining a `char' constant. */ - -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ -do { \ - fprintf (FILE, "%s", ASM_BYTE_OP); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ -} while (0) - -/* This is how to output an assembler line defining a `short' constant. */ - -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ -do { \ - fprintf (FILE, "\tdata2\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ -} while (0) - -/* This is how to output an assembler line defining an `int' constant. - We also handle symbol output here. */ - -/* ??? For ILP32, also need to handle function addresses here. */ - -#define ASM_OUTPUT_INT(FILE, VALUE) \ -do { \ - fprintf (FILE, "\tdata4\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ -} while (0) - -/* This is how to output an assembler line defining a `long' constant. - We also handle symbol output here. */ - -#define ASM_OUTPUT_DOUBLE_INT(FILE, VALUE) \ -do { \ - fprintf (FILE, "\tdata8\t"); \ - if (!(TARGET_NO_PIC || TARGET_AUTO_PIC) && SYMBOL_REF_FLAG (VALUE)) \ - fprintf (FILE, "@fptr("); \ - output_addr_const (FILE, (VALUE)); \ - if (!(TARGET_NO_PIC || TARGET_AUTO_PIC) && SYMBOL_REF_FLAG (VALUE)) \ - fprintf (FILE, ")"); \ - fprintf (FILE, "\n"); \ -} while (0) - /* This is how to output an assembler line defining a `char' constant to an xdata segment. */ @@ -2044,12 +1996,6 @@ do { \ } while (0) -/* A C statement to output to the stdio stream STREAM an assembler instruction - to assemble a single byte containing the number VALUE. */ - -#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ - fprintf (STREAM, "%s0x%x\n", ASM_BYTE_OP, (int)(VALUE) & 0xff) - /* Output of Uninitialized Variables. */ @@ -2361,9 +2307,7 @@ do { \ reltag = "@gprel("; \ if (reltag) \ { \ - fputs (((SIZE) == 4 ? UNALIGNED_INT_ASM_OP \ - : (SIZE) == 8 ? UNALIGNED_DOUBLE_INT_ASM_OP \ - : (abort (), "")), FILE); \ + fputs (integer_asm_op (SIZE, FALSE), FILE); \ fputs (reltag, FILE); \ assemble_name (FILE, XSTR (ADDR, 0)); \ fputc (')', FILE); \ @@ -2425,13 +2369,6 @@ do { \ #define DWARF2_DEBUGGING_INFO -/* C string constants giving the pseudo-op to use for a sequence of - 2, 4, and 8 byte unaligned constants. dwarf2out.c needs these. */ - -#define UNALIGNED_SHORT_ASM_OP "\tdata2.ua\t" -#define UNALIGNED_INT_ASM_OP "\tdata4.ua\t" -#define UNALIGNED_DOUBLE_INT_ASM_OP "\tdata8.ua\t" - #define DWARF2_ASM_LINE_DEBUG_INFO (TARGET_DWARF2_ASM) /* Use tags for debug info labels, so that they don't break instruction @@ -2447,9 +2384,7 @@ do { \ proper relocations for them. */ #define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL) \ do { \ - fputs (((SIZE) == 4 ? UNALIGNED_INT_ASM_OP \ - : (SIZE) == 8 ? UNALIGNED_DOUBLE_INT_ASM_OP \ - : (abort (), "")), FILE); \ + fputs (integer_asm_op (SIZE, FALSE), FILE); \ fputs ("@secrel(", FILE); \ assemble_name (FILE, LABEL); \ fputc (')', FILE); \ @@ -2458,9 +2393,7 @@ do { \ /* Emit a PC-relative relocation. */ #define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL) \ do { \ - fputs (((SIZE) == 4 ? UNALIGNED_INT_ASM_OP \ - : (SIZE) == 8 ? UNALIGNED_DOUBLE_INT_ASM_OP \ - : (abort (), "")), FILE); \ + fputs (integer_asm_op (SIZE, FALSE), FILE); \ fputs ("@pcrel(", FILE); \ assemble_name (FILE, LABEL); \ fputc (')', FILE); \ diff --git a/gcc/config/ia64/sysv4.h b/gcc/config/ia64/sysv4.h index 8159d54a1fb..1b5d4691efc 100644 --- a/gcc/config/ia64/sysv4.h +++ b/gcc/config/ia64/sysv4.h @@ -10,9 +10,6 @@ /* Various pseudo-ops for which the Intel assembler uses non-standard definitions. */ -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\tdata1\t" - #undef STRING_ASM_OP #define STRING_ASM_OP "\tstringz\t" diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index cdb3f257d8c..2b1dc75d333 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -79,6 +79,11 @@ static int m32r_issue_rate PARAMS ((void)); #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE m32r_attribute_table +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE m32r_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 614caa0c3d7..4741849f794 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -1719,37 +1719,6 @@ do { \ no longer contain unusual constructs. */ #define ASM_APP_OFF "" -/* This is how to output an assembler line defining a `char' constant. */ -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ - do \ - { \ - fprintf (FILE, "\t.byte\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - -/* This is how to output an assembler line defining a `short' constant. */ -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ - do \ - { \ - fprintf (FILE, "\t.hword\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - -/* This is how to output an assembler line defining an `int' constant. - We also handle symbol output here. */ -#define ASM_OUTPUT_INT(FILE, VALUE) \ - do \ - { \ - fprintf (FILE, "\t.word\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - /* This is how to output an assembler line defining a `float' constant. */ #define ASM_OUTPUT_FLOAT(FILE, VALUE) \ do \ @@ -1776,10 +1745,6 @@ do { \ } \ while (0) -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf (FILE, "%s0x%x\n", ASM_BYTE_OP, (VALUE)) - /* This is how to output the definition of a user-level label named NAME, such as the label on a static function or variable NAME. */ /* On the M32R we need to ensure the next instruction starts on a 32 bit diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index dd3c3080f1b..b0e82dcedd4 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -213,6 +213,9 @@ static int nb_soft_regs; #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE m68hc11_attribute_table +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" + #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE m68hc11_output_function_epilogue diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 73b38fb6f07..c2603c59670 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1579,7 +1579,8 @@ do { \ #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ do { long l[2]; \ REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \ - fprintf (FILE, "\t%s\t0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \ + fprintf (FILE, "\t%s\t0x%lx,0x%lx\n", \ + integer_asm_op (4, TRUE), l[0], l[1]); \ } while (0) /* This is how to output an assembler line defining a `float' constant. */ @@ -1587,30 +1588,9 @@ do { long l[2]; \ #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ do { long l; \ REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \ - fprintf ((FILE), "\t%s\t0x%lx\n", ASM_LONG, l); \ + assemble_aligned_integer (4, GEN_INT (l)); \ } while (0) -/* This is how to output an assembler line defining a `long' constant. */ -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t%s\t", ASM_LONG), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t%s\t", ASM_SHORT), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "%s", ASM_BYTE_OP), \ - output_addr_const (FILE, (VALUE)), \ - putc ('\n', FILE)) - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf ((FILE), "%s0x%x\n", ASM_BYTE_OP, (VALUE)) - /* This is how to output the definition of a user-level label named NAME, such as the label on a static function or variable NAME. */ @@ -1700,11 +1680,11 @@ do { long l; \ /* This is how to output an element of a case-vector that is relative. */ #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - asm_fprintf (FILE, "\t%s\tL%d-L%d\n", ASM_SHORT, VALUE, REL) + asm_fprintf (FILE, "\t%s\tL%d-L%d\n", integer_asm_op (2, TRUE), VALUE, REL) /* This is how to output an element of a case-vector that is absolute. */ #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ - asm_fprintf (FILE, "\t%s\t.L%d\n", ASM_SHORT, VALUE) + asm_fprintf (FILE, "\t%s\t.L%d\n", integer_asm_op (2, TRUE), VALUE) /* This is how to output an assembler line that says to advance the location counter to a multiple of 2**LOG bytes. */ @@ -1733,8 +1713,6 @@ do { long l; \ /* The prefix for immediate operands. */ #define IMMEDIATE_PREFIX "#" #define GLOBAL_ASM_OP "\t.globl\t" -#define ASM_LONG ".long" -#define ASM_SHORT ".word" /* Miscellaneous Parameters. */ diff --git a/gcc/config/m68k/amix.h b/gcc/config/m68k/amix.h index d1968c028d3..998240eb386 100644 --- a/gcc/config/m68k/amix.h +++ b/gcc/config/m68k/amix.h @@ -101,7 +101,7 @@ do { \ #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ do { \ register size_t sp = 0, limit = (LEN); \ - fprintf ((FILE), "%s", BYTE_ASM_OP); \ + fputs (integer_asm_op (1, TRUE), (FILE)); \ do { \ int ch = (PTR)[sp]; \ if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \ @@ -116,7 +116,7 @@ do { \ { \ if ((sp % 10) == 0) \ { \ - fprintf ((FILE), "\n%s", BYTE_ASM_OP); \ + fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE)); \ } \ else \ { \ diff --git a/gcc/config/m68k/atari.h b/gcc/config/m68k/atari.h index 322058ec1e7..12b106a4be5 100644 --- a/gcc/config/m68k/atari.h +++ b/gcc/config/m68k/atari.h @@ -61,7 +61,7 @@ int switch_table_difference_label_flag; #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ { \ register size_t sp = 0, limit = (LEN); \ - fprintf ((FILE), "%s", BYTE_ASM_OP); \ + fputs (integer_asm_op (1, TRUE), (FILE)); \ do { \ int ch = (PTR)[sp]; \ if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \ @@ -76,7 +76,7 @@ int switch_table_difference_label_flag; { \ if ((sp % 10) == 0) \ { \ - fprintf ((FILE), "\n%s", BYTE_ASM_OP); \ + fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE)); \ } \ else \ { \ diff --git a/gcc/config/m68k/auxas.h b/gcc/config/m68k/auxas.h index 3f368c77345..86d9853c3f0 100644 --- a/gcc/config/m68k/auxas.h +++ b/gcc/config/m68k/auxas.h @@ -38,21 +38,15 @@ Boston, MA 02111-1307, USA. */ #define NO_DOLLAR_IN_LABEL #define NO_DOT_IN_LABEL +#undef INT_OP_GROUP +#define INT_OP_GROUP INT_OP_NO_DOT + #undef TEXT_SECTION_ASM_OP #define TEXT_SECTION_ASM_OP "\ttext" #undef DATA_SECTION_ASM_OP #define DATA_SECTION_ASM_OP "\tdata\t1" -#undef BYTE_ASM_OP -#define BYTE_ASM_OP "\tbyte\t" - -#undef WORD_ASM_OP -#define WORD_ASM_OP "\tshort\t" - -#undef LONG_ASM_OP -#define LONG_ASM_OP "\tlong\t" - #undef SPACE_ASM_OP #define SPACE_ASM_OP "\tspace\t" @@ -76,12 +70,6 @@ Boston, MA 02111-1307, USA. */ #define ADDITIONAL_REGISTER_NAMES { {"%a6", 14}, {"%a7", 15} } -#undef ASM_OUTPUT_INT -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf ((FILE), "%s", LONG_ASM_OP), \ - output_addr_const ((FILE), (VALUE)), \ - fprintf ((FILE), "\n")) - #undef ASM_OUTPUT_COMMON #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ ( fputs ("\tcomm\t", (FILE)), \ diff --git a/gcc/config/m68k/dpx2.h b/gcc/config/m68k/dpx2.h index 27aa342cb50..b2379293031 100644 --- a/gcc/config/m68k/dpx2.h +++ b/gcc/config/m68k/dpx2.h @@ -31,6 +31,9 @@ Boston, MA 02111-1307, USA. */ #undef SELECT_RTX_SECTION #include "svr3.h" +#undef INT_OP_GROUP +#define INT_OP_GROUP INT_OP_DC + /* We use collect2 instead of ctors_section constructors. */ #undef INIT_SECTION_ASM_OP #undef FINI_SECTION_ASM_OP @@ -119,13 +122,6 @@ Boston, MA 02111-1307, USA. */ #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NA) \ do { fprintf ((FILE), "\t.file\t'%s'\n", (NA)); } while (0) -/* Assembler pseudos to introduce constants of various size. */ - -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\tdc.b\t" -#undef ASM_LONG -#define ASM_LONG "\tdc.l" - /* * we don't seem to support any of: * .globl @@ -310,31 +306,6 @@ do { long l; \ fprintf (FILE, "\tdc.l $%lx\n", l); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ -#undef ASM_OUTPUT_INT -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\tdc.l "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ -#undef ASM_OUTPUT_SHORT -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\tdc.w "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#undef ASM_OUTPUT_CHAR -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\tdc.b "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ -#undef ASM_OUTPUT_BYTE -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\tdc.b $%x\n", (int)(VALUE)) - /* This is how to output an element of a case-vector that is absolute. (The 68000 does not use such vectors, but we must define this macro anyway.) */ diff --git a/gcc/config/m68k/dpx2g.h b/gcc/config/m68k/dpx2g.h index 812f6f7cd7e..8fa6b42ac33 100644 --- a/gcc/config/m68k/dpx2g.h +++ b/gcc/config/m68k/dpx2g.h @@ -15,7 +15,4 @@ /* GAS does not understand .ident so don't output anything for #ident. */ #undef ASM_OUTPUT_IDENT -#undef ASM_LONG -#define ASM_LONG "\t.long" - /* end of dpx2g.h */ diff --git a/gcc/config/m68k/hp320.h b/gcc/config/m68k/hp320.h index 403e4d17ded..11784c7ca9f 100644 --- a/gcc/config/m68k/hp320.h +++ b/gcc/config/m68k/hp320.h @@ -59,6 +59,9 @@ Boston, MA 02111-1307, USA. */ #include "m68k/m68k.h" +#undef INT_OP_GROUP +#define INT_OP_GROUP INT_OP_NO_DOT + /* See m68k.h. 7 means 68020 with 68881. */ #ifndef TARGET_DEFAULT @@ -164,10 +167,6 @@ Boston, MA 02111-1307, USA. */ #undef READONLY_DATA_SECTION #undef ASM_OUTPUT_DOUBLE #undef ASM_OUTPUT_FLOAT -#undef ASM_OUTPUT_INT -#undef ASM_OUTPUT_SHORT -#undef ASM_OUTPUT_CHAR -#undef ASM_OUTPUT_BYTE #undef ASM_OUTPUT_ADDR_VEC_ELT #undef ASM_OUTPUT_ADDR_DIFF_ELT #undef ASM_OUTPUT_ALIGN @@ -286,30 +285,6 @@ do { long l[3]; \ fprintf (FILE, "\tlong 0x%lx,0x%lx,0x%lx\n", l[0], l[1], l[2]); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\tlong "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\tshort "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\tbyte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\tbyte 0x%x\n", (int)(VALUE)) - #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ fprintf (FILE, "\tlong L%d\n", VALUE) diff --git a/gcc/config/m68k/lynx.h b/gcc/config/m68k/lynx.h index 92bded34854..31415b97ad2 100644 --- a/gcc/config/m68k/lynx.h +++ b/gcc/config/m68k/lynx.h @@ -29,8 +29,6 @@ Boston, MA 02111-1307, USA. */ #define BSS_SECTION_ASM_OP "\t.bss" -#define ASM_LONG ".long" - #include /* See m68k.h. 7 means 68020 with 68881. */ diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index f8932037775..228d98f1043 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -88,6 +88,35 @@ int m68k_align_funcs; int m68k_last_compare_had_fp_operands; /* Initialize the GCC target structure. */ + +#if INT_OP_GROUP == INT_OP_DOT_WORD +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" +#endif + +#if INT_OP_GROUP == INT_OP_NO_DOT +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP "\tbyte\t" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\tshort\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\tlong\t" +#endif + +#if INT_OP_GROUP == INT_OP_DC +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP "\tdc.b\t" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\tdc.w\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\tdc.l\t" +#endif + +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE m68k_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index 65a34eeba26..4637d812249 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -25,6 +25,16 @@ Boston, MA 02111-1307, USA. */ many of the definitions that relate to assembler syntax. */ +/* Classify the groups of pseudo-ops used to assemble QI, HI and SI + quantities. */ +#define INT_OP_STANDARD 0 /* .byte, .short, .long */ +#define INT_OP_DOT_WORD 1 /* .byte, .word, .long */ +#define INT_OP_NO_DOT 2 /* byte, short, long */ +#define INT_OP_DC 3 /* dc.b, dc.w, dc.l */ + +/* Set the default */ +#define INT_OP_GROUP INT_OP_DOT_WORD + /* Names to predefine in the preprocessor for this target machine. */ /* See sun3.h, sun2.h, isi.h for different CPP_PREDEFINES. */ @@ -1816,30 +1826,6 @@ do { long l; \ fprintf (FILE, "\t.long 0x%lx\n", l); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (int)(VALUE)) - /* This is how to output an insn to push a register on the stack. It need not be very fast code. */ diff --git a/gcc/config/m68k/m68kelf.h b/gcc/config/m68k/m68kelf.h index ae47c195dfe..88154fc7a7f 100644 --- a/gcc/config/m68k/m68kelf.h +++ b/gcc/config/m68k/m68kelf.h @@ -183,7 +183,7 @@ do { \ #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ do { \ register int sp = 0, ch; \ - fprintf ((FILE), "%s", BYTE_ASM_OP); \ + fputs (integer_asm_op (1, TRUE), (FILE)); \ do { \ ch = (PTR)[sp]; \ if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \ @@ -198,7 +198,7 @@ do { \ { \ if ((sp % 10) == 0) \ { \ - fprintf ((FILE), "\n%s", BYTE_ASM_OP); \ + fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE)); \ } \ else \ { \ diff --git a/gcc/config/m68k/m68kv4.h b/gcc/config/m68k/m68kv4.h index 7b1f0e72fd2..d2bb108bd99 100644 --- a/gcc/config/m68k/m68kv4.h +++ b/gcc/config/m68k/m68kv4.h @@ -217,7 +217,7 @@ do { \ #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ do { \ register size_t sp = 0, limit = (LEN); \ - fprintf ((FILE), "%s", BYTE_ASM_OP); \ + fputs (integer_asm_op (1, TRUE), (FILE)); \ do { \ int ch = (PTR)[sp]; \ if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \ @@ -232,7 +232,7 @@ do { \ { \ if ((sp % 10) == 0) \ { \ - fprintf ((FILE), "\n%s", BYTE_ASM_OP); \ + fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE)); \ } \ else \ { \ @@ -308,13 +308,13 @@ int switch_table_difference_label_flag; #undef TRAMPOLINE_TEMPLATE #define TRAMPOLINE_TEMPLATE(FILE) \ { \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x227a)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (8)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x2f3a)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (8)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x4e75)); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ + assemble_aligned_integer (2, GEN_INT (0x227a)); \ + assemble_aligned_integer (2, GEN_INT (8)); \ + assemble_aligned_integer (2, GEN_INT (0x2f3a)); \ + assemble_aligned_integer (2, GEN_INT (8)); \ + assemble_aligned_integer (2, GEN_INT (0x4e75)); \ + assemble_aligned_integer (4, const0_rtx); \ + assemble_aligned_integer (4, const0_rtx); \ } /* Redefine since we are using a different trampoline */ diff --git a/gcc/config/m68k/mot3300.h b/gcc/config/m68k/mot3300.h index 1c8da7a98c7..6801f6b53ea 100644 --- a/gcc/config/m68k/mot3300.h +++ b/gcc/config/m68k/mot3300.h @@ -289,29 +289,12 @@ Boston, MA 02111-1307, USA. */ ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \ sprintf ((OUTPUT), "%s_%%%d", (NAME), (LABELNO))) +#undef INT_OP_GROUP #ifdef USE_GAS -#undef ASM_LONG -#define ASM_LONG ".long" -#undef ASM_SHORT -#define ASM_SHORT ".short" -#undef ASM_CHAR -#define ASM_CHAR ".byte" -#undef ASM_BYTE -#define ASM_BYTE ".byte" -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\t.byte\t" +#define INT_OP_GROUP INT_OP_STANDARD #else -#undef ASM_LONG -#define ASM_LONG "long" -#undef ASM_SHORT -#define ASM_SHORT "short" -#undef ASM_CHAR -#define ASM_CHAR "byte" -#undef ASM_BYTE -#define ASM_BYTE "byte" -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\tbyte\t" -#endif /* USE_GAS */ +#define INT_OP_GROUP INT_OP_NO_DOT +#endif /* The sysV68 as doesn't know about double's and float's. */ /* This is how to output an assembler line defining a `double' constant. */ @@ -320,14 +303,16 @@ Boston, MA 02111-1307, USA. */ #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ do { long l[2]; \ REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \ - fprintf (FILE, "\t%s 0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \ + fprintf ((FILE), "%s0x%lx,0x%lx\n", \ + integer_asm_op (4, TRUE), l[0], l[1]); \ } while (0) #undef ASM_OUTPUT_LONG_DOUBLE #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \ do { long l[3]; \ REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \ - fprintf (FILE, "\t%s 0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \ + fprintf (FILE, "%s 0x%lx,0x%lx,0x%lx\n", \ + integer_asm_op (4, TRUE), l[0], l[1], l[2]); \ } while (0) /* This is how to output an assembler line defining a `float' constant. */ @@ -336,37 +321,9 @@ do { long l[3]; \ #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ do { long l; \ REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \ - fprintf ((FILE), "\t%s 0x%lx\n", ASM_LONG, l); \ + assemble_aligned_integer (4, GEN_INT (l)); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#undef ASM_OUTPUT_INT -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t%s ", ASM_LONG), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#undef ASM_OUTPUT_SHORT -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t%s ", ASM_SHORT), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#undef ASM_OUTPUT_CHAR -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t%s ", ASM_CHAR), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#undef ASM_OUTPUT_BYTE -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t%s 0x%x\n", ASM_BYTE, (int)(VALUE)) - /* This is how to output an assembler line that says to advance the location counter to a multiple of 2**LOG bytes. */ @@ -419,7 +376,7 @@ do { long l; \ #undef ASM_OUTPUT_ASCII #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ do { register size_t sp = 0, lp = 0, limit = (LEN); \ - fprintf ((FILE), "%s", ASM_BYTE_OP); \ + fputs (integer_asm_op (1, TRUE), (FILE)); \ loop: \ if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \ { lp += 3; \ @@ -490,13 +447,14 @@ do { long l; \ #undef ASM_OUTPUT_ADDR_VEC_ELT #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ - asm_fprintf (FILE, "\t%s %LL%d\n", ASM_LONG, (VALUE)) + asm_fprintf (FILE, "%s%LL%d\n", integer_asm_op (4, TRUE), (VALUE)) /* This is how to output an element of a case-vector that is relative. */ #undef ASM_OUTPUT_ADDR_DIFF_ELT #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - asm_fprintf (FILE, "\t%s %LL%d-%LL%d\n", ASM_SHORT, (VALUE), (REL)) + asm_fprintf (FILE, "\t%s %LL%d-%LL%d\n", \ + integer_asm_op (2, TRUE), (VALUE), (REL)) #ifndef USE_GAS diff --git a/gcc/config/m68k/sgs.h b/gcc/config/m68k/sgs.h index 5e4c212c691..7f44b268209 100644 --- a/gcc/config/m68k/sgs.h +++ b/gcc/config/m68k/sgs.h @@ -30,11 +30,11 @@ Boston, MA 02111-1307, USA. */ #include "m68k/m68k.h" +#undef INT_OP_GROUP +#define INT_OP_GROUP INT_OP_STANDARD + /* SGS specific assembler pseudo ops. */ -#define BYTE_ASM_OP "\t.byte " -#define WORD_ASM_OP "\t.short " -#define LONG_ASM_OP "\t.long " #define SPACE_ASM_OP "\t.space " #define ALIGN_ASM_OP "\t.align " #undef GLOBAL_ASM_OP @@ -42,9 +42,6 @@ Boston, MA 02111-1307, USA. */ #define SWBEG_ASM_OP "\t.swbeg " #define SET_ASM_OP "\t.set " -#define UNALIGNED_SHORT_ASM_OP "\t.short " /* Used in dwarfout.c */ -#define UNALIGNED_INT_ASM_OP "\t.long " /* Used in dwarfout.c */ - #define ASM_PN_FORMAT "%s_%d" /* Format for private names */ /* Here are four prefixes that are used by asm_fprintf to @@ -105,18 +102,12 @@ Boston, MA 02111-1307, USA. */ /* This is how to output an assembler line defining an `int' constant. */ /* The SGS assembler doesn't understand ".word". */ -#undef ASM_OUTPUT_SHORT -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf ((FILE), "%s", WORD_ASM_OP), \ - output_addr_const ((FILE), (VALUE)), \ - fprintf ((FILE), "\n")) - #undef ASM_OUTPUT_LONG_DOUBLE #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \ do { long l[3]; \ REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \ - fprintf ((FILE), "%s0x%lx,0x%lx,0x%lx\n", LONG_ASM_OP, \ - l[0], l[1], l[2]); \ + fprintf ((FILE), "%s0x%lx,0x%lx,0x%lx\n", \ + integer_asm_op (4, TRUE), l[0], l[1], l[2]); \ } while (0) /* This is how to output an assembler line defining a `double' constant. */ @@ -125,8 +116,8 @@ do { long l[3]; \ #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ do { long l[2]; \ REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \ - fprintf ((FILE), "%s0x%lx,0x%lx\n", LONG_ASM_OP, \ - l[0], l[1]); \ + fprintf ((FILE), "%s0x%lx,0x%lx\n", \ + integer_asm_op (4, TRUE), l[0], l[1]); \ } while (0) /* This is how to output an assembler line defining a `float' constant. */ @@ -135,7 +126,7 @@ do { long l[2]; \ #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ do { long l; \ REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \ - fprintf ((FILE), "%s0x%lx\n", LONG_ASM_OP, l); \ + assemble_aligned_integer (4, GEN_INT (l)); \ } while (0) /* This is how to output an assembler line that says to advance the @@ -160,7 +151,7 @@ do { \ #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ do { \ register size_t sp = 0, limit = (LEN); \ - fprintf ((FILE), "%s", BYTE_ASM_OP); \ + fputs (integer_asm_op (1, TRUE), (FILE)); \ do { \ int ch = (PTR)[sp]; \ if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \ @@ -175,7 +166,7 @@ do { \ { \ if ((sp % 10) == 0) \ { \ - fprintf ((FILE), "\n%s", BYTE_ASM_OP); \ + fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE)); \ } \ else \ { \ @@ -423,7 +414,7 @@ extern int switch_table_difference_label_flag; #undef ASM_OUTPUT_ADDR_DIFF_ELT #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - asm_fprintf (FILE, "%s%LL%d-%LL%d\n", WORD_ASM_OP, VALUE, REL) + asm_fprintf (FILE, "%s%LL%d-%LL%d\n", integer_asm_op (2, TRUE), VALUE, REL) /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to keep switch tables in the text section. */ diff --git a/gcc/config/m68k/tower-as.h b/gcc/config/m68k/tower-as.h index 927e92d0af6..f9009df0083 100644 --- a/gcc/config/m68k/tower-as.h +++ b/gcc/config/m68k/tower-as.h @@ -63,6 +63,9 @@ Boston, MA 02111-1307, USA. */ #define SGS_CMP_ORDER /* Takes cmp operands in reverse order */ #define SGS_NO_LI /* Suppress jump table label usage */ +#undef INT_OP_GROUP +#define INT_OP_GROUP INT_OP_NO_DOT + /* Turn on SDB debugging info. */ #define SDB_DEBUGGING_INFO @@ -276,34 +279,6 @@ do { long l; \ fprintf ((FILE), "\tlong 0x%lx\n", l); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#undef ASM_OUTPUT_INT -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\tlong "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#undef ASM_OUTPUT_SHORT -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\tshort "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#undef ASM_OUTPUT_CHAR -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\tbyte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#undef ASM_OUTPUT_BYTE -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\tbyte 0x%x\n", (int)(VALUE)) - #undef ASM_OUTPUT_ADDR_VEC_ELT #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ fprintf (FILE, "\tlong L%%%d\n", (VALUE)) @@ -585,7 +560,6 @@ do { fprintf (asm_out_file, "\ttag\t"); \ and CTOR_LIST_END to contribute to the .init section an instruction to push a word containing 0 (or some equivalent of that). */ -#define ASM_LONG "\tlong" #undef INIT_SECTION_ASM_OP #define INIT_SECTION_ASM_OP "\tsection\t~init" #undef FINI_SECTION_ASM_OP diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c index df5019655c7..e3ce288da61 100644 --- a/gcc/config/m88k/m88k.c +++ b/gcc/config/m88k/m88k.c @@ -76,6 +76,17 @@ static void m88k_svr3_asm_out_destructor PARAMS ((rtx, int)); static int m88k_adjust_cost PARAMS ((rtx, rtx, rtx, int)); /* Initialize the GCC target structure. */ +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP "\tbyte\t" +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\thalf\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\tword\t" +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\tuahalf\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\tuaword\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE m88k_output_function_prologue #undef TARGET_ASM_FUNCTION_END_PROLOGUE @@ -2364,7 +2375,8 @@ output_tdesc (file, offset) tdesc_section (); - fprintf (file, "%s%d,%d", ASM_LONG, /* 8:0,22:(20 or 16),2:2 */ + /* 8:0,22:(20 or 16),2:2 */ + fprintf (file, "%s%d,%d", integer_asm_op (4, TRUE), (((xmask != 0) ? 20 : 16) << 2) | 2, flag_pic ? 2 : 1); diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index c47619d742c..47c49b822cd 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -1154,9 +1154,9 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, /* Restore r10 and load the static chain register. */ \ fprintf (FILE, "\tld.d\t %s,%s,24\n", reg_names[10], reg_names[10]); \ /* Storage: r10 save area, static chain, function address. */ \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ + assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ + assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ + assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ } /* Length in units of the trampoline for entering a nested function. @@ -1687,9 +1687,6 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, #define BSS_ASM_OP "\tbss\t" #define FLOAT_ASM_OP "\tfloat\t" #define DOUBLE_ASM_OP "\tdouble\t" -#define ASM_LONG "\tword\t" -#define SHORT_ASM_OP "\thalf\t" -#define CHAR_ASM_OP "\tbyte\t" #define ASCII_DATA_ASM_OP "\tstring\t" /* These are particular to the global pool optimization. */ @@ -1715,8 +1712,6 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, /* These are specific to version 03.00 assembler syntax. */ #define INTERNAL_ASM_OP "\tlocal\t" #define VERSION_ASM_OP "\tversion\t" -#define UNALIGNED_SHORT_ASM_OP "\tuahalf\t" -#define UNALIGNED_INT_ASM_OP "\tuaword\t" #define PUSHSECTION_ASM_OP "\tsection\t" #define POPSECTION_ASM_OP "\tprevious" @@ -2035,7 +2030,8 @@ do { \ do { \ union { REAL_VALUE_TYPE d; long l[2]; } x; \ x.d = (VALUE); \ - fprintf (FILE, "%s0x%.8lx, 0x%.8lx\n", ASM_LONG, \ + fprintf (FILE, "%s0x%.8lx, 0x%.8lx\n", \ + integer_asm_op (4, TRUE), \ (long) x.l[0], (long) x.l[1]); \ } while (0) @@ -2044,32 +2040,10 @@ do { \ do { \ int i; \ FLOAT_TO_INT_INTERNAL (VALUE, i); \ - fprintf (FILE, "%s0x%.8x\n", ASM_LONG, i); \ + assemble_aligned_integer (4, GEN_INT (i)); \ } while (0) -/* Likewise for `int', `short', and `char' constants. */ -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "%s", ASM_LONG), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "%s", SHORT_ASM_OP), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "%s", CHAR_ASM_OP), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "%s0x%x\n", CHAR_ASM_OP, (int)(VALUE)) - /* The single-byte pseudo-op is the default. Override svr[34].h. */ -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\tbyte\t" #undef ASM_OUTPUT_ASCII #define ASM_OUTPUT_ASCII(FILE, P, SIZE) \ output_ascii (FILE, ASCII_DATA_ASM_OP, 48, P, SIZE) diff --git a/gcc/config/mcore/mcore-elf.h b/gcc/config/mcore/mcore-elf.h index ef1feedea1b..45cb3e86df1 100644 --- a/gcc/config/mcore/mcore-elf.h +++ b/gcc/config/mcore/mcore-elf.h @@ -40,11 +40,6 @@ Boston, MA 02111-1307, USA. */ #define DWARF_DEBUGGING_INFO 1 #endif -/* MCore defines .long and .short to NOT force any alignment. - This lets you misalign as much as you wish. */ -#define UNALIGNED_INT_ASM_OP "\t.long\t" -#define UNALIGNED_SHORT_ASM_OP "\t.short\t" - #define EXPORTS_SECTION_ASM_OP "\t.section .exports" #define SUBTARGET_EXTRA_SECTIONS in_const, in_exports diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index a367a557c5c..2b47e24e82d 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -144,6 +144,13 @@ static void mcore_asm_named_section PARAMS ((const char *, #define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes #endif +#ifdef OBJECT_FORMAT_ELF +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.short\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.long\t" +#endif + #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE mcore_attribute_table diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index 7bced8ea8b5..2709c578aab 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -1266,24 +1266,6 @@ extern long mcore_current_compilation_timestamp; } \ while (0) -#define ASM_OUTPUT_INT(STREAM, EXP) \ - (fprintf (STREAM, "\t.long\t"), \ - output_addr_const (STREAM, (EXP)), \ - fputc ('\n', STREAM)) - -#define ASM_OUTPUT_SHORT(STREAM, EXP) \ - (fprintf (STREAM, "\t.short\t"), \ - output_addr_const (STREAM, (EXP)), \ - fputc ('\n', STREAM)) - -#define ASM_OUTPUT_CHAR(STREAM, EXP) \ - (fprintf (STREAM, "\t.byte\t"), \ - output_addr_const (STREAM, (EXP)), \ - fputc ('\n', STREAM)) - -#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ - fprintf (STREAM, "\t.byte\t%d\n", VALUE) \ - /* This is how to output an assembler line that says to advance the location counter by SIZE bytes. */ #undef ASM_OUTPUT_SKIP diff --git a/gcc/config/mips/iris5.h b/gcc/config/mips/iris5.h index 7e3efa0a1f3..2c8fd83dd74 100644 --- a/gcc/config/mips/iris5.h +++ b/gcc/config/mips/iris5.h @@ -19,6 +19,8 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define TARGET_IRIX5 1 + #ifndef TARGET_DEFAULT #define TARGET_DEFAULT MASK_ABICALLS #endif @@ -155,10 +157,6 @@ do { \ fputs (" .text\n", FILE); \ } while (0) -/* To get unaligned data, we have to turn off auto alignment. */ -#define UNALIGNED_SHORT_ASM_OP "\t.align 0\n\t.half\t" -#define UNALIGNED_INT_ASM_OP "\t.align 0\n\t.word\t" - /* Also do this for libcalls. */ #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ mips_output_external_libcall (FILE, XSTR (FUN, 0)) diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h index d7a989ad007..776434a8d59 100644 --- a/gcc/config/mips/iris6.h +++ b/gcc/config/mips/iris6.h @@ -159,8 +159,6 @@ Boston, MA 02111-1307, USA. */ #undef ASM_OUTPUT_UNDEF_FUNCTION #undef ASM_OUTPUT_EXTERNAL_LIBCALL #undef ASM_DECLARE_FUNCTION_SIZE -#undef UNALIGNED_SHORT_ASM_OP -#undef UNALIGNED_INT_ASM_OP /* Stuff we need for Irix 6 that isn't in Irix 5. */ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 1d79f8ed3f8..9601efb946d 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -118,6 +118,7 @@ static void abort_with_insn PARAMS ((rtx, const char *)) ATTRIBUTE_NORETURN; static int symbolic_expression_p PARAMS ((rtx)); static void mips_add_gc_roots PARAMS ((void)); +static bool mips_assemble_integer PARAMS ((rtx, unsigned int, int)); static void mips_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static void mips_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static enum processor_type mips_parse_cpu PARAMS ((const char *)); @@ -456,6 +457,20 @@ enum reg_class mips_char_to_class[256] = }; /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER mips_assemble_integer + +#if TARGET_IRIX5 && !TARGET_IRIX6 +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.align 0\n\t.half\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.align 0\n\t.word\t" +#endif + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE mips_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -5788,7 +5803,29 @@ print_operand_address (file, addr) break; } } + +/* Target hook for assembling integer objects. It appears that the Irix + 6 assembler can't handle 64-bit decimal integers, so avoid printing + such an integer here. */ +static bool +mips_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + if ((TARGET_64BIT || TARGET_GAS) && size == 8 && aligned_p) + { + fputs ("\t.dword\t", asm_out_file); + if (HOST_BITS_PER_WIDE_INT < 64 || GET_CODE (x) != CONST_INT) + output_addr_const (asm_out_file, x); + else + print_operand (asm_out_file, x, 'X'); + fputc ('\n', asm_out_file); + return true; + } + return default_assemble_integer (x, size, aligned_p); +} /* If optimizing for the global pointer, keep track of all of the externs, so that at the end of the file, we can emit the appropriate .extern diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index b0415087faf..c877fd15adc 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -4396,69 +4396,6 @@ do { \ mips_output_float (STREAM, VALUE) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(STREAM,VALUE) \ -do { \ - fprintf (STREAM, "\t.word\t"); \ - output_addr_const (STREAM, (VALUE)); \ - fprintf (STREAM, "\n"); \ -} while (0) - -/* Likewise for 64 bit, `char' and `short' constants. - - FIXME: operand_subword can't handle some complex constant expressions - that output_addr_const can (for example it does not call - simplify_subtraction). Since GAS can handle dword, even for mipsII, - rely on that to avoid operand_subword for most of the cases where this - matters. Try gcc.c-torture/compile/930326-1.c with -mips2 -mlong64, - or the same case with the type of 'i' changed to long long. - -*/ - -#define ASM_OUTPUT_DOUBLE_INT(STREAM,VALUE) \ -do { \ - if (TARGET_64BIT || TARGET_GAS) \ - { \ - fprintf (STREAM, "\t.dword\t"); \ - if (HOST_BITS_PER_WIDE_INT < 64 || GET_CODE (VALUE) != CONST_INT) \ - /* We can't use 'X' for negative numbers, because then we won't \ - get the right value for the upper 32 bits. */ \ - output_addr_const (STREAM, VALUE); \ - else \ - /* We must use 'X', because otherwise LONG_MIN will print as \ - a number that the Irix 6 assembler won't accept. */ \ - print_operand (STREAM, VALUE, 'X'); \ - fprintf (STREAM, "\n"); \ - } \ - else \ - { \ - assemble_integer (operand_subword ((VALUE), 0, 0, DImode), \ - UNITS_PER_WORD, BITS_PER_WORD, 1); \ - assemble_integer (operand_subword ((VALUE), 1, 0, DImode), \ - UNITS_PER_WORD, BITS_PER_WORD, 1); \ - } \ -} while (0) - -#define ASM_OUTPUT_SHORT(STREAM,VALUE) \ -{ \ - fprintf (STREAM, "\t.half\t"); \ - output_addr_const (STREAM, (VALUE)); \ - fprintf (STREAM, "\n"); \ -} - -#define ASM_OUTPUT_CHAR(STREAM,VALUE) \ -{ \ - fprintf (STREAM, "\t.byte\t"); \ - output_addr_const (STREAM, (VALUE)); \ - fprintf (STREAM, "\n"); \ -} - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(STREAM,VALUE) \ - fprintf (STREAM, "\t.byte\t0x%x\n", (int)(VALUE)) - /* This is how to output an element of a case-vector that is absolute. */ #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ diff --git a/gcc/config/mips/sni-svr4.h b/gcc/config/mips/sni-svr4.h index 1df69745f21..e1783556490 100644 --- a/gcc/config/mips/sni-svr4.h +++ b/gcc/config/mips/sni-svr4.h @@ -68,7 +68,6 @@ Boston, MA 02111-1307, USA. */ #define NM_FLAGS "-p" -#define ASM_LONG ".word\t" #define ASM_GLOBAL ".rdata\n\t\t.globl\t" #include "mips/mips.h" diff --git a/gcc/config/mmix/mmix-protos.h b/gcc/config/mmix/mmix-protos.h index e1b11a3aaf2..0a3aca1ca80 100644 --- a/gcc/config/mmix/mmix-protos.h +++ b/gcc/config/mmix/mmix-protos.h @@ -122,7 +122,6 @@ extern void mmix_canonicalize_comparison PARAMS ((RTX_CODE *, rtx *, rtx *)); extern int mmix_rtx_cost_recalculated PARAMS ((rtx, RTX_CODE, RTX_CODE, int *)); extern int mmix_address_cost PARAMS ((rtx)); -extern void mmix_asm_output_double_int PARAMS ((FILE *, rtx, int)); extern void mmix_print_operand PARAMS ((FILE *, rtx, int)); extern void mmix_print_operand_address PARAMS ((FILE *, rtx)); extern int mmix_valid_comparison PARAMS ((RTX_CODE, enum machine_mode, rtx)); diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 6d1c72d2e90..9ba6c2d2b40 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -87,6 +87,7 @@ static void mmix_output_shifted_value PARAMS ((FILE *, HOST_WIDEST_INT)); static void mmix_output_condition PARAMS ((FILE *, rtx, int)); static HOST_WIDEST_INT mmix_intval PARAMS ((rtx)); static void mmix_output_octa PARAMS ((FILE *, HOST_WIDEST_INT, int)); +static bool mmix_assemble_integer PARAMS ((rtx, unsigned int, int)); static void mmix_init_machine_status PARAMS ((struct function *)); extern void mmix_target_asm_function_prologue @@ -100,6 +101,17 @@ extern void mmix_target_asm_function_epilogue /* Node: Function Entry */ +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP NULL +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP NULL +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP NULL +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP NULL +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER mmix_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE mmix_target_asm_function_prologue @@ -1911,31 +1923,45 @@ mmix_asm_output_float (stream, valuep) + 1))); } -/* ASM_OUTPUT_DOUBLE_INT. */ +/* Target hook for assembling integer objects. Use mmix_print_operand + for WYDE and TETRA. Use mmix_output_octa to output 8-byte + CONST_DOUBLEs. */ -void -mmix_asm_output_double_int (stream, value, do_begin_end) - FILE * stream; - rtx value; - int do_begin_end; +static bool +mmix_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; { - if (do_begin_end) - fprintf (stream, "\tOCTA "); + if (aligned_p) + switch (size) + { + case 1: + fputs ("\tBYTE\t", asm_out_file); + mmix_print_operand (asm_out_file, x, 'B'); + fputc ('\n', asm_out_file); + return true; - if (GET_CODE (value) == CONST_DOUBLE) - { - /* Get the bit representation of this number. */ - HOST_WIDE_INT wval = mmix_intval (value); - mmix_output_octa (stream, wval, 0); - } - else - /* FIXME: We scrap the '@' symbol-modifier since it's not used - anymore; we used to jump through lots of hoops, attempting to get - mmixal-compatible symbols; defined before use (still failed). */ - output_addr_const (stream, value); + case 2: + fputs ("\tWYDE\t", asm_out_file); + mmix_print_operand (asm_out_file, x, 'W'); + fputc ('\n', asm_out_file); + return true; - if (do_begin_end) - fprintf (stream, "\n"); + case 4: + fputs ("\tTETRA\t", asm_out_file); + mmix_print_operand (asm_out_file, x, 'L'); + fputc ('\n', asm_out_file); + return true; + + case 8: + if (GET_CODE (x) == CONST_DOUBLE) + mmix_output_octa (asm_out_file, mmix_intval (x), 0); + else + assemble_integer_with_op ("\tOCTA\t", x); + return true; + } + return default_assemble_integer (x, size, aligned_p); } /* ASM_OUTPUT_ASCII. */ @@ -2301,7 +2327,7 @@ mmix_print_operand (stream, x, code) case CONST_DOUBLE: /* Do somewhat as CONST_INT. */ - mmix_asm_output_double_int (stream, modified_x, 0); + mmix_output_octa (stream, mmix_intval (modified_x), 0); return; case CONST: diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 4fcc27ec2f9..8cb14e29f8a 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -972,42 +972,6 @@ const_section () \ #define ASM_OUTPUT_FLOAT(STREAM, VALUE) \ mmix_asm_output_float (STREAM, &VALUE) -#define ASM_OUTPUT_DOUBLE_INT(STREAM, EXP) \ - mmix_asm_output_double_int (STREAM, EXP, 1) - -#define ASM_OUTPUT_INT(STREAM, EXP) \ - do { \ - fprintf (STREAM, "\tTETRA "); \ - mmix_print_operand (STREAM, EXP, 'L'); \ - fprintf (STREAM, "\n"); \ - } while (0) - -#define ASM_OUTPUT_SHORT(STREAM, EXP) \ - do { \ - fprintf (STREAM, "\tWYDE "); \ - mmix_print_operand (STREAM, EXP, 'W'); \ - fprintf (STREAM, "\n"); \ - } while (0) - -#define ASM_OUTPUT_CHAR(STREAM, EXP) \ - do { \ - fprintf (STREAM, "\tBYTE "); \ - mmix_print_operand (STREAM, EXP, 'B'); \ - fprintf (STREAM, "\n"); \ - } while (0) - -#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ - fprintf (STREAM, "\tBYTE %d\n", (int) (VALUE) & 255) - -#define ASM_BYTE_OP "\tBYTE\t" - -/* We need these for DWARF2 EH data. If we don't define them, the - ordinary BYTE, WYDE, TETRA and OCTA will be used, and those are - aligning. */ -#define UNALIGNED_SHORT_ASM_OP "\t.2byte\t" -#define UNALIGNED_INT_ASM_OP "\t.4byte\t" -#define UNALIGNED_DOUBLE_INT_ASM_OP "\t.8byte\t" - #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \ mmix_asm_output_ascii (STREAM, PTR, LEN) @@ -1150,12 +1114,6 @@ const_section () \ mmix_asm_output_addr_vec_elt (STREAM, VALUE) -/* FIXME: Add to docs; It is not mentioned at all that - ASM_OUTPUT_ADDR_VEC_ELT is used if relative elements are - used, and that the default expects an undocumented macro - "ASM_LONG". */ -#define ASM_LONG "OCTA" - /* Node: Exception Region Output */ /* (empty) */ diff --git a/gcc/config/mn10200/mn10200.c b/gcc/config/mn10200/mn10200.c index 5f286e5ca63..bbe25b61aa2 100644 --- a/gcc/config/mn10200/mn10200.c +++ b/gcc/config/mn10200/mn10200.c @@ -67,6 +67,8 @@ static void count_tst_insns PARAMS ((int *)); static int out_of_line_epilogue; /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/mn10200/mn10200.h b/gcc/config/mn10200/mn10200.h index ffc5c7cca52..3aa38cf80f9 100644 --- a/gcc/config/mn10200/mn10200.h +++ b/gcc/config/mn10200/mn10200.h @@ -834,29 +834,6 @@ do { char dstr[30]; \ fprintf (FILE, "\t.float %s\n", dstr); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE, VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ -( fprintf (FILE, "\t.hword "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This says how to output the assembler to define a global uninitialized but not common symbol. Try to use asm_output_bss to implement this macro. */ diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 23fe80ff674..54bf0409262 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -53,6 +53,8 @@ Boston, MA 02111-1307, USA. */ || regs_ever_live[16] || regs_ever_live[17])) /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h index db77f064aca..4adf82372c7 100644 --- a/gcc/config/mn10300/mn10300.h +++ b/gcc/config/mn10300/mn10300.h @@ -918,29 +918,6 @@ do { char dstr[30]; \ fprintf (FILE, "\t.float %s\n", dstr); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE, VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ -( fprintf (FILE, "\t.hword "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This says how to output the assembler to define a global uninitialized but not common symbol. Try to use asm_output_bss to implement this macro. */ diff --git a/gcc/config/ns32k/encore.h b/gcc/config/ns32k/encore.h index dd7c14be60f..3a1515cdde5 100644 --- a/gcc/config/ns32k/encore.h +++ b/gcc/config/ns32k/encore.h @@ -40,7 +40,6 @@ Boston, MA 02111-1307, USA. */ #undef ASM_OUTPUT_ALIGN #undef ASM_OUTPUT_ASCII #undef ASM_OUTPUT_DOUBLE -#undef ASM_OUTPUT_INT #undef ASM_OUTPUT_INTERNAL_LABEL #undef ASM_OUTPUT_LOCAL #undef CPP_PREDEFINES @@ -98,11 +97,6 @@ output_file_directive ((FILE), main_input_filename) * uninitialized locals. */ -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.double "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - #define ASM_OUTPUT_LABELREF_AS_INT(STREAM, NAME) \ do { \ fprintf (STREAM, "\t.double\t"); \ diff --git a/gcc/config/ns32k/ns32k.c b/gcc/config/ns32k/ns32k.c index 264245e3c2a..3802675f981 100644 --- a/gcc/config/ns32k/ns32k.c +++ b/gcc/config/ns32k/ns32k.c @@ -74,6 +74,14 @@ static void ns32k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE ns32k_attribute_table +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" + +#ifdef ENCORE_ASM +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.double\t" +#endif + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE ns32k_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/ns32k/ns32k.h b/gcc/config/ns32k/ns32k.h index f4d52b2fc1b..8bd64f6a2ef 100644 --- a/gcc/config/ns32k/ns32k.h +++ b/gcc/config/ns32k/ns32k.h @@ -736,8 +736,8 @@ operands on the 32k are stored). */ fprintf (FILE, "\tjump " ); \ PUT_ABSOLUTE_PREFIX (FILE); \ fprintf (FILE, "__trampoline\n" ); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ + assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ + assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ } /* Length in units of the trampoline for entering a nested function. */ @@ -1295,28 +1295,6 @@ while (0) /* This is how to output an assembler line defining an `int' constant. */ -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This is how to output an assembler line defining an external/static address which is not in tree format (for collect.c). */ diff --git a/gcc/config/pa/pa-64.h b/gcc/config/pa/pa-64.h index a79567af7f5..416e079511a 100644 --- a/gcc/config/pa/pa-64.h +++ b/gcc/config/pa/pa-64.h @@ -91,20 +91,6 @@ Boston, MA 02111-1307, USA. */ #undef STATIC_CHAIN_REGNUM #define STATIC_CHAIN_REGNUM 31 -/* This is not needed for correct operation in 32bit mode, and since - older versions of gas and the hpux assembler do not accept .dword - we put this here instead of the more logical location, pa.h. */ -#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ - do \ - { \ - fputs ("\t.dword ", FILE); \ - if (function_label_operand (VALUE, VOIDmode)) \ - fputs ("P%", FILE); \ - output_addr_const (FILE, (VALUE)); \ - fputs ("\n", FILE); \ - } \ - while (0) - /* Nonzero if we do not know how to pass TYPE solely in registers. */ #define MUST_PASS_IN_STACK(MODE,TYPE) \ ((TYPE) != 0 \ diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 27d2d79423f..6234a3356f4 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -64,6 +64,7 @@ static void pa_add_gc_roots PARAMS ((void)); static void mark_deferred_plabels PARAMS ((void *)); static void compute_zdepwi_operands PARAMS ((unsigned HOST_WIDE_INT, unsigned *)); static int compute_movstrsi_length PARAMS ((rtx)); +static bool pa_assemble_integer PARAMS ((rtx, unsigned int, int)); static void remove_useless_addtr_insns PARAMS ((rtx, int)); static rtx store_reg PARAMS ((int, int, int)); static rtx load_reg PARAMS ((int, int, int)); @@ -113,6 +114,22 @@ struct deferred_plabel int n_deferred_plabels = 0; /* Initialize the GCC target structure. */ + +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP "\t.dword\t" +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER pa_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE pa_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -209,6 +226,18 @@ override_options () if (flag_pic == 1 || TARGET_64BIT) flag_pic = 2; + /* We can't guarantee that .dword is available for 32-bit targets. */ + if (UNITS_PER_WORD == 4) + targetm.asm_out.aligned_op.di = NULL; + + /* The unaligned ops are only available when using GAS. */ + if (!TARGET_GAS) + { + targetm.asm_out.unaligned_op.hi = NULL; + targetm.asm_out.unaligned_op.si = NULL; + targetm.asm_out.unaligned_op.di = NULL; + } + /* Register global variables with the garbage collector. */ pa_add_gc_roots (); } @@ -2513,6 +2542,27 @@ output_64bit_ior (operands) return "depdi -1,%2,%3,%0"; } +/* Target hook for assembling integer objects. This code handles + aligned SI and DI integers specially, since function references must + be preceded by P%. */ + +static bool +pa_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + if (size == UNITS_PER_WORD && aligned_p + && function_label_operand (x, VOIDmode)) + { + fputs (size == 8? "\t.dword\tP%" : "\t.word\tP%", asm_out_file); + output_addr_const (asm_out_file, x); + fputc ('\n', asm_out_file); + return true; + } + return default_assemble_integer (x, size, aligned_p); +} + /* Output an ascii string. */ void output_ascii (file, p, size) diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index f6255fae0fe..525a9420d2d 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1751,43 +1751,6 @@ while (0) fprintf (FILE, "\t.word 0x%lx\n", l); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. - - This is made more complicated by the fact that functions must be - prefixed by a P% as well as code label references for the exception - table -- otherwise the linker chokes. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -{ fputs ("\t.word ", FILE); \ - if (function_label_operand (VALUE, VOIDmode)) \ - fputs ("P%", FILE); \ - output_addr_const (FILE, (VALUE)); \ - fputs ("\n", FILE);} - -/* Likewise for `short' and `char' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fputs ("\t.half ", FILE), \ - output_addr_const (FILE, (VALUE)), \ - fputs ("\n", FILE)) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fputs ("\t.byte ", FILE), \ - output_addr_const (FILE, (VALUE)), \ - fputs ("\n", FILE)) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (int)(VALUE)) - -/* C string constants giving the pseudo-op to use for a sequence of - 2, 4, and 8 byte unaligned constants. dwarf2out.c needs these. */ - -#define UNALIGNED_SHORT_ASM_OP (TARGET_GAS ? "\t.half " : NULL) -#define UNALIGNED_INT_ASM_OP (TARGET_GAS ? "\t.word " : NULL) -#define UNALIGNED_DOUBLE_INT_ASM_OP (TARGET_GAS ? "\t.dword " : NULL) - #define ASM_GLOBALIZE_LABEL(FILE, NAME) \ do { \ /* We only handle DATA objects here, functions are globalized in \ diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 03e596c5afe..505456550bd 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -53,11 +53,21 @@ int current_first_parm_offset; /* rtx cc0_reg_rtx; - no longer needed? */ static rtx find_addr_reg PARAMS ((rtx)); -static const char *singlemove_string PARAMS ((rtx *)); +static const char *singlemove_string PARAMS ((rtx *)); +static bool pdp11_assemble_integer PARAMS ((rtx, unsigned int, int)); static void pdp11_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void pdp11_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); /* Initialize the GCC target structure. */ +#undef TARGET_ASM_BYTE_OP +#define TARGET_ASM_BYTE_OP NULL +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP NULL +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP NULL +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER pdp11_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE pdp11_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -944,6 +954,34 @@ print_operand_address (file, addr) } } +/* Target hook to assemble integer objects. We need to use the + pdp-specific version of output_addr_const. */ + +static bool +pdp11_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + if (aligned_p) + switch (size) + { + case 1: + fprintf (asm_out_file, "\t.byte\t"); + output_addr_const_pdp11 (asm_out_file, x); + fprintf (asm_out_file, " /* char */\n"); + return true; + + case 2: + fprintf (asm_out_file, TARGET_UNIX_ASM ? "\t" : "\t.word\t"); + output_addr_const_pdp11 (asm_out_file, x); + fprintf (asm_out_file, " /* short */\n"); + return true; + } + return default_assemble_integer (x, size, aligned_p); +} + + /* register move costs, indexed by regs */ static int move_costs[N_REG_CLASSES][N_REG_CLASSES] = diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h index 5f8d968c2b3..61327e748f5 100644 --- a/gcc/config/pdp11/pdp11.h +++ b/gcc/config/pdp11/pdp11.h @@ -1099,25 +1099,6 @@ fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n") \ #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ fprintf (FILE, "\tfloat %.12e\n", (VALUE)) -/* Likewise for `short' and `char' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, TARGET_UNIX_ASM ? "\t" : "\t.word "), \ - output_addr_const_pdp11 (FILE, (VALUE)), \ - fprintf (FILE, " /*short*/\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const_pdp11 (FILE, (VALUE)), \ - fprintf (FILE, " /* char */\n")) - -/* This is how to output an assembler line for a numeric constant byte. - This won't actually be used since we define ASM_OUTPUT_CHAR. -*/ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte %o\n", (VALUE)) - #define ASM_OUTPUT_ASCII(FILE, P, SIZE) \ output_ascii (FILE, P, SIZE) @@ -1228,10 +1209,10 @@ JMP FUNCTION 0x0058 0x0000 <- FUNCTION if (TARGET_SPLIT) \ abort(); \ \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x9400+STATIC_CHAIN_REGNUM)); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT(0x0058)); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ + assemble_aligned_integer (2, GEN_INT (0x9400+STATIC_CHAIN_REGNUM)); \ + assemble_aligned_integer (2, const0_rtx); \ + assemble_aligned_integer (2, GEN_INT(0x0058)); \ + assemble_aligned_integer (2, const0_rtx); \ } #define TRAMPOLINE_SIZE 8 diff --git a/gcc/config/pj/pj.h b/gcc/config/pj/pj.h index 115062d7257..11c6aad9d61 100644 --- a/gcc/config/pj/pj.h +++ b/gcc/config/pj/pj.h @@ -1049,7 +1049,6 @@ struct pj_args fprintf (FILE,"\t! %s\n", TARGET_LITTLE_ENDIAN ? ".little" : ".big"); \ fprintf (FILE,"\t.align 4\n"); -#define ASM_LONG ".long" #define ASM_APP_ON "" #define ASM_APP_OFF "" #define FILE_ASM_OP "\t.file\n" @@ -1201,24 +1200,6 @@ do { char dstr[30]; \ fprintf ((FILE), "\t.float %s\n", dstr); \ } while (0) -#define ASM_OUTPUT_INT(STREAM, EXP) \ - (fprintf ((STREAM), "\t.long\t"), \ - output_addr_const ((STREAM), (EXP)), \ - fputc ('\n', (STREAM))) - -#define ASM_OUTPUT_SHORT(STREAM, EXP) \ - (fprintf ((STREAM), "\t.short\t"), \ - output_addr_const ((STREAM), (EXP)), \ - fputc ('\n', (STREAM))) - -#define ASM_OUTPUT_CHAR(STREAM, EXP) \ - (fprintf ((STREAM), "\t.byte\t"), \ - output_addr_const ((STREAM), (EXP)), \ - fputc ('\n', (STREAM))) - -#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ - fprintf ((STREAM), "\t.byte\t%d\n", (VALUE)) - /* This is how to output an assembler line that says to advance the location counter by SIZE bytes. */ diff --git a/gcc/config/romp/romp.h b/gcc/config/romp/romp.h index 2a1cd2b12a4..f9b7e9d8989 100644 --- a/gcc/config/romp/romp.h +++ b/gcc/config/romp/romp.h @@ -1404,30 +1404,6 @@ struct rt_cargs {int gregs, fregs; }; fprintf (FILE, "\t.long 0x%x\n", u_i_f.i);\ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.short "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This is how to output code to push a register on the stack. It need not be very fast code. */ diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 785ee88ebb0..80a4c8abae4 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -274,29 +274,8 @@ do { \ || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ && ! TARGET_NO_FP_IN_TOC))))) -/* This is how to output an assembler line defining an `int' - constant. */ -#undef ASM_OUTPUT_INT -#define ASM_OUTPUT_INT(FILE, VALUE) \ - do \ - { \ - fputs ("\t.long ", (FILE)); \ - output_addr_const ((FILE), (VALUE)); \ - putc ('\n', (FILE)); \ - } \ - while (0) - -/* This is how to output an assembler line defining a `double int' - constant. */ -#undef ASM_OUTPUT_DOUBLE_INT -#define ASM_OUTPUT_DOUBLE_INT(FILE, VALUE) \ - do \ - { \ - fputs (DOUBLE_INT_ASM_OP, (FILE)); \ - output_addr_const ((FILE), (VALUE)); \ - putc ('\n', (FILE)); \ - } \ - while (0) - #undef ASM_DEFAULT_SPEC #define ASM_DEFAULT_SPEC "-mppc64" + +/* We don't need to generate entries in .fixup. */ +#undef RELOCATABLE_NEEDS_FIXUP diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5b4c86eec5b..b2abd819cf7 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -135,6 +135,7 @@ static void toc_hash_mark_table PARAMS ((void *)); static int constant_pool_expr_1 PARAMS ((rtx, int *, int *)); static void rs6000_free_machine_status PARAMS ((struct function *)); static void rs6000_init_machine_status PARAMS ((struct function *)); +static bool rs6000_assemble_integer PARAMS ((rtx, unsigned int, int)); static int rs6000_ra_ever_killed PARAMS ((void)); static tree rs6000_handle_longcall_attribute PARAMS ((tree *, tree, tree, int, bool *)); const struct attribute_spec rs6000_attribute_table[]; @@ -222,6 +223,35 @@ static const char alt_reg_names[][8] = #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE rs6000_attribute_table +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP DOUBLE_INT_ASM_OP + +/* Default unaligned ops are only provided for ELF. Find the ops needed + for non-ELF systems. */ +#ifndef OBJECT_FORMAT_ELF +#ifdef OBJECT_FORMAT_COFF +/* For ECOFF. rs6000_assemble_integer will handle unaligned DIs on + 64-bit targets. */ +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.vbyte\t2," +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.vbyte\t4," +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP "\t.vbyte\t8," +#else +/* For Darwin. */ +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.short\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.long\t" +#endif +#endif + +/* This hook deals with fixups for relocatable code and DI-mode objects + in 64-bit code. */ +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER rs6000_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE rs6000_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -532,6 +562,14 @@ rs6000_override_options (default_cpu) if (TARGET_TOC) ASM_GENERATE_INTERNAL_LABEL (toc_label_name, "LCTOC", 1); + /* We can only guarantee the availability of DI pseudo-ops when + assembling for 64-bit targets. */ + if (!TARGET_POWERPC64) + { + targetm.asm_out.aligned_op.di = NULL; + targetm.asm_out.unaligned_op.di = NULL; + } + /* Arrange to save and restore machine status around nested functions. */ init_machine_status = rs6000_init_machine_status; free_machine_status = rs6000_free_machine_status; @@ -6019,6 +6057,70 @@ print_operand_address (file, x) abort (); } +/* Target hook for assembling integer objects. The powerpc version has + to handle fixup entries for relocatable code if RELOCATABLE_NEEDS_FIXUP + is defined. It also needs to handle DI-mode objects on 64-bit + targets. */ + +static bool +rs6000_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ +#ifdef RELOCATABLE_NEEDS_FIXUP + /* Special handling for SI values. */ + if (size == 4 && aligned_p) + { + extern int in_toc_section PARAMS ((void)); + static int recurse = 0; + + /* For -mrelocatable, we mark all addresses that need to be fixed up + in the .fixup section. */ + if (TARGET_RELOCATABLE + && !in_toc_section () + && !in_text_section () + && !recurse + && GET_CODE (x) != CONST_INT + && GET_CODE (x) != CONST_DOUBLE + && CONSTANT_P (x)) + { + char buf[256]; + + recurse = 1; + ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", fixuplabelno); + fixuplabelno++; + ASM_OUTPUT_LABEL (asm_out_file, buf); + fprintf (asm_out_file, "\t.long\t("); + output_addr_const (asm_out_file, x); + fprintf (asm_out_file, ")@fixup\n"); + fprintf (asm_out_file, "\t.section\t\".fixup\",\"aw\"\n"); + ASM_OUTPUT_ALIGN (asm_out_file, 2); + fprintf (asm_out_file, "\t.long\t"); + assemble_name (asm_out_file, buf); + fprintf (asm_out_file, "\n\t.previous\n"); + recurse = 0; + return true; + } + /* Remove initial .'s to turn a -mcall-aixdesc function + address into the address of the descriptor, not the function + itself. */ + else if (GET_CODE (x) == SYMBOL_REF + && XSTR (x, 0)[0] == '.' + && DEFAULT_ABI == ABI_AIX) + { + const char *name = XSTR (x, 0); + while (*name == '.') + name++; + + fprintf (asm_out_file, "\t.long\t%s\n", name); + return true; + } + } +#endif /* RELOCATABLE_NEEDS_FIXUP */ + return default_assemble_integer (x, size, aligned_p); +} + enum rtx_code rs6000_reverse_condition (mode, code) enum machine_mode mode; diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index d84706e9911..8669324b126 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -2727,50 +2727,6 @@ extern char rs6000_reg_names[][8]; /* register names (0 vs. %r0). */ fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \ } -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ -do { \ - if (TARGET_32BIT) \ - { \ - assemble_integer (operand_subword ((VALUE), 0, 0, DImode), \ - UNITS_PER_WORD, BITS_PER_WORD, 1); \ - assemble_integer (operand_subword ((VALUE), 1, 0, DImode), \ - UNITS_PER_WORD, BITS_PER_WORD, 1); \ - } \ - else \ - { \ - fprintf (FILE, "%s", DOUBLE_INT_ASM_OP); \ - output_addr_const (FILE, (VALUE)); \ - putc ('\n', FILE); \ - } \ -} while (0) - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fputs ("\t.long ", FILE), \ - output_addr_const (FILE, (VALUE)), \ - putc ('\n', FILE)) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fputs ("\t.short ", FILE), \ - output_addr_const (FILE, (VALUE)), \ - putc ('\n', FILE)) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fputs ("\t.byte ", FILE), \ - output_addr_const (FILE, (VALUE)), \ - putc ('\n', FILE)) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (int)(VALUE)) - -/* This is used by the definition of ASM_OUTPUT_ADDR_ELT in defaults.h. */ -#define ASM_LONG (TARGET_32BIT ? ".long" : DOUBLE_INT_ASM_OP) - /* This is how to output an element of a case-vector that is relative. */ #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 56e16ba7877..e5abf8e9b13 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -485,6 +485,12 @@ toc_section () \ } \ } \ } \ +} \ + \ +extern int in_toc_section PARAMS ((void)); \ +int in_toc_section () \ +{ \ + return in_section == in_toc; \ } #define SDATA_SECTION_FUNCTION \ @@ -788,59 +794,6 @@ extern int fixuplabelno; #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor -/* This is how to output an assembler line defining an `int' constant. - For -mrelocatable, we mark all addresses that need to be fixed up - in the .fixup section. */ -/* Override rs6000.h definition. */ -#undef ASM_OUTPUT_INT -#define ASM_OUTPUT_INT(FILE,VALUE) \ -do { \ - static int recurse = 0; \ - if (TARGET_RELOCATABLE \ - && in_section != in_toc \ - && in_section != in_text \ - && !recurse \ - && GET_CODE (VALUE) != CONST_INT \ - && GET_CODE (VALUE) != CONST_DOUBLE \ - && CONSTANT_P (VALUE)) \ - { \ - char buf[256]; \ - \ - recurse = 1; \ - ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", fixuplabelno); \ - fixuplabelno++; \ - ASM_OUTPUT_LABEL (FILE, buf); \ - fprintf (FILE, "\t.long ("); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, ")@fixup\n"); \ - fprintf (FILE, "\t.section\t\".fixup\",\"aw\"\n"); \ - ASM_OUTPUT_ALIGN (FILE, 2); \ - fprintf (FILE, "\t.long\t"); \ - assemble_name (FILE, buf); \ - fprintf (FILE, "\n\t.previous\n"); \ - recurse = 0; \ - } \ - /* Remove initial .'s to turn a -mcall-aixdesc function \ - address into the address of the descriptor, not the function \ - itself. */ \ - else if (GET_CODE (VALUE) == SYMBOL_REF \ - && XSTR (VALUE, 0)[0] == '.' \ - && DEFAULT_ABI == ABI_AIX) \ - { \ - const char *name = XSTR (VALUE, 0); \ - while (*name == '.') \ - name++; \ - \ - fprintf (FILE, "\t.long %s\n", name); \ - } \ - else \ - { \ - fprintf (FILE, "\t.long "); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ - } \ -} while (0) - /* This is the end of what might become sysv4.h. */ /* Use DWARF 2 debugging information by default. */ @@ -1497,3 +1450,6 @@ ncrtn.o%s" #define TARGET_ASM_EXCEPTION_SECTION readonly_data_section #define DOUBLE_INT_ASM_OP "\t.quad\t" + +/* Generate entries in .fixup for relocatable addresses. */ +#define RELOCATABLE_NEEDS_FIXUP diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index 246e9d9d593..095a5663ea8 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -472,17 +472,8 @@ toc_section () \ /* This is how we tell the assembler that two symbols have the same value. */ #define SET_ASM_OP "\t.set " -/* Used by definition of ASM_OUTPUT_DOUBLE_INT */ -#define DOUBLE_INT_ASM_OP "\t.llong " - -/* These are various definitions for DWARF output. They could just - use '.long' or '.word', but that aligns to a 4-byte boundary which - is not what is required. So we define a million macros... */ - -#define UNALIGNED_SHORT_ASM_OP "\t.vbyte\t2," -#define UNALIGNED_INT_ASM_OP "\t.vbyte\t4," -/* Only define if alignment greater than 4. */ -#define UNALIGNED_DOUBLE_INT_ASM_OP (TARGET_64BIT ? "\t.vbyte\t8," : NULL) +/* Used by rs6000_assemble_integer, among others. */ +#define DOUBLE_INT_ASM_OP "\t.llong\t" /* Output before instructions. */ #define TEXT_SECTION_ASM_OP "\t.csect .text[PR]" diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h index ce1477e1944..25bae58d475 100644 --- a/gcc/config/s390/linux.h +++ b/gcc/config/s390/linux.h @@ -76,9 +76,6 @@ Boston, MA 02111-1307, USA. */ /* Assembler pseudos to introduce constants of various size. */ -#define ASM_SHORT "\t.word" -#define ASM_LONG "\t.long" -#define ASM_QUAD "\t.quad" #define ASM_DOUBLE "\t.double" @@ -130,44 +127,6 @@ Boston, MA 02111-1307, USA. */ sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) -#define ASM_OUTPUT_DOUBLE_INT(FILE, VALUE) \ -do { fprintf ((FILE), "%s\t", ASM_QUAD); \ - /* Work around bug in some GNU as versions */ \ - if (GET_CODE (VALUE) == CONST_INT && INTVAL (VALUE) < INT_MIN) \ - fprintf ((FILE), HOST_WIDE_INT_PRINT_HEX, INTVAL (x)); \ - else \ - output_addr_const ((FILE), (VALUE)); \ - putc ('\n', (FILE)); \ - } while (0) - - -/* This is how to output an assembler line defining an `int' constant. */ - -#undef ASM_OUTPUT_INT -#define ASM_OUTPUT_INT(FILE, VALUE) \ -do { fprintf (FILE, "%s\t", ASM_LONG); \ - output_addr_const (FILE, (VALUE)); \ - putc ('\n',FILE); \ - } while (0) - -/* Likewise for `char' and `short' constants. - is this supposed to do align too?? */ - -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ -( fprintf (FILE, "%s\t", ASM_SHORT), \ - output_addr_const (FILE, (VALUE)), \ - putc ('\n',FILE)) - -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ -( fprintf (FILE, "\t%s\t", ASM_BYTE_OP), \ - output_addr_const (FILE, (VALUE)), \ - putc ('\n', FILE)) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf ((FILE), "\t%s\t0x%x\n", ASM_BYTE_OP, (int)(VALUE)) - /* internal macro to output long */ #define _ASM_OUTPUT_LONG(FILE, VALUE) \ fprintf (FILE, "\t.long\t0x%lX\n", VALUE); @@ -176,13 +135,13 @@ do { fprintf (FILE, "%s\t", ASM_LONG); \ /* This is how to output an element of a case-vector that is absolute. */ #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ - fprintf (FILE, "%s\t%s%d\n", TARGET_64BIT?ASM_QUAD:ASM_LONG, \ + fprintf (FILE, "%s%s%d\n", integer_asm_op (UNITS_PER_WORD, TRUE), \ LPREFIX, VALUE) /* This is how to output an element of a case-vector that is relative. */ #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "%s\t%s%d-%s%d\n", TARGET_64BIT?ASM_QUAD:ASM_LONG, \ + fprintf (FILE, "%s%s%d-%s%d\n", integer_asm_op (UNITS_PER_WORD, TRUE), \ LPREFIX, VALUE, LPREFIX, REL) diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 743276c4da2..83e02a8a845 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -46,9 +46,17 @@ Boston, MA 02111-1307, USA. */ #include "debug.h" +static bool s390_assemble_integer PARAMS ((rtx, unsigned int, int)); static int s390_adjust_cost PARAMS ((rtx, rtx, rtx, int)); static int s390_adjust_priority PARAMS ((rtx, int)); +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t" +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER s390_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE s390_function_prologue @@ -1951,6 +1959,28 @@ print_operand (file, x, code) } } +/* Target hook for assembling integer objects. We need to define it + here to work a round a bug in some versions of GAS, which couldn't + handle values smaller than INT_MIN when printed in decimal. */ + +static bool +s390_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; +{ + if (size == 8 && aligned_p + && GET_CODE (x) == CONST_INT && INTVAL (x) < INT_MIN) + { + fputs ("\t.quad\t", asm_out_file); + fprintf (asm_out_file, HOST_WIDE_INT_PRINT_HEX, INTVAL (x)); + putc ('\n', asm_out_file); + return true; + } + return default_assemble_integer (x, size, aligned_p); +} + + #define DEBUG_SCHED 0 /* Returns true if register REGNO is used for forming diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 988d7e26563..9b85fb4d0fb 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -1413,7 +1413,7 @@ extern int s390_nr_constants; || GET_CODE (EXP) == SYMBOL_REF \ || GET_CODE (EXP) == LABEL_REF )) \ { \ - fprintf (FILE, "%s\t",TARGET_64BIT ? ASM_QUAD : ASM_LONG); \ + fputs (integer_asm_op (UNITS_PER_WORD, TRUE), FILE); \ s390_output_symbolic_const (FILE, EXP); \ fputc ('\n', (FILE)); \ } \ diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 322de210a18..d08100d257e 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -170,6 +170,12 @@ static int sh_adjust_cost PARAMS ((rtx, rtx, rtx, int)); #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE sh_attribute_table +/* The next two are used for debug info when compiling with -gdwarf. */ +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.uaword\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.ualong\t" + #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE sh_output_function_epilogue diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index cdb25c89ec2..b2dd8f9bcc6 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2087,28 +2087,6 @@ do { char dstr[30]; \ fprintf ((FILE), "\t.float %s\n", dstr); \ } while (0) -#define ASM_OUTPUT_INT(STREAM, EXP) \ - (fprintf ((STREAM), "\t.long\t"), \ - output_addr_const ((STREAM), (EXP)), \ - fputc ('\n', (STREAM))) - -#define ASM_OUTPUT_SHORT(STREAM, EXP) \ - (fprintf ((STREAM), "\t.short\t"), \ - output_addr_const ((STREAM), (EXP)), \ - fputc ('\n', (STREAM))) - -#define ASM_OUTPUT_CHAR(STREAM, EXP) \ - (fprintf ((STREAM), "\t.byte\t"), \ - output_addr_const ((STREAM), (EXP)), \ - fputc ('\n', (STREAM))) - -#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ - fprintf ((STREAM), "\t.byte\t%d\n", (VALUE)) \ - -/* The next two are used for debug info when compiling with -gdwarf. */ -#define UNALIGNED_SHORT_ASM_OP "\t.uaword\t" -#define UNALIGNED_INT_ASM_OP "\t.ualong\t" - /* Loop alignment is now done in machine_dependent_reorg, so that branch shortening can know about it. */ diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h index 54b672e826f..61384465477 100644 --- a/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h @@ -353,14 +353,6 @@ do { \ #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM)) -/* Define the names of various pseudo-ops used by the Sparc/svr4 assembler. - ??? If ints are 64 bits then UNALIGNED_INT_ASM_OP (defined elsewhere) is - misnamed. These should all refer to explicit sizes (half/word/xword?), - anything other than short/int/long/etc. */ - -#undef UNALIGNED_DOUBLE_INT_ASM_OP -#define UNALIGNED_DOUBLE_INT_ASM_OP "\t.uaxword\t" - /* DWARF bits. */ /* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h index 9f6e38c2596..82f7d32ab22 100644 --- a/gcc/config/sparc/sol2.h +++ b/gcc/config/sparc/sol2.h @@ -95,13 +95,6 @@ Boston, MA 02111-1307, USA. */ #define ASM_OUTPUT_SKIP(FILE,SIZE) \ fprintf (FILE, "\t.skip %u\n", (SIZE)) -/* Use .uahalf/.uaword so packed structure members don't generate - assembler errors when using the native assembler. */ -#undef ASM_SHORT -#define ASM_SHORT ".uahalf" -#undef ASM_LONG -#define ASM_LONG ".uaword" - /* This is how to output a definition of an internal numbered label where PREFIX is the class of label and NUM is the number within the class. */ diff --git a/gcc/config/sparc/sp64-elf.h b/gcc/config/sparc/sp64-elf.h index 40d18dfac97..3bd2a53f562 100644 --- a/gcc/config/sparc/sp64-elf.h +++ b/gcc/config/sparc/sp64-elf.h @@ -114,8 +114,3 @@ crtbegin.o%s \ #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG - -/* Define the names of various pseudo-ops used by the Sparc/svr4 assembler. */ - -#undef UNALIGNED_DOUBLE_INT_ASM_OP -#define UNALIGNED_DOUBLE_INT_ASM_OP "\t.uaxword\t" diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h index 7e0e1fcad9b..b0778eb85ef 100644 --- a/gcc/config/sparc/sparc-protos.h +++ b/gcc/config/sparc/sparc-protos.h @@ -90,7 +90,6 @@ extern const char *output_return PARAMS ((rtx *)); extern const char *output_sibcall PARAMS ((rtx, rtx)); extern char *output_v9branch PARAMS ((rtx, int, int, int, int, int, rtx)); extern void emit_v9_brxx_insn PARAMS ((enum rtx_code, rtx, rtx)); -extern void output_double_int PARAMS ((FILE *, rtx)); extern void print_operand PARAMS ((FILE *, rtx, int)); extern int mems_ok_for_ldd_peep PARAMS ((rtx, rtx)); extern int arith_double_4096_operand PARAMS ((rtx, enum machine_mode)); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 48906d46bf4..d93f57c92c2 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -151,6 +151,7 @@ static void sparc_add_gc_roots PARAMS ((void)); static void mark_ultrasparc_pipeline_state PARAMS ((void *)); static int check_return_regs PARAMS ((rtx)); static int epilogue_renumber PARAMS ((rtx *, int)); +static bool sparc_assemble_integer PARAMS ((rtx, unsigned int, int)); static int ultra_cmove_results_ready_p PARAMS ((rtx)); static int ultra_fpmode_conflict_exists PARAMS ((enum machine_mode)); static rtx *ultra_find_type PARAMS ((int, rtx *, int)); @@ -202,6 +203,27 @@ struct sparc_cpu_select sparc_select[] = enum processor_type sparc_cpu; /* Initialize the GCC target structure. */ + +/* The sparc default is to use .half rather than .short for aligned + HI objects. Use .word instead of .long on non-ELF systems. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" +#ifndef OBJECT_FORMAT_ELF +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" +#endif + +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.uahalf\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.uaword\t" +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP "\t.uaxword\t" + +/* The target hook has to handle DI-mode values. */ +#undef TARGET_ASM_INTEGER +#define TARGET_ASM_INTEGER sparc_assemble_integer + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE sparc_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -401,6 +423,10 @@ sparc_override_options () if (flag_pcc_struct_return == DEFAULT_PCC_STRUCT_RETURN) flag_pcc_struct_return = (TARGET_ARCH64 ? 0 : 1); + /* Only use .uaxword when compiling for a 64-bit target. */ + if (!TARGET_ARCH64) + targetm.asm_out.unaligned_op.di = NULL; + /* Do various machine dependent initializations. */ sparc_init_modes (); @@ -6008,65 +6034,33 @@ print_operand (file, x, code) else { output_addr_const (file, x); } } -/* This function outputs assembler code for VALUE to FILE, where VALUE is - a 64 bit (DImode) value. */ +/* Target hook for assembling integer objects. The sparc version has + special handling for aligned DI-mode objects. */ -/* ??? If there is a 64 bit counterpart to .word that the assembler - understands, then using that would simply this code greatly. */ -/* ??? We only output .xword's for symbols and only then in environments - where the assembler can handle them. */ - -void -output_double_int (file, value) - FILE *file; - rtx value; +static bool +sparc_assemble_integer (x, size, aligned_p) + rtx x; + unsigned int size; + int aligned_p; { - if (GET_CODE (value) == CONST_INT) + /* ??? We only output .xword's for symbols and only then in environments + where the assembler can handle them. */ + if (aligned_p && size == 8 + && (GET_CODE (x) != CONST_INT && GET_CODE (x) != CONST_DOUBLE)) { - /* ??? This has endianness issues. */ -#if HOST_BITS_PER_WIDE_INT == 64 - HOST_WIDE_INT xword = INTVAL (value); - HOST_WIDE_INT high, low; - - high = (xword >> 32) & 0xffffffff; - low = xword & 0xffffffff; - ASM_OUTPUT_INT (file, GEN_INT (high)); - ASM_OUTPUT_INT (file, GEN_INT (low)); -#else - if (INTVAL (value) < 0) - ASM_OUTPUT_INT (file, constm1_rtx); - else - ASM_OUTPUT_INT (file, const0_rtx); - ASM_OUTPUT_INT (file, value); -#endif - } - else if (GET_CODE (value) == CONST_DOUBLE) - { - ASM_OUTPUT_INT (file, GEN_INT (CONST_DOUBLE_HIGH (value))); - ASM_OUTPUT_INT (file, GEN_INT (CONST_DOUBLE_LOW (value))); - } - else if (GET_CODE (value) == SYMBOL_REF - || GET_CODE (value) == CONST - || GET_CODE (value) == PLUS - || (TARGET_ARCH64 && - (GET_CODE (value) == LABEL_REF - || GET_CODE (value) == CODE_LABEL - || GET_CODE (value) == MINUS))) - { - if (! TARGET_V9) + if (TARGET_V9) { - ASM_OUTPUT_INT (file, const0_rtx); - ASM_OUTPUT_INT (file, value); + assemble_integer_with_op ("\t.xword\t", x); + return true; } else { - fprintf (file, "\t%s\t", ASM_LONGLONG); - output_addr_const (file, value); - fprintf (file, "\n"); + assemble_aligned_integer (4, const0_rtx); + assemble_aligned_integer (4, x); + return true; } } - else - abort (); + return default_assemble_integer (x, size, aligned_p); } /* Return the value of a code used in the .proc pseudo-op that says diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 4d88325d940..35802753746 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -2652,10 +2652,6 @@ do { \ /* ??? Try to make the style consistent here (_OP?). */ -#define ASM_LONGLONG ".xword" -#define ASM_LONG ".word" -#define ASM_SHORT ".half" -#define ASM_BYTE_OP "\t.byte\t" #define ASM_FLOAT ".single" #define ASM_DOUBLE ".double" #define ASM_LONGDOUBLE ".xxx" /* ??? Not known (or used yet). */ @@ -2732,7 +2728,8 @@ do { \ char str[30]; \ REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \ REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \ - fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t, \ + fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", \ + integer_asm_op (4, TRUE), t, \ ASM_COMMENT_START, str); \ } \ @@ -2745,11 +2742,12 @@ do { \ { \ long t[2]; \ char str[30]; \ + const char *long_op = integer_asm_op (4, TRUE); \ REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \ REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \ - fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t[0], \ + fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", long_op, t[0], \ ASM_COMMENT_START, str); \ - fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[1]); \ + fprintf (FILE, "\t%s\t0x%lx\n", long_op, t[1]); \ } /* This is how to output an assembler line defining a `long double' @@ -2759,43 +2757,16 @@ do { \ { \ long t[4]; \ char str[30]; \ + const char *long_op = integer_asm_op (4, TRUE); \ REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), t); \ REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \ - fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t[0], \ + fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", long_op, t[0], \ ASM_COMMENT_START, str); \ - fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[1]); \ - fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[2]); \ - fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[3]); \ + fprintf (FILE, "\t%s\t0x%lx\n", long_op, t[1]); \ + fprintf (FILE, "\t%s\t0x%lx\n", long_op, t[2]); \ + fprintf (FILE, "\t%s\t0x%lx\n", long_op, t[3]); \ } -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t%s\t", ASM_LONG), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line defining a DImode constant. */ -#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ - output_double_int (FILE, VALUE) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t%s\t", ASM_SHORT), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "%s", ASM_BYTE_OP), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "%s0x%x\n", ASM_BYTE_OP, (int)(VALUE)) - /* This is how we hook in and defer the case-vector until the end of the function. */ #define ASM_OUTPUT_ADDR_VEC(LAB,VEC) \ diff --git a/gcc/config/sparc/sun4gas.h b/gcc/config/sparc/sun4gas.h index 0848ecd11ac..7f4f7dbbc80 100644 --- a/gcc/config/sparc/sun4gas.h +++ b/gcc/config/sparc/sun4gas.h @@ -18,10 +18,5 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* gas supports unaligned data. */ -#define UNALIGNED_DOUBLE_INT_ASM_OP "\t.uaxword\t" -#define UNALIGNED_INT_ASM_OP "\t.uaword\t" -#define UNALIGNED_SHORT_ASM_OP "\t.uahalf\t" - /* defaults.h will define DWARF2_UNWIND_INFO for us. */ #undef DWARF2_UNWIND_INFO diff --git a/gcc/config/sparc/sysv4.h b/gcc/config/sparc/sysv4.h index be10190ff26..a4c7f915c2e 100644 --- a/gcc/config/sparc/sysv4.h +++ b/gcc/config/sparc/sysv4.h @@ -87,16 +87,9 @@ Boston, MA 02111-1307, USA. */ #define STRING_ASM_OP "\t.asciz\t" #define COMMON_ASM_OP "\t.common\t" #define SKIP_ASM_OP "\t.skip\t" -#define UNALIGNED_DOUBLE_INT_ASM_OP (TARGET_ARCH64 ? "\t.uaxword\t" : NULL) -#define UNALIGNED_INT_ASM_OP "\t.uaword\t" -#define UNALIGNED_SHORT_ASM_OP "\t.uahalf\t" #define PUSHSECTION_ASM_OP "\t.pushsection\t" #define POPSECTION_ASM_OP "\t.popsection" -/* This is defined in sparc.h but is not used by svr4.h. */ -#undef ASM_LONG -#define ASM_LONG ".long" - /* This is the format used to print the second operand of a .type pseudo-op for the Sparc/svr4 assembler. */ diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 2f92367e396..a8906c63828 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -2003,4 +2003,9 @@ xstormy16_handle_interrupt_attribute (node, name, args, flags, no_add_attrs) return NULL_TREE; } +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index 7ad9c55b63f..4f71d53e66e 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -3571,57 +3571,6 @@ do { char dstr[30]; \ /* #define ASM_OUTPUT_SHORT_FLOAT(STREAM, VALUE) */ /* #define ASM_OUTPUT_BYTE_FLOAT(STREAM, VALUE) */ -/* A C statement to output to the stdio stream STREAM an assembler instruction - to assemble an integer of 16, 8, 4, 2 or 1 bytes, respectively, whose value - is VALUE. The argument EXP will be an RTL expression which represents a - constant value. Use `output_addr_const (STREAM, EXP)' to output this value - as an assembler expression. - - For sizes larger than `UNITS_PER_WORD', if the action of a macro would be - identical to repeatedly calling the macro corresponding to a size of - `UNITS_PER_WORD', once for each word, you need not define the macro. */ -/* #define ASM_OUTPUT_QUADRUPLE_INT(STREAM, EXP) */ -/* #define ASM_OUTPUT_DOUBLE_INT(STREAM, EXP) */ - -/* This is how to output an assembler line defining a `char' constant. */ -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ -do { \ - fprintf (FILE, "\t.byte\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ -} while (0) - -/* This is how to output an assembler line defining a `short' constant. */ -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ -do { \ - fprintf (FILE, "\t.hword\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ -} while (0) - -/* This is how to output an assembler line defining an `int' constant. - We also handle symbol output here. */ -#define ASM_OUTPUT_INT(FILE, VALUE) \ -do { \ - fprintf (FILE, "\t.word\t"); \ - output_addr_const (FILE, (VALUE)); \ - fprintf (FILE, "\n"); \ -} while (0) - -/* A C statement to output to the stdio stream STREAM an assembler instruction - to assemble a single byte containing the number VALUE. - - This declaration must be present. */ -#define ASM_OUTPUT_BYTE(STREAM, VALUE) \ - fprintf (STREAM, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE)) - -/* A C string constant giving the pseudo-op to use for a sequence of - single-byte constants. If this macro is not defined, the default - is `"byte"'. - - Defined in svr4.h. */ -/* #define ASM_BYTE_OP */ - /* A C statement to output to the stdio stream STREAM an assembler instruction to assemble a string constant containing the LEN bytes at PTR. PTR will be a C expression of type `char *' and LEN a C expression of type `int'. @@ -4397,8 +4346,7 @@ do { \ /* Define this macro to 0 if your target supports DWARF 2 frame unwind information, but it does not yet work with exception handling. Otherwise, if your target supports this information (if it defines - `INCOMING_RETURN_ADDR_RTX' and either `UNALIGNED_INT_ASM_OP' or - `OBJECT_FORMAT_ELF'), GCC will provide a default definition of 1. + `INCOMING_RETURN_ADDR_RTX'), GCC will provide a default definition of 1. If this macro is defined to 1, the DWARF 2 unwinder will be the default exception handling mechanism; otherwise, setjmp/longjmp will be used by diff --git a/gcc/config/svr3.h b/gcc/config/svr3.h index 3e17c653bd7..4de6f52670c 100644 --- a/gcc/config/svr3.h +++ b/gcc/config/svr3.h @@ -154,12 +154,6 @@ Boston, MA 02111-1307, USA. #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD -/* Assembler pseudos to introduce constants of various size. These - definitions should work for most svr3 systems. */ - -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\t.byte\t" - /* The prefix to add to user-visible assembler symbols. For System V Release 3 the convention is to prepend a leading diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 0d45ac97b5b..3c9ac92e23b 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -87,6 +87,9 @@ static int v850_interrupt_cache_p = FALSE; static int v850_interrupt_p = FALSE; /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" + #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE v850_attribute_table diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 834ab52ce0a..cb3d1459f51 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -1246,7 +1246,7 @@ do { \ #undef USER_LABEL_PREFIX #define USER_LABEL_PREFIX "_" -/* When ASM_OUTPUT_SHORT is used to emit the offsets for a switch +/* When assemble_integer is used to emit the offsets for a switch table it can encounter (TRUNCATE:HI (MINUS:SI (LABEL_REF:SI) (LABEL_REF:SI))). output_addr_const will normally barf at this, but it is OK to omit the truncate and just emit the difference of the two labels. The @@ -1275,29 +1275,6 @@ do { char dstr[30]; \ fprintf (FILE, "\t.float %s\n", dstr); \ } while (0) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE, VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE, VALUE) \ -( fprintf (FILE, "\t.hword "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE, VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ -#define ASM_OUTPUT_BYTE(FILE, VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This says how to output the assembler to define a global uninitialized but not common symbol. */ diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 1e6820ae266..ccaee768bb0 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -45,6 +45,9 @@ static void vms_asm_out_destructor PARAMS ((rtx, int)); #endif /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE vax_output_function_prologue diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h index 0edc824f420..7d0608e46cf 100644 --- a/gcc/config/vax/vax.h +++ b/gcc/config/vax/vax.h @@ -504,14 +504,14 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES }; movl $STATIC,r0 (store the functions static chain) jmp *$FUNCTION (jump to function code at address FUNCTION) */ -#define TRAMPOLINE_TEMPLATE(FILE) \ -{ \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x8fd0)); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ - ASM_OUTPUT_BYTE (FILE, 0x50 + STATIC_CHAIN_REGNUM); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x9f17)); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ +#define TRAMPOLINE_TEMPLATE(FILE) \ +{ \ + assemble_aligned_integer (2, const0_rtx); \ + assemble_aligned_integer (2, GEN_INT (0x8fd0)); \ + assemble_aligned_integer (4, const0_rtx); \ + assemble_aligned_integer (1, GEN_INT (0x50 + STATIC_CHAIN_REGNUM)); \ + assemble_aligned_integer (2, GEN_INT (0x9f17)); \ + assemble_aligned_integer (4, const0_rtx); \ } /* Length in units of the trampoline for entering a nested function. */ @@ -1123,30 +1123,6 @@ do { char dstr[30]; \ REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", dstr); \ fprintf (FILE, "\t.float 0f%s\n", dstr); } while (0); -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - /* This is how to output an insn to push a register on the stack. It need not be very fast code. */ diff --git a/gcc/config/we32k/we32k.c b/gcc/config/we32k/we32k.c index 32d6bb184b2..5813b2a44bb 100644 --- a/gcc/config/we32k/we32k.c +++ b/gcc/config/we32k/we32k.c @@ -40,6 +40,11 @@ static void we32k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void we32k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); /* Initialize the GCC target structure. */ +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" +#undef TARGET_ASM_ALIGNED_SI_OP +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE we32k_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE diff --git a/gcc/config/we32k/we32k.h b/gcc/config/we32k/we32k.h index 9e15f706a92..0cc12caf20e 100644 --- a/gcc/config/we32k/we32k.h +++ b/gcc/config/we32k/we32k.h @@ -439,15 +439,15 @@ enum reg_class { NO_REGS, GENERAL_REGS, mov #STATIC,%r8 jmp #FUNCTION */ -#define TRAMPOLINE_TEMPLATE(FILE) \ -{ \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x844f)); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ - ASM_OUTPUT_CHAR (FILE, GEN_INT (0x48)); \ - ASM_OUTPUT_SHORT (FILE, GEN_INT (0x247f)); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ - ASM_OUTPUT_SHORT (FILE, const0_rtx); \ +#define TRAMPOLINE_TEMPLATE(FILE) \ +{ \ + assemble_aligned_integer (2, GEN_INT (0x844f)); \ + assemble_aligned_integer (2, const0_rtx); \ + assemble_aligned_integer (2, const0_rtx); \ + assemble_aligned_integer (1, GEN_INT (0x48)); \ + assemble_aligned_integer (2, GEN_INT (0x247f)); \ + assemble_aligned_integer (2, const0_rtx); \ + assemble_aligned_integer (2, const0_rtx); \ } /* Length in units of the trampoline for entering a nested function. */ @@ -755,10 +755,6 @@ enum reg_class { NO_REGS, GENERAL_REGS, ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \ } while (0) -/* Assembler pseudo to introduce byte constants. */ - -#define ASM_BYTE_OP "\t.byte\t" - /* This is how to output an assembler line defining a `double' constant. */ /* This is how to output an assembler line defining a `float' constant. */ @@ -790,30 +786,6 @@ do { union { float f; long l;} tem; \ #endif /* not CROSS_COMPILE */ -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.half "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) - #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ do { \ const unsigned char *s; \ diff --git a/gcc/defaults.h b/gcc/defaults.h index ecfcedaaae2..91962d4ea80 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -62,7 +62,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef ASM_OUTPUT_ADDR_VEC_ELT #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ -do { fprintf (FILE, "\t%s\t", ASM_LONG); \ +do { fputs (integer_asm_op (POINTER_SIZE / UNITS_PER_WORD, TRUE), FILE); \ ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE)); \ fputc ('\n', FILE); \ } while (0) @@ -400,23 +400,6 @@ do { \ #define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER true #endif -/* GAS and SYSV4 assemblers accept these. */ -#if defined (OBJECT_FORMAT_ELF) || defined (OBJECT_FORMAT_ROSE) -#ifndef UNALIGNED_SHORT_ASM_OP -#define UNALIGNED_SHORT_ASM_OP "\t.2byte\t" -#endif -#ifndef UNALIGNED_INT_ASM_OP -#define UNALIGNED_INT_ASM_OP "\t.4byte\t" -#endif -#ifndef UNALIGNED_DOUBLE_INT_ASM_OP -#define UNALIGNED_DOUBLE_INT_ASM_OP "\t.8byte\t" -#endif -#endif /* OBJECT_FORMAT_ELF || OBJECT_FORMAT_ROSE */ - -#ifndef ASM_BYTE_OP -#define ASM_BYTE_OP "\t.byte\t" -#endif - #ifndef DEFAULT_GDB_EXTENSIONS #define DEFAULT_GDB_EXTENSIONS 1 #endif diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index c0105a84017..da3b4d543dc 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5810,8 +5810,39 @@ set via @code{__attribute__}. @node Data Output @subsection Output of Data -@c prevent bad page break with this line -This describes data output. + +@deftypevr {Target Hook} {const char *} TARGET_ASM_BYTE_OP +@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP +@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP +@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP +@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP +@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP +@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP +@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP +@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP +These hooks specify assembly directives for creating certain kinds +of integer object. The @code{TARGET_ASM_BYTE_OP} directive creates a +byte-sized object, the @code{TARGET_ASM_ALIGNED_HI_OP} one creates an +aligned two-byte object, and so on. Any of the hooks may be +@code{NULL}, indicating that no suitable directive is available. + +The compiler will print these strings at the start of a new line, +followed immediately by the object's initial value. In most cases, +the string should contain a tab, a pseudo-op, and then another tab. +@end deftypevr + +@deftypefn {Target Hook} bool TARGET_ASM_INTEGER (rtx @var{x}, unsigned int @var{size}, int @var{aligned_p}) +The @code{assemble_integer} function uses this hook to output an +integer object. @var{x} is the object's value, @var{size} is its size +in bytes and @var{aligned_p} indicates whether it is aligned. The +function should return @code{true} if it was able to output the +object. If it returns false, @code{assemble_integer} will try to +split the object into smaller parts. + +The default implementation of this hook will use the +@code{TARGET_ASM_BYTE_OP} family of strings, returning @code{false} +when the relevant string is @code{NULL}. +@end deftypefn @table @code @findex ASM_OUTPUT_LONG_DOUBLE @@ -5831,29 +5862,6 @@ will be a C expression of type @code{REAL_VALUE_TYPE}. Macros such as @code{REAL_VALUE_TO_TARGET_DOUBLE} are useful for writing these definitions. -@findex ASM_OUTPUT_QUADRUPLE_INT -@findex ASM_OUTPUT_DOUBLE_INT -@findex ASM_OUTPUT_INT -@findex ASM_OUTPUT_SHORT -@findex ASM_OUTPUT_CHAR -@findex output_addr_const -@item ASM_OUTPUT_QUADRUPLE_INT (@var{stream}, @var{exp}) -@itemx ASM_OUTPUT_DOUBLE_INT (@var{stream}, @var{exp}) -@itemx ASM_OUTPUT_INT (@var{stream}, @var{exp}) -@itemx ASM_OUTPUT_SHORT (@var{stream}, @var{exp}) -@itemx ASM_OUTPUT_CHAR (@var{stream}, @var{exp}) -A C statement to output to the stdio stream @var{stream} an assembler -instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes, -respectively, whose value is @var{value}. The argument @var{exp} will -be an RTL expression which represents a constant value. Use -@samp{output_addr_const (@var{stream}, @var{exp})} to output this value -as an assembler expression. - -For sizes larger than @code{UNITS_PER_WORD}, if the action of a macro -would be identical to repeatedly calling the macro corresponding to -a size of @code{UNITS_PER_WORD}, once for each word, you need not define -the macro. - @findex OUTPUT_ADDR_CONST_EXTRA @item OUTPUT_ADDR_CONST_EXTRA (@var{stream}, @var{x}, @var{fail}) A C statement to recognize @var{rtx} patterns that @@ -5866,29 +5874,6 @@ If @code{OUTPUT_ADDR_CONST_EXTRA} fails to recognize a pattern, it must prints an error message itself, by calling, for example, @code{output_operand_lossage}, it may just complete normally. -@findex ASM_OUTPUT_BYTE -@item ASM_OUTPUT_BYTE (@var{stream}, @var{value}) -A C statement to output to the stdio stream @var{stream} an assembler -instruction to assemble a single byte containing the number @var{value}. - -@findex ASM_BYTE_OP -@item ASM_BYTE_OP -A C string constant, including spacing, giving the pseudo-op to use for a -sequence of single-byte constants. If this macro is not defined, the -default is @code{"\t.byte\t"}. - -@findex UNALIGNED_SHORT_ASM_OP -@findex UNALIGNED_INT_ASM_OP -@findex UNALIGNED_DOUBLE_INT_ASM_OP -@item UNALIGNED_SHORT_ASM_OP -@itemx UNALIGNED_INT_ASM_OP -@itemx UNALIGNED_DOUBLE_INT_ASM_OP -A C string constant, including spacing, giving the pseudo-op to use -to assemble 16-, 32-, and 64-bit integers respectively @emph{without} -adding implicit padding or alignment. These macros are required if -DWARF 2 frame unwind is used. On ELF systems, these will default -to @code{.2byte}, @code{.4byte}, and @code{.8byte}. - @findex ASM_OUTPUT_ASCII @item ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len}) A C statement to output to the stdio stream @var{stream} an assembler diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c index 94f0e967be0..f2cc3c1e947 100644 --- a/gcc/dwarf2asm.c +++ b/gcc/dwarf2asm.c @@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree.h" #include "rtl.h" #include "output.h" +#include "target.h" #include "dwarf2asm.h" #include "dwarf2.h" #include "splay-tree.h" @@ -37,50 +38,29 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define ASM_COMMENT_START ";#" #endif -/* We don't have unaligned support, let's hope the normal output works for - .debug_frame. But we know it won't work for .debug_info. */ -#if !defined(UNALIGNED_INT_ASM_OP) && defined(DWARF2_DEBUGGING_INFO) - #error DWARF2_DEBUGGING_INFO requires UNALIGNED_INT_ASM_OP. -#endif - -/* Despite the fact that assemble_integer handles unaligned data, - continue emitting things by hand when possible, since that makes - the assembler commentary come out prettier. */ -#ifdef UNALIGNED_INT_ASM_OP -static const char * unaligned_integer_asm_op PARAMS ((int)); +/* Output an unaligned integer with the given value and size. Prefer not + to print a newline, since the caller may want to add a comment. */ -static inline const char * -unaligned_integer_asm_op (size) +void +dw2_assemble_integer (size, x) int size; + rtx x; { - const char *op = NULL; - switch (size) + const char *op = integer_asm_op (size, FALSE); + + if (op) { - case 1: - op = ASM_BYTE_OP; - break; - case 2: - op = UNALIGNED_SHORT_ASM_OP; - break; - case 4: - op = UNALIGNED_INT_ASM_OP; - break; - case 8: -#ifdef UNALIGNED_DOUBLE_INT_ASM_OP - op = UNALIGNED_DOUBLE_INT_ASM_OP; - break; -#endif - default: - abort (); + fputs (op, asm_out_file); + if (GET_CODE (x) == CONST_INT) + fprintf (asm_out_file, HOST_WIDE_INT_PRINT_HEX, INTVAL (x)); + else + output_addr_const (asm_out_file, x); } - - if (! op) - abort (); - - return op; + else + assemble_integer (x, size, BITS_PER_UNIT, 1); } -#endif /* UNALIGNED_INT_ASM_OP */ + /* Output an immediate constant in a given size. */ @@ -96,12 +76,7 @@ dw2_asm_output_data VPARAMS ((int size, unsigned HOST_WIDE_INT value, if (size * 8 < HOST_BITS_PER_WIDE_INT) value &= ~(~(unsigned HOST_WIDE_INT)0 << (size * 8)); -#ifdef UNALIGNED_INT_ASM_OP - fputs (unaligned_integer_asm_op (size), asm_out_file); - fprintf (asm_out_file, HOST_WIDE_INT_PRINT_HEX, value); -#else - assemble_integer (GEN_INT (value), size, BITS_PER_UNIT, 1); -#endif + dw2_assemble_integer (size, GEN_INT (value)); if (flag_debug_asm && comment) { @@ -129,16 +104,10 @@ dw2_asm_output_delta VPARAMS ((int size, const char *lab1, const char *lab2, VA_FIXEDARG (ap, const char *, lab2); VA_FIXEDARG (ap, const char *, comment); -#ifdef UNALIGNED_INT_ASM_OP - fputs (unaligned_integer_asm_op (size), asm_out_file); - assemble_name (asm_out_file, lab1); - fputc ('-', asm_out_file); - assemble_name (asm_out_file, lab2); -#else - assemble_integer (gen_rtx_MINUS (Pmode, gen_rtx_SYMBOL_REF (Pmode, lab1), - gen_rtx_SYMBOL_REF (Pmode, lab2)), - size, BITS_PER_UNIT, 1); -#endif + dw2_assemble_integer (size, + gen_rtx_MINUS (Pmode, + gen_rtx_SYMBOL_REF (Pmode, lab1), + gen_rtx_SYMBOL_REF (Pmode, lab2))); if (flag_debug_asm && comment) { @@ -168,12 +137,7 @@ dw2_asm_output_offset VPARAMS ((int size, const char *label, #ifdef ASM_OUTPUT_DWARF_OFFSET ASM_OUTPUT_DWARF_OFFSET (asm_out_file, size, label); #else -#ifdef UNALIGNED_INT_ASM_OP - fputs (unaligned_integer_asm_op (size), asm_out_file); - assemble_name (asm_out_file, label); -#else - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, label), size, BITS_PER_UNIT, 1); -#endif + dw2_assemble_integer (size, gen_rtx_SYMBOL_REF (Pmode, label)); #endif if (flag_debug_asm && comment) @@ -202,14 +166,10 @@ dw2_asm_output_pcrel VPARAMS ((int size ATTRIBUTE_UNUSED, #ifdef ASM_OUTPUT_DWARF_PCREL ASM_OUTPUT_DWARF_PCREL (asm_out_file, size, label); #else -#ifdef UNALIGNED_INT_ASM_OP - fputs (unaligned_integer_asm_op (size), asm_out_file); - assemble_name (asm_out_file, label); - fputc ('-', asm_out_file); - fputc ('.', asm_out_file); -#else - abort (); -#endif + dw2_assemble_integer (size, + gen_rtx_MINUS (Pmode, + gen_rtx_SYMBOL_REF (Pmode, label), + pc_rtx)); #endif if (flag_debug_asm && comment) @@ -233,12 +193,7 @@ dw2_asm_output_addr VPARAMS ((int size, const char *label, VA_FIXEDARG (ap, const char *, label); VA_FIXEDARG (ap, const char *, comment); -#ifdef UNALIGNED_INT_ASM_OP - fputs (unaligned_integer_asm_op (size), asm_out_file); - assemble_name (asm_out_file, label); -#else - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, label), size, BITS_PER_UNIT, 1); -#endif + dw2_assemble_integer (size, gen_rtx_SYMBOL_REF (Pmode, label)); if (flag_debug_asm && comment) { @@ -261,12 +216,7 @@ dw2_asm_output_addr_rtx VPARAMS ((int size, rtx addr, VA_FIXEDARG (ap, rtx, addr); VA_FIXEDARG (ap, const char *, comment); -#ifdef UNALIGNED_INT_ASM_OP - fputs (unaligned_integer_asm_op (size), asm_out_file); - output_addr_const (asm_out_file, addr); -#else - assemble_integer (addr, size, BITS_PER_UNIT, 1); -#endif + dw2_assemble_integer (size, addr); if (flag_debug_asm && comment) { @@ -319,7 +269,7 @@ dw2_asm_output_nstring VPARAMS ((const char *str, size_t orig_len, len += 1; ASM_OUTPUT_ASCII (asm_out_file, str, len); if (orig_len != (size_t) -1) - fprintf (asm_out_file, "%s0\n", ASM_BYTE_OP); + assemble_integer (const0_rtx, 1, BITS_PER_UNIT, 1); } VA_CLOSE (ap); @@ -571,8 +521,10 @@ dw2_asm_output_data_uleb128 VPARAMS ((unsigned HOST_WIDE_INT value, #else { unsigned HOST_WIDE_INT work = value; + const char *byte_op = targetm.asm_out.byte_op; - fputs (ASM_BYTE_OP, asm_out_file); + if (byte_op) + fputs (byte_op, asm_out_file); do { int byte = (work & 0x7f); @@ -581,9 +533,14 @@ dw2_asm_output_data_uleb128 VPARAMS ((unsigned HOST_WIDE_INT value, /* More bytes to follow. */ byte |= 0x80; - fprintf (asm_out_file, "0x%x", byte); - if (work != 0) - fputc (',', asm_out_file); + if (byte_op) + { + fprintf (asm_out_file, "0x%x", byte); + if (work != 0) + fputc (',', asm_out_file); + } + else + assemble_integer (GEN_INT (byte), 1, BITS_PER_UNIT, 1); } while (work != 0); @@ -627,8 +584,10 @@ dw2_asm_output_data_sleb128 VPARAMS ((HOST_WIDE_INT value, { HOST_WIDE_INT work = value; int more, byte; + const char *byte_op = targetm.asm_out.byte_op; - fputs (ASM_BYTE_OP, asm_out_file); + if (byte_op) + fputs (byte_op, asm_out_file); do { byte = (work & 0x7f); @@ -639,9 +598,14 @@ dw2_asm_output_data_sleb128 VPARAMS ((HOST_WIDE_INT value, if (more) byte |= 0x80; - fprintf (asm_out_file, "0x%x", byte); - if (more) - fputc (',', asm_out_file); + if (byte_op) + { + fprintf (asm_out_file, "0x%x", byte); + if (more) + fputc (',', asm_out_file); + } + else + assemble_integer (GEN_INT (byte), 1, BITS_PER_UNIT, 1); } while (more); @@ -905,12 +869,7 @@ dw2_asm_output_encoded_addr_rtx VPARAMS ((int encoding, switch (encoding & 0xF0) { case DW_EH_PE_absptr: -#ifdef UNALIGNED_INT_ASM_OP - fputs (unaligned_integer_asm_op (size), asm_out_file); - output_addr_const (asm_out_file, addr); -#else - assemble_integer (addr, size, BITS_PER_UNIT, 1); -#endif + dw2_assemble_integer (size, addr); break; case DW_EH_PE_pcrel: @@ -919,14 +878,7 @@ dw2_asm_output_encoded_addr_rtx VPARAMS ((int encoding, #ifdef ASM_OUTPUT_DWARF_PCREL ASM_OUTPUT_DWARF_PCREL (asm_out_file, size, XSTR (addr, 0)); #else -#ifdef UNALIGNED_INT_ASM_OP - fputs (unaligned_integer_asm_op (size), asm_out_file); - assemble_name (asm_out_file, XSTR (addr, 0)); - fputc ('-', asm_out_file); - fputc ('.', asm_out_file); -#else - abort (); -#endif + dw2_assemble_integer (size, gen_rtx_MINUS (Pmode, addr, pc_rtx)); #endif break; diff --git a/gcc/dwarf2asm.h b/gcc/dwarf2asm.h index 63d55e59ef4..859883d45e3 100644 --- a/gcc/dwarf2asm.h +++ b/gcc/dwarf2asm.h @@ -23,6 +23,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA the way these routines are signaled that there is no associated debug information. So the attributes are commented out. */ +extern void dw2_assemble_integer PARAMS ((int, rtx)); + extern void dw2_asm_output_data PARAMS ((int, unsigned HOST_WIDE_INT, const char *, ...)) /* ATTRIBUTE_PRINTF_3 */; diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index 3edaf351906..0ff75f585f7 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -574,6 +574,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "insn-config.h" #include "reload.h" #include "output.h" +#include "dwarf2asm.h" #include "toplev.h" #include "tm_p.h" #include "debug.h" @@ -928,7 +929,8 @@ static void shuffle_filename_entry PARAMS ((filename_entry *)); static void generate_new_sfname_entry PARAMS ((void)); static unsigned lookup_filename PARAMS ((const char *)); static void generate_srcinfo_entry PARAMS ((unsigned, unsigned)); -static void generate_macinfo_entry PARAMS ((const char *, const char *)); +static void generate_macinfo_entry PARAMS ((unsigned int, rtx, + const char *)); static int is_pseudo_reg PARAMS ((rtx)); static tree type_main_variant PARAMS ((tree)); static int is_tagged_type PARAMS ((tree)); @@ -1207,147 +1209,77 @@ static void retry_incomplete_types PARAMS ((void)); #ifndef ASM_OUTPUT_DWARF_DELTA2 #define ASM_OUTPUT_DWARF_DELTA2(FILE,LABEL1,LABEL2) \ - do { fprintf ((FILE), "%s", UNALIGNED_SHORT_ASM_OP); \ - assemble_name (FILE, LABEL1); \ - fprintf (FILE, "-"); \ - assemble_name (FILE, LABEL2); \ - fprintf (FILE, "\n"); \ - } while (0) + dw2_asm_output_delta (2, LABEL1, LABEL2, NULL) #endif #ifndef ASM_OUTPUT_DWARF_DELTA4 #define ASM_OUTPUT_DWARF_DELTA4(FILE,LABEL1,LABEL2) \ - do { fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP); \ - assemble_name (FILE, LABEL1); \ - fprintf (FILE, "-"); \ - assemble_name (FILE, LABEL2); \ - fprintf (FILE, "\n"); \ - } while (0) + dw2_asm_output_delta (4, LABEL1, LABEL2, NULL) #endif #ifndef ASM_OUTPUT_DWARF_TAG #define ASM_OUTPUT_DWARF_TAG(FILE,TAG) \ - do { \ - fprintf ((FILE), "%s0x%x", \ - UNALIGNED_SHORT_ASM_OP, (unsigned) TAG); \ - if (flag_debug_asm) \ - fprintf ((FILE), "\t%s %s", \ - ASM_COMMENT_START, dwarf_tag_name (TAG)); \ - fputc ('\n', (FILE)); \ - } while (0) + dw2_asm_output_data (2, TAG, "%s", dwarf_tag_name (TAG)); #endif #ifndef ASM_OUTPUT_DWARF_ATTRIBUTE #define ASM_OUTPUT_DWARF_ATTRIBUTE(FILE,ATTR) \ - do { \ - fprintf ((FILE), "%s0x%x", \ - UNALIGNED_SHORT_ASM_OP, (unsigned) ATTR); \ - if (flag_debug_asm) \ - fprintf ((FILE), "\t%s %s", \ - ASM_COMMENT_START, dwarf_attr_name (ATTR)); \ - fputc ('\n', (FILE)); \ - } while (0) + dw2_asm_output_data (2, ATTR, "%s", dwarf_attr_name (ATTR)) #endif #ifndef ASM_OUTPUT_DWARF_STACK_OP #define ASM_OUTPUT_DWARF_STACK_OP(FILE,OP) \ - do { \ - fprintf ((FILE), "%s0x%x", ASM_BYTE_OP, (unsigned) OP); \ - if (flag_debug_asm) \ - fprintf ((FILE), "\t%s %s", \ - ASM_COMMENT_START, dwarf_stack_op_name (OP)); \ - fputc ('\n', (FILE)); \ - } while (0) + dw2_asm_output_data (1, OP, "%s", dwarf_stack_op_name (OP)) #endif #ifndef ASM_OUTPUT_DWARF_FUND_TYPE #define ASM_OUTPUT_DWARF_FUND_TYPE(FILE,FT) \ - do { \ - fprintf ((FILE), "%s0x%x", \ - UNALIGNED_SHORT_ASM_OP, (unsigned) FT); \ - if (flag_debug_asm) \ - fprintf ((FILE), "\t%s %s", \ - ASM_COMMENT_START, dwarf_fund_type_name (FT)); \ - fputc ('\n', (FILE)); \ - } while (0) + dw2_asm_output_data (2, FT, "%s", dwarf_fund_type_name (FT)) #endif #ifndef ASM_OUTPUT_DWARF_FMT_BYTE #define ASM_OUTPUT_DWARF_FMT_BYTE(FILE,FMT) \ - do { \ - fprintf ((FILE), "%s0x%x", ASM_BYTE_OP, (unsigned) FMT); \ - if (flag_debug_asm) \ - fprintf ((FILE), "\t%s %s", \ - ASM_COMMENT_START, dwarf_fmt_byte_name (FMT)); \ - fputc ('\n', (FILE)); \ - } while (0) + dw2_asm_output_data (1, FMT, "%s", dwarf_fmt_byte_name (FMT)); #endif #ifndef ASM_OUTPUT_DWARF_TYPE_MODIFIER #define ASM_OUTPUT_DWARF_TYPE_MODIFIER(FILE,MOD) \ - do { \ - fprintf ((FILE), "%s0x%x", ASM_BYTE_OP, (unsigned) MOD); \ - if (flag_debug_asm) \ - fprintf ((FILE), "\t%s %s", \ - ASM_COMMENT_START, dwarf_typemod_name (MOD)); \ - fputc ('\n', (FILE)); \ - } while (0) + dw2_asm_output_data (1, MOD, "%s", dwarf_typemod_name (MOD)); #endif #ifndef ASM_OUTPUT_DWARF_ADDR #define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL) \ - do { fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP); \ - assemble_name (FILE, LABEL); \ - fprintf (FILE, "\n"); \ - } while (0) + dw2_asm_output_addr (4, LABEL, NULL) #endif #ifndef ASM_OUTPUT_DWARF_ADDR_CONST #define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \ - do { \ - fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP); \ - output_addr_const ((FILE), (RTX)); \ - fputc ('\n', (FILE)); \ - } while (0) + dw2_asm_output_addr_rtx (4, RTX, NULL) #endif #ifndef ASM_OUTPUT_DWARF_REF #define ASM_OUTPUT_DWARF_REF(FILE,LABEL) \ - do { fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP); \ - assemble_name (FILE, LABEL); \ - fprintf (FILE, "\n"); \ - } while (0) + dw2_asm_output_addr (4, LABEL, NULL) #endif #ifndef ASM_OUTPUT_DWARF_DATA1 #define ASM_OUTPUT_DWARF_DATA1(FILE,VALUE) \ - fprintf ((FILE), "%s0x%x\n", ASM_BYTE_OP, VALUE) + dw2_asm_output_data (1, VALUE, NULL) #endif #ifndef ASM_OUTPUT_DWARF_DATA2 #define ASM_OUTPUT_DWARF_DATA2(FILE,VALUE) \ - fprintf ((FILE), "%s0x%x\n", UNALIGNED_SHORT_ASM_OP, (unsigned) VALUE) + dw2_asm_output_data (2, VALUE, NULL) #endif #ifndef ASM_OUTPUT_DWARF_DATA4 #define ASM_OUTPUT_DWARF_DATA4(FILE,VALUE) \ - fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, (unsigned) VALUE) + dw2_asm_output_data (4, VALUE, NULL) #endif #ifndef ASM_OUTPUT_DWARF_DATA8 #define ASM_OUTPUT_DWARF_DATA8(FILE,HIGH_VALUE,LOW_VALUE) \ - do { \ - if (WORDS_BIG_ENDIAN) \ - { \ - fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \ - fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE); \ - } \ - else \ - { \ - fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE); \ - fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \ - } \ - } while (0) + dw2_asm_output_data (8, VALUE, NULL) #endif /* ASM_OUTPUT_DWARF_STRING is defined to output an ascii string, but to @@ -1757,11 +1689,8 @@ output_unsigned_leb128 (value) value >>= 7; if (value != 0) /* more bytes to follow */ byte |= 0x80; - fprintf (asm_out_file, "%s0x%x", ASM_BYTE_OP, (unsigned) byte); - if (flag_debug_asm && value == 0) - fprintf (asm_out_file, "\t%s ULEB128 number - value = %lu", - ASM_COMMENT_START, orig_value); - fputc ('\n', asm_out_file); + dw2_asm_output_data (1, byte, "\t%s ULEB128 number - value = %lu", + orig_value); } while (value != 0); } @@ -1789,11 +1718,8 @@ output_signed_leb128 (value) byte |= 0x80; more = 1; } - fprintf (asm_out_file, "%s0x%x", ASM_BYTE_OP, (unsigned) byte); - if (flag_debug_asm && more == 0) - fprintf (asm_out_file, "\t%s SLEB128 number - value = %ld", - ASM_COMMENT_START, orig_value); - fputc ('\n', asm_out_file); + dw2_asm_output_data (1, byte, "\t%s SLEB128 number - value = %ld", + orig_value); } while (more); } @@ -2168,8 +2094,7 @@ output_reg_number (rtl) regno); regno = 0; } - fprintf (asm_out_file, "%s0x%x", - UNALIGNED_INT_ASM_OP, DBX_REGISTER_NUMBER (regno)); + dw2_assemble_integer (4, GEN_INT (DBX_REGISTER_NUMBER (regno))); if (flag_debug_asm) { fprintf (asm_out_file, "\t%s ", ASM_COMMENT_START); @@ -6160,9 +6085,7 @@ dwarfout_source_line (line, filename) filename = tail; } - fprintf (asm_out_file, "%s%u\t%s %s:%u\n", - UNALIGNED_INT_ASM_OP, line, ASM_COMMENT_START, - filename, line); + dw2_asm_output_data (4, line, "%s:%u", filename, line); ASM_OUTPUT_DWARF_DATA2 (asm_out_file, 0xffff); ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, label, TEXT_BEGIN_LABEL); ASM_OUTPUT_POP_SECTION (asm_out_file); @@ -6176,8 +6099,9 @@ dwarfout_source_line (line, filename) /* Generate an entry in the .debug_macinfo section. */ static void -generate_macinfo_entry (type_and_offset, string) - const char *type_and_offset; +generate_macinfo_entry (type, offset, string) + unsigned int type; + rtx offset; const char *string; { if (! use_gnu_debug_info_extensions) @@ -6185,7 +6109,8 @@ generate_macinfo_entry (type_and_offset, string) fputc ('\n', asm_out_file); ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_MACINFO_SECTION); - fprintf (asm_out_file, "%s%s\n", UNALIGNED_INT_ASM_OP, type_and_offset); + assemble_integer (gen_rtx_PLUS (SImode, GEN_INT (type << 24), offset), + 4, BITS_PER_UNIT, 1); ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, string); ASM_OUTPUT_POP_SECTION (asm_out_file); } @@ -6206,15 +6131,16 @@ dwarfout_start_source_file (line, filename) const char *filename; { char label[MAX_ARTIFICIAL_LABEL_BYTES]; - char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*3]; + const char *label1, *label2; sprintf (label, SFNAMES_ENTRY_LABEL_FMT, lookup_filename (filename)); - sprintf (type_and_offset, "0x%08x+%s-%s", - ((unsigned) MACINFO_start << 24), - /* Hack: skip leading '*' . */ - (*label == '*') + label, - (*SFNAMES_BEGIN_LABEL == '*') + SFNAMES_BEGIN_LABEL); - generate_macinfo_entry (type_and_offset, ""); + label1 = (*label == '*') + label; + label2 = (*SFNAMES_BEGIN_LABEL == '*') + SFNAMES_BEGIN_LABEL; + generate_macinfo_entry (MACINFO_start, + gen_rtx_MINUS (Pmode, + gen_rtx_SYMBOL_REF (Pmode, label1), + gen_rtx_SYMBOL_REF (Pmode, label2)), + ""); } /* Wrapper for toplev.c callback to check debug info level. */ @@ -6230,11 +6156,7 @@ static void dwarfout_end_source_file (lineno) unsigned lineno; { - char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*2]; - - sprintf (type_and_offset, "0x%08x+%u", - ((unsigned) MACINFO_resume << 24), lineno); - generate_macinfo_entry (type_and_offset, ""); + generate_macinfo_entry (MACINFO_resume, GEN_INT (lineno), ""); } /* Called from check_newline in c-parse.y. The `buffer' parameter @@ -6248,16 +6170,13 @@ dwarfout_define (lineno, buffer) const char *buffer; { static int initialized = 0; - char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*2]; if (!initialized) { dwarfout_start_source_file (0, primary_filename); initialized = 1; } - sprintf (type_and_offset, "0x%08x+%u", - ((unsigned) MACINFO_define << 24), lineno); - generate_macinfo_entry (type_and_offset, buffer); + generate_macinfo_entry (MACINFO_define, GEN_INT (lineno), buffer); } /* Called from check_newline in c-parse.y. The `buffer' parameter @@ -6270,11 +6189,7 @@ dwarfout_undef (lineno, buffer) unsigned lineno; const char *buffer; { - char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*2]; - - sprintf (type_and_offset, "0x%08x+%u", - ((unsigned) MACINFO_undef << 24), lineno); - generate_macinfo_entry (type_and_offset, buffer); + generate_macinfo_entry (MACINFO_undef, GEN_INT (lineno), buffer); } /* Set up for Dwarf output at the start of compilation. */ diff --git a/gcc/final.c b/gcc/final.c index 1653138ff9e..e0100c18be6 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -3465,16 +3465,16 @@ output_addr_const (file, x) output_addr_const (file, XEXP (x, 0)); fprintf (file, "-"); - if ((GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) < 0) - || GET_CODE (XEXP (x, 1)) != CONST_INT) + if ((GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) >= 0) + || GET_CODE (XEXP (x, 1)) == PC + || GET_CODE (XEXP (x, 1)) == SYMBOL_REF) + output_addr_const (file, XEXP (x, 1)); + else { fputs (targetm.asm_out.open_paren, file); output_addr_const (file, XEXP (x, 1)); fputs (targetm.asm_out.close_paren, file); } - else - output_addr_const (file, XEXP (x, 1)); break; case ZERO_EXTEND: diff --git a/gcc/halfpic.c b/gcc/halfpic.c index 4931212bdfe..f491314f99f 100644 --- a/gcc/halfpic.c +++ b/gcc/halfpic.c @@ -187,7 +187,8 @@ half_pic_finish (stream) if (p->pointer_p) { ASM_OUTPUT_LABEL (stream, p->ref_name); - ASM_OUTPUT_INT (stream, gen_rtx_SYMBOL_REF (Pmode, p->real_name)); + assemble_aligned_integer (POINTER_SIZE / BITS_PER_UNIT, + gen_rtx_SYMBOL_REF (Pmode, p->real_name)); } } } diff --git a/gcc/output.h b/gcc/output.h index d733fce0bf1..1a2eefb36eb 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -315,12 +315,34 @@ extern void assemble_eh_label PARAMS ((const char *)); Many macros in the tm file are defined to call this function. */ extern void assemble_name PARAMS ((FILE *, const char *)); +/* Return the assembler directive for creating a given kind of integer + object. SIZE is the number of bytes in the object and ALIGNED_P + indicates whether it is known to be aligned. Return NULL if the + assembly dialect has no such directive. + + The returned string should be printed at the start of a new line and + be followed immediately by the object's initial value. */ +extern const char *integer_asm_op PARAMS ((int, int)); + #ifdef RTX_CODE +/* Use directive OP to assemble an integer object X. Print OP at the + start of the line, followed immediately by the value of X. */ +extern void assemble_integer_with_op PARAMS ((const char *, rtx)); + +/* The default implementation of the asm_out.integer target hook. */ +extern bool default_assemble_integer PARAMS ((rtx, unsigned int, int)); + /* Assemble the integer constant X into an object of SIZE bytes. ALIGN is the alignment of the integer in bits. Return 1 if we were able to output the constant, otherwise 0. If FORCE is non-zero, abort if we can't output the constant. */ -extern int assemble_integer PARAMS ((rtx, unsigned, unsigned, int)); +extern bool assemble_integer PARAMS ((rtx, unsigned, unsigned, int)); + +/* An interface to assemble_integer for the common case in which a value is + fully aligned and must be printed. VALUE is the value of the integer + object and SIZE is the number of bytes it contains. */ +#define assemble_aligned_integer(SIZE, VALUE) \ + assemble_integer (VALUE, SIZE, (SIZE) * BITS_PER_UNIT, 1) #ifdef REAL_VALUE_TYPE /* Assemble the floating-point constant D into an object of size MODE. */ diff --git a/gcc/target-def.h b/gcc/target-def.h index 59b5e8de0c8..feeb2c7aa33 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -32,6 +32,28 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* Assembler output. */ #define TARGET_ASM_OPEN_PAREN "(" #define TARGET_ASM_CLOSE_PAREN ")" +#define TARGET_ASM_BYTE_OP "\t.byte\t" + +#define TARGET_ASM_ALIGNED_HI_OP "\t.short\t" +#define TARGET_ASM_ALIGNED_SI_OP "\t.long\t" +#define TARGET_ASM_ALIGNED_DI_OP NULL +#define TARGET_ASM_ALIGNED_TI_OP NULL + +/* GAS and SYSV4 assemblers accept these. */ +#if defined (OBJECT_FORMAT_ELF) || defined (OBJECT_FORMAT_ROSE) +#define TARGET_ASM_UNALIGNED_HI_OP "\t.2byte\t" +#define TARGET_ASM_UNALIGNED_SI_OP "\t.4byte\t" +#define TARGET_ASM_UNALIGNED_DI_OP "\t.8byte\t" +#define TARGET_ASM_UNALIGNED_TI_OP NULL +#else +#define TARGET_ASM_UNALIGNED_HI_OP NULL +#define TARGET_ASM_UNALIGNED_SI_OP NULL +#define TARGET_ASM_UNALIGNED_DI_OP NULL +#define TARGET_ASM_UNALIGNED_TI_OP NULL +#endif /* OBJECT_FORMAT_ELF || OBJECT_FORMAT_ROSE */ + +#define TARGET_ASM_INTEGER default_assemble_integer + #define TARGET_ASM_FUNCTION_PROLOGUE default_function_pro_epilogue #define TARGET_ASM_FUNCTION_EPILOGUE default_function_pro_epilogue #define TARGET_ASM_FUNCTION_END_PROLOGUE no_asm_to_stream @@ -84,8 +106,24 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TARGET_ASM_EH_FRAME_SECTION default_eh_frame_section #endif +#define TARGET_ASM_ALIGNED_INT_OP \ + {TARGET_ASM_ALIGNED_HI_OP, \ + TARGET_ASM_ALIGNED_SI_OP, \ + TARGET_ASM_ALIGNED_DI_OP, \ + TARGET_ASM_ALIGNED_TI_OP} + +#define TARGET_ASM_UNALIGNED_INT_OP \ + {TARGET_ASM_UNALIGNED_HI_OP, \ + TARGET_ASM_UNALIGNED_SI_OP, \ + TARGET_ASM_UNALIGNED_DI_OP, \ + TARGET_ASM_UNALIGNED_TI_OP} + #define TARGET_ASM_OUT {TARGET_ASM_OPEN_PAREN, \ TARGET_ASM_CLOSE_PAREN, \ + TARGET_ASM_BYTE_OP, \ + TARGET_ASM_ALIGNED_INT_OP, \ + TARGET_ASM_UNALIGNED_INT_OP, \ + TARGET_ASM_INTEGER, \ TARGET_ASM_FUNCTION_PROLOGUE, \ TARGET_ASM_FUNCTION_END_PROLOGUE, \ TARGET_ASM_FUNCTION_BEGIN_EPILOGUE, \ diff --git a/gcc/target.h b/gcc/target.h index a0545800c27..355a910502c 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -52,6 +52,23 @@ struct gcc_target /* Opening and closing parentheses for asm expression grouping. */ const char *open_paren, *close_paren; + /* Assembler instructions for creating various kinds of integer object. */ + const char *byte_op; + struct asm_int_op + { + const char *hi; + const char *si; + const char *di; + const char *ti; + } aligned_op, unaligned_op; + + /* Try to output the assembler code for an integer object whose + value is given by X. SIZE is the size of the object in bytes and + ALIGNED_P indicates whether it is aligned. Return true if + successful. Only handles cases for which BYTE_OP, ALIGNED_OP + and UNALIGNED_OP are NULL. */ + bool (* integer) PARAMS ((rtx x, unsigned int size, int aligned_p)); + /* Output the assembler code for entry to a function. */ void (* function_prologue) PARAMS ((FILE *, HOST_WIDE_INT)); diff --git a/gcc/varasm.c b/gcc/varasm.c index 123b57c89d1..87d81e38ba3 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1922,146 +1922,112 @@ min_align (a, b) return (a | b) & -(a | b); } +/* Return the assembler directive for creating a given kind of integer + object. SIZE is the number of bytes in the object and ALIGNED_P + indicates whether it is known to be aligned. Return NULL if the + assembly dialect has no such directive. + + The returned string should be printed at the start of a new line and + be followed immediately by the object's initial value. */ + +const char * +integer_asm_op (size, aligned_p) + int size; + int aligned_p; +{ + struct asm_int_op *ops; + + if (aligned_p) + ops = &targetm.asm_out.aligned_op; + else + ops = &targetm.asm_out.unaligned_op; + + switch (size) + { + case 1: + return targetm.asm_out.byte_op; + case 2: + return ops->hi; + case 4: + return ops->si; + case 8: + return ops->di; + case 16: + return ops->ti; + default: + return NULL; + } +} + +/* Use directive OP to assemble an integer object X. Print OP at the + start of the line, followed immediately by the value of X. */ + +void +assemble_integer_with_op (op, x) + const char *op; + rtx x; +{ + fputs (op, asm_out_file); + output_addr_const (asm_out_file, x); + fputc ('\n', asm_out_file); +} + +/* The default implementation of the asm_out.integer target hook. */ + +bool +default_assemble_integer (x, size, aligned_p) + rtx x ATTRIBUTE_UNUSED; + unsigned int size ATTRIBUTE_UNUSED; + int aligned_p ATTRIBUTE_UNUSED; +{ + const char *op = integer_asm_op (size, aligned_p); + return op && (assemble_integer_with_op (op, x), true); +} + /* Assemble the integer constant X into an object of SIZE bytes. ALIGN is the alignment of the integer in bits. Return 1 if we were able to output the constant, otherwise 0. If FORCE is non-zero, abort if we can't output the constant. */ -int +bool assemble_integer (x, size, align, force) rtx x; unsigned int size; unsigned int align; int force; { - /* First try to use the standard 1, 2, 4, 8, and 16 byte - ASM_OUTPUT... macros. */ + int aligned_p; - if (align >= MIN (size * BITS_PER_UNIT, BIGGEST_ALIGNMENT)) - switch (size) - { -#ifdef ASM_OUTPUT_CHAR - case 1: - ASM_OUTPUT_CHAR (asm_out_file, x); - return 1; -#endif -#ifdef ASM_OUTPUT_SHORT - case 2: - ASM_OUTPUT_SHORT (asm_out_file, x); - return 1; -#endif -#ifdef ASM_OUTPUT_INT - case 4: - ASM_OUTPUT_INT (asm_out_file, x); - return 1; -#endif -#ifdef ASM_OUTPUT_DOUBLE_INT - case 8: - ASM_OUTPUT_DOUBLE_INT (asm_out_file, x); - return 1; -#endif -#ifdef ASM_OUTPUT_QUADRUPLE_INT - case 16: - ASM_OUTPUT_QUADRUPLE_INT (asm_out_file, x); - return 1; -#endif - } - else - { - const char *asm_op = NULL; + aligned_p = (align >= MIN (size * BITS_PER_UNIT, BIGGEST_ALIGNMENT)); - /* ??? This isn't quite as flexible as the ASM_OUTPUT_INT type hooks. - At present powerpc-eabi can't jump -mrelocatable hoops, so you can - get assembler errors from symbolic references in packed structs. */ - switch (size) - { -#ifdef UNALIGNED_SHORT_ASM_OP - case 2: - asm_op = UNALIGNED_SHORT_ASM_OP; - break; -#endif -#ifdef UNALIGNED_INT_ASM_OP - case 4: - asm_op = UNALIGNED_INT_ASM_OP; - break; -#endif -#ifdef UNALIGNED_DOUBLE_INT_ASM_OP - case 8: - asm_op = UNALIGNED_DOUBLE_INT_ASM_OP; - break; -#endif - } + /* See if the target hook can handle this kind of object. */ + if ((*targetm.asm_out.integer) (x, size, aligned_p)) + return true; - if (asm_op) - { - fputs (asm_op, asm_out_file); - output_addr_const (asm_out_file, x); - fputc ('\n', asm_out_file); - return 1; - } - } - - /* If we couldn't do it that way, there are two other possibilities: First, - if the machine can output an explicit byte and this is a 1 byte constant, - we can use ASM_OUTPUT_BYTE. */ - -#ifdef ASM_OUTPUT_BYTE - if (size == 1 && GET_CODE (x) == CONST_INT) - { - ASM_OUTPUT_BYTE (asm_out_file, INTVAL (x)); - return 1; - } -#endif - - /* If SIZE is larger than a single word, try to output the constant - one word at a time. */ - - if (size > UNITS_PER_WORD) - { - enum machine_mode mode - = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0); - unsigned align2 = min_align (align, BITS_PER_WORD); - unsigned int i; - - for (i = 0; i < size / UNITS_PER_WORD; i++) - { - rtx word = operand_subword (x, i, 0, mode); - if (word == 0) - break; - if (! assemble_integer (word, UNITS_PER_WORD, align2, 0)) - break; - } - - if (i == size / UNITS_PER_WORD) - return 1; - /* If we output at least one word and then could not finish, - there is no valid way to continue. */ - if (i > 0) - abort (); - } - - /* If unaligned, and this is a constant, emit it one byte at a time. */ - if (align < size * BITS_PER_UNIT) + /* If the object is a multi-byte one, try splitting it up. Split + it into words it if is multi-word, otherwise split it into bytes. */ + if (size > 1) { enum machine_mode omode, imode; - unsigned int i; + unsigned int subalign; + unsigned int subsize, i; - omode = mode_for_size (BITS_PER_UNIT, MODE_INT, 0); + subsize = size > UNITS_PER_WORD? UNITS_PER_WORD : 1; + subalign = MIN (align, subsize * BITS_PER_UNIT); + omode = mode_for_size (subsize * BITS_PER_UNIT, MODE_INT, 0); imode = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0); - for (i = 0; i < size; i++) + for (i = 0; i < size; i += subsize) { - rtx byte = simplify_subreg (omode, x, imode, i); - if (byte == 0) - break; - if (! assemble_integer (byte, 1, BITS_PER_UNIT, 0)) + rtx partial = simplify_subreg (omode, x, imode, i); + if (!partial || !assemble_integer (partial, subsize, subalign, 0)) break; } - if (i == size) - return 1; - /* If we output at least one byte and then could not finish, - there is no valid way to continue. */ + return true; + + /* If we've printed some of it, but not all of it, there's no going + back now. */ if (i > 0) abort (); } @@ -2069,7 +2035,7 @@ assemble_integer (x, size, align, force) if (force) abort (); - return 0; + return false; } /* Assemble the floating-point constant D into an object of size MODE. */