Commit d78f3f78 by Zdenek Dvorak Committed by Zdenek Dvorak

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
parent efb0828d
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> 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. * pa/x-ada-hpux10, pa/t-pa-hpux10, pa/t-pa-hpux11: New files.
......
...@@ -185,6 +185,9 @@ enum ...@@ -185,6 +185,9 @@ enum
LOOPS_HAVE_MARKED_SINGLE_EXITS = 8 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. */ /* Structure to hold CFG information about natural loops within a function. */
struct loops struct loops
{ {
...@@ -434,7 +437,7 @@ extern unsigned global_cost_for_size (unsigned, unsigned, unsigned); ...@@ -434,7 +437,7 @@ extern unsigned global_cost_for_size (unsigned, unsigned, unsigned);
extern void init_set_costs (void); extern void init_set_costs (void);
/* Loop optimizer initialization. */ /* 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 *); extern void loop_optimizer_finalize (struct loops *, FILE *);
/* Optimization passes. */ /* Optimization passes. */
......
...@@ -1617,6 +1617,8 @@ fix_loop_structure (struct loops *loops, bitmap changed_bbs) ...@@ -1617,6 +1617,8 @@ fix_loop_structure (struct loops *loops, bitmap changed_bbs)
bb->aux = NULL; bb->aux = NULL;
} }
mark_single_exit_loops (loops); if (loops->state & LOOPS_HAVE_MARKED_SINGLE_EXITS)
mark_irreducible_loops (loops); mark_single_exit_loops (loops);
if (loops->state & LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS)
mark_irreducible_loops (loops);
} }
...@@ -34,10 +34,11 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -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 /* 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 * struct loops *
loop_optimizer_init (FILE *dumpfile) loop_optimizer_init (FILE *dumpfile, unsigned flags)
{ {
struct loops *loops = XCNEW (struct loops); struct loops *loops = XCNEW (struct loops);
edge e; edge e;
...@@ -77,13 +78,19 @@ loop_optimizer_init (FILE *dumpfile) ...@@ -77,13 +78,19 @@ loop_optimizer_init (FILE *dumpfile)
loops->cfg.dfs_order = NULL; loops->cfg.dfs_order = NULL;
/* Create pre-headers. */ /* 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 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. */
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. */ /* Dump loops. */
flow_loops_dump (loops, dumpfile, NULL, 1); flow_loops_dump (loops, dumpfile, NULL, 1);
...@@ -166,7 +173,7 @@ rtl_loop_init (void) ...@@ -166,7 +173,7 @@ rtl_loop_init (void)
/* Initialize structures for layout changes. */ /* Initialize structures for layout changes. */
cfg_layout_initialize (0); 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 = struct tree_opt_pass pass_rtl_loop_init =
......
...@@ -894,44 +894,6 @@ canon_loop (struct loop *loop) ...@@ -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 /* Main entry point, perform SMS scheduling on the loops of the function
that consist of single basic blocks. */ that consist of single basic blocks. */
static void static void
...@@ -953,10 +915,11 @@ sms_schedule (FILE *dump_file) ...@@ -953,10 +915,11 @@ sms_schedule (FILE *dump_file)
edge latch_edge; edge latch_edge;
gcov_type trip_count = 0; 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. */ return; /* There is no loops to schedule. */
stats_file = dump_file; stats_file = dump_file;
/* Initialize issue_rate. */ /* Initialize issue_rate. */
......
...@@ -132,13 +132,10 @@ copy_loop_headers (void) ...@@ -132,13 +132,10 @@ copy_loop_headers (void)
unsigned n_bbs; unsigned n_bbs;
unsigned bbs_size; unsigned bbs_size;
loops = loop_optimizer_init (dump_file); loops = loop_optimizer_init (dump_file, (LOOPS_HAVE_PREHEADERS
| LOOPS_HAVE_SIMPLE_LATCHES));
if (!loops) if (!loops)
return; 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 #ifdef ENABLE_CHECKING
verify_loop_structure (loops); verify_loop_structure (loops);
......
...@@ -48,7 +48,10 @@ struct loops *current_loops = NULL; ...@@ -48,7 +48,10 @@ struct loops *current_loops = NULL;
static struct loops * static struct loops *
tree_loop_optimizer_init (FILE *dump) 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) if (!loops)
return NULL; return NULL;
...@@ -92,9 +95,6 @@ tree_ssa_loop_init (void) ...@@ -92,9 +95,6 @@ tree_ssa_loop_init (void)
if (!current_loops) if (!current_loops)
return; return;
/* Find the loops that are exited just through a single edge. */
mark_single_exit_loops (current_loops);
scev_initialize (current_loops); scev_initialize (current_loops);
} }
......
...@@ -3441,7 +3441,7 @@ init_pre (bool do_fre) ...@@ -3441,7 +3441,7 @@ init_pre (bool do_fre)
vn_init (); vn_init ();
if (!do_fre) if (!do_fre)
current_loops = loop_optimizer_init (dump_file); current_loops = loop_optimizer_init (dump_file, LOOPS_NORMAL);
connect_infinite_loops_to_exit (); connect_infinite_loops_to_exit ();
memset (&pre_stats, 0, sizeof (pre_stats)); memset (&pre_stats, 0, sizeof (pre_stats));
......
...@@ -522,7 +522,7 @@ sink_code_in_bb (basic_block bb) ...@@ -522,7 +522,7 @@ sink_code_in_bb (basic_block bb)
static void static void
execute_sink_code (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 (); connect_infinite_loops_to_exit ();
memset (&sink_stats, 0, sizeof (sink_stats)); memset (&sink_stats, 0, sizeof (sink_stats));
calculate_dominance_info (CDI_DOMINATORS | CDI_POST_DOMINATORS); calculate_dominance_info (CDI_DOMINATORS | CDI_POST_DOMINATORS);
......
...@@ -41,10 +41,6 @@ Boston, MA 02110-1301, USA. */ ...@@ -41,10 +41,6 @@ Boston, MA 02110-1301, USA. */
sub-graph in find_assert_locations. */ sub-graph in find_assert_locations. */
static sbitmap found_in_subgraph; 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. */ /* Local functions. */
static int compare_values (tree val1, tree val2); 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, ...@@ -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. */ /* Do not adjust ranges when chrec may wrap. */
if (scev_probably_wraps_p (chrec_type (chrec), init, step, stmt, 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) &init_is_max, &unknown_max)
|| unknown_max) || unknown_max)
return; return;
...@@ -3278,7 +3274,7 @@ vrp_visit_assignment (tree stmt, tree *output_p) ...@@ -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 /* If STMT is inside a loop, we may be able to know something
else about the range of LHS by examining scalar evolution else about the range of LHS by examining scalar evolution
information. */ 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); adjust_range_with_scev (&new_vr, l, stmt, lhs);
if (update_value_range (lhs, &new_vr)) if (update_value_range (lhs, &new_vr))
...@@ -4312,18 +4308,18 @@ execute_vrp (void) ...@@ -4312,18 +4308,18 @@ execute_vrp (void)
{ {
insert_range_assertions (); insert_range_assertions ();
cfg_loops = loop_optimizer_init (NULL); current_loops = loop_optimizer_init (NULL, LOOPS_NORMAL);
if (cfg_loops) if (current_loops)
scev_initialize (cfg_loops); scev_initialize (current_loops);
vrp_initialize (); vrp_initialize ();
ssa_propagate (vrp_visit_stmt, vrp_visit_phi_node); ssa_propagate (vrp_visit_stmt, vrp_visit_phi_node);
vrp_finalize (); vrp_finalize ();
if (cfg_loops) if (current_loops)
{ {
scev_finalize (); scev_finalize ();
loop_optimizer_finalize (cfg_loops, NULL); loop_optimizer_finalize (current_loops, NULL);
current_loops = NULL; current_loops = NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment