diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-10-23 09:48:31 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-10-23 09:48:31 +0000 |
commit | 2a31c3216c53ffaeb21ec76e4491611bb40792b4 (patch) | |
tree | dc789f94038ad4986ddbf27397744b5117bf64e4 /gcc/config/vax | |
parent | 3ec43c5e312e368cca5cf0b9727bcbd71f13a704 (diff) | |
download | gcc-2a31c3216c53ffaeb21ec76e4491611bb40792b4.zip gcc-2a31c3216c53ffaeb21ec76e4491611bb40792b4.tar.gz gcc-2a31c3216c53ffaeb21ec76e4491611bb40792b4.tar.bz2 |
Convert STARTING_FRAME_OFFSET to a hook
I took the documentation of the FRAME_GROWS_DOWNWARD behaviour from the
version that was in most header files, since the one in the manual seemed
less clear.
The patch deliberately keeps FIRST_PARM_OFFSET(FNDECL) in
microblaze_starting_frame_offset; this seems to be a port-local
convention and takes advantage of the fact that FIRST_PARM_OFFSET
doesn't read FNDECL.
2017-10-23 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* target.def (starting_frame_offset): New hook.
* doc/tm.texi (STARTING_FRAME_OFFSET): Remove in favor of...
(TARGET_STARTING_FRAME_OFFSET): ...this new hook.
* doc/tm.texi.in: Regenerate.
* hooks.h (hook_hwi_void_0): Declare.
* hooks.c (hook_hwi_void_0): New function.
* doc/rtl.texi: Refer to TARGET_STARTING_FRAME_OFFSET instead of
STARTING_FRAME_OFFSET.
* builtins.c (expand_builtin_setjmp_receiver): Likewise.
* reload1.c (reload): Likewise.
* cfgexpand.c (expand_used_vars): Use targetm.starting_frame_offset
instead of STARTING_FRAME_OFFSET.
* function.c (try_fit_stack_local): Likewise.
(assign_stack_local_1): Likewise
(instantiate_virtual_regs): Likewise.
* rtlanal.c (rtx_addr_can_trap_p_1): Likewise.
* config/avr/avr.md (nonlocal_goto_receiver): Likewise.
* config/aarch64/aarch64.h (STARTING_FRAME_OFFSET): Delete.
* config/alpha/alpha.h (STARTING_FRAME_OFFSET): Likewise.
* config/arc/arc.h (STARTING_FRAME_OFFSET): Likewise.
* config/arm/arm.h (STARTING_FRAME_OFFSET): Likewise.
* config/bfin/bfin.h (STARTING_FRAME_OFFSET): Likewise.
* config/c6x/c6x.h (STARTING_FRAME_OFFSET): Likewise.
* config/cr16/cr16.h (STARTING_FRAME_OFFSET): Likewise.
* config/cris/cris.h (STARTING_FRAME_OFFSET): Likewise.
* config/fr30/fr30.h (STARTING_FRAME_OFFSET): Likewise.
* config/frv/frv.h (STARTING_FRAME_OFFSET): Likewise.
* config/ft32/ft32.h (STARTING_FRAME_OFFSET): Likewise.
* config/h8300/h8300.h (STARTING_FRAME_OFFSET): Likewise.
* config/i386/i386.h (STARTING_FRAME_OFFSET): Likewise.
* config/ia64/ia64.h (STARTING_FRAME_OFFSET): Likewise.
* config/m32c/m32c.h (STARTING_FRAME_OFFSET): Likewise.
* config/m68k/m68k.h (STARTING_FRAME_OFFSET): Likewise.
* config/mcore/mcore.h (STARTING_FRAME_OFFSET): Likewise.
* config/mn10300/mn10300.h (STARTING_FRAME_OFFSET): Likewise.
* config/moxie/moxie.h (STARTING_FRAME_OFFSET): Likewise.
* config/msp430/msp430.h (STARTING_FRAME_OFFSET): Likewise.
* config/nds32/nds32.h (STARTING_FRAME_OFFSET): Likewise.
* config/nios2/nios2.h (STARTING_FRAME_OFFSET): Likewise.
* config/nvptx/nvptx.h (STARTING_FRAME_OFFSET): Likewise.
* config/pdp11/pdp11.h (STARTING_FRAME_OFFSET): Likewise.
* config/riscv/riscv.h (STARTING_FRAME_OFFSET): Likewise.
* config/rl78/rl78.h (STARTING_FRAME_OFFSET): Likewise.
* config/rx/rx.h (STARTING_FRAME_OFFSET): Likewise.
* config/s390/s390.h (STARTING_FRAME_OFFSET): Likewise.
* config/sh/sh.h (STARTING_FRAME_OFFSET): Likewise.
* config/sparc/sparc.c (sparc_compute_frame_size): Likewise.
* config/sparc/sparc.h (STARTING_FRAME_OFFSET): Likewise.
* config/spu/spu.h (STARTING_FRAME_OFFSET): Likewise.
* config/stormy16/stormy16.h (STARTING_FRAME_OFFSET): Likewise.
* config/tilegx/tilegx.h (STARTING_FRAME_OFFSET): Likewise.
* config/tilepro/tilepro.h (STARTING_FRAME_OFFSET): Likewise.
* config/v850/v850.h (STARTING_FRAME_OFFSET): Likewise.
* config/visium/visium.h (STARTING_FRAME_OFFSET): Likewise.
* config/avr/avr.h (STARTING_FRAME_OFFSET): Likewise.
* config/avr/avr-protos.h (avr_starting_frame_offset): Likewise.
* config/avr/avr.c (avr_starting_frame_offset): Make static and
return a HOST_WIDE_INT.
(avr_builtin_setjmp_frame_value): Use it instead of
STARTING_FRAME_OFFSET.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
* config/epiphany/epiphany.h (STARTING_FRAME_OFFSET): Delete.
* config/epiphany/epiphany.c (epiphany_starting_frame_offset):
New function.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
* config/iq2000/iq2000.h (STARTING_FRAME_OFFSET): Delete.
* config/iq2000/iq2000.c (iq2000_starting_frame_offset): New function.
(TARGET_CONSTANT_ALIGNMENT): Redefine.
* config/lm32/lm32.h (STARTING_FRAME_OFFSET): Delete.
* config/lm32/lm32.c (lm32_starting_frame_offset): New function.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
* config/m32r/m32r.h (STARTING_FRAME_OFFSET): Delete.
* config/m32r/m32r.c (m32r_starting_frame_offset): New function.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
* config/microblaze/microblaze.h (STARTING_FRAME_OFFSET): Delete.
* config/microblaze/microblaze.c (microblaze_starting_frame_offset):
New function.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
* config/mips/mips.h (STARTING_FRAME_OFFSET): Delete.
* config/mips/mips.c (mips_compute_frame_info): Refer to
TARGET_STARTING_FRAME_OFFSET instead of STARTING_FRAME_OFFSET.
(mips_starting_frame_offset): New function.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
* config/mmix/mmix.h (STARTING_FRAME_OFFSET): Delete.
* config/mmix/mmix-protos.h (mmix_starting_frame_offset): Delete.
* config/mmix/mmix.c (mmix_starting_frame_offset): Make static
and return a HOST_WIDE_INT.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
(mmix_initial_elimination_offset): Refer to
TARGET_STARTING_FRAME_OFFSET instead of STARTING_FRAME_OFFSET.
* config/pa/pa.h (STARTING_FRAME_OFFSET): Delete.
* config/pa/pa.c (pa_starting_frame_offset): New function.
(pa_compute_frame_size): Use it instead of STARTING_FRAME_OFFSET.
(pa_expand_prologue): Likewise.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
* config/powerpcspe/aix.h (STARTING_FRAME_OFFSET): Split out
!FRAME_GROWS_DOWNWARD handling to...
(RS6000_STARTING_FRAME_OFFSET): ...this new macro.
* config/powerpcspe/darwin.h (STARTING_FRAME_OFFSET): Split out
!FRAME_GROWS_DOWNWARD handling to...
(RS6000_STARTING_FRAME_OFFSET): ...this new macro.
* config/powerpcspe/powerpcspe.h (STARTING_FRAME_OFFSET): Split out
!FRAME_GROWS_DOWNWARD handling to...
(RS6000_STARTING_FRAME_OFFSET): ...this new macro.
* config/powerpcspe/powerpcspe.c (TARGET_STARTING_FRAME_OFFSET):
Redefine.
(rs6000_starting_frame_offset): New function.
* config/rs6000/aix.h (STARTING_FRAME_OFFSET): Split out
!FRAME_GROWS_DOWNWARD handling to...
(RS6000_STARTING_FRAME_OFFSET): ...this new macro.
* config/rs6000/darwin.h (STARTING_FRAME_OFFSET): Split out
!FRAME_GROWS_DOWNWARD handling to...
(RS6000_STARTING_FRAME_OFFSET): ...this new macro.
* config/rs6000/rs6000.h (STARTING_FRAME_OFFSET): Split out
!FRAME_GROWS_DOWNWARD handling to...
(RS6000_STARTING_FRAME_OFFSET): ...this new macro.
* config/rs6000/rs6000.c (TARGET_STARTING_FRAME_OFFSET): Refine.
(rs6000_starting_frame_offset): New function.
* config/vax/elf.h (STARTING_FRAME_OFFSET): Delete.
* config/vax/vax.h (STARTING_FRAME_OFFSET): Delete.
* config/vax/vax.c (vax_starting_frame_offset): New function.
(vax_expand_prologue): Use it instead of STARTING_FRAME_OFFSET.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
* config/xtensa/xtensa.h (STARTING_FRAME_OFFSET): Delete.
* config/xtensa/xtensa.c (xtensa_starting_frame_offset): New function.
(TARGET_STARTING_FRAME_OFFSET): Redefine.
* system.h (STARTING_FRAME_OFFSET): Poison.
From-SVN: r254003
Diffstat (limited to 'gcc/config/vax')
-rw-r--r-- | gcc/config/vax/elf.h | 4 | ||||
-rw-r--r-- | gcc/config/vax/vax.c | 15 | ||||
-rw-r--r-- | gcc/config/vax/vax.h | 6 |
3 files changed, 14 insertions, 11 deletions
diff --git a/gcc/config/vax/elf.h b/gcc/config/vax/elf.h index 1ff1814..e699c12 100644 --- a/gcc/config/vax/elf.h +++ b/gcc/config/vax/elf.h @@ -66,10 +66,6 @@ along with GCC; see the file COPYING3. If not see 16)) -/* Reserve the top of the stack for exception handler stackadj value. */ -#undef STARTING_FRAME_OFFSET -#define STARTING_FRAME_OFFSET -4 - /* The VAX wants no space between the case instruction and the jump table. */ #undef ASM_OUTPUT_BEFORE_CASE_LABEL #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 5989607..82f13da 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -62,6 +62,7 @@ static void vax_asm_trampoline_template (FILE *); static void vax_trampoline_init (rtx, tree, rtx); static int vax_return_pops_args (tree, tree, int); static bool vax_mode_dependent_address_p (const_rtx, addr_space_t); +static HOST_WIDE_INT vax_starting_frame_offset (void); /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -120,6 +121,9 @@ static bool vax_mode_dependent_address_p (const_rtx, addr_space_t); #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE vax_option_override +#undef TARGET_STARTING_FRAME_OFFSET +#define TARGET_STARTING_FRAME_OFFSET vax_starting_frame_offset + struct gcc_target targetm = TARGET_INITIALIZER; /* Set global variables as needed for the options enabled. */ @@ -208,7 +212,7 @@ vax_expand_prologue (void) /* Allocate the local stack frame. */ size = get_frame_size (); - size -= STARTING_FRAME_OFFSET; + size -= vax_starting_frame_offset (); emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, GEN_INT (-size))); @@ -2179,3 +2183,12 @@ vax_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, ? (GET_MODE_SIZE (mode) + 3) & ~3 : (int_size_in_bytes (type) + 3) & ~3); } + +static HOST_WIDE_INT +vax_starting_frame_offset (void) +{ + /* On ELF targets, reserve the top of the stack for exception handler + stackadj value. */ + return TARGET_ELF ? -4 : 0; +} + diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h index 04a865c..990140d 100644 --- a/gcc/config/vax/vax.h +++ b/gcc/config/vax/vax.h @@ -228,12 +228,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES }; goes at a more negative offset in the frame. */ #define FRAME_GROWS_DOWNWARD 1 -/* Offset within stack frame to start allocating local variables at. - If FRAME_GROWS_DOWNWARD, this is the offset to the END of the - first local allocated. Otherwise, it is the offset to the BEGINNING - of the first local allocated. */ -#define STARTING_FRAME_OFFSET 0 - /* Given an rtx for the address of a frame, return an rtx for the address of the word in the frame that holds the dynamic chain--the previous frame's address. */ |