+2016-09-10 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * doc/tm.texi.in (INITIAL_FRAME_POINTER_OFFSET): Remove.
+ (ELIMINABLE_REGS, TARGET_CAN_ELIMINATE,
+ INITIAL_ELIMINATION_OFFSET) : Update documentation.
+ * target.def (frame_pointer_required, can_eliminate): Likewise.
+ * doc/tm.texi: Regenerated.
+ * builtins.c (expand_builtin_setjmp_receiver): Remove #ifdef
+ ELIMINABLE_REGS.
+ * df-scan.c (df_hard_reg_init): Likewise.
+ * ira.c (ira_setup_eliminable_regset): Likewise.
+ * lra-eliminations.c (reg_eliminate_1, (update_reg_eliminate,
+ init_elim_table): Likewise.
+ * reload1.c (reg_eliminate_1, verify_initial_elim_offsets,
+ set_initial_elim_offsets, update_eliminables,
+ init_elim_table): Likewise.
+ * rtlanal.c (get_initial_register_offset): Likewise.
+ * config/ft32/ft32.h (INITIAL_FRAME_POINTER_OFFSET): Remove.
+ * config/m32r/m32r.h (INITIAL_FRAME_POINTER_OFFSET): Likewise.
+ * config/moxie/moxie.h (INITIAL_FRAME_POINTER_OFFSET): Likewise.
+ * config/vax/vax.h (INITIAL_FRAME_POINTER_OFFSET): Likewise.
+ * config/fr30/fr30.h: Fix comment.
+ * config/frv/frv.c: Likewise.
+ * config/frv/frv.h: Likewise.
+ * config/ft32/ft32.h: Likewise.
+ * config/visium/visium.h: Likewise.
+ * config/pa/pa64-linux.h: Likewise.
+ * config/v850/v850.h: Likewise.
+ * config/cris/cris.c: Likewise.
+ * config/ia64/ia64.h: Likewise.
+ * config/moxie/moxie.h: Likewise.
+ * config/m32r/m32r.h: Likewise.
+
2016-09-10 Alexander Ivchenko <alexander.ivchenko@intel.com>
PR target/77267
if (!HARD_FRAME_POINTER_IS_ARG_POINTER && fixed_regs[ARG_POINTER_REGNUM])
{
-#ifdef ELIMINABLE_REGS
/* If the argument pointer can be eliminated in favor of the
frame pointer, we don't need to restore it. We assume here
that if such an elimination is present, it can always be used.
break;
if (i == ARRAY_SIZE (elim_regs))
-#endif
{
/* Now restore our arg pointer from the address at which it
was saved in our stack frame. */
: cris_return_address_on_stack ();
}
-/* This used to be the INITIAL_FRAME_POINTER_OFFSET worker; now only
- handles FP -> SP elimination offset. */
+/* This handles FP -> SP elimination offset. */
static int
cris_initial_frame_pointer_offset (void)
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
}
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the
- initial difference between the specified pair of registers. This macro must
- be defined if `ELIMINABLE_REGS' is defined. */
+/* This macro returns the initial difference between the specified pair
+ of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
(OFFSET) = fr30_compute_frame_size (FROM, TO)
: true);
}
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the
- initial difference between the specified pair of registers. This macro must
- be defined if `ELIMINABLE_REGS' is defined. */
+/* This function returns the initial difference between the specified
+ pair of registers. */
/* See frv_stack_info for more details on the frv stack frame. */
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
}
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the
- initial difference between the specified pair of registers. This macro must
- be defined if `ELIMINABLE_REGS' is defined. */
+/* This macro returns the initial difference between the specified pair
+ of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
(OFFSET) = frv_initial_elimination_offset (FROM, TO)
pointer to a smaller address. */
#define STACK_GROWS_DOWNWARD 1
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0
-
/* Offset from the frame pointer to the first local variable slot to
be allocated. */
#define STARTING_FRAME_OFFSET 0
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
- specifies the initial difference between the specified pair of
- registers. This macro must be defined if `ELIMINABLE_REGS' is
- defined. */
+/* This macro returns the initial difference between the specified pair
+ of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
do { \
(OFFSET) = ft32_initial_elimination_offset ((FROM), (TO)); \
{FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
}
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
- specifies the initial difference between the specified pair of
- registers. This macro must be defined if `ELIMINABLE_REGS' is
- defined. */
+/* This macro returns the initial difference between the specified pair
+ of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
((OFFSET) = ia64_initial_elimination_offset ((FROM), (TO)))
\f
\f
/* Eliminating the frame and arg pointers. */
-#if 0
-/* C statement to store the difference between the frame pointer
- and the stack pointer values immediately after the function prologue.
- If `ELIMINABLE_REGS' is defined, this macro will be not be used and
- need not be defined. */
-#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
-((VAR) = m32r_compute_frame_size (get_frame_size ()))
-#endif
-
/* If defined, this macro specifies a table of register pairs used to
eliminate unneeded registers that point into the stack frame. If
it is not defined, the only elimination attempted by the compiler
{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
{ ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }}
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
- specifies the initial difference between the specified pair of
- registers. This macro must be defined if `ELIMINABLE_REGS' is
- defined. */
+/* This macro returns the initial difference between the specified pair
+ of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
do \
pointer to a smaller address. */
#define STACK_GROWS_DOWNWARD 1
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0
-
/* Offset from the frame pointer to the first local variable slot to
be allocated. */
#define STARTING_FRAME_OFFSET 0
{{ FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
{ ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }}
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
- specifies the initial difference between the specified pair of
- registers. This macro must be defined if `ELIMINABLE_REGS' is
- defined. */
+/* This macro returns the initial difference between the specified pair
+ of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
do { \
(OFFSET) = moxie_initial_elimination_offset ((FROM), (TO)); \
{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
}
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
- specifies the initial difference between the specified pair of
- registers. This macro must be defined if `ELIMINABLE_REGS' is
- defined. */
+/* This macro returns the initial difference between the specified pair
+ of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
do \
{ \
{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
{ ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }} \
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
- specifies the initial difference between the specified pair of
- registers. This macro must be defined if `ELIMINABLE_REGS' is
- defined. */
+/* This macro returns the initial difference between the specified pair
+ of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
{ \
#define EXIT_IGNORE_STACK 1
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved.
-
- On the VAX, FRAME_POINTER_REQUIRED is always 1, so the definition of this
- macro doesn't matter. But it must be defined. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0;
-
/* Length in units of the trampoline for entering a nested function. */
#define TRAMPOLINE_SIZE 15
/* `INITIAL_ELIMINATION_OFFSET (FROM-REG, TO-REG, OFFSET-VAR)'
- This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
- specifies the initial difference between the specified pair of
- registers. This macro must be defined if `ELIMINABLE_REGS' is
- defined. */
+ This macro returns the initial difference between the specified pair
+ of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
(OFFSET = visium_initial_elimination_offset (FROM, TO))
void
df_hard_reg_init (void)
{
-#ifdef ELIMINABLE_REGS
int i;
static const struct {const int from, to; } eliminables[] = ELIMINABLE_REGS;
-#endif
+
if (initialized)
return;
mark_used_regs. */
CLEAR_HARD_REG_SET (elim_reg_set);
-#ifdef ELIMINABLE_REGS
for (i = 0; i < (int) ARRAY_SIZE (eliminables); i++)
SET_HARD_REG_BIT (elim_reg_set, eliminables[i].from);
-#else
- SET_HARD_REG_BIT (elim_reg_set, FRAME_POINTER_REGNUM);
-#endif
initialized = true;
}
In certain cases, the compiler does not know how to produce valid code
without a frame pointer. The compiler recognizes those cases and
automatically gives the function a frame pointer regardless of what
-@code{TARGET_FRAME_POINTER_REQUIRED} returns. You don't need to worry about
+@code{targetm.frame_pointer_required} returns. You don't need to worry about
them.
In a function that does not require a frame pointer, the frame pointer
Default return value is @code{false}.
@end deftypefn
-@findex get_frame_size
-@defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
-A C statement to store in the variable @var{depth-var} the difference
-between the frame pointer and the stack pointer values immediately after
-the function prologue. The value would be computed from information
-such as the result of @code{get_frame_size ()} and the tables of
-registers @code{regs_ever_live} and @code{call_used_regs}.
-
-If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
-need not be defined. Otherwise, it must be defined even if
-@code{TARGET_FRAME_POINTER_REQUIRED} always returns true; in that
-case, you may set @var{depth-var} to anything.
-@end defmac
-
@defmac ELIMINABLE_REGS
-If defined, this macro specifies a table of register pairs used to
-eliminate unneeded registers that point into the stack frame. If it is not
-defined, the only elimination attempted by the compiler is to replace
-references to the frame pointer with references to the stack pointer.
+This macro specifies a table of register pairs used to eliminate
+unneeded registers that point into the stack frame.
The definition of this macro is a list of structure initializations, each
of which specifies an original and replacement register.
@end defmac
@deftypefn {Target Hook} bool TARGET_CAN_ELIMINATE (const int @var{from_reg}, const int @var{to_reg})
-This target hook should returns @code{true} if the compiler is allowed to
+This target hook should return @code{true} if the compiler is allowed to
try to replace register number @var{from_reg} with register number
-@var{to_reg}. This target hook need only be defined if @code{ELIMINABLE_REGS}
-is defined, and will usually be @code{true}, since most of the cases
-preventing register elimination are things that the compiler already
+@var{to_reg}. This target hook will usually be @code{true}, since most of the
+cases preventing register elimination are things that the compiler already
knows about.
Default return value is @code{true}.
@end deftypefn
@defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})
-This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. It
-specifies the initial difference between the specified pair of
-registers. This macro must be defined if @code{ELIMINABLE_REGS} is
-defined.
+This macro returns the initial difference between the specified pair
+of registers. The value would be computed from information
+such as the result of @code{get_frame_size ()} and the tables of
+registers @code{df_regs_ever_live_p} and @code{call_used_regs}.
@end defmac
@node Stack Arguments
@hook TARGET_FRAME_POINTER_REQUIRED
-@findex get_frame_size
-@defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
-A C statement to store in the variable @var{depth-var} the difference
-between the frame pointer and the stack pointer values immediately after
-the function prologue. The value would be computed from information
-such as the result of @code{get_frame_size ()} and the tables of
-registers @code{regs_ever_live} and @code{call_used_regs}.
-
-If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
-need not be defined. Otherwise, it must be defined even if
-@code{TARGET_FRAME_POINTER_REQUIRED} always returns true; in that
-case, you may set @var{depth-var} to anything.
-@end defmac
-
@defmac ELIMINABLE_REGS
-If defined, this macro specifies a table of register pairs used to
-eliminate unneeded registers that point into the stack frame. If it is not
-defined, the only elimination attempted by the compiler is to replace
-references to the frame pointer with references to the stack pointer.
+This macro specifies a table of register pairs used to eliminate
+unneeded registers that point into the stack frame.
The definition of this macro is a list of structure initializations, each
of which specifies an original and replacement register.
@hook TARGET_CAN_ELIMINATE
@defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})
-This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. It
-specifies the initial difference between the specified pair of
-registers. This macro must be defined if @code{ELIMINABLE_REGS} is
-defined.
+This macro returns the initial difference between the specified pair
+of registers. The value would be computed from information
+such as the result of @code{get_frame_size ()} and the tables of
+registers @code{df_regs_ever_live_p} and @code{call_used_regs}.
@end defmac
@node Stack Arguments
void
ira_setup_eliminable_regset (void)
{
-#ifdef ELIMINABLE_REGS
int i;
static const struct {const int from, to; } eliminables[] = ELIMINABLE_REGS;
-#endif
+
/* FIXME: If EXIT_IGNORE_STACK is set, we will not save and restore
sp for alloca. So we can't eliminate the frame pointer in that
case. At some point, we should improve this by emitting the
/* Build the regset of all eliminable registers and show we can't
use those that we already know won't be eliminated. */
-#ifdef ELIMINABLE_REGS
for (i = 0; i < (int) ARRAY_SIZE (eliminables); i++)
{
bool cannot_elim
else
df_set_regs_ever_live (HARD_FRAME_POINTER_REGNUM, true);
}
-
-#else
- if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM))
- {
- SET_HARD_REG_BIT (eliminable_regset, FRAME_POINTER_REGNUM);
- if (frame_pointer_needed)
- SET_HARD_REG_BIT (ira_no_alloc_regs, FRAME_POINTER_REGNUM);
- }
- else if (frame_pointer_needed)
- error ("%s cannot be used in asm here", reg_names[FRAME_POINTER_REGNUM]);
- else
- df_set_regs_ever_live (FRAME_POINTER_REGNUM, true);
-#endif
}
\f
const int to;
} reg_eliminate_1[] =
-/* If a set of eliminable hard registers was specified, define the
- table from it. Otherwise, default to the normal case of the frame
- pointer being replaced by the stack pointer. */
-
-#ifdef ELIMINABLE_REGS
ELIMINABLE_REGS;
-#else
- {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}};
-#endif
#define NUM_ELIMINABLE_REGS ARRAY_SIZE (reg_eliminate_1)
}
}
-#ifdef ELIMINABLE_REGS
INITIAL_ELIMINATION_OFFSET (ep->from, ep->to, ep->offset);
-#else
- INITIAL_FRAME_POINTER_OFFSET (ep->offset);
-#endif
}
setup_elimination_map ();
result = false;
init_elim_table (void)
{
struct lra_elim_table *ep;
-#ifdef ELIMINABLE_REGS
bool value_p;
const struct elim_table_1 *ep1;
-#endif
if (!reg_eliminate)
reg_eliminate = XCNEWVEC (struct lra_elim_table, NUM_ELIMINABLE_REGS);
/* Initiate member values which will be never changed. */
self_elim_table.can_eliminate = self_elim_table.prev_can_eliminate = true;
self_elim_table.previous_offset = 0;
-#ifdef ELIMINABLE_REGS
+
for (ep = reg_eliminate, ep1 = reg_eliminate_1;
ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++, ep1++)
{
|| ! stack_realign_fp)));
setup_can_eliminate (ep, value_p);
}
-#else
- reg_eliminate[0].offset = reg_eliminate[0].previous_offset = 0;
- reg_eliminate[0].from = reg_eliminate_1[0].from;
- reg_eliminate[0].to = reg_eliminate_1[0].to;
- setup_can_eliminate (®_eliminate[0], ! frame_pointer_needed);
-#endif
/* Build the FROM and TO REG rtx's. Note that code in gen_rtx_REG
will cause, e.g., gen_rtx_REG (Pmode, STACK_POINTER_REGNUM) to
const int to;
} reg_eliminate_1[] =
-/* If a set of eliminable registers was specified, define the table from it.
- Otherwise, default to the normal case of the frame pointer being
- replaced by the stack pointer. */
-
-#ifdef ELIMINABLE_REGS
ELIMINABLE_REGS;
-#else
- {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}};
-#endif
#define NUM_ELIMINABLE_REGS ARRAY_SIZE (reg_eliminate_1)
verify_initial_elim_offsets (void)
{
HOST_WIDE_INT t;
+ struct elim_table *ep;
if (!num_eliminable)
return true;
-#ifdef ELIMINABLE_REGS
- {
- struct elim_table *ep;
-
- for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- {
- INITIAL_ELIMINATION_OFFSET (ep->from, ep->to, t);
- if (t != ep->initial_offset)
- return false;
- }
- }
-#else
- INITIAL_FRAME_POINTER_OFFSET (t);
- if (t != reg_eliminate[0].initial_offset)
- return false;
-#endif
+ for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
+ {
+ INITIAL_ELIMINATION_OFFSET (ep->from, ep->to, t);
+ if (t != ep->initial_offset)
+ return false;
+ }
return true;
}
{
struct elim_table *ep = reg_eliminate;
-#ifdef ELIMINABLE_REGS
for (; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
{
INITIAL_ELIMINATION_OFFSET (ep->from, ep->to, ep->initial_offset);
ep->previous_offset = ep->offset = ep->initial_offset;
}
-#else
- INITIAL_FRAME_POINTER_OFFSET (ep->initial_offset);
- ep->previous_offset = ep->offset = ep->initial_offset;
-#endif
num_not_at_initial_offset = 0;
}
for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
if ((ep->from == HARD_FRAME_POINTER_REGNUM
&& targetm.frame_pointer_required ())
-#ifdef ELIMINABLE_REGS
|| ! targetm.can_eliminate (ep->from, ep->to)
-#endif
)
ep->can_eliminate = 0;
init_elim_table (void)
{
struct elim_table *ep;
-#ifdef ELIMINABLE_REGS
const struct elim_table_1 *ep1;
-#endif
if (!reg_eliminate)
reg_eliminate = XCNEWVEC (struct elim_table, NUM_ELIMINABLE_REGS);
num_eliminable = 0;
-#ifdef ELIMINABLE_REGS
for (ep = reg_eliminate, ep1 = reg_eliminate_1;
ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++, ep1++)
{
&& (! SUPPORTS_STACK_ALIGNMENT
|| ! stack_realign_fp)));
}
-#else
- reg_eliminate[0].from = reg_eliminate_1[0].from;
- reg_eliminate[0].to = reg_eliminate_1[0].to;
- reg_eliminate[0].can_eliminate = reg_eliminate[0].can_eliminate_previous
- = ! frame_pointer_needed;
-#endif
/* Count the number of eliminable registers and build the FROM and TO
REG rtx's. Note that code in gen_rtx_REG will cause, e.g.,
static HOST_WIDE_INT
get_initial_register_offset (int from, int to)
{
-#ifdef ELIMINABLE_REGS
static const struct elim_table_t
{
const int from;
return get_initial_register_offset (from, FRAME_POINTER_REGNUM);
else
return 0;
-
-#else
- HOST_WIDE_INT offset;
-
- if (to == from)
- return 0;
-
- if (reload_completed)
- {
- INITIAL_FRAME_POINTER_OFFSET (offset);
- }
- else
- {
- offset = crtl->outgoing_args_size + get_frame_size ();
-#if !STACK_GROWS_DOWNWARD
- offset = - offset;
-#endif
- }
-
- if (to == STACK_POINTER_REGNUM)
- return offset;
- else if (from == STACK_POINTER_REGNUM)
- return - offset;
- else
- return 0;
-
-#endif
}
/* Return nonzero if the use of X+OFFSET as an address in a MEM with SIZE
unsigned int, (void),
default_case_values_threshold)
-/* Retutn true if a function must have and use a frame pointer. */
+/* Return true if a function must have and use a frame pointer. */
DEFHOOK
(frame_pointer_required,
"This target hook should return @code{true} if a function must have and use\n\
In certain cases, the compiler does not know how to produce valid code\n\
without a frame pointer. The compiler recognizes those cases and\n\
automatically gives the function a frame pointer regardless of what\n\
-@code{TARGET_FRAME_POINTER_REQUIRED} returns. You don't need to worry about\n\
+@code{targetm.frame_pointer_required} returns. You don't need to worry about\n\
them.\n\
\n\
In a function that does not require a frame pointer, the frame pointer\n\
from-reg with register number to-reg. */
DEFHOOK
(can_eliminate,
- "This target hook should returns @code{true} if the compiler is allowed to\n\
+ "This target hook should return @code{true} if the compiler is allowed to\n\
try to replace register number @var{from_reg} with register number\n\
-@var{to_reg}. This target hook need only be defined if @code{ELIMINABLE_REGS}\n\
-is defined, and will usually be @code{true}, since most of the cases\n\
-preventing register elimination are things that the compiler already\n\
+@var{to_reg}. This target hook will usually be @code{true}, since most of the\n\
+cases preventing register elimination are things that the compiler already\n\
knows about.\n\
\n\
Default return value is @code{true}.",