diff options
author | chriseth <c@ethdev.com> | 2015-04-30 20:41:55 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-05-06 17:10:42 +0800 |
commit | 867101e40981db56d8b72fd363e4f9e376991284 (patch) | |
tree | ba4dc55d57bf0c90960fb0755e273ca86a42c0b1 /KnownState.cpp | |
parent | 3ebb7d99c4e24d7bc963c419790c9f0081cc47a1 (diff) | |
download | dexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.tar.gz dexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.tar.zst dexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.zip |
Common subexpression elimination ready for using pre-known state.
Diffstat (limited to 'KnownState.cpp')
-rw-r--r-- | KnownState.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/KnownState.cpp b/KnownState.cpp index e83810d4..02c6ee13 100644 --- a/KnownState.cpp +++ b/KnownState.cpp @@ -135,8 +135,10 @@ ExpressionClasses::Id KnownState::stackElement(int _stackHeight, SourceLocation { if (m_stackElements.count(_stackHeight)) return m_stackElements.at(_stackHeight); - // Stack element not found (not assigned yet), create new equivalence class. - return m_stackElements[_stackHeight] = m_expressionClasses->newId(); + // Stack element not found (not assigned yet), create new unknown equivalence class. + //@todo check that we do not infer incorrect equivalences when the stack is cleared partially + //in between. + return m_stackElements[_stackHeight] = initialStackElement(_stackHeight, _location); } ExpressionClasses::Id KnownState::initialStackElement( @@ -144,10 +146,8 @@ ExpressionClasses::Id KnownState::initialStackElement( SourceLocation const& _location ) { - assertThrow(_stackHeight <= 0, OptimizerException, "Initial stack element of positive height requested."); - assertThrow(_stackHeight > -16, StackTooDeepException, ""); // This is a special assembly item that refers to elements pre-existing on the initial stack. - return m_expressionClasses->find(AssemblyItem(dupInstruction(1 - _stackHeight), _location)); + return m_expressionClasses->find(AssemblyItem(UndefinedItem, u256(_stackHeight), _location)); } void KnownState::setStackElement(int _stackHeight, Id _class) |