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]

[6/27] Use target structures for init_regs (2)


This patch deals with the other part of init_regs: the part which
initialises variables declared in regs.h.  It also deals with
last_mode_for_init_move_cost, which is a static variable that
caches information related to the regs.h move tables.

Richard


gcc/
	* regs.h (target_regs): Add x_hard_regs_of_mode, x_contains_reg_of_mode,
	x_move_cost, x_may_move_in_cost, x_may_move_out_cost and
	x_last_mode_for_init_move_cost.
	(have_regs_of_mode, contains_reg_of_mode, move_cost)
	(may_move_in_cost, may_move_out_cost): Redefine as macros.
	* reginfo.c (have_regs_of_mode, contains_reg_of_mode, move_cost)
	(may_move_in_cost, may_move_out_cost): Delete.
	(last_mode_for_init_move_cost): Redefine as a macro.

Index: gcc/regs.h
===================================================================
--- gcc/regs.h	2010-07-03 22:59:22.000000000 +0100
+++ gcc/regs.h	2010-07-03 23:05:02.000000000 +0100
@@ -214,10 +214,6 @@ #define REG_BASIC_BLOCK(N) (reg_info_p[N
 
 extern short *reg_renumber;
 
-/* Vector indexed by machine mode saying whether there are regs of that mode.  */
-
-extern bool have_regs_of_mode [MAX_MACHINE_MODE];
-
 /* Flag set by local-alloc or global-alloc if they decide to allocate
    something in a call-clobbered register.  */
 
@@ -249,24 +245,8 @@ #define HARD_REGNO_CALLER_SAVE_MODE(REGN
 #define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) 0
 #endif
 
-/* 1 if the corresponding class does contain register of given
-   mode.  */
-extern char contains_reg_of_mode [N_REG_CLASSES] [MAX_MACHINE_MODE];
-
 typedef unsigned short move_table[N_REG_CLASSES];
 
-/* Maximum cost of moving from a register in one class to a register
-   in another class.  */
-extern move_table *move_cost[MAX_MACHINE_MODE];
-
-/* Similar, but here we don't have to move if the first index is a
-   subset of the second so in that case the cost is zero.  */
-extern move_table *may_move_in_cost[MAX_MACHINE_MODE];
-
-/* Similar, but here we don't have to move if the first index is a
-   superset of the second so in that case the cost is zero.  */
-extern move_table *may_move_out_cost[MAX_MACHINE_MODE];
-
 /* Target-dependent globals.  */
 struct target_regs {
   /* For each starting hard register, the number of consecutive hard
@@ -278,6 +258,28 @@ struct target_regs {
      it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the
      register.  */
   enum machine_mode x_reg_raw_mode[FIRST_PSEUDO_REGISTER];
+
+  /* Vector indexed by machine mode saying whether there are regs of
+     that mode.  */
+  bool x_have_regs_of_mode[MAX_MACHINE_MODE];
+
+  /* 1 if the corresponding class contains a register of the given mode.  */
+  char x_contains_reg_of_mode[N_REG_CLASSES][MAX_MACHINE_MODE];
+
+  /* Maximum cost of moving from a register in one class to a register
+     in another class.  Based on TARGET_REGISTER_MOVE_COST.  */
+  move_table *x_move_cost[MAX_MACHINE_MODE];
+
+  /* Similar, but here we don't have to move if the first index is a
+     subset of the second so in that case the cost is zero.  */
+  move_table *x_may_move_in_cost[MAX_MACHINE_MODE];
+
+  /* Similar, but here we don't have to move if the first index is a
+     superset of the second so in that case the cost is zero.  */
+  move_table *x_may_move_out_cost[MAX_MACHINE_MODE];
+
+  /* Keep track of the last mode we initialized move costs for.  */
+  int x_last_mode_for_init_move_cost;
 };
 
 extern struct target_regs default_target_regs;
@@ -291,6 +293,16 @@ #define hard_regno_nregs \
   (this_target_regs->x_hard_regno_nregs)
 #define reg_raw_mode \
   (this_target_regs->x_reg_raw_mode)
+#define have_regs_of_mode \
+  (this_target_regs->x_have_regs_of_mode)
+#define contains_reg_of_mode \
+  (this_target_regs->x_contains_reg_of_mode)
+#define move_cost \
+  (this_target_regs->x_move_cost)
+#define may_move_in_cost \
+  (this_target_regs->x_may_move_in_cost)
+#define may_move_out_cost \
+  (this_target_regs->x_may_move_out_cost)
 
 /* Return an exclusive upper bound on the registers occupied by hard
    register (reg:MODE REGNO).  */
Index: gcc/reginfo.c
===================================================================
--- gcc/reginfo.c	2010-07-03 23:01:59.000000000 +0100
+++ gcc/reginfo.c	2010-07-03 23:04:25.000000000 +0100
@@ -117,26 +117,8 @@ static const char *const initial_reg_nam
 /* Array containing all of the register class names.  */
 const char * reg_class_names[] = REG_CLASS_NAMES;
 
-/* 1 if there is a register of given mode.  */
-bool have_regs_of_mode [MAX_MACHINE_MODE];
-
-/* 1 if class does contain register of given mode.  */
-char contains_reg_of_mode [N_REG_CLASSES] [MAX_MACHINE_MODE];
-
-/* Maximum cost of moving from a register in one class to a register in
-   another class.  Based on TARGET_REGISTER_MOVE_COST.  */
-move_table *move_cost[MAX_MACHINE_MODE];
-
-/* Similar, but here we don't have to move if the first index is a subset
-   of the second so in that case the cost is zero.  */
-move_table *may_move_in_cost[MAX_MACHINE_MODE];
-
-/* Similar, but here we don't have to move if the first index is a superset
-   of the second so in that case the cost is zero.  */
-move_table *may_move_out_cost[MAX_MACHINE_MODE];
-
-/* Keep track of the last mode we initialized move costs for.  */
-static int last_mode_for_init_move_cost;
+#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];


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