Commit 08a13f9e authored by Arthur Bit-Monnot's avatar Arthur Bit-Monnot

Optimize in a single pass after AST is constructed.

parent d4b03d5f
......@@ -126,10 +126,8 @@ object SatisfactionProblem {
and(value.valid, implies(condition.present, and(condition.value, condition.valid)))
)
}
if(optimize)
IR(optimizer(value1), optimizer(present1), optimizer(valid1))
else
IR(value1, present1, valid1)
IR(value1, present1, valid1)
}
def optimizer(tot: Fix[Total]): Fix[Total] =
......@@ -141,8 +139,10 @@ object SatisfactionProblem {
val ir = Recursion.hylo(coalgebra, compiler(optimize = optimize))(root)
// println(Algebras.format(ir.valid))
ir.valid
if(optimize)
optimizer(ir.valid)
else
ir.valid
}
}
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