Commit cd54f7ca authored by Moritz Kroll's avatar Moritz Kroll
Browse files

Let some optimizations return non-zero, if they changed something (for...

Let some optimizations return non-zero, if they changed something (for fixpoint iteration). Updated Visual Studio project.

[r22486]
parent 51071bf6
......@@ -39,20 +39,22 @@ void local_optimize_node(ir_node *n);
* @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.
*
......
......@@ -63,8 +63,10 @@ void opt_bool(ir_graph *irg);
* 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.
......@@ -235,8 +237,10 @@ ir_node *can_replace_load_by_const(const ir_node *load, ir_node *c);
*
* 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.
......@@ -372,9 +376,9 @@ void proc_cloning(float threshold);
* 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
......
......@@ -166,11 +166,11 @@ static void opt_walker(ir_node *n, void *env) {
}
/* 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;
......@@ -220,6 +220,10 @@ void optimize_graph_df(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);
......@@ -235,4 +239,5 @@ void optimize_graph_df(ir_graph *irg) {
edges_deactivate(irg);
current_ir_graph = rem;
return changed;
}
......@@ -274,7 +274,7 @@ void conv_opt_walker(ir_node *node, void *data)
}
}
void conv_opt(ir_graph *irg)
int conv_opt(ir_graph *irg)
{
char invalidate = 0;
FIRM_DBG_REGISTER(dbg, "firm.opt.conv");
......@@ -292,4 +292,5 @@ void conv_opt(ir_graph *irg)
if (invalidate) {
set_irg_outs_inconsistent(irg);
}
return invalidate;
}
......@@ -2211,7 +2211,7 @@ static int optimize_loops(ir_graph *irg) {
/*
* 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");
......@@ -2258,4 +2258,5 @@ void optimize_load_store(ir_graph *irg) {
have Bad() predecessors. */
set_irg_doms_inconsistent(irg);
}
return (int) env.changes;
} /* optimize_load_store */
......@@ -872,7 +872,7 @@ static void reverse_rules(ir_node *node, void *env) {
/*
* do the reassociation
*/
void optimize_reassociation(ir_graph *irg)
int optimize_reassociation(ir_graph *irg)
{
walker_t env;
irg_loopinfo_state state;
......@@ -931,6 +931,7 @@ void optimize_reassociation(ir_graph *irg)
del_waitq(env.wq);
current_ir_graph = rem;
return env.changes;
} /* optimize_reassociation */
/* Sets the default reassociation operation for an ir_op_ops. */
......
......@@ -322,6 +322,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\ir\adt\array_t.h"
>
</File>
<File
RelativePath="..\ir\adt\bipartite.c"
>
......@@ -4469,34 +4473,6 @@
/>
</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"
>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment