Introduce LiteralRematerializer and thus simplify StructuralSimplifier.

This commit is contained in:
chriseth
2019-09-11 19:50:24 +02:00
parent a064e0fc97
commit fcfe829534
10 changed files with 152 additions and 145 deletions
+21
View File
@@ -68,4 +68,25 @@ protected:
std::set<YulString> m_varsToAlwaysRematerialize;
};
/**
* If a variable is referenced that is known to have a literal
* value at that point, replace it by a literal.
*
* This is mostly used so that other components do not have to rely
* on the data flow analyzer.
*
* Prerequisite: Disambiguator, ForLoopInitRewriter.
*/
class LiteralRematerialiser: public DataFlowAnalyzer
{
public:
LiteralRematerialiser(Dialect const& _dialect):
DataFlowAnalyzer(_dialect)
{}
using ASTModifier::visit;
void visit(Expression& _e) override;
};
}