* often.
* @author Christian Schaefer, Goetz Lindenmaier, Sebastian Felis,
* Michael Beck
- * @version $Id$
*
* The idea here is to push nodes as deep into the dominance tree as their
* dependencies allow. After pushing them back up out of as many loops as
#include "irouts.h"
#include "irgopt.h"
#include "irpass.h"
-#include "opt_manage.h"
static bool is_block_reachable(ir_node *block)
{
return;
/* some nodes should simply stay in the startblock */
if (is_irn_start_block_placed(n)) {
-#ifndef NDEBUG
- ir_graph *irg = get_irn_irg(n);
- ir_node *start_block = get_irg_start_block(irg);
- assert(get_nodes_block(n) == start_block);
-#endif
+ assert(get_nodes_block(n) == get_irg_start_block(get_irn_irg(n)));
return;
}
}
/* Code Placement. */
-static ir_graph_state_t do_codeplacement(ir_graph *irg)
+void place_code(ir_graph *irg)
{
waitq *worklist;
/* Handle graph state */
assert(get_irg_phase_state(irg) != phase_building);
+ assure_irg_properties(irg,
+ IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES |
+ IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE |
+ IR_GRAPH_PROPERTY_CONSISTENT_OUTS |
+ IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE |
+ IR_GRAPH_PROPERTY_CONSISTENT_LOOPINFO);
/* Place all floating nodes as early as possible. This guarantees
a legal code placement. */
place_late(irg, worklist);
del_waitq(worklist);
- return 0;
-}
-
-static optdesc_t opt_codeplacement = {
- "code-placement",
- IR_GRAPH_STATE_NO_CRITICAL_EDGES |
- IR_GRAPH_STATE_CONSISTENT_OUTS |
- IR_GRAPH_STATE_CONSISTENT_DOMINANCE |
- IR_GRAPH_STATE_CONSISTENT_LOOPINFO,
- do_codeplacement,
-};
-
-void place_code(ir_graph *irg)
-{
- perform_irg_optimization(irg, &opt_codeplacement);
+ confirm_irg_properties(irg, IR_GRAPH_PROPERTIES_NONE);
}
/**
set_opt_global_cse(0);
}
-#if 0
-static ir_graph_state_t do_gcse(ir_graph *irg)
-{
- set_opt_global_cse(1);
- optimize_graph_df(irg);
- do_codeplacement(irg);
- set_opt_global_cse(0);
- return 0;
-}
-
-static optdesc_t opt_gcse = {
- "gcse",
- IR_GRAPH_STATE_NO_CRITICAL_EDGES |
- IR_GRAPH_STATE_CONSISTENT_OUTS |
- IR_GRAPH_STATE_CONSISTENT_DOMINANCE |
- IR_GRAPH_STATE_CONSISTENT_LOOPINFO,
- do_gcse,
-};
-#endif
-
ir_graph_pass_t *place_code_pass(const char *name)
{
return def_graph_pass(name ? name : "place", place_code_wrapper);