/* Loop unswitching.
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2014 Free Software Foundation, Inc.
This file is part of GCC.
#include "tree.h"
#include "tm_p.h"
#include "basic-block.h"
+#include "tree-ssa-alias.h"
+#include "internal-fn.h"
+#include "gimple-expr.h"
+#include "is-a.h"
#include "gimple.h"
#include "gimplify.h"
#include "gimple-ssa.h"
return cond;
e = single_pred_edge (e->src);
- if (e->src == ENTRY_BLOCK_PTR)
+ if (e->src == ENTRY_BLOCK_PTR_FOR_FN (cfun))
return cond;
}
}
/* Loop unswitching pass. */
-static unsigned int
-tree_ssa_loop_unswitch (void)
-{
- if (number_of_loops (cfun) <= 1)
- return 0;
-
- return tree_ssa_unswitch_loops ();
-}
-
-static bool
-gate_tree_ssa_loop_unswitch (void)
-{
- return flag_unswitch_loops != 0;
-}
-
namespace {
const pass_data pass_data_tree_unswitch =
GIMPLE_PASS, /* type */
"unswitch", /* name */
OPTGROUP_LOOP, /* optinfo_flags */
- true, /* has_gate */
true, /* has_execute */
TV_TREE_LOOP_UNSWITCH, /* tv_id */
PROP_cfg, /* properties_required */
{}
/* opt_pass methods: */
- bool gate () { return gate_tree_ssa_loop_unswitch (); }
- unsigned int execute () { return tree_ssa_loop_unswitch (); }
+ virtual bool gate (function *) { return flag_unswitch_loops != 0; }
+ virtual unsigned int execute (function *);
}; // class pass_tree_unswitch
+unsigned int
+pass_tree_unswitch::execute (function *fun)
+{
+ if (number_of_loops (fun) <= 1)
+ return 0;
+
+ return tree_ssa_unswitch_loops ();
+}
+
} // anon namespace
gimple_opt_pass *