From 52fbe7dbfd57f4e884992b6596d54aadb070bd41 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 27 May 2014 14:02:15 +0200 Subject: [PATCH] Start of pinhole optimiser. Minor fix for debugger. --- Assembly.cpp | 2 ++ Assembly.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Assembly.cpp b/Assembly.cpp index 3614bfc48..aebe71850 100644 --- a/Assembly.cpp +++ b/Assembly.cpp @@ -144,6 +144,8 @@ AssemblyItem const& Assembly::append(AssemblyItem const& _i) void Assembly::optimise() { + std::vector, function< vector(vector) > >> rules; +// rules.insert(make_pair({(int)Instruction::ADD, (int)Instruction::ADD, -(int)Push}, []() {})); } bytes Assembly::assemble() const diff --git a/Assembly.h b/Assembly.h index 26392d141..5194d23fa 100644 --- a/Assembly.h +++ b/Assembly.h @@ -51,11 +51,15 @@ public: int deposit() const; + bool operator==(int _mask) const { return -_mask == (int)m_type || (m_type == Operation && _mask == (int)m_data); } + private: AssemblyItemType m_type; u256 m_data; }; +inline bool operator==(int _i, AssemblyItem _ai) { return _ai.operator==(_i); } + class Assembly { public: