Commit a1daf895 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

iropt: Factorise common code.

parent 96b4cd58
...@@ -7493,6 +7493,15 @@ static ir_node *transform_node_Store(ir_node *n) ...@@ -7493,6 +7493,15 @@ static ir_node *transform_node_Store(ir_node *n)
return n; return n;
} }
static bool always_optimize(unsigned const iro)
{
return
iro == iro_Block ||
iro == iro_Id ||
iro == iro_Phi ||
iro == iro_Proj;
}
/** /**
* Tries several [inplace] [optimizing] transformations and returns an * Tries several [inplace] [optimizing] transformations and returns an
* equivalent node. The difference to equivalent_node() is that these * equivalent node. The difference to equivalent_node() is that these
...@@ -7539,11 +7548,7 @@ restart:; ...@@ -7539,11 +7548,7 @@ restart:;
} }
/* remove unnecessary nodes */ /* remove unnecessary nodes */
if (get_opt_constant_folding() || if (get_opt_constant_folding() || always_optimize(iro)) {
(iro == iro_Phi) || /* always optimize these nodes. */
(iro == iro_Id) || /* ... */
(iro == iro_Proj) || /* ... */
(iro == iro_Block)) { /* Flags tested local. */
n = equivalent_node(n); n = equivalent_node(n);
if (n != old_n) if (n != old_n)
goto restart; goto restart;
...@@ -7875,11 +7880,7 @@ ir_node *optimize_node(ir_node *n) ...@@ -7875,11 +7880,7 @@ ir_node *optimize_node(ir_node *n)
} }
/* remove unnecessary nodes */ /* remove unnecessary nodes */
if (get_opt_algebraic_simplification() || if (get_opt_algebraic_simplification() || always_optimize(iro))
(iro == iro_Phi) || /* always optimize these nodes. */
(iro == iro_Id) ||
(iro == iro_Proj) ||
(iro == iro_Block) ) /* Flags tested local. */
n = equivalent_node(n); n = equivalent_node(n);
/* Common Subexpression Elimination. /* Common Subexpression Elimination.
......
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