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
This commit is contained in:
Zdenek Dvorak 2006-02-05 21:14:59 +01:00 committed by Zdenek Dvorak
parent efb0828de3
commit d78f3f787f
10 changed files with 60 additions and 71 deletions

View file

@ -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.

View file

@ -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. */

View file

@ -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);
}

View file

@ -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 =

View file

@ -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. */

View file

@ -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);

View file

@ -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);
}

View file

@ -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));

View file

@ -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);

View file

@ -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;
}