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]

[7/27] Use target structures for init_fake_stack_mems


We're now up to here:

      /* This invokes target hooks to set fixed_reg[] etc, which is
         mode-dependent.  */
      init_regs ();

      /* This depends on stack_pointer_rtx.  */
==>   init_fake_stack_mems ();

      /* Sets static_base_value[HARD_FRAME_POINTER_REGNUM], which is
         mode-dependent.  */
      init_alias_target ();

init_fake_stack_mems initialises a single array called top_of_stack,
which stores a (mem:M (sp)) rtx for each mode M.  This seems like a
generally useful thing to have, so I think it should be exposed in rtl.h
rather than kept static (point (4) in the covering note).

top_of_stack was the last GGC-ed variable in reginfo.c.

Richard


gcc/
	* Makefile.in (reginfo.o): Don't depend on $(GGC_H) or gt-reginfo.h.
	(GTFILES): Remove reginfo.c.
	* rtl.h (target_rtl): Add x_top_of_stack.
	(top_of_stack): New macro.
	* reginfo.c: Don't include ggc.h or gt-reginfo.h.
	(top_of_stack): Delete.

Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	2010-07-04 12:42:07.000000000 +0100
+++ gcc/Makefile.in	2010-07-04 12:43:05.000000000 +0100
@@ -3261,9 +3261,8 @@ combine.o : combine.c $(CONFIG_H) $(SYST
    insn-codes.h $(TIMEVAR_H) $(TREE_PASS_H) $(DF_H) vecprim.h $(CGRAPH_H)
 reginfo.o : reginfo.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) addresses.h $(REGS_H) insn-config.h \
-   $(RECOG_H) reload.h $(TOPLEV_H) $(FUNCTION_H) output.h $(GGC_H) \
-   $(TM_P_H) $(EXPR_H) $(TIMEVAR_H) gt-reginfo.h $(HASHTAB_H) \
-   $(TARGET_H) $(TREE_PASS_H) $(DF_H) ira.h
+   $(RECOG_H) reload.h $(TOPLEV_H) $(FUNCTION_H) output.h $(TM_P_H) $(EXPR_H) \
+   $(TIMEVAR_H) $(HASHTAB_H) $(TARGET_H) $(TREE_PASS_H) $(DF_H) ira.h
 bitmap.o : bitmap.c $(CONFIG_H) $(SYSTEM_H)  coretypes.h $(TM_H) $(RTL_H) \
    $(FLAGS_H) $(GGC_H) gt-bitmap.h $(BITMAP_H) $(OBSTACK_H) $(HASHTAB_H)
 vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(VEC_H) $(GGC_H) \
@@ -3730,7 +3729,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/inp
   $(srcdir)/expr.h \
   $(srcdir)/function.c $(srcdir)/except.c \
   $(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c $(srcdir)/optabs.c \
-  $(srcdir)/profile.c $(srcdir)/reginfo.c $(srcdir)/mcf.c \
+  $(srcdir)/profile.c $(srcdir)/mcf.c \
   $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/cfglayout.h \
   $(srcdir)/sdbout.c $(srcdir)/stor-layout.c \
   $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2010-07-04 12:42:07.000000000 +0100
+++ gcc/rtl.h	2010-07-04 12:43:41.000000000 +0100
@@ -2042,6 +2042,9 @@ struct GTY(()) target_rtl {
      They are initialized once per compilation unit, then copied into
      regno_reg_rtx at the beginning of each function.  */
   rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
+
+  /* A sample (mem:M stack_pointer_rtx) rtx for each mode M.  */
+  rtx x_top_of_stack[MAX_MACHINE_MODE];
 };
 
 extern GTY(()) struct target_rtl default_target_rtl;
@@ -2057,6 +2060,8 @@ #define pic_offset_table_rtx \
   (this_target_rtl->x_pic_offset_table_rtx)
 #define return_address_pointer_rtx \
   (this_target_rtl->x_return_address_pointer_rtx)
+#define top_of_stack \
+  (this_target_rtl->x_top_of_stack)
 
 /* Standard pieces of rtx, to be substituted directly into things.  */
 #define pc_rtx                  (global_rtl[GR_PC])
Index: gcc/reginfo.c
===================================================================
--- gcc/reginfo.c	2010-07-04 12:42:07.000000000 +0100
+++ gcc/reginfo.c	2010-07-04 12:43:20.000000000 +0100
@@ -45,7 +45,6 @@ Software Foundation; either version 3, o
 #include "reload.h"
 #include "toplev.h"
 #include "output.h"
-#include "ggc.h"
 #include "timevar.h"
 #include "hashtab.h"
 #include "target.h"
@@ -120,9 +119,6 @@ const char * reg_class_names[] = REG_CLA
 #define last_mode_for_init_move_cost \
   (this_target_regs->x_last_mode_for_init_move_cost)
 
-/* Sample MEM values for use by memory_move_secondary_cost.  */
-static GTY(()) rtx top_of_stack[MAX_MACHINE_MODE];
-
 /* No more global register variables may be declared; true once
    reginfo has been initialized.  */
 static int no_global_reg_vars = 0;
@@ -1338,5 +1334,3 @@ finish_subregs_of_mode (void)
 }
 
 #endif /* CANNOT_CHANGE_MODE_CLASS */
-
-#include "gt-reginfo.h"


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