aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-11-11 21:11:07 +0800
committerchriseth <c@ethdev.com>2016-11-16 21:37:19 +0800
commit0335ed4cb476ece63224a96c8ab660116ff08c3a (patch)
tree6579706bb8da1e8b84e05dc95775bfca5076cc7c /libsolidity/codegen
parent22b4d1b29a17c6a6360d6d6e42860bd621a7bfd3 (diff)
downloaddexon-solidity-0335ed4cb476ece63224a96c8ab660116ff08c3a.tar.gz
dexon-solidity-0335ed4cb476ece63224a96c8ab660116ff08c3a.tar.zst
dexon-solidity-0335ed4cb476ece63224a96c8ab660116ff08c3a.zip
Simple peephole optimizer that is activated even if not requested.
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r--libsolidity/codegen/Compiler.cpp6
-rw-r--r--libsolidity/codegen/CompilerContext.h2
2 files changed, 3 insertions, 5 deletions
diff --git a/libsolidity/codegen/Compiler.cpp b/libsolidity/codegen/Compiler.cpp
index eefa50c5..54639515 100644
--- a/libsolidity/codegen/Compiler.cpp
+++ b/libsolidity/codegen/Compiler.cpp
@@ -41,8 +41,7 @@ void Compiler::compileContract(
ContractCompiler creationCompiler(&runtimeCompiler, m_context, m_optimize);
m_runtimeSub = creationCompiler.compileConstructor(_contract, _contracts);
- if (m_optimize)
- m_context.optimise(m_optimizeRuns);
+ m_context.optimise(m_optimize, m_optimizeRuns);
if (_contract.isLibrary())
{
@@ -60,8 +59,7 @@ void Compiler::compileClone(
ContractCompiler cloneCompiler(&runtimeCompiler, m_context, m_optimize);
m_runtimeSub = cloneCompiler.compileClone(_contract, _contracts);
- if (m_optimize)
- m_context.optimise(m_optimizeRuns);
+ m_context.optimise(m_optimize, m_optimizeRuns);
}
eth::AssemblyItem Compiler::functionEntryLabel(FunctionDefinition const& _function) const
diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h
index ee3fb068..8ccbddfd 100644
--- a/libsolidity/codegen/CompilerContext.h
+++ b/libsolidity/codegen/CompilerContext.h
@@ -155,7 +155,7 @@ public:
/// Prepends "PUSH <compiler version number> POP"
void injectVersionStampIntoSub(size_t _subIndex);
- void optimise(unsigned _runs = 200) { m_asm->optimise(true, true, _runs); }
+ void optimise(bool _fullOptimsation, unsigned _runs = 200) { m_asm->optimise(_fullOptimsation, true, _runs); }
/// @returns the runtime context if in creation mode and runtime context is set, nullptr otherwise.
CompilerContext* runtimeContext() { return m_runtimeContext; }