This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove support for INITIAL_FRAME_POINTER_OFFSET


Hi,

I think it is time to remove support for INITIAL_FRAME_POINTER_OFFSET, which is no longer
used by any target today.  This removes a bunch of conditional code, and fixes a few bits
in the documentation.  I'd say that part of the documentation is quite out of sync, but I just
have to stop somewhere.


Bootstrapped and reg-tested on x86_64-pc-linux.gnu
Is it OK for trunk?


Thanks
Bernd.

Attachment: changelog-initial-frame-pointer-offset.txt
Description: changelog-initial-frame-pointer-offset.txt

Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c	(Revision 240049)
+++ gcc/builtins.c	(Arbeitskopie)
@@ -862,7 +862,6 @@ expand_builtin_setjmp_receiver (rtx receiver_label
 
   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.
@@ -877,7 +876,6 @@ expand_builtin_setjmp_receiver (rtx receiver_label
 	  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.  */
Index: gcc/config/ft32/ft32.h
===================================================================
--- gcc/config/ft32/ft32.h	(Revision 240049)
+++ gcc/config/ft32/ft32.h	(Arbeitskopie)
@@ -250,8 +250,6 @@ enum reg_class
    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
Index: gcc/config/m32r/m32r.h
===================================================================
--- gcc/config/m32r/m32r.h	(Revision 240049)
+++ gcc/config/m32r/m32r.h	(Arbeitskopie)
@@ -581,15 +581,6 @@ extern enum reg_class m32r_regno_reg_class[FIRST_P
 
 /* 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
Index: gcc/config/moxie/moxie.h
===================================================================
--- gcc/config/moxie/moxie.h	(Revision 240049)
+++ gcc/config/moxie/moxie.h	(Arbeitskopie)
@@ -243,8 +243,6 @@ enum reg_class
    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
Index: gcc/config/vax/vax.h
===================================================================
--- gcc/config/vax/vax.h	(Revision 240049)
+++ gcc/config/vax/vax.h	(Arbeitskopie)
@@ -340,16 +340,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSE
 
 #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
Index: gcc/df-scan.c
===================================================================
--- gcc/df-scan.c	(Revision 240049)
+++ gcc/df-scan.c	(Arbeitskopie)
@@ -3829,10 +3829,9 @@ static bool initialized = false;
 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;
 
@@ -3840,12 +3839,8 @@ df_hard_reg_init (void)
      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;
 }
Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(Revision 240049)
+++ gcc/doc/tm.texi	(Arbeitskopie)
@@ -3624,7 +3624,7 @@ pointer.
 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
@@ -3634,25 +3634,9 @@ fixed register.  See @code{FIXED_REGISTERS} for mo
 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.
@@ -3676,11 +3660,10 @@ specified first since that is the preferred elimin
 @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}.
@@ -3687,10 +3670,10 @@ 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 specifies 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
Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(Revision 240049)
+++ gcc/doc/tm.texi.in	(Arbeitskopie)
@@ -3177,25 +3177,9 @@ This is about eliminating the frame pointer and ar
 
 @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.
@@ -3221,10 +3205,10 @@ specified first since that is the preferred elimin
 @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 specifies 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
Index: gcc/ira.c
===================================================================
--- gcc/ira.c	(Revision 240049)
+++ gcc/ira.c	(Arbeitskopie)
@@ -2253,10 +2253,9 @@ compute_regs_asm_clobbered (void)
 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
@@ -2292,7 +2291,6 @@ ira_setup_eliminable_regset (void)
 
   /* 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
@@ -2326,19 +2324,6 @@ ira_setup_eliminable_regset (void)
       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
 }
 
 
Index: gcc/lra-eliminations.c
===================================================================
--- gcc/lra-eliminations.c	(Revision 240049)
+++ gcc/lra-eliminations.c	(Arbeitskopie)
@@ -108,15 +108,7 @@ static const struct elim_table_1
   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)
 
@@ -1265,11 +1257,7 @@ update_reg_eliminate (bitmap insns_with_changed_of
 	    }
 	}
 
-#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;
@@ -1308,10 +1296,8 @@ static void
 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);
@@ -1320,7 +1306,7 @@ init_elim_table (void)
   /* 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 < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++, ep1++)
     {
@@ -1334,12 +1320,6 @@ init_elim_table (void)
 			   || ! 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 (&reg_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
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c	(Revision 240049)
+++ gcc/reload1.c	(Arbeitskopie)
@@ -286,15 +286,7 @@ static const struct elim_table_1
   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)
 
@@ -3823,27 +3815,18 @@ static bool
 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 < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
+    {
+      INITIAL_ELIMINATION_OFFSET (ep->from, ep->to, t);
+      if (t != ep->initial_offset)
+	return false;
+    }
 
-   for (ep = reg_eliminate; ep < &reg_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
-
   return true;
 }
 
@@ -3854,16 +3837,11 @@ set_initial_elim_offsets (void)
 {
   struct elim_table *ep = reg_eliminate;
 
-#ifdef ELIMINABLE_REGS
   for (; ep < &reg_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;
 }
@@ -3935,9 +3913,7 @@ update_eliminables (HARD_REG_SET *pset)
   for (ep = reg_eliminate; ep < &reg_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;
 
@@ -4058,9 +4034,7 @@ static void
 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);
@@ -4067,7 +4041,6 @@ init_elim_table (void)
 
   num_eliminable = 0;
 
-#ifdef ELIMINABLE_REGS
   for (ep = reg_eliminate, ep1 = reg_eliminate_1;
        ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++, ep1++)
     {
@@ -4080,12 +4053,6 @@ init_elim_table (void)
 		 && (! 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.,
Index: gcc/rtlanal.c
===================================================================
--- gcc/rtlanal.c	(Revision 240049)
+++ gcc/rtlanal.c	(Arbeitskopie)
@@ -345,7 +345,6 @@ rtx_varies_p (const_rtx x, bool for_alias)
 static HOST_WIDE_INT
 get_initial_register_offset (int from, int to)
 {
-#ifdef ELIMINABLE_REGS
   static const struct elim_table_t
   {
     const int from;
@@ -448,33 +447,6 @@ get_initial_register_offset (int from, int to)
     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
Index: gcc/target.def
===================================================================
--- gcc/target.def	(Revision 240049)
+++ gcc/target.def	(Arbeitskopie)
@@ -5289,7 +5289,7 @@ five otherwise.  This is best for most machines.",
  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\
@@ -5306,7 +5306,7 @@ pointer.\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\
@@ -5321,11 +5321,10 @@ Default return value is @code{false}.",
    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}.",

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]