mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
syn eq
This commit is contained in:
parent
ad33e295bb
commit
8c18193e82
@ -133,8 +133,3 @@ void CommonSubexpressionEliminator::assignValue(YulString _variable, Expression
|
||||
m_replacementCandidates[*_value].insert(_variable);
|
||||
DataFlowAnalyzer::assignValue(_variable, _value);
|
||||
}
|
||||
|
||||
bool CommonSubexpressionEliminator::ExpressionEqual::operator()(Expression const& _a, Expression const& _b) const
|
||||
{
|
||||
return SyntacticallyEqual{}(_a, _b);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <libyul/optimiser/DataFlowAnalyzer.h>
|
||||
#include <libyul/optimiser/OptimiserStep.h>
|
||||
#include <libyul/optimiser/SyntacticalEquality.h>
|
||||
#include <libyul/optimiser/BlockHasher.h>
|
||||
|
||||
#include <set>
|
||||
@ -61,15 +62,12 @@ protected:
|
||||
|
||||
void assignValue(YulString _variable, Expression const* _value) override;
|
||||
private:
|
||||
struct ExpressionEqual {
|
||||
bool operator()(Expression const&, Expression const&) const;
|
||||
};
|
||||
std::set<YulString> m_returnVariables;
|
||||
std::unordered_map<
|
||||
std::reference_wrapper<Expression const>,
|
||||
std::set<YulString>,
|
||||
ExpressionHash,
|
||||
ExpressionEqual
|
||||
SyntacticallyEqualCallable
|
||||
> m_replacementCandidates;
|
||||
};
|
||||
|
||||
|
@ -85,4 +85,23 @@ private:
|
||||
std::map<YulString, std::size_t> m_identifiersRHS;
|
||||
};
|
||||
|
||||
/**
|
||||
* Does the same as SyntacticallyEqual just that the operator() function is const.
|
||||
*/
|
||||
struct SyntacticallyEqualCallable
|
||||
{
|
||||
bool operator()(Expression const& _lhs, Expression const& _rhs) const
|
||||
{
|
||||
(void)_lhs;
|
||||
(void)_rhs;
|
||||
return true;//SyntacticallyEqual{}(_lhs, _rhs);
|
||||
}
|
||||
// bool operator()(Statement const& _lhs, Statement const& _rhs) const
|
||||
// {
|
||||
// (void)_lhs;
|
||||
// (void)_rhs;
|
||||
// return true;//SyntacticallyEqual{}(_lhs, _rhs);
|
||||
// }
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user