aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2010-07-12 18:53:08 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2010-07-12 18:53:08 +0000
commit939dcd0d38af0571a15f1bcff788d593ed33d5eb (patch)
treed708b56be81952da9c5f1952199355f972230b0e
parent3bd36029de1b586b49b3b021385b275ba5427611 (diff)
downloadgcc-939dcd0d38af0571a15f1bcff788d593ed33d5eb.zip
gcc-939dcd0d38af0571a15f1bcff788d593ed33d5eb.tar.gz
gcc-939dcd0d38af0571a15f1bcff788d593ed33d5eb.tar.bz2
Makefile.in (target-globals.o): Depend on $(REGS_H).
gcc/ * Makefile.in (target-globals.o): Depend on $(REGS_H). * regs.h (target_reg_modes): New structure. (default_target_reg_modes): Declare. (this_target_reg_modes): Declare as a variable or define as a macro. (hard_regno_nregs, reg_raw_mode): Redefine as macros. * reginfo.c (default_target_reg_modes): New variable. (this_target_reg_modes): New conditional variable. (hard_regno_nregs, reg_raw_mode): Delete. * target-globals.h (this_target_regs): Declare. (target_globals): Add a regs field. (restore_target_globals): Copy the regs field to this_target_regs. * target-globals.c: Include regs.h. (default_target_globals): Initialize the regs field. (save_target_globals): Likewise. From-SVN: r162087
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/reginfo.c14
-rw-r--r--gcc/regs.h35
-rw-r--r--gcc/target-globals.c5
-rw-r--r--gcc/target-globals.h3
6 files changed, 55 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aa2ef84..eec56ce 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,22 @@
2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
+ * Makefile.in (target-globals.o): Depend on $(REGS_H).
+ * regs.h (target_reg_modes): New structure.
+ (default_target_reg_modes): Declare.
+ (this_target_reg_modes): Declare as a variable or define as a macro.
+ (hard_regno_nregs, reg_raw_mode): Redefine as macros.
+ * reginfo.c (default_target_reg_modes): New variable.
+ (this_target_reg_modes): New conditional variable.
+ (hard_regno_nregs, reg_raw_mode): Delete.
+ * target-globals.h (this_target_regs): Declare.
+ (target_globals): Add a regs field.
+ (restore_target_globals): Copy the regs field to this_target_regs.
+ * target-globals.c: Include regs.h.
+ (default_target_globals): Initialize the regs field.
+ (save_target_globals): Likewise.
+
+2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
+
* doc/tm.texi.in (SWITCHABLE_TARGET): Document.
* doc/tm.texi: Regenerate.
* Makefile.in (OBJS-common): Add target-globals.o.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6fd3b00..1365227 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3477,7 +3477,7 @@ lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(EXPR_H) $(EXCEPT_H) $(REGS_H) $(TREE_PASS_H) $(DF_H)
target-globals.o : target-globals.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) insn-config.h $(MACHMODE_H) $(GGC_H) $(TOPLEV_H) target-globals.h \
- $(FLAGS_H)
+ $(FLAGS_H) $(REGS_H)
$(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index a9d29c8..87bc630 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -59,6 +59,11 @@ along with GCC; see the file COPYING3. If not see
int max_regno;
+struct target_regs default_target_regs;
+#if SWITCHABLE_TARGET
+struct target_regs *this_target_regs = &default_target_regs;
+#endif
+
/* Register tables used by many passes. */
/* Indexed by hard register number, contains 1 for registers
@@ -175,12 +180,6 @@ const char * reg_names[] = REGISTER_NAMES;
/* Array containing all of the register class names. */
const char * reg_class_names[] = REG_CLASS_NAMES;
-/* For each hard register, the widest mode object that it can contain.
- This will be a MODE_INT mode if the register can hold integers. Otherwise
- it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the
- register. */
-enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
-
/* 1 if there is a register of given mode. */
bool have_regs_of_mode [MAX_MACHINE_MODE];
@@ -209,9 +208,6 @@ static GTY(()) rtx top_of_stack[MAX_MACHINE_MODE];
reginfo has been initialized. */
static int no_global_reg_vars = 0;
-/* Specify number of hard registers given machine mode occupy. */
-unsigned char hard_regno_nregs[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE];
-
/* Given a register bitmap, turn on the bits in a HARD_REG_SET that
correspond to the hard registers, if any, set in that map. This
could be done far more efficiently by having all sorts of special-cases
diff --git a/gcc/regs.h b/gcc/regs.h
index c9dddb5..6ae427c 100644
--- a/gcc/regs.h
+++ b/gcc/regs.h
@@ -218,13 +218,6 @@ extern short *reg_renumber;
extern bool have_regs_of_mode [MAX_MACHINE_MODE];
-/* For each hard register, the widest mode object that it can contain.
- This will be a MODE_INT mode if the register can hold integers. Otherwise
- it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the
- register. */
-
-extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
-
/* Flag set by local-alloc or global-alloc if they decide to allocate
something in a call-clobbered register. */
@@ -266,9 +259,6 @@ typedef unsigned short move_table[N_REG_CLASSES];
in another class. */
extern move_table *move_cost[MAX_MACHINE_MODE];
-/* Specify number of hard registers given machine mode occupy. */
-extern unsigned char hard_regno_nregs[FIRST_PSEUDO_REGISTER][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];
@@ -277,6 +267,31 @@ extern move_table *may_move_in_cost[MAX_MACHINE_MODE];
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
+ registers that a given machine mode occupies. */
+ unsigned char x_hard_regno_nregs[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE];
+
+ /* For each hard register, the widest mode object that it can contain.
+ This will be a MODE_INT mode if the register can hold integers. Otherwise
+ 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];
+};
+
+extern struct target_regs default_target_regs;
+#if SWITCHABLE_TARGET
+extern struct target_regs *this_target_regs;
+#else
+#define this_target_regs (&default_target_regs)
+#endif
+
+#define hard_regno_nregs \
+ (this_target_regs->x_hard_regno_nregs)
+#define reg_raw_mode \
+ (this_target_regs->x_reg_raw_mode)
+
/* Return an exclusive upper bound on the registers occupied by hard
register (reg:MODE REGNO). */
diff --git a/gcc/target-globals.c b/gcc/target-globals.c
index ecbc76b..3a7f2d4 100644
--- a/gcc/target-globals.c
+++ b/gcc/target-globals.c
@@ -27,10 +27,12 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "target-globals.h"
#include "flags.h"
+#include "regs.h"
#if SWITCHABLE_TARGET
struct target_globals default_target_globals = {
- &default_target_flag_state
+ &default_target_flag_state,
+ &default_target_regs
};
struct target_globals *
@@ -40,6 +42,7 @@ save_target_globals (void)
g = ggc_alloc_target_globals ();
g->flag_state = XCNEW (struct target_flag_state);
+ g->regs = XCNEW (struct target_regs);
restore_target_globals (g);
target_reinit ();
return g;
diff --git a/gcc/target-globals.h b/gcc/target-globals.h
index 496a507..a733aa5 100644
--- a/gcc/target-globals.h
+++ b/gcc/target-globals.h
@@ -22,9 +22,11 @@ along with GCC; see the file COPYING3. If not see
#if SWITCHABLE_TARGET
extern struct target_flag_state *this_target_flag_state;
+extern struct target_regs *this_target_regs;
struct GTY(()) target_globals {
struct target_flag_state *GTY((skip)) flag_state;
+ struct target_regs *GTY((skip)) regs;
};
extern struct target_globals default_target_globals;
@@ -35,6 +37,7 @@ static inline void
restore_target_globals (struct target_globals *g)
{
this_target_flag_state = g->flag_state;
+ this_target_regs = g->regs;
}
#endif