Turn CONSTANT_ALIGNMENT into a hook

Programming / Compilers / GCC - rsandifo [138bc75d-0d04-0410-961f-82ee72b054a4] - 25 September 2017 12:04 EDT

The definition:

#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ (TREE_CODE (EXP) == STRING_CST \ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))

was very common, so the patch adds a canned definition for that, called constant_alignment_word_strings. Some ports had a variation that used a port-local FASTEST_ALIGNMENT instead of BITS_PER_WORD; the patch uses constant_alignment_word_strings if FASTEST_ALIGNMENT was always BITS_PER_WORD and a port-local hook function otherwise.

2017-09-25 Richard Sandiford

gcc/
- target.def (constant_alignment): New hook.
- defaults.h (CONSTANT_ALIGNMENT): Delete.
- doc/tm.texi.in (CONSTANT_ALIGNMENT): Replace with... (TARGET_CONSTANT_ALIGNMENT): ...this new hook.
- doc/tm.texi: Regenerate.
- targhooks.h (default_constant_alignment): Declare. (constant_alignment_word_strings): Likewise.
- targhooks.c (default_constant_alignment): New function. (constant_alignment_word_strings): Likewise.
- builtins.c (get_object_alignment_2): Use targetm.constant_alignment instead of CONSTANT_ALIGNMENT.
- varasm.c (align_variable, get_variable_align, build_constant_desc) (force_const_mem): Likewise.
- config/aarch64/aarch64.h (CONSTANT_ALIGNMENT): Delete.
- config/aarch64/aarch64.c (aarch64_constant_alignment): New function. (aarch64_classify_address): Call it instead of CONSTANT_ALIGNMENT. (TARGET_CONSTANT_ALIGNMENT): Redefine.
- config/alpha/alpha.h (CONSTANT_ALIGNMENT): Delete commented-out definition.
- config/arc/arc.h (CONSTANT_ALIGNMENT): Delete.
- config/arc/arc.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/arm/arm.h (CONSTANT_ALIGNMENT_FACTOR): Delete. (CONSTANT_ALIGNMENT): Likewise.
- config/arm/arm.c (TARGET_CONSTANT_ALIGNMENT): Redefine. (arm_constant_alignment): New function.
- config/bfin/bfin.h (CONSTANT_ALIGNMENT): Delete.
- config/bfin/bfin.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/cr16/cr16.h (CONSTANT_ALIGNMENT): Delete.
- config/cr16/cr16.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/cris/cris.h (CONSTANT_ALIGNMENT): Delete.
- config/cris/cris.c (TARGET_CONSTANT_ALIGNMENT): Redefine. (cris_constant_alignment): New function.
- config/epiphany/epiphany.h (CONSTANT_ALIGNMENT): Delete.
- config/epiphany/epiphany.c (TARGET_CONSTANT_ALIGNMENT): Redefine. (epiphany_constant_alignment): New function.
- config/fr30/fr30.h (CONSTANT_ALIGNMENT): Delete.
- config/fr30/fr30.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/frv/frv.h (CONSTANT_ALIGNMENT): Delete.
- config/frv/frv.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/ft32/ft32.h (CONSTANT_ALIGNMENT): Delete.
- config/ft32/ft32.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/i386/i386.h (CONSTANT_ALIGNMENT): Delete.
- config/i386/i386-protos.h (ix86_constant_alignment): Delete.
- config/i386/i386.c (ix86_constant_alignment): Make static. Use the same interface as the target hook. (TARGET_CONSTANT_ALIGNMENT): Redefine.
- config/ia64/ia64.h (CONSTANT_ALIGNMENT): Delete.
- config/ia64/ia64.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/iq2000/iq2000.h (CONSTANT_ALIGNMENT): Delete.
- config/iq2000/iq2000.c (iq2000_constant_alignment): New function. (TARGET_CONSTANT_ALIGNMENT): Redefine.
- config/lm32/lm32.h (CONSTANT_ALIGNMENT): Delete.
- config/lm32/lm32.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/m32r/m32r.h (CONSTANT_ALIGNMENT): Delete.
- config/m32r/m32r.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/mcore/mcore.h (CONSTANT_ALIGNMENT): Delete.
- config/mcore/mcore.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/microblaze/microblaze.h (CONSTANT_ALIGNMENT): Delete.
- config/microblaze/microblaze.c (microblaze_constant_alignment): New function. (TARGET_CONSTANT_ALIGNMENT): Redefine.
- config/mips/mips.h (CONSTANT_ALIGNMENT): Delete.
- config/mips/mips.c (mips_constant_alignment): New function. (TARGET_CONSTANT_ALIGNMENT): Redefine.
- config/mmix/mmix.h (CONSTANT_ALIGNMENT): Delete.
- config/mmix/mmix-protos.h (mmix_constant_alignment): Delete.
- config/mmix/mmix.c (TARGET_CONSTANT_ALIGNMENT): Redefine. (mmix_constant_alignment): Make static. Use the same interface as the target hook.
- config/moxie/moxie.h (CONSTANT_ALIGNMENT): Delete.
- config/moxie/moxie.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/nios2/nios2.h (CONSTANT_ALIGNMENT): Delete.
- config/nios2/nios2.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/pa/pa.h (CONSTANT_ALIGNMENT): Delete.
- config/pa/pa.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/powerpcspe/powerpcspe.h (CONSTANT_ALIGNMENT): Delete.
- config/powerpcspe/powerpcspe.c (TARGET_CONSTANT_ALIGNMENT): Redefine. (rs6000_constant_alignment): New function.
- config/riscv/riscv.h (CONSTANT_ALIGNMENT): Delete.
- config/riscv/riscv.c (riscv_constant_alignment): New function. (TARGET_CONSTANT_ALIGNMENT): Redefine.
- config/rs6000/rs6000.h (CONSTANT_ALIGNMENT): Delete.
- config/rs6000/rs6000.c (TARGET_CONSTANT_ALIGNMENT): Redefine. (rs6000_constant_alignment): New function.
- config/s390/s390.h (CONSTANT_ALIGNMENT): Delete.
- config/s390/s390.c (s390_constant_alignment): New function. (TARGET_CONSTANT_ALIGNMENT): Redefine.
- config/sh/sh.h (CONSTANT_ALIGNMENT): Delete.
- config/sh/sh.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/sparc/sparc.h (CONSTANT_ALIGNMENT): Delete.
- config/sparc/sparc.c (TARGET_CONSTANT_ALIGNMENT): Redefine. (sparc_constant_alignment): New function.
- config/spu/spu.h (CONSTANT_ALIGNMENT): Delete.
- config/spu/spu.c (spu_constant_alignment): New function. (TARGET_CONSTANT_ALIGNMENT): Redefine.
- config/stormy16/stormy16.h (CONSTANT_ALIGNMENT): Delete.
- config/stormy16/stormy16.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/tilegx/tilegx.h (CONSTANT_ALIGNMENT): Delete.
- config/tilegx/tilegx.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/tilepro/tilepro.h (CONSTANT_ALIGNMENT): Delete.
- config/tilepro/tilepro.c (TARGET_CONSTANT_ALIGNMENT): Redefine to constant_alignment_word_strings.
- config/visium/visium.h (CONSTANT_ALIGNMENT): Delete.
- config/visium/visium.c (TARGET_CONSTANT_ALIGNMENT): Redefine. (visium_constant_alignment): New function.
- config/xtensa/xtensa.h (CONSTANT_ALIGNMENT): Delete.
- config/xtensa/xtensa.c (TARGET_CONSTANT_ALIGNMENT): Redefine. (xtensa_constant_alignment): New function.
- system.h (CONSTANT_ALIGNMENT): Poison.

579d67b Turn CONSTANT_ALIGNMENT into a hook
gcc/ChangeLog | 128 +++++++++++++++++++++++++++++++++++++
gcc/builtins.c | 4 +-
gcc/config/aarch64/aarch64.c | 16 ++++-
gcc/config/aarch64/aarch64.h | 8 ---
gcc/config/alpha/alpha.h | 1 -
gcc/config/arc/arc.c | 3 +
gcc/config/arc/arc.h | 7 --
gcc/config/arm/arm.c | 16 +++++
gcc/config/arm/arm.h | 9 ---
gcc/config/bfin/bfin.c | 3 +
gcc/config/bfin/bfin.h | 5 --
gcc/config/cr16/cr16.c | 3 +
gcc/config/cr16/cr16.h | 5 --
gcc/config/cris/cris.c | 21 ++++++
gcc/config/cris/cris.h | 11 ----
gcc/config/epiphany/epiphany.c | 14 ++++
gcc/config/epiphany/epiphany.h | 6 --
gcc/config/fr30/fr30.c | 3 +
gcc/config/fr30/fr30.h | 4 --
gcc/config/frv/frv.c | 2 +
gcc/config/frv/frv.h | 14 ----
gcc/config/ft32/ft32.c | 3 +
gcc/config/ft32/ft32.h | 6 --
gcc/config/i386/i386-protos.h | 1 -
gcc/config/i386/i386.c | 13 ++--
gcc/config/i386/i386.h | 14 ----
gcc/config/ia64/ia64.c | 3 +
gcc/config/ia64/ia64.h | 9 ---
gcc/config/iq2000/iq2000.c | 14 ++++
gcc/config/iq2000/iq2000.h | 4 --
gcc/config/lm32/lm32.c | 3 +
gcc/config/lm32/lm32.h | 5 --
gcc/config/m32r/m32r.c | 3 +
gcc/config/m32r/m32r.h | 6 --
gcc/config/mcore/mcore.c | 3 +
gcc/config/mcore/mcore.h | 6 --
gcc/config/microblaze/microblaze.c | 13 ++++
gcc/config/microblaze/microblaze.h | 6 --
gcc/config/mips/mips.c | 13 ++++
gcc/config/mips/mips.h | 16 -----
gcc/config/mmix/mmix-protos.h | 1 -
gcc/config/mmix/mmix.c | 10 ++-
gcc/config/mmix/mmix.h | 3 -
gcc/config/moxie/moxie.c | 3 +
gcc/config/moxie/moxie.h | 6 --
gcc/config/nios2/nios2.c | 3 +
gcc/config/nios2/nios2.h | 4 --
gcc/config/pa/pa.c | 3 +
gcc/config/pa/pa.h | 5 --
gcc/config/powerpcspe/powerpcspe.c | 14 ++++
gcc/config/powerpcspe/powerpcspe.h | 8 ---
gcc/config/riscv/riscv.c | 14 ++++
gcc/config/riscv/riscv.h | 16 -----
gcc/config/rs6000/rs6000.c | 14 ++++
gcc/config/rs6000/rs6000.h | 8 ---
gcc/config/s390/s390.c | 12 ++++
gcc/config/s390/s390.h | 1 -
gcc/config/sh/sh.c | 3 +
gcc/config/sh/sh.h | 6 --
gcc/config/sparc/sparc.c | 14 ++++
gcc/config/sparc/sparc.h | 6 --
gcc/config/spu/spu.c | 17 ++++-
gcc/config/spu/spu.h | 1 -
gcc/config/stormy16/stormy16.c | 3 +
gcc/config/stormy16/stormy16.h | 4 --
gcc/config/tilegx/tilegx.c | 3 +
gcc/config/tilegx/tilegx.h | 7 --
gcc/config/tilepro/tilepro.c | 3 +
gcc/config/tilepro/tilepro.h | 7 --
gcc/config/visium/visium.c | 13 ++++
gcc/config/visium/visium.h | 10 ---
gcc/config/xtensa/xtensa.c | 19 ++++++
gcc/config/xtensa/xtensa.h | 11 ----
gcc/defaults.h | 4 --
gcc/doc/tm.texi | 19 +++---
gcc/doc/tm.texi.in | 14 +---
gcc/system.h | 2 +-
gcc/target.def | 15 +++++
gcc/targhooks.c | 19 ++++++
gcc/targhooks.h | 3 +
gcc/varasm.c | 16 ++---
81 files changed, 470 insertions(+), 298 deletions(-)

Upstream: gcc.gnu.org


  • Share