#include "basic-block.h"
#include "cfgloop.h"
#include "cfglayout.h"
-#include "gcov-io.h"
-#include "profile.h"
/* Initialize loop optimizer. */
struct loops *
-loop_optimizer_init (dumpfile)
- FILE *dumpfile;
+loop_optimizer_init (FILE *dumpfile)
{
struct loops *loops = xcalloc (1, sizeof (struct loops));
edge e;
+ /* Initialize structures for layout changes. */
+ cfg_layout_initialize ();
+
/* Avoid annoying special cases of edges going to exit
block. */
for (e = EXIT_BLOCK_PTR->pred; e; e = e->pred_next)
if (flow_loops_find (loops, LOOP_TREE) <= 1)
{
+ basic_block bb;
+
/* No loops. */
flow_loops_free (loops);
free (loops);
+ /* Make chain. */
+ FOR_EACH_BB (bb)
+ if (bb->next_bb != EXIT_BLOCK_PTR)
+ bb->rbi->next = bb->next_bb;
+ cfg_layout_finalize ();
return NULL;
}
free (loops->cfg.dfs_order);
loops->cfg.dfs_order = NULL;
- /* Initialize structures for layout changes. */
- cfg_layout_initialize (loops);
-
/* Create pre-headers. */
- create_preheaders (loops, CP_SIMPLE_PREHEADERS | CP_INSIDE_CFGLAYOUT);
+ create_preheaders (loops, CP_SIMPLE_PREHEADERS);
/* Force all latches to have only single successor. */
force_single_succ_latches (loops);
/* Finalize loop optimizer. */
void
-loop_optimizer_finalize (loops, dumpfile)
- struct loops *loops;
- FILE *dumpfile;
+loop_optimizer_finalize (struct loops *loops, FILE *dumpfile)
{
basic_block bb;
/* Make chain. */
FOR_EACH_BB (bb)
if (bb->next_bb != EXIT_BLOCK_PTR)
- RBI (bb)->next = bb->next_bb;
+ bb->rbi->next = bb->next_bb;
/* Another dump. */
flow_loops_dump (loops, dumpfile, NULL, 1);
/* Clean up. */
flow_loops_free (loops);
free (loops);
-
+
/* Finalize changes. */
cfg_layout_finalize ();
verify_flow_info ();
#endif
}
-