aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2010-07-12 19:02:55 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2010-07-12 19:02:55 +0000
commit4391924a335032f89f99247f2dad59c4b47b7a7a (patch)
tree8d8e2175f8a02aff3689db8673741343a8f10fbf
parent9d86796b627350ba83fcdf4e101805ae4edf08a6 (diff)
downloadgcc-4391924a335032f89f99247f2dad59c4b47b7a7a.zip
gcc-4391924a335032f89f99247f2dad59c4b47b7a7a.tar.gz
gcc-4391924a335032f89f99247f2dad59c4b47b7a7a.tar.bz2
Makefile.in (target-globals.o): Depend on $(CFGLOOP_H).
gcc/ * Makefile.in (target-globals.o): Depend on $(CFGLOOP_H). * cfgloop.h (target_cfgloop): New structure. (default_target_cfgloop): Declare. (this_target_cfgloop): Declare as a variable or define as a macro. (target_avail_regs, target_clobbered_regs, target_res_regs) (target_reg_cost, target_spill_cost): Redefine as macros. * cfgloopanal.c (default_target_cfgloop): New variable. (this_target_cfgloop): New conditional variable. (target_avail_regs, target_clobbered_regs, target_res_regs) (target_reg_cost, target_spill_cost): Delete. * target-globals.h (this_target_cfgloop): Declare. (target_globals): Add a cfgloop field. (restore_target_globals): Copy the cfgloop field to this_target_cfgloop. * target-globals.c: Include cfgloop.h. (default_target_globals): Initialize the cfgloop field. (save_target_globals): Likewise. From-SVN: r162101
-rw-r--r--gcc/ChangeLog20
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/cfgloop.h39
-rw-r--r--gcc/cfgloopanal.c18
-rw-r--r--gcc/target-globals.c5
-rw-r--r--gcc/target-globals.h3
6 files changed, 67 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d5864aa..ece776f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,25 @@
2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
+ * Makefile.in (target-globals.o): Depend on $(CFGLOOP_H).
+ * cfgloop.h (target_cfgloop): New structure.
+ (default_target_cfgloop): Declare.
+ (this_target_cfgloop): Declare as a variable or define as a macro.
+ (target_avail_regs, target_clobbered_regs, target_res_regs)
+ (target_reg_cost, target_spill_cost): Redefine as macros.
+ * cfgloopanal.c (default_target_cfgloop): New variable.
+ (this_target_cfgloop): New conditional variable.
+ (target_avail_regs, target_clobbered_regs, target_res_regs)
+ (target_reg_cost, target_spill_cost): Delete.
+ * target-globals.h (this_target_cfgloop): Declare.
+ (target_globals): Add a cfgloop field.
+ (restore_target_globals): Copy the cfgloop field to
+ this_target_cfgloop.
+ * target-globals.c: Include cfgloop.h.
+ (default_target_globals): Initialize the cfgloop field.
+ (save_target_globals): Likewise.
+
+2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
+
* regs.h (target_regs): Add x_direct_load, x_direct_store and
x_float_extend_from_mem.
(direct_load, direct_store, float_extend_from_mem): New macros.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 8ee8a32..748b653 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3483,7 +3483,7 @@ lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.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) $(REGS_H) $(RTL_H) reload.h expmed.h $(EXPR_H) $(OPTABS_H) \
- $(LIBFUNCS_H)
+ $(LIBFUNCS_H) $(CFGLOOP_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/cfgloop.h b/gcc/cfgloop.h
index 46cda11..535e256 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -625,12 +625,41 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags)
}
/* The properties of the target. */
+struct target_cfgloop {
+ /* Number of available registers. */
+ unsigned x_target_avail_regs;
-extern unsigned target_avail_regs;
-extern unsigned target_clobbered_regs;
-extern unsigned target_res_regs;
-extern unsigned target_reg_cost [2];
-extern unsigned target_spill_cost [2];
+ /* Number of available registers that are call-clobbered. */
+ unsigned x_target_clobbered_regs;
+
+ /* Number of registers reserved for temporary expressions. */
+ unsigned x_target_res_regs;
+
+ /* The cost for register when there still is some reserve, but we are
+ approaching the number of available registers. */
+ unsigned x_target_reg_cost[2];
+
+ /* The cost for register when we need to spill. */
+ unsigned x_target_spill_cost[2];
+};
+
+extern struct target_cfgloop default_target_cfgloop;
+#if SWITCHABLE_TARGET
+extern struct target_cfgloop *this_target_cfgloop;
+#else
+#define this_target_cfgloop (&default_target_cfgloop)
+#endif
+
+#define target_avail_regs \
+ (this_target_cfgloop->x_target_avail_regs)
+#define target_clobbered_regs \
+ (this_target_cfgloop->x_target_clobbered_regs)
+#define target_res_regs \
+ (this_target_cfgloop->x_target_res_regs)
+#define target_reg_cost \
+ (this_target_cfgloop->x_target_reg_cost)
+#define target_spill_cost \
+ (this_target_cfgloop->x_target_spill_cost)
/* Register pressure estimation for induction variable optimizations & loop
invariant motion. */
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 853e6f2..48a44d2 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -32,6 +32,11 @@ along with GCC; see the file COPYING3. If not see
#include "graphds.h"
#include "params.h"
+struct target_cfgloop default_target_cfgloop;
+#if SWITCHABLE_TARGET
+struct target_cfgloop *this_target_cfgloop = &default_target_cfgloop;
+#endif
+
/* Checks whether BB is executed exactly once in each LOOP iteration. */
bool
@@ -317,19 +322,6 @@ seq_cost (const_rtx seq, bool speed)
return cost;
}
-/* The properties of the target. */
-
-unsigned target_avail_regs; /* Number of available registers. */
-unsigned target_clobbered_regs; /* Number of available registers that are
- call-clobbered. */
-unsigned target_res_regs; /* Number of registers reserved for temporary
- expressions. */
-unsigned target_reg_cost[2]; /* The cost for register when there still
- is some reserve, but we are approaching
- the number of available registers. */
-unsigned target_spill_cost[2]; /* The cost for register when we need
- to spill. */
-
/* Initialize the constants for computing set costs. */
void
diff --git a/gcc/target-globals.c b/gcc/target-globals.c
index 6655f9a..7a34032 100644
--- a/gcc/target-globals.c
+++ b/gcc/target-globals.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "expr.h"
#include "optabs.h"
#include "libfuncs.h"
+#include "cfgloop.h"
#if SWITCHABLE_TARGET
struct target_globals default_target_globals = {
@@ -45,7 +46,8 @@ struct target_globals default_target_globals = {
&default_target_reload,
&default_target_expmed,
&default_target_optabs,
- &default_target_libfuncs
+ &default_target_libfuncs,
+ &default_target_cfgloop
};
struct target_globals *
@@ -62,6 +64,7 @@ save_target_globals (void)
g->expmed = XCNEW (struct target_expmed);
g->optabs = XCNEW (struct target_optabs);
g->libfuncs = ggc_alloc_cleared_target_libfuncs ();
+ g->cfgloop = XCNEW (struct target_cfgloop);
restore_target_globals (g);
target_reinit ();
return g;
diff --git a/gcc/target-globals.h b/gcc/target-globals.h
index 7b7b725..b90f1415 100644
--- a/gcc/target-globals.h
+++ b/gcc/target-globals.h
@@ -29,6 +29,7 @@ extern struct target_reload *this_target_reload;
extern struct target_expmed *this_target_expmed;
extern struct target_optabs *this_target_optabs;
extern struct target_libfuncs *this_target_libfuncs;
+extern struct target_cfgloop *this_target_cfgloop;
struct GTY(()) target_globals {
struct target_flag_state *GTY((skip)) flag_state;
@@ -39,6 +40,7 @@ struct GTY(()) target_globals {
struct target_expmed *GTY((skip)) expmed;
struct target_optabs *GTY((skip)) optabs;
struct target_libfuncs *libfuncs;
+ struct target_cfgloop *GTY((skip)) cfgloop;
};
extern struct target_globals default_target_globals;
@@ -56,6 +58,7 @@ restore_target_globals (struct target_globals *g)
this_target_expmed = g->expmed;
this_target_optabs = g->optabs;
this_target_libfuncs = g->libfuncs;
+ this_target_cfgloop = g->cfgloop;
}
#endif