summaryrefslogtreecommitdiff
path: root/gcc/loop-init.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/loop-init.c')
-rw-r--r--gcc/loop-init.c378
1 files changed, 250 insertions, 128 deletions
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 65f9c6c9d4a..80c31ef70cd 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -316,26 +316,43 @@ gate_handle_loop2 (void)
}
}
-struct rtl_opt_pass pass_loop2 =
-{
- {
- RTL_PASS,
- "loop2", /* name */
- OPTGROUP_LOOP, /* optinfo_flags */
- gate_handle_loop2, /* gate */
- NULL, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_LOOP, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0 /* todo_flags_finish */
- }
+namespace {
+
+const pass_data pass_data_loop2 =
+{
+ RTL_PASS, /* type */
+ "loop2", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ true, /* has_gate */
+ false, /* has_execute */
+ TV_LOOP, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
};
+class pass_loop2 : public rtl_opt_pass
+{
+public:
+ pass_loop2(gcc::context *ctxt)
+ : rtl_opt_pass(pass_data_loop2, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ bool gate () { return gate_handle_loop2 (); }
+
+}; // class pass_loop2
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_loop2 (gcc::context *ctxt)
+{
+ return new pass_loop2 (ctxt);
+}
+
/* Initialization of the RTL loop passes. */
static unsigned int
@@ -353,26 +370,43 @@ rtl_loop_init (void)
return 0;
}
-struct rtl_opt_pass pass_rtl_loop_init =
-{
- {
- RTL_PASS,
- "loop2_init", /* name */
- OPTGROUP_LOOP, /* optinfo_flags */
- NULL, /* gate */
- rtl_loop_init, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_LOOP, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_verify_rtl_sharing /* todo_flags_finish */
- }
+namespace {
+
+const pass_data pass_data_rtl_loop_init =
+{
+ RTL_PASS, /* type */
+ "loop2_init", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ false, /* has_gate */
+ true, /* has_execute */
+ TV_LOOP, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_verify_rtl_sharing, /* todo_flags_finish */
};
+class pass_rtl_loop_init : public rtl_opt_pass
+{
+public:
+ pass_rtl_loop_init(gcc::context *ctxt)
+ : rtl_opt_pass(pass_data_rtl_loop_init, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ unsigned int execute () { return rtl_loop_init (); }
+
+}; // class pass_rtl_loop_init
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_rtl_loop_init (gcc::context *ctxt)
+{
+ return new pass_rtl_loop_init (ctxt);
+}
+
/* Finalization of the RTL loop passes. */
@@ -394,27 +428,43 @@ rtl_loop_done (void)
return 0;
}
-struct rtl_opt_pass pass_rtl_loop_done =
-{
- {
- RTL_PASS,
- "loop2_done", /* name */
- OPTGROUP_LOOP, /* optinfo_flags */
- NULL, /* gate */
- rtl_loop_done, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_LOOP, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- PROP_loops, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_verify_flow
- | TODO_verify_rtl_sharing /* todo_flags_finish */
- }
+namespace {
+
+const pass_data pass_data_rtl_loop_done =
+{
+ RTL_PASS, /* type */
+ "loop2_done", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ false, /* has_gate */
+ true, /* has_execute */
+ TV_LOOP, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ PROP_loops, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ ( TODO_verify_flow | TODO_verify_rtl_sharing ), /* todo_flags_finish */
};
+class pass_rtl_loop_done : public rtl_opt_pass
+{
+public:
+ pass_rtl_loop_done(gcc::context *ctxt)
+ : rtl_opt_pass(pass_data_rtl_loop_done, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ unsigned int execute () { return rtl_loop_done (); }
+
+}; // class pass_rtl_loop_done
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_rtl_loop_done (gcc::context *ctxt)
+{
+ return new pass_rtl_loop_done (ctxt);
+}
+
/* Loop invariant code motion. */
static bool
@@ -431,27 +481,45 @@ rtl_move_loop_invariants (void)
return 0;
}
-struct rtl_opt_pass pass_rtl_move_loop_invariants =
-{
- {
- RTL_PASS,
- "loop2_invariant", /* name */
- OPTGROUP_LOOP, /* optinfo_flags */
- gate_rtl_move_loop_invariants, /* gate */
- rtl_move_loop_invariants, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_LOOP_MOVE_INVARIANTS, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_df_verify |
- TODO_df_finish | TODO_verify_rtl_sharing /* todo_flags_finish */
- }
+namespace {
+
+const pass_data pass_data_rtl_move_loop_invariants =
+{
+ RTL_PASS, /* type */
+ "loop2_invariant", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ true, /* has_gate */
+ true, /* has_execute */
+ TV_LOOP_MOVE_INVARIANTS, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ ( TODO_df_verify | TODO_df_finish
+ | TODO_verify_rtl_sharing ), /* todo_flags_finish */
};
+class pass_rtl_move_loop_invariants : public rtl_opt_pass
+{
+public:
+ pass_rtl_move_loop_invariants(gcc::context *ctxt)
+ : rtl_opt_pass(pass_data_rtl_move_loop_invariants, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ bool gate () { return gate_rtl_move_loop_invariants (); }
+ unsigned int execute () { return rtl_move_loop_invariants (); }
+
+}; // class pass_rtl_move_loop_invariants
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_rtl_move_loop_invariants (gcc::context *ctxt)
+{
+ return new pass_rtl_move_loop_invariants (ctxt);
+}
+
/* Loop unswitching for RTL. */
static bool
@@ -468,26 +536,44 @@ rtl_unswitch (void)
return 0;
}
-struct rtl_opt_pass pass_rtl_unswitch =
-{
- {
- RTL_PASS,
- "loop2_unswitch", /* name */
- OPTGROUP_LOOP, /* optinfo_flags */
- gate_rtl_unswitch, /* gate */
- rtl_unswitch, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_LOOP_UNSWITCH, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_verify_rtl_sharing, /* todo_flags_finish */
- }
+namespace {
+
+const pass_data pass_data_rtl_unswitch =
+{
+ RTL_PASS, /* type */
+ "loop2_unswitch", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ true, /* has_gate */
+ true, /* has_execute */
+ TV_LOOP_UNSWITCH, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_verify_rtl_sharing, /* todo_flags_finish */
};
+class pass_rtl_unswitch : public rtl_opt_pass
+{
+public:
+ pass_rtl_unswitch(gcc::context *ctxt)
+ : rtl_opt_pass(pass_data_rtl_unswitch, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ bool gate () { return gate_rtl_unswitch (); }
+ unsigned int execute () { return rtl_unswitch (); }
+
+}; // class pass_rtl_unswitch
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_rtl_unswitch (gcc::context *ctxt)
+{
+ return new pass_rtl_unswitch (ctxt);
+}
+
/* Loop unswitching for RTL. */
static bool
@@ -517,26 +603,44 @@ rtl_unroll_and_peel_loops (void)
return 0;
}
-struct rtl_opt_pass pass_rtl_unroll_and_peel_loops =
-{
- {
- RTL_PASS,
- "loop2_unroll", /* name */
- OPTGROUP_LOOP, /* optinfo_flags */
- gate_rtl_unroll_and_peel_loops, /* gate */
- rtl_unroll_and_peel_loops, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_LOOP_UNROLL, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_verify_rtl_sharing, /* todo_flags_finish */
- }
+namespace {
+
+const pass_data pass_data_rtl_unroll_and_peel_loops =
+{
+ RTL_PASS, /* type */
+ "loop2_unroll", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ true, /* has_gate */
+ true, /* has_execute */
+ TV_LOOP_UNROLL, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_verify_rtl_sharing, /* todo_flags_finish */
};
+class pass_rtl_unroll_and_peel_loops : public rtl_opt_pass
+{
+public:
+ pass_rtl_unroll_and_peel_loops(gcc::context *ctxt)
+ : rtl_opt_pass(pass_data_rtl_unroll_and_peel_loops, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ bool gate () { return gate_rtl_unroll_and_peel_loops (); }
+ unsigned int execute () { return rtl_unroll_and_peel_loops (); }
+
+}; // class pass_rtl_unroll_and_peel_loops
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_rtl_unroll_and_peel_loops (gcc::context *ctxt)
+{
+ return new pass_rtl_unroll_and_peel_loops (ctxt);
+}
+
/* The doloop optimization. */
static bool
@@ -559,22 +663,40 @@ rtl_doloop (void)
return 0;
}
-struct rtl_opt_pass pass_rtl_doloop =
-{
- {
- RTL_PASS,
- "loop2_doloop", /* name */
- OPTGROUP_LOOP, /* optinfo_flags */
- gate_rtl_doloop, /* gate */
- rtl_doloop, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_LOOP_DOLOOP, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_verify_rtl_sharing /* todo_flags_finish */
- }
+namespace {
+
+const pass_data pass_data_rtl_doloop =
+{
+ RTL_PASS, /* type */
+ "loop2_doloop", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ true, /* has_gate */
+ true, /* has_execute */
+ TV_LOOP_DOLOOP, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_verify_rtl_sharing, /* todo_flags_finish */
};
+
+class pass_rtl_doloop : public rtl_opt_pass
+{
+public:
+ pass_rtl_doloop(gcc::context *ctxt)
+ : rtl_opt_pass(pass_data_rtl_doloop, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ bool gate () { return gate_rtl_doloop (); }
+ unsigned int execute () { return rtl_doloop (); }
+
+}; // class pass_rtl_doloop
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_rtl_doloop (gcc::context *ctxt)
+{
+ return new pass_rtl_doloop (ctxt);
+}