aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mmix
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-10-23 09:48:31 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-10-23 09:48:31 +0000
commit2a31c3216c53ffaeb21ec76e4491611bb40792b4 (patch)
treedc789f94038ad4986ddbf27397744b5117bf64e4 /gcc/config/mmix
parent3ec43c5e312e368cca5cf0b9727bcbd71f13a704 (diff)
downloadgcc-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/mmix')
-rw-r--r--gcc/config/mmix/mmix-protos.h1
-rw-r--r--gcc/config/mmix/mmix.c10
-rw-r--r--gcc/config/mmix/mmix.h3
3 files changed, 7 insertions, 7 deletions
diff --git a/gcc/config/mmix/mmix-protos.h b/gcc/config/mmix/mmix-protos.h
index 6c38924..4e3a752 100644
--- a/gcc/config/mmix/mmix-protos.h
+++ b/gcc/config/mmix/mmix-protos.h
@@ -21,7 +21,6 @@ along with GCC; see the file COPYING3. If not see
extern void mmix_init_expanders (void);
extern int mmix_eh_return_data_regno (int);
extern int mmix_initial_elimination_offset (int, int);
-extern int mmix_starting_frame_offset (void);
extern int mmix_function_arg_regno_p (int, int);
extern void mmix_function_profiler (FILE *, int);
extern int mmix_reversible_cc_mode (machine_mode);
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index 09e752d..e911594 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -169,6 +169,7 @@ static void mmix_print_operand_address (FILE *, machine_mode, rtx);
static bool mmix_print_operand_punct_valid_p (unsigned char);
static void mmix_conditional_register_usage (void);
static HOST_WIDE_INT mmix_constant_alignment (const_tree, HOST_WIDE_INT);
+static HOST_WIDE_INT mmix_starting_frame_offset (void);
/* Target structure macros. Listed by node. See `Using and Porting GCC'
for a general description. */
@@ -286,6 +287,9 @@ static HOST_WIDE_INT mmix_constant_alignment (const_tree, HOST_WIDE_INT);
#undef TARGET_CONSTANT_ALIGNMENT
#define TARGET_CONSTANT_ALIGNMENT mmix_constant_alignment
+#undef TARGET_STARTING_FRAME_OFFSET
+#define TARGET_STARTING_FRAME_OFFSET mmix_starting_frame_offset
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Functions that are expansions for target macros.
@@ -498,9 +502,9 @@ mmix_dynamic_chain_address (rtx frame)
return plus_constant (Pmode, frame, -8);
}
-/* STARTING_FRAME_OFFSET. */
+/* Implement TARGET_STARTING_FRAME_OFFSET. */
-int
+static HOST_WIDE_INT
mmix_starting_frame_offset (void)
{
/* The old frame pointer is in the slot below the new one, so
@@ -566,7 +570,7 @@ mmix_initial_elimination_offset (int fromreg, int toreg)
counted; the others go on the register stack.
The frame-pointer is counted too if it is what is eliminated, as we
- need to balance the offset for it from STARTING_FRAME_OFFSET.
+ need to balance the offset for it from TARGET_STARTING_FRAME_OFFSET.
Also add in the slot for the register stack pointer we save if we
have a landing pad.
diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h
index 7d1e83c..5dafe2d 100644
--- a/gcc/config/mmix/mmix.h
+++ b/gcc/config/mmix/mmix.h
@@ -437,9 +437,6 @@ enum reg_class
#define STACK_GROWS_DOWNWARD 1
#define FRAME_GROWS_DOWNWARD 1
-#define STARTING_FRAME_OFFSET \
- mmix_starting_frame_offset ()
-
#define FIRST_PARM_OFFSET(FUNDECL) 0
#define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) \