aboutsummaryrefslogtreecommitdiffstats
path: root/CommonSubexpressionEliminator.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-04-30 20:41:55 +0800
committerchriseth <c@ethdev.com>2015-05-06 17:10:42 +0800
commit867101e40981db56d8b72fd363e4f9e376991284 (patch)
treeba4dc55d57bf0c90960fb0755e273ca86a42c0b1 /CommonSubexpressionEliminator.h
parent3ebb7d99c4e24d7bc963c419790c9f0081cc47a1 (diff)
downloaddexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.tar
dexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.tar.gz
dexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.tar.bz2
dexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.tar.lz
dexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.tar.xz
dexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.tar.zst
dexon-solidity-867101e40981db56d8b72fd363e4f9e376991284.zip
Common subexpression elimination ready for using pre-known state.
Diffstat (limited to 'CommonSubexpressionEliminator.h')
-rw-r--r--CommonSubexpressionEliminator.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/CommonSubexpressionEliminator.h b/CommonSubexpressionEliminator.h
index 2ed92640..6e1ba40b 100644
--- a/CommonSubexpressionEliminator.h
+++ b/CommonSubexpressionEliminator.h
@@ -61,7 +61,7 @@ public:
using Id = ExpressionClasses::Id;
using StoreOperation = KnownState::StoreOperation;
- CommonSubexpressionEliminator(KnownState const& _state): m_state(_state) {}
+ CommonSubexpressionEliminator(KnownState const& _state): m_initialState(_state), m_state(_state) {}
/// Feeds AssemblyItems into the eliminator and @returns the iterator pointing at the first
/// item that must be fed into a new instance of the eliminator.
@@ -85,6 +85,7 @@ private:
/// Tries to optimize the item that breaks the basic block at the end.
void optimizeBreakingItem();
+ KnownState m_initialState;
KnownState m_state;
/// Keeps information about which storage or memory slots were written to at which sequence
/// number with what instruction.
@@ -115,6 +116,7 @@ public:
/// @param _targetStackContents final contents of the stack, by stack height relative to initial
/// @note should only be called once on each object.
AssemblyItems generateCode(
+ int _initialStackHeight,
std::map<int, Id> const& _initialStack,
std::map<int, Id> const& _targetStackContents
);
@@ -150,7 +152,7 @@ private:
AssemblyItems m_generatedItems;
/// Current height of the stack relative to the start.
- int m_stackHeight = 0;
+ int m_stackHeight;
/// If (b, a) is in m_requests then b is needed to compute a.
std::multimap<Id, Id> m_neededBy;
/// Current content of the stack.