aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2006-02-05 21:14:59 +0100
committerZdenek Dvorak <rakdver@gcc.gnu.org>2006-02-05 20:14:59 +0000
commitd78f3f787f098ce3c535883b1ba47c3b1820b983 (patch)
treef9c43362e6fd6ea70ca28c6eb34ce8db0d770637 /gcc
parentefb0828de397e990ed58d9429e4f70cd4694b718 (diff)
downloadgcc-d78f3f787f098ce3c535883b1ba47c3b1820b983.zip
gcc-d78f3f787f098ce3c535883b1ba47c3b1820b983.tar.gz
gcc-d78f3f787f098ce3c535883b1ba47c3b1820b983.tar.bz2
tree-vrp.c (cfg_loops): Removed.
* tree-vrp.c (cfg_loops): Removed. (adjust_range_with_scev, vrp_visit_assignment, execute_vrp): Use current_loops instead of cfg_loops. Pass flags to loop_optimizer_init. * cfgloopmanip.c (fix_loop_structure): Update only available information. * tree-ssa-loop-ch.c (copy_loop_headers): Pass flags to loop_optimizer_init. * modulo-sched.c (build_loops_structure): Removed. (sms_schedule): Use loop_optimizer_init. * loop-init.c (loop_optimizer_init): Use flags to determine which properties of loops to prepare. (rtl_loop_init): Pass flags to loop_optimizer_init. * tree-ssa-sink.c (execute_sink_code): Ditto. * tree-ssa-loop.c (tree_loop_optimizer_init): Ditto. * tree-ssa-pre.c (init_pre): Ditto. * cfgloop.h (LOOPS_NORMAL): New. (loop_optimizer_init): Declaration changed. From-SVN: r110620
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog21
-rw-r--r--gcc/cfgloop.h5
-rw-r--r--gcc/cfgloopmanip.c6
-rw-r--r--gcc/loop-init.c19
-rw-r--r--gcc/modulo-sched.c43
-rw-r--r--gcc/tree-ssa-loop-ch.c7
-rw-r--r--gcc/tree-ssa-loop.c8
-rw-r--r--gcc/tree-ssa-pre.c2
-rw-r--r--gcc/tree-ssa-sink.c2
-rw-r--r--gcc/tree-vrp.c18
10 files changed, 60 insertions, 71 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e8a26ef..93a10d7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,24 @@
+2006-02-04 Zdenek Dvorak <dvorakz@suse.cz>
+
+ * tree-vrp.c (cfg_loops): Removed.
+ (adjust_range_with_scev, vrp_visit_assignment, execute_vrp):
+ Use current_loops instead of cfg_loops. Pass flags to
+ loop_optimizer_init.
+ * cfgloopmanip.c (fix_loop_structure): Update only available
+ information.
+ * tree-ssa-loop-ch.c (copy_loop_headers): Pass flags to
+ loop_optimizer_init.
+ * modulo-sched.c (build_loops_structure): Removed.
+ (sms_schedule): Use loop_optimizer_init.
+ * loop-init.c (loop_optimizer_init): Use flags to determine
+ which properties of loops to prepare.
+ (rtl_loop_init): Pass flags to loop_optimizer_init.
+ * tree-ssa-sink.c (execute_sink_code): Ditto.
+ * tree-ssa-loop.c (tree_loop_optimizer_init): Ditto.
+ * tree-ssa-pre.c (init_pre): Ditto.
+ * cfgloop.h (LOOPS_NORMAL): New.
+ (loop_optimizer_init): Declaration changed.
+
2006-02-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa/x-ada-hpux10, pa/t-pa-hpux10, pa/t-pa-hpux11: New files.
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 5bbde8b..9e57384 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -185,6 +185,9 @@ enum
LOOPS_HAVE_MARKED_SINGLE_EXITS = 8
};
+#define LOOPS_NORMAL (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_SIMPLE_LATCHES \
+ | LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS)
+
/* Structure to hold CFG information about natural loops within a function. */
struct loops
{
@@ -434,7 +437,7 @@ extern unsigned global_cost_for_size (unsigned, unsigned, unsigned);
extern void init_set_costs (void);
/* Loop optimizer initialization. */
-extern struct loops *loop_optimizer_init (FILE *);
+extern struct loops *loop_optimizer_init (FILE *, unsigned);
extern void loop_optimizer_finalize (struct loops *, FILE *);
/* Optimization passes. */
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index ac2a75b..bb7aca0 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -1617,6 +1617,8 @@ fix_loop_structure (struct loops *loops, bitmap changed_bbs)
bb->aux = NULL;
}
- mark_single_exit_loops (loops);
- mark_irreducible_loops (loops);
+ if (loops->state & LOOPS_HAVE_MARKED_SINGLE_EXITS)
+ mark_single_exit_loops (loops);
+ if (loops->state & LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS)
+ mark_irreducible_loops (loops);
}
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index d44575b..d6c3703 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -34,10 +34,11 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
/* Initialize loop optimizer. This is used by the tree and RTL loop
- optimizers. */
+ optimizers. FLAGS specify what properties to compute and/or ensure for
+ loops. */
struct loops *
-loop_optimizer_init (FILE *dumpfile)
+loop_optimizer_init (FILE *dumpfile, unsigned flags)
{
struct loops *loops = XCNEW (struct loops);
edge e;
@@ -77,13 +78,19 @@ loop_optimizer_init (FILE *dumpfile)
loops->cfg.dfs_order = NULL;
/* Create pre-headers. */
- create_preheaders (loops, CP_SIMPLE_PREHEADERS);
+ if (flags & LOOPS_HAVE_PREHEADERS)
+ create_preheaders (loops, CP_SIMPLE_PREHEADERS);
/* Force all latches to have only single successor. */
- force_single_succ_latches (loops);
+ if (flags & LOOPS_HAVE_SIMPLE_LATCHES)
+ force_single_succ_latches (loops);
/* Mark irreducible loops. */
- mark_irreducible_loops (loops);
+ if (flags & LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS)
+ mark_irreducible_loops (loops);
+
+ if (flags & LOOPS_HAVE_MARKED_SINGLE_EXITS)
+ mark_single_exit_loops (loops);
/* Dump loops. */
flow_loops_dump (loops, dumpfile, NULL, 1);
@@ -166,7 +173,7 @@ rtl_loop_init (void)
/* Initialize structures for layout changes. */
cfg_layout_initialize (0);
- current_loops = loop_optimizer_init (dump_file);
+ current_loops = loop_optimizer_init (dump_file, LOOPS_NORMAL);
}
struct tree_opt_pass pass_rtl_loop_init =
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index f76bcfd..52190e0 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -894,44 +894,6 @@ canon_loop (struct loop *loop)
}
}
-/* Build the loop information without loop
- canonization, the loop canonization will
- be performed if the loop is SMSable. */
-static struct loops *
-build_loops_structure (FILE *dumpfile)
-{
- struct loops *loops = XCNEW (struct loops);
-
- /* Find the loops. */
-
- if (flow_loops_find (loops) <= 1)
- {
- /* No loops. */
- flow_loops_free (loops);
- free (loops);
-
- return NULL;
- }
-
- /* Not going to update these. */
- free (loops->cfg.rc_order);
- loops->cfg.rc_order = NULL;
- free (loops->cfg.dfs_order);
- loops->cfg.dfs_order = NULL;
-
- create_preheaders (loops, CP_SIMPLE_PREHEADERS);
- mark_single_exit_loops (loops);
- /* Dump loops. */
- flow_loops_dump (loops, dumpfile, NULL, 1);
-
-#ifdef ENABLE_CHECKING
- verify_dominators (CDI_DOMINATORS);
- verify_loop_structure (loops);
-#endif
-
- return loops;
-}
-
/* Main entry point, perform SMS scheduling on the loops of the function
that consist of single basic blocks. */
static void
@@ -953,10 +915,11 @@ sms_schedule (FILE *dump_file)
edge latch_edge;
gcov_type trip_count = 0;
- if (! (loops = build_loops_structure (dump_file)))
+ loops = loop_optimizer_init (dump_file, (LOOPS_HAVE_PREHEADERS
+ | LOOPS_HAVE_MARKED_SINGLE_EXITS));
+ if (!loops)
return; /* There is no loops to schedule. */
-
stats_file = dump_file;
/* Initialize issue_rate. */
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index 7d8870c..b9d1ce9 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -132,13 +132,10 @@ copy_loop_headers (void)
unsigned n_bbs;
unsigned bbs_size;
- loops = loop_optimizer_init (dump_file);
+ loops = loop_optimizer_init (dump_file, (LOOPS_HAVE_PREHEADERS
+ | LOOPS_HAVE_SIMPLE_LATCHES));
if (!loops)
return;
-
- /* We do not try to keep the information about irreducible regions
- up-to-date. */
- loops->state &= ~LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS;
#ifdef ENABLE_CHECKING
verify_loop_structure (loops);
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 8565f25..b776d0f 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -48,7 +48,10 @@ struct loops *current_loops = NULL;
static struct loops *
tree_loop_optimizer_init (FILE *dump)
{
- struct loops *loops = loop_optimizer_init (dump);
+ struct loops *loops;
+
+ loops = loop_optimizer_init (dump, (LOOPS_NORMAL
+ | LOOPS_HAVE_MARKED_SINGLE_EXITS));
if (!loops)
return NULL;
@@ -92,9 +95,6 @@ tree_ssa_loop_init (void)
if (!current_loops)
return;
- /* Find the loops that are exited just through a single edge. */
- mark_single_exit_loops (current_loops);
-
scev_initialize (current_loops);
}
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 6593deb..4c4cec5 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3441,7 +3441,7 @@ init_pre (bool do_fre)
vn_init ();
if (!do_fre)
- current_loops = loop_optimizer_init (dump_file);
+ current_loops = loop_optimizer_init (dump_file, LOOPS_NORMAL);
connect_infinite_loops_to_exit ();
memset (&pre_stats, 0, sizeof (pre_stats));
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index c6cdc6f..ed6baf2 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -522,7 +522,7 @@ sink_code_in_bb (basic_block bb)
static void
execute_sink_code (void)
{
- struct loops *loops = loop_optimizer_init (dump_file);
+ struct loops *loops = loop_optimizer_init (dump_file, LOOPS_NORMAL);
connect_infinite_loops_to_exit ();
memset (&sink_stats, 0, sizeof (sink_stats));
calculate_dominance_info (CDI_DOMINATORS | CDI_POST_DOMINATORS);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index e80f385..0938d6c 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -41,10 +41,6 @@ Boston, MA 02110-1301, USA. */
sub-graph in find_assert_locations. */
static sbitmap found_in_subgraph;
-/* Loop structure of the program. Used to analyze scalar evolutions
- inside adjust_range_with_scev. */
-static struct loops *cfg_loops;
-
/* Local functions. */
static int compare_values (tree val1, tree val2);
@@ -1909,7 +1905,7 @@ adjust_range_with_scev (value_range_t *vr, struct loop *loop, tree stmt,
/* Do not adjust ranges when chrec may wrap. */
if (scev_probably_wraps_p (chrec_type (chrec), init, step, stmt,
- cfg_loops->parray[CHREC_VARIABLE (chrec)],
+ current_loops->parray[CHREC_VARIABLE (chrec)],
&init_is_max, &unknown_max)
|| unknown_max)
return;
@@ -3278,7 +3274,7 @@ vrp_visit_assignment (tree stmt, tree *output_p)
/* If STMT is inside a loop, we may be able to know something
else about the range of LHS by examining scalar evolution
information. */
- if (cfg_loops && (l = loop_containing_stmt (stmt)))
+ if (current_loops && (l = loop_containing_stmt (stmt)))
adjust_range_with_scev (&new_vr, l, stmt, lhs);
if (update_value_range (lhs, &new_vr))
@@ -4312,18 +4308,18 @@ execute_vrp (void)
{
insert_range_assertions ();
- cfg_loops = loop_optimizer_init (NULL);
- if (cfg_loops)
- scev_initialize (cfg_loops);
+ current_loops = loop_optimizer_init (NULL, LOOPS_NORMAL);
+ if (current_loops)
+ scev_initialize (current_loops);
vrp_initialize ();
ssa_propagate (vrp_visit_stmt, vrp_visit_phi_node);
vrp_finalize ();
- if (cfg_loops)
+ if (current_loops)
{
scev_finalize ();
- loop_optimizer_finalize (cfg_loops, NULL);
+ loop_optimizer_finalize (current_loops, NULL);
current_loops = NULL;
}