Only analyze memory in DataFlowAnalyzer if it is needed in the optimizer step.

This commit is contained in:
chriseth
2022-07-11 15:51:25 +02:00
parent e7c5f04464
commit c12d151834
9 changed files with 56 additions and 37 deletions
+4
View File
@@ -81,12 +81,14 @@ struct AssignedValue
class DataFlowAnalyzer: public ASTModifier
{
public:
enum class MemoryAndStorage { Analyze, Ignore };
/// @param _functionSideEffects
/// Side-effects of user-defined functions. Worst-case side-effects are assumed
/// if this is not provided or the function is not found.
/// The parameter is mostly used to determine movability of expressions.
explicit DataFlowAnalyzer(
Dialect const& _dialect,
MemoryAndStorage _analyzeStores,
std::map<YulString, SideEffects> _functionSideEffects = {}
);
@@ -189,6 +191,8 @@ private:
protected:
KnowledgeBase m_knowledgeBase;
/// If true, analyzes memory and storage content via mload/mstore and sload/sstore.
bool m_analyzeStores = true;
YulString m_storeFunctionName[static_cast<unsigned>(StoreLoadLocation::Last) + 1];
YulString m_loadFunctionName[static_cast<unsigned>(StoreLoadLocation::Last) + 1];