aboutsummaryrefslogtreecommitdiffstats
path: root/Assembly.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-01 18:32:59 +0800
committerchriseth <c@ethdev.com>2015-06-05 23:34:26 +0800
commit88096c2c694983da327fd0fc46c31dc6f7404f73 (patch)
treefb84765bb8ab726354bf9c4d44d152008ec2c530 /Assembly.cpp
parentd309c3c76827606c4cabd5660035df394a16b601 (diff)
downloaddexon-solidity-88096c2c694983da327fd0fc46c31dc6f7404f73.tar.gz
dexon-solidity-88096c2c694983da327fd0fc46c31dc6f7404f73.tar.zst
dexon-solidity-88096c2c694983da327fd0fc46c31dc6f7404f73.zip
Compute constants
Diffstat (limited to 'Assembly.cpp')
-rw-r--r--Assembly.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/Assembly.cpp b/Assembly.cpp
index a9ee9619..8642824f 100644
--- a/Assembly.cpp
+++ b/Assembly.cpp
@@ -22,9 +22,12 @@
#include "Assembly.h"
#include <fstream>
#include <libdevcore/Log.h>
+#include <libevmcore/Params.h>
#include <libevmasm/CommonSubexpressionEliminator.h>
#include <libevmasm/ControlFlowGraph.h>
#include <libevmasm/BlockDeduplicator.h>
+#include <libevmasm/ConstantOptimiser.h>
+#include <libevmasm/GasMeter.h>
#include <json/json.h>
using namespace std;
using namespace dev;
@@ -302,7 +305,7 @@ inline bool matches(AssemblyItemsConstRef _a, AssemblyItemsConstRef _b)
struct OptimiserChannel: public LogChannel { static const char* name() { return "OPT"; } static const int verbosity = 12; };
#define copt dev::LogOutputStream<OptimiserChannel, true>()
-Assembly& Assembly::optimise(bool _enable)
+Assembly& Assembly::optimise(bool _enable, bool _isCreation, size_t _runs)
{
if (!_enable)
return *this;
@@ -364,10 +367,17 @@ Assembly& Assembly::optimise(bool _enable)
}
}
+ total += ConstantOptimisationMethod::optimiseConstants(
+ _isCreation,
+ _isCreation ? 1 : _runs,
+ *this,
+ m_items
+ );
+
copt << total << " optimisations done.";
for (auto& sub: m_subs)
- sub.optimise(true);
+ sub.optimise(true, false, _runs);
return *this;
}