mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Introduce LiteralRematerializer and thus simplify StructuralSimplifier.
This commit is contained in:
@@ -71,9 +71,9 @@ void Rematerialiser::visit(Expression& _e)
|
||||
if (_e.type() == typeid(Identifier))
|
||||
{
|
||||
Identifier& identifier = boost::get<Identifier>(_e);
|
||||
if (m_value.count(identifier.name))
|
||||
YulString name = identifier.name;
|
||||
if (m_value.count(name))
|
||||
{
|
||||
YulString name = identifier.name;
|
||||
assertThrow(m_value.at(name), OptimizerException, "");
|
||||
auto const& value = *m_value.at(name);
|
||||
size_t refs = m_referenceCounts[name];
|
||||
@@ -93,3 +93,20 @@ void Rematerialiser::visit(Expression& _e)
|
||||
}
|
||||
DataFlowAnalyzer::visit(_e);
|
||||
}
|
||||
|
||||
void LiteralRematerialiser::visit(Expression& _e)
|
||||
{
|
||||
if (_e.type() == typeid(Identifier))
|
||||
{
|
||||
Identifier& identifier = boost::get<Identifier>(_e);
|
||||
YulString name = identifier.name;
|
||||
if (m_value.count(name))
|
||||
{
|
||||
Expression const* value = m_value.at(name);
|
||||
assertThrow(value, OptimizerException, "");
|
||||
if (value->type() == typeid(Literal))
|
||||
_e = *value;
|
||||
}
|
||||
}
|
||||
DataFlowAnalyzer::visit(_e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user