diff options
author | chriseth <chris@ethereum.org> | 2018-10-29 22:12:02 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-11-08 02:30:27 +0800 |
commit | 674e17c2a895eff6729357d8c10db709ac368b79 (patch) | |
tree | 300a55700b068709f36340563db1b43e5b8b1188 /libyul/optimiser/RedundantAssignEliminator.h | |
parent | 0a96f091ab63e8d77106e00590a442c59714eecb (diff) | |
download | dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.gz dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.bz2 dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.lz dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.xz dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.zst dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.zip |
Performance: Replace string by special single-copy YulString class.
Diffstat (limited to 'libyul/optimiser/RedundantAssignEliminator.h')
-rw-r--r-- | libyul/optimiser/RedundantAssignEliminator.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libyul/optimiser/RedundantAssignEliminator.h b/libyul/optimiser/RedundantAssignEliminator.h index 52092138..805a1f63 100644 --- a/libyul/optimiser/RedundantAssignEliminator.h +++ b/libyul/optimiser/RedundantAssignEliminator.h @@ -125,9 +125,9 @@ private: public: enum Value { Unused, Undecided, Used }; State(Value _value = Undecided): m_value(_value) {} - bool operator==(State _other) const { return m_value == _other.m_value; } - bool operator!=(State _other) const { return !operator==(_other); } - void join(State _other) + inline bool operator==(State _other) const { return m_value == _other.m_value; } + inline bool operator!=(State _other) const { return !operator==(_other); } + inline void join(State const& _other) { // Using "max" works here because of the order of the values in the enum. m_value = Value(std::max(int(_other.m_value), int(m_value))); @@ -156,17 +156,18 @@ private: private: RedundantAssignEliminator& m_rae; - std::set<std::string> m_outerDeclaredVariables; + std::set<YulString> m_outerDeclaredVariables; }; /// Joins the assignment mapping with @a _other according to the rules laid out /// above. /// Will destroy @a _other. void join(RedundantAssignEliminator& _other); - void changeUndecidedTo(std::string const& _variable, State _newState); + void changeUndecidedTo(YulString _variable, State _newState); - std::set<std::string> m_declaredVariables; - std::map<std::string, std::map<Assignment const*, State>> m_assignments; + std::set<YulString> m_declaredVariables; + // TODO check that this does not cause nondeterminism! + std::map<YulString, std::map<Assignment const*, State>> m_assignments; }; class AssignmentRemover: public ASTModifier |