* @param irg The graph to be optimized.
*
* After applying local_optimize_graph() to a IR-graph, Bad nodes
- * only occure as predecessor of Block and Phi nodes.
+ * only occur as predecessor of Block and Phi nodes.
*/
void local_optimize_graph(ir_graph *irg);
/** Applies local optimizations (see iropt.h) to all nodes in the graph.
*
- * @param irg The graph to be optimized.
+ * After applying optimize_graph_df() to a IR-graph, Bad nodes
+ * only occur as predecessor of Block and Phi nodes.
*
- * After applying local_optimize_graph() to a IR-graph, Bad nodes
- * only occure as predecessor of Block and Phi nodes.
+ * This version uses fixpoint iteration.
+ *
+ * @param irg The graph to be optimized.
*
- * This version used a fixpoint iteration.
+ * @return non-zero if the optimization could be applied, 0 else
*/
-void optimize_graph_df(ir_graph *irg);
+int optimize_graph_df(ir_graph *irg);
/** Performs dead node elimination by copying the ir graph to a new obstack.
*
* Try to reduce the number of conv nodes in the given ir graph.
*
* @param irg the graph
+ *
+ * @return non-zero if the optimization could be applied, 0 else
*/
-void conv_opt(ir_graph *irg);
+int conv_opt(ir_graph *irg);
/**
* Do the scalar replacement optimization.
*
* Store after Load: A Store after a Load is removed, if the
* Store doesn't have an exception handler.
+ *
+ * @return non-zero if the optimization could be applied, 0 else
*/
-void optimize_load_store(ir_graph *irg);
+int optimize_load_store(ir_graph *irg);
/**
* Do Loop unrolling in the given graph.
* See Muchnik 12.3.1 Algebraic Simplification and Reassociation of
* Addressing Expressions.
*
- *
+ * @return non-zero if the optimization could be applied, 0 else
*/
-void optimize_reassociation(ir_graph *irg);
+int optimize_reassociation(ir_graph *irg);
/**
* Normalize the Returns of a graph by creating a new End block
}
/* Applies local optimizations to all nodes in the graph until fixpoint. */
-void optimize_graph_df(ir_graph *irg) {
+int optimize_graph_df(ir_graph *irg) {
pdeq *waitq = new_pdeq();
ir_graph *rem = current_ir_graph;
ir_node *end;
- int i, state, n_ka;
+ int i, state, n_ka, changed;
current_ir_graph = irg;
set_irg_visited(current_ir_graph, get_irg_visited(irg) - 1);
irg_walk(get_irg_end(irg), NULL, opt_walker, waitq);
+ /* any optimized nodes are stored in the wait queue,
+ * so if it's not empty, the graph has been changed */
+ changed = !pdeq_empty(waitq);
+
/* finish the wait queue */
while (! pdeq_empty(waitq)) {
ir_node *n = pdeq_getl(waitq);
edges_deactivate(irg);
current_ir_graph = rem;
+ return changed;
}
}
}
-void conv_opt(ir_graph *irg)
+int conv_opt(ir_graph *irg)
{
char invalidate = 0;
FIRM_DBG_REGISTER(dbg, "firm.opt.conv");
if (invalidate) {
set_irg_outs_inconsistent(irg);
}
+ return invalidate;
}
/*
* do the load store optimization
*/
-void optimize_load_store(ir_graph *irg) {
+int optimize_load_store(ir_graph *irg) {
walk_env_t env;
FIRM_DBG_REGISTER(dbg, "firm.opt.ldstopt");
have Bad() predecessors. */
set_irg_doms_inconsistent(irg);
}
+ return (int) env.changes;
} /* optimize_load_store */
/*
* do the reassociation
*/
-void optimize_reassociation(ir_graph *irg)
+int optimize_reassociation(ir_graph *irg)
{
walker_t env;
irg_loopinfo_state state;
del_waitq(env.wq);
current_ir_graph = rem;
+ return env.changes;
} /* optimize_reassociation */
/* Sets the default reassociation operation for an ir_op_ops. */
/>
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\ir\adt\array_t.h"
+ >
+ </File>
<File
RelativePath="..\ir\adt\bipartite.c"
>
/>
</FileConfiguration>
</File>
- <File
- RelativePath="..\ir\ir\irflag_t.def"
- >
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="DebugJTEST|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
<File
RelativePath="..\ir\ir\irflag_t.h"
>