Skip to content

Commit

Permalink
Convert STARTING_FRAME_OFFSET to a hook
Browse files Browse the repository at this point in the history
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.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254003 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
rsandifo committed Oct 23, 2017
1 parent 98a46e0 commit 8374586
Show file tree
Hide file tree
Showing 84 changed files with 370 additions and 302 deletions.
130 changes: 130 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,133 @@
2017-10-23 Richard Sandiford <richard.sandiford@linaro.org>

* 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.

2017-10-23 Richard Sandiford <richard.sandiford@linaro.org>

* tree-vect-loop.c (vect_create_epilog_for_reduction): Use
Expand Down
2 changes: 1 addition & 1 deletion gcc/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ expand_builtin_setjmp_receiver (rtx receiver_label)
to the underlying register (fp in this case) that makes
the original assignment true.
So the following insn will actually be decrementing fp by
STARTING_FRAME_OFFSET. */
TARGET_STARTING_FRAME_OFFSET. */
emit_move_insn (virtual_stack_vars_rtx, hard_frame_pointer_rtx);

/* Restoring the frame pointer also modifies the hard frame pointer.
Expand Down
2 changes: 1 addition & 1 deletion gcc/cfgexpand.c
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ expand_used_vars (void)
/* Compute the phase of the stack frame for this function. */
{
int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
int off = STARTING_FRAME_OFFSET % align;
int off = targetm.starting_frame_offset () % align;
frame_phase = off ? align - off : 0;
}

Expand Down
2 changes: 0 additions & 2 deletions gcc/config/aarch64/aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,6 @@ extern enum aarch64_processor aarch64_tune;

#define FRAME_GROWS_DOWNWARD 1

#define STARTING_FRAME_OFFSET 0

#define ACCUMULATE_OUTGOING_ARGS 1

#define FIRST_PARM_OFFSET(FNDECL) 0
Expand Down
7 changes: 0 additions & 7 deletions gcc/config/alpha/alpha.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,6 @@ enum reg_class {
goes at a more negative offset in the frame. */
/* #define FRAME_GROWS_DOWNWARD 0 */

/* 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

/* If we generate an insn to push BYTES bytes,
this says how many the stack pointer really advances by.
On Alpha, don't define this because there are no push insns. */
Expand Down
6 changes: 0 additions & 6 deletions gcc/config/arc/arc.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,12 +658,6 @@ extern enum reg_class arc_regno_reg_class[];
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

/* Offset from the stack pointer register to the first location at which
outgoing arguments are placed. */
#define STACK_POINTER_OFFSET (0)
Expand Down
6 changes: 0 additions & 6 deletions gcc/config/arm/arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1256,12 +1256,6 @@ enum reg_class
&& crtl->outgoing_args_size != 0 \
? UNITS_PER_WORD : 0)

/* 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

/* If we generate an insn to push BYTES bytes,
this says how many the stack pointer really advances by. */
/* The push insns do not do this rounding implicitly.
Expand Down
1 change: 0 additions & 1 deletion gcc/config/avr/avr-protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ extern void avr_expand_prologue (void);
extern void avr_expand_epilogue (bool);
extern bool avr_emit_movmemhi (rtx*);
extern int avr_epilogue_uses (int regno);
extern int avr_starting_frame_offset (void);

extern void avr_output_addr_vec (rtx_insn*, rtx);
extern const char *avr_out_sbxx_branch (rtx_insn *insn, rtx operands[]);
Expand Down
13 changes: 8 additions & 5 deletions gcc/config/avr/avr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,11 +1153,11 @@ avr_outgoing_args_size (void)
}


/* Implement `STARTING_FRAME_OFFSET'. */
/* Implement TARGET_STARTING_FRAME_OFFSET. */
/* This is the offset from the frame pointer register to the first stack slot
that contains a variable living in the frame. */

int
static HOST_WIDE_INT
avr_starting_frame_offset (void)
{
return 1 + avr_outgoing_args_size ();
Expand Down Expand Up @@ -1314,16 +1314,16 @@ avr_build_builtin_va_list (void)

/* Implement `TARGET_BUILTIN_SETJMP_FRAME_VALUE'. */
/* Actual start of frame is virtual_stack_vars_rtx this is offset from
frame pointer by +STARTING_FRAME_OFFSET.
Using saved frame = virtual_stack_vars_rtx - STARTING_FRAME_OFFSET
frame pointer by +TARGET_STARTING_FRAME_OFFSET.
Using saved frame = virtual_stack_vars_rtx - TARGET_STARTING_FRAME_OFFSET
avoids creating add/sub of offset in nonlocal goto and setjmp. */

static rtx
avr_builtin_setjmp_frame_value (void)
{
rtx xval = gen_reg_rtx (Pmode);
emit_insn (gen_subhi3 (xval, virtual_stack_vars_rtx,
gen_int_mode (STARTING_FRAME_OFFSET, Pmode)));
gen_int_mode (avr_starting_frame_offset (), Pmode)));
return xval;
}

Expand Down Expand Up @@ -14789,6 +14789,9 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg,
#undef TARGET_LEGITIMATE_COMBINED_INSN
#define TARGET_LEGITIMATE_COMBINED_INSN avr_legitimate_combined_insn

#undef TARGET_STARTING_FRAME_OFFSET
#define TARGET_STARTING_FRAME_OFFSET avr_starting_frame_offset

struct gcc_target targetm = TARGET_INITIALIZER;


Expand Down
2 changes: 0 additions & 2 deletions gcc/config/avr/avr.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ enum reg_class {

#define STACK_GROWS_DOWNWARD 1

#define STARTING_FRAME_OFFSET avr_starting_frame_offset()

#define STACK_POINTER_OFFSET 1

#define FIRST_PARM_OFFSET(FUNDECL) 0
Expand Down
5 changes: 2 additions & 3 deletions gcc/config/avr/avr.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,9 @@
(unspec_volatile:HI [(const_int 0)] UNSPECV_GOTO_RECEIVER))]
""
{
rtx offset = gen_int_mode (targetm.starting_frame_offset (), Pmode);
emit_move_insn (virtual_stack_vars_rtx,
gen_rtx_PLUS (Pmode, hard_frame_pointer_rtx,
gen_int_mode (STARTING_FRAME_OFFSET,
Pmode)));
gen_rtx_PLUS (Pmode, hard_frame_pointer_rtx, offset));
/* ; This might change the hard frame pointer in ways that aren't
; apparent to early optimization passes, so force a clobber. */
emit_clobber (hard_frame_pointer_rtx);
Expand Down
6 changes: 0 additions & 6 deletions gcc/config/bfin/bfin.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,6 @@ extern const char *bfin_library_id_string;
it. */
#define FIRST_PARM_OFFSET(DECL) 0

/* 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

/* Register to use for pushing function arguments. */
#define STACK_POINTER_REGNUM REG_P6

Expand Down
1 change: 0 additions & 1 deletion gcc/config/c6x/c6x.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ enum reg_class
#define STACK_POINTER_OFFSET 4
/* Likewise for AP (which is the incoming stack pointer). */
#define FIRST_PARM_OFFSET(fundecl) 4
#define STARTING_FRAME_OFFSET 0
#define FRAME_GROWS_DOWNWARD 1
#define STACK_GROWS_DOWNWARD 1

Expand Down
2 changes: 0 additions & 2 deletions gcc/config/cr16/cr16.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ enum reg_class
/* Stack layout and calling conventions. */
#define STACK_GROWS_DOWNWARD 1

#define STARTING_FRAME_OFFSET 0

#define STACK_POINTER_REGNUM 15

#define FRAME_POINTER_REGNUM 13
Expand Down
4 changes: 0 additions & 4 deletions gcc/config/cris/cris.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,6 @@ enum reg_class
#define STACK_GROWS_DOWNWARD 1
#define FRAME_GROWS_DOWNWARD 1

/* It seems to be indicated in the code (at least 2.1) that this is
better a constant, and best 0. */
#define STARTING_FRAME_OFFSET 0

#define FIRST_PARM_OFFSET(FNDECL) 0

#define RETURN_ADDR_RTX(COUNT, FRAMEADDR) \
Expand Down
11 changes: 11 additions & 0 deletions gcc/config/epiphany/epiphany.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ static rtx_insn *frame_insn (rtx);

#undef TARGET_CONSTANT_ALIGNMENT
#define TARGET_CONSTANT_ALIGNMENT epiphany_constant_alignment

#undef TARGET_STARTING_FRAME_OFFSET
#define TARGET_STARTING_FRAME_OFFSET epiphany_starting_frame_offset

bool
epiphany_is_interrupt_p (tree decl)
Expand Down Expand Up @@ -3028,4 +3031,12 @@ epiphany_constant_alignment (const_tree exp, HOST_WIDE_INT align)
return align;
}

/* Implement TARGET_STARTING_FRAME_OFFSET. */

static HOST_WIDE_INT
epiphany_starting_frame_offset (void)
{
return epiphany_stack_offset;
}

struct gcc_target targetm = TARGET_INITIALIZER;
6 changes: 0 additions & 6 deletions gcc/config/epiphany/epiphany.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,6 @@ typedef struct GTY (()) machine_function
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 epiphany_stack_offset

/* Offset from the stack pointer register to the first location at which
outgoing arguments are placed. */
#define STACK_POINTER_OFFSET epiphany_stack_offset
Expand Down
9 changes: 0 additions & 9 deletions gcc/config/fr30/fr30.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,6 @@ enum reg_class
are at negative offsets from the frame pointer. */
#define FRAME_GROWS_DOWNWARD 1

/* Offset from the frame pointer to the first local variable slot to be
allocated.
If `FRAME_GROWS_DOWNWARD', find the next slot's offset by subtracting the
first slot's length from `STARTING_FRAME_OFFSET'. Otherwise, it is found by
adding the length of the first slot to the value `STARTING_FRAME_OFFSET'. */
/* #define STARTING_FRAME_OFFSET -4 */
#define STARTING_FRAME_OFFSET 0

/* Offset from the stack pointer register to the first location at which
outgoing arguments are placed. If not specified, the default value of zero
is used. This is the proper value for most machines.
Expand Down
8 changes: 0 additions & 8 deletions gcc/config/frv/frv.h
Original file line number Diff line number Diff line change
Expand Up @@ -966,14 +966,6 @@ typedef struct frv_stack {
are at negative offsets from the frame pointer. */
#define FRAME_GROWS_DOWNWARD 1

/* Offset from the frame pointer to the first local variable slot to be
allocated.
If `FRAME_GROWS_DOWNWARD', find the next slot's offset by subtracting the
first slot's length from `STARTING_FRAME_OFFSET'. Otherwise, it is found by
adding the length of the first slot to the value `STARTING_FRAME_OFFSET'. */
#define STARTING_FRAME_OFFSET 0

/* Offset from the stack pointer register to the first location at which
outgoing arguments are placed. If not specified, the default value of zero
is used. This is the proper value for most machines.
Expand Down
4 changes: 0 additions & 4 deletions gcc/config/ft32/ft32.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,6 @@ enum reg_class
pointer to a smaller address. */
#define STACK_GROWS_DOWNWARD 1

/* Offset from the frame pointer to the first local variable slot to
be allocated. */
#define STARTING_FRAME_OFFSET 0

/* Offset from the argument pointer register to the first argument's
address. On some machines it may depend on the data type of the
function. */
Expand Down
Loading

0 comments on commit 8374586

Please sign in to comment.