From 4bcee00be98ac55a659f3f866136e4b5ab17dc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Fri, 6 Feb 2015 17:11:24 +0100 Subject: [PATCH] #include cleanups --- libevmjit/Arith256.cpp | 3 +- libevmjit/Arith256.h | 1 - libevmjit/BasicBlock.cpp | 14 +- libevmjit/BasicBlock.h | 3 +- libevmjit/Cache.cpp | 11 +- libevmjit/Cache.h | 4 +- libevmjit/Common.h | 1 - libevmjit/Compiler.cpp | 29 ++-- libevmjit/Compiler.h | 4 - libevmjit/CompilerHelper.cpp | 98 ++++++------ libevmjit/CompilerHelper.h | 153 ++++++++++--------- libevmjit/Endianness.cpp | 76 ++++----- libevmjit/Endianness.h | 49 +++--- libevmjit/ExecStats.h | 4 +- libevmjit/ExecutionEngine.cpp | 15 +- libevmjit/ExecutionEngine.h | 3 +- libevmjit/Ext.cpp | 10 +- libevmjit/Ext.h | 4 +- libevmjit/GasMeter.cpp | 12 +- libevmjit/GasMeter.h | 2 - libevmjit/Instruction.cpp | 4 +- libevmjit/Instruction.h | 1 - libevmjit/Memory.cpp | 15 +- libevmjit/Memory.h | 1 - libevmjit/Runtime.cpp | 6 +- libevmjit/Runtime.h | 4 +- libevmjit/RuntimeData.h | 4 +- libevmjit/RuntimeManager.cpp | 10 +- libevmjit/RuntimeManager.h | 1 - libevmjit/Stack.cpp | 2 - libevmjit/Stack.h | 83 +++++----- libevmjit/Type.cpp | 4 - libevmjit/Type.h | 7 +- libevmjit/Utils.cpp | 1 - libevmjit/Utils.h | 1 - libevmjit/preprocessor/llvm_includes_start.h | 1 + 36 files changed, 296 insertions(+), 345 deletions(-) diff --git a/libevmjit/Arith256.cpp b/libevmjit/Arith256.cpp index a77050adc..6ae62b9d3 100644 --- a/libevmjit/Arith256.cpp +++ b/libevmjit/Arith256.cpp @@ -3,8 +3,9 @@ #include "Type.h" #include "Endianness.h" -#include +#include "preprocessor/llvm_includes_start.h" #include +#include "preprocessor/llvm_includes_end.h" #include diff --git a/libevmjit/Arith256.h b/libevmjit/Arith256.h index 2513ca568..4b94652d8 100644 --- a/libevmjit/Arith256.h +++ b/libevmjit/Arith256.h @@ -1,5 +1,4 @@ #pragma once - #include "CompilerHelper.h" namespace dev diff --git a/libevmjit/BasicBlock.cpp b/libevmjit/BasicBlock.cpp index c71bae94f..112e9d652 100644 --- a/libevmjit/BasicBlock.cpp +++ b/libevmjit/BasicBlock.cpp @@ -1,15 +1,15 @@ - #include "BasicBlock.h" +#include "Type.h" -#include - +#include "preprocessor/llvm_includes_start.h" #include #include #include #include #include +#include "preprocessor/llvm_includes_end.h" -#include "Type.h" +#include namespace dev { @@ -141,7 +141,7 @@ void BasicBlock::synchronizeLocalStack(Stack& _evmStack) auto endIter = m_currentStack.end(); // Update (emit set()) changed values - for (int idx = m_currentStack.size() - 1 - m_tosOffset; + for (int idx = (int)m_currentStack.size() - 1 - m_tosOffset; currIter < endIter && idx >= 0; ++currIter, --idx) { @@ -308,7 +308,7 @@ void BasicBlock::linkLocalStacks(std::vector basicBlocks, llvm::IRB auto& initialStack = bblock.m_initialStack; initialStack.erase(initialStack.begin(), initialStack.begin() + info.inputItems); // Initial stack shrinks, so the size difference grows: - bblock.m_tosOffset += info.inputItems; + bblock.m_tosOffset += (int)info.inputItems; } // We must account for the items that were pushed directly to successor @@ -321,7 +321,7 @@ void BasicBlock::linkLocalStacks(std::vector basicBlocks, llvm::IRB auto& exitStack = bblock.m_currentStack; exitStack.erase(exitStack.end() - info.outputItems, exitStack.end()); - bblock.m_tosOffset -= info.outputItems; + bblock.m_tosOffset -= (int)info.outputItems; // FIXME: Fix types } } diff --git a/libevmjit/BasicBlock.h b/libevmjit/BasicBlock.h index 1be742f9f..0f639602a 100644 --- a/libevmjit/BasicBlock.h +++ b/libevmjit/BasicBlock.h @@ -1,8 +1,7 @@ #pragma once -#include -#include #include "Common.h" #include "Stack.h" +#include namespace dev { diff --git a/libevmjit/Cache.cpp b/libevmjit/Cache.cpp index cad3f2094..64015a820 100644 --- a/libevmjit/Cache.cpp +++ b/libevmjit/Cache.cpp @@ -1,14 +1,17 @@ #include "Cache.h" -#include -#include -#include +#include "ExecutionEngine.h" + +#include "preprocessor/llvm_includes_start.h" #include #include #include #include #include #include -#include "ExecutionEngine.h" +#include "preprocessor/llvm_includes_end.h" + +#include +#include namespace dev { diff --git a/libevmjit/Cache.h b/libevmjit/Cache.h index d7b32c651..18f9237f1 100644 --- a/libevmjit/Cache.h +++ b/libevmjit/Cache.h @@ -1,8 +1,6 @@ #pragma once - -#include #include - +#include namespace dev { diff --git a/libevmjit/Common.h b/libevmjit/Common.h index 62731292f..cd7177e67 100644 --- a/libevmjit/Common.h +++ b/libevmjit/Common.h @@ -1,5 +1,4 @@ #pragma once - #include #include #include diff --git a/libevmjit/Compiler.cpp b/libevmjit/Compiler.cpp index 02e2e920a..9ad53ce3c 100644 --- a/libevmjit/Compiler.cpp +++ b/libevmjit/Compiler.cpp @@ -1,19 +1,4 @@ - #include "Compiler.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - #include "Instruction.h" #include "Type.h" #include "Memory.h" @@ -25,6 +10,20 @@ #include "Arith256.h" #include "RuntimeManager.h" +#include "preprocessor/llvm_includes_start.h" +#include +#include +#include +#include +#include +#include +#include "preprocessor/llvm_includes_end.h" + +#include +#include +#include +#include + namespace dev { namespace eth diff --git a/libevmjit/Compiler.h b/libevmjit/Compiler.h index 89b2f1a8e..30130798c 100644 --- a/libevmjit/Compiler.h +++ b/libevmjit/Compiler.h @@ -1,8 +1,4 @@ - #pragma once - -#include - #include "Common.h" #include "BasicBlock.h" diff --git a/libevmjit/CompilerHelper.cpp b/libevmjit/CompilerHelper.cpp index 9cccecd79..bf2929429 100644 --- a/libevmjit/CompilerHelper.cpp +++ b/libevmjit/CompilerHelper.cpp @@ -1,51 +1,47 @@ - -#include "CompilerHelper.h" - -#include -#include - -#include "RuntimeManager.h" - -namespace dev -{ -namespace eth -{ -namespace jit -{ - -CompilerHelper::CompilerHelper(llvm::IRBuilder<>& _builder) : - m_builder(_builder) -{} - -llvm::Module* CompilerHelper::getModule() -{ - assert(m_builder.GetInsertBlock()); - assert(m_builder.GetInsertBlock()->getParent()); // BB must be in a function - return m_builder.GetInsertBlock()->getParent()->getParent(); -} - -llvm::Function* CompilerHelper::getMainFunction() -{ - // TODO: Rename or change semantics of getMainFunction() function - assert(m_builder.GetInsertBlock()); - auto mainFunc = m_builder.GetInsertBlock()->getParent(); - assert(mainFunc); - if (mainFunc == &mainFunc->getParent()->getFunctionList().front()) // Main function is the first one in module - return mainFunc; - return nullptr; -} - -llvm::CallInst* CompilerHelper::createCall(llvm::Function* _func, std::initializer_list const& _args) -{ - return getBuilder().CreateCall(_func, {_args.begin(), _args.size()}); -} - - -RuntimeHelper::RuntimeHelper(RuntimeManager& _runtimeManager): - CompilerHelper(_runtimeManager.getBuilder()), - m_runtimeManager(_runtimeManager) -{} - -} -} -} +#include "CompilerHelper.h" +#include "RuntimeManager.h" +#include + +namespace dev +{ +namespace eth +{ +namespace jit +{ + +CompilerHelper::CompilerHelper(llvm::IRBuilder<>& _builder) : + m_builder(_builder) +{} + +llvm::Module* CompilerHelper::getModule() +{ + assert(m_builder.GetInsertBlock()); + assert(m_builder.GetInsertBlock()->getParent()); // BB must be in a function + return m_builder.GetInsertBlock()->getParent()->getParent(); +} + +llvm::Function* CompilerHelper::getMainFunction() +{ + // TODO: Rename or change semantics of getMainFunction() function + assert(m_builder.GetInsertBlock()); + auto mainFunc = m_builder.GetInsertBlock()->getParent(); + assert(mainFunc); + if (mainFunc == &mainFunc->getParent()->getFunctionList().front()) // Main function is the first one in module + return mainFunc; + return nullptr; +} + +llvm::CallInst* CompilerHelper::createCall(llvm::Function* _func, std::initializer_list const& _args) +{ + return getBuilder().CreateCall(_func, {_args.begin(), _args.size()}); +} + + +RuntimeHelper::RuntimeHelper(RuntimeManager& _runtimeManager): + CompilerHelper(_runtimeManager.getBuilder()), + m_runtimeManager(_runtimeManager) +{} + +} +} +} diff --git a/libevmjit/CompilerHelper.h b/libevmjit/CompilerHelper.h index 62733ca72..912f7e93f 100644 --- a/libevmjit/CompilerHelper.h +++ b/libevmjit/CompilerHelper.h @@ -1,78 +1,79 @@ +#pragma once -#pragma once - +#include "preprocessor/llvm_includes_start.h" #include - - -namespace dev -{ -namespace eth -{ -namespace jit -{ -class RuntimeManager; - -/// Base class for compiler helpers like Memory, GasMeter, etc. -class CompilerHelper -{ -protected: - CompilerHelper(llvm::IRBuilder<>& _builder); - - CompilerHelper(const CompilerHelper&) = delete; - void operator=(CompilerHelper) = delete; - - /// Reference to the IR module being compiled - llvm::Module* getModule(); - - /// Reference to the main module function - llvm::Function* getMainFunction(); - - /// Reference to parent compiler IR builder - llvm::IRBuilder<>& m_builder; - llvm::IRBuilder<>& getBuilder() { return m_builder; } - - llvm::CallInst* createCall(llvm::Function* _func, std::initializer_list const& _args); - - friend class RuntimeHelper; -}; - - -/// Compiler helper that depends on runtime data -class RuntimeHelper : public CompilerHelper -{ -protected: - RuntimeHelper(RuntimeManager& _runtimeManager); - - RuntimeManager& getRuntimeManager() { return m_runtimeManager; } - -private: - RuntimeManager& m_runtimeManager; -}; - - -/// Saves the insert point of the IR builder and restores it when destructed -struct InsertPointGuard -{ - InsertPointGuard(llvm::IRBuilder<>& _builder) : - m_builder(_builder), - m_insertBB(m_builder.GetInsertBlock()), - m_insertPt(m_builder.GetInsertPoint()) - {} - - InsertPointGuard(const InsertPointGuard&) = delete; - void operator=(InsertPointGuard) = delete; - - ~InsertPointGuard() - { - m_builder.SetInsertPoint(m_insertBB, m_insertPt); - } - -private: - llvm::IRBuilder<>& m_builder; - llvm::BasicBlock* m_insertBB; - llvm::BasicBlock::iterator m_insertPt; -}; - -} -} -} +#include "preprocessor/llvm_includes_end.h" + + +namespace dev +{ +namespace eth +{ +namespace jit +{ +class RuntimeManager; + +/// Base class for compiler helpers like Memory, GasMeter, etc. +class CompilerHelper +{ +protected: + CompilerHelper(llvm::IRBuilder<>& _builder); + + CompilerHelper(const CompilerHelper&) = delete; + CompilerHelper& operator=(CompilerHelper) = delete; + + /// Reference to the IR module being compiled + llvm::Module* getModule(); + + /// Reference to the main module function + llvm::Function* getMainFunction(); + + /// Reference to parent compiler IR builder + llvm::IRBuilder<>& m_builder; + llvm::IRBuilder<>& getBuilder() { return m_builder; } + + llvm::CallInst* createCall(llvm::Function* _func, std::initializer_list const& _args); + + friend class RuntimeHelper; +}; + + +/// Compiler helper that depends on runtime data +class RuntimeHelper : public CompilerHelper +{ +protected: + RuntimeHelper(RuntimeManager& _runtimeManager); + + RuntimeManager& getRuntimeManager() { return m_runtimeManager; } + +private: + RuntimeManager& m_runtimeManager; +}; + + +/// Saves the insert point of the IR builder and restores it when destructed +struct InsertPointGuard +{ + InsertPointGuard(llvm::IRBuilder<>& _builder) : + m_builder(_builder), + m_insertBB(m_builder.GetInsertBlock()), + m_insertPt(m_builder.GetInsertPoint()) + {} + + InsertPointGuard(const InsertPointGuard&) = delete; + void operator=(InsertPointGuard) = delete; + + ~InsertPointGuard() + { + m_builder.SetInsertPoint(m_insertBB, m_insertPt); + } + +private: + llvm::IRBuilder<>& m_builder; + llvm::BasicBlock* m_insertBB; + llvm::BasicBlock::iterator m_insertPt; +}; + +} +} +} diff --git a/libevmjit/Endianness.cpp b/libevmjit/Endianness.cpp index db7edfdc9..f3ee4c783 100644 --- a/libevmjit/Endianness.cpp +++ b/libevmjit/Endianness.cpp @@ -1,38 +1,38 @@ - -#include "Endianness.h" - -#include - -#include "Type.h" - -namespace dev -{ -namespace eth -{ -namespace jit -{ - -llvm::Value* Endianness::bswapIfLE(llvm::IRBuilder<>& _builder, llvm::Value* _word) -{ - union tester - { - unsigned int x; - unsigned char isLE; - }; - - if (tester{1}.isLE) - { - // FIXME: Disabled because of problems with BYTE - //if (auto constant = llvm::dyn_cast(_word)) - // return _builder.getInt(constant->getValue().byteSwap()); - - // OPT: Cache func declaration? - auto bswapFunc = llvm::Intrinsic::getDeclaration(_builder.GetInsertBlock()->getParent()->getParent(), llvm::Intrinsic::bswap, Type::Word); - return _builder.CreateCall(bswapFunc, _word); - } - return _word; -} - -} -} -} +#include "Endianness.h" +#include "Type.h" + +#include "preprocessor/llvm_includes_start.h" +#include +#include "preprocessor/llvm_includes_end.h" + +namespace dev +{ +namespace eth +{ +namespace jit +{ + +llvm::Value* Endianness::bswapIfLE(llvm::IRBuilder<>& _builder, llvm::Value* _word) +{ + union tester + { + unsigned int x; + unsigned char isLE; + }; + + if (tester{1}.isLE) + { + // FIXME: Disabled because of problems with BYTE + //if (auto constant = llvm::dyn_cast(_word)) + // return _builder.getInt(constant->getValue().byteSwap()); + + // OPT: Cache func declaration? + auto bswapFunc = llvm::Intrinsic::getDeclaration(_builder.GetInsertBlock()->getParent()->getParent(), llvm::Intrinsic::bswap, Type::Word); + return _builder.CreateCall(bswapFunc, _word); + } + return _word; +} + +} +} +} diff --git a/libevmjit/Endianness.h b/libevmjit/Endianness.h index 8a1f41085..73224fb21 100644 --- a/libevmjit/Endianness.h +++ b/libevmjit/Endianness.h @@ -1,24 +1,25 @@ - -#pragma once - -#include - -namespace dev -{ -namespace eth -{ -namespace jit -{ - -struct Endianness -{ - static llvm::Value* toBE(llvm::IRBuilder<>& _builder, llvm::Value* _word) { return bswapIfLE(_builder, _word); } - static llvm::Value* toNative(llvm::IRBuilder<>& _builder, llvm::Value* _word) { return bswapIfLE(_builder, _word); } - -private: - static llvm::Value* bswapIfLE(llvm::IRBuilder<>& _builder, llvm::Value* _word); -}; - -} -} -} +#pragma once + +#include "preprocessor/llvm_includes_start.h" +#include +#include "preprocessor/llvm_includes_end.h" + +namespace dev +{ +namespace eth +{ +namespace jit +{ + +struct Endianness +{ + static llvm::Value* toBE(llvm::IRBuilder<>& _builder, llvm::Value* _word) { return bswapIfLE(_builder, _word); } + static llvm::Value* toNative(llvm::IRBuilder<>& _builder, llvm::Value* _word) { return bswapIfLE(_builder, _word); } + +private: + static llvm::Value* bswapIfLE(llvm::IRBuilder<>& _builder, llvm::Value* _word); +}; + +} +} +} diff --git a/libevmjit/ExecStats.h b/libevmjit/ExecStats.h index 284ecad7b..17f58ccac 100644 --- a/libevmjit/ExecStats.h +++ b/libevmjit/ExecStats.h @@ -1,8 +1,6 @@ #pragma once - -#include -#include #include "ExecutionEngine.h" +#include namespace dev { diff --git a/libevmjit/ExecutionEngine.cpp b/libevmjit/ExecutionEngine.cpp index ef62e8441..24ed74f15 100644 --- a/libevmjit/ExecutionEngine.cpp +++ b/libevmjit/ExecutionEngine.cpp @@ -1,7 +1,10 @@ #include "ExecutionEngine.h" +#include "Runtime.h" +#include "Compiler.h" +#include "Cache.h" +#include "ExecStats.h" +#include "BuildInfo.gen.h" -#include -#include // env options #include "preprocessor/llvm_includes_start.h" #include #include @@ -12,12 +15,8 @@ #include #include "preprocessor/llvm_includes_end.h" -#include "Runtime.h" -#include "Compiler.h" -#include "Cache.h" -#include "ExecStats.h" -#include "BuildInfo.gen.h" - +#include +#include // env options #include namespace dev diff --git a/libevmjit/ExecutionEngine.h b/libevmjit/ExecutionEngine.h index 101475b11..a31b6bf1e 100644 --- a/libevmjit/ExecutionEngine.h +++ b/libevmjit/ExecutionEngine.h @@ -1,7 +1,6 @@ #pragma once - -#include #include "RuntimeData.h" +#include namespace dev { diff --git a/libevmjit/Ext.cpp b/libevmjit/Ext.cpp index 0a465bb80..c06d01f74 100644 --- a/libevmjit/Ext.cpp +++ b/libevmjit/Ext.cpp @@ -1,15 +1,13 @@ - #include "Ext.h" - -#include -#include -#include - #include "RuntimeManager.h" #include "Memory.h" #include "Type.h" #include "Endianness.h" +#include "preprocessor/llvm_includes_start.h" +#include +#include "preprocessor/llvm_includes_end.h" + namespace dev { namespace eth diff --git a/libevmjit/Ext.h b/libevmjit/Ext.h index 8ad69ea6e..669797848 100644 --- a/libevmjit/Ext.h +++ b/libevmjit/Ext.h @@ -1,8 +1,6 @@ - #pragma once - -#include #include "CompilerHelper.h" +#include namespace dev { diff --git a/libevmjit/GasMeter.cpp b/libevmjit/GasMeter.cpp index eb06795f0..3f3cf2e04 100644 --- a/libevmjit/GasMeter.cpp +++ b/libevmjit/GasMeter.cpp @@ -1,14 +1,12 @@ - #include "GasMeter.h" - -#include -#include -#include - -#include "Type.h" #include "Ext.h" #include "RuntimeManager.h" +#include "preprocessor/llvm_includes_start.h" +#include +#include "preprocessor/llvm_includes_end.h" + + namespace dev { namespace eth diff --git a/libevmjit/GasMeter.h b/libevmjit/GasMeter.h index 27f55253f..4f29f5c29 100644 --- a/libevmjit/GasMeter.h +++ b/libevmjit/GasMeter.h @@ -1,6 +1,4 @@ - #pragma once - #include "CompilerHelper.h" #include "Instruction.h" diff --git a/libevmjit/Instruction.cpp b/libevmjit/Instruction.cpp index 909121607..f70b020f8 100644 --- a/libevmjit/Instruction.cpp +++ b/libevmjit/Instruction.cpp @@ -1,6 +1,8 @@ - #include "Instruction.h" + +#include "preprocessor/llvm_includes_start.h" #include +#include "preprocessor/llvm_includes_end.h" namespace dev { diff --git a/libevmjit/Instruction.h b/libevmjit/Instruction.h index 6785213d6..db18c934a 100644 --- a/libevmjit/Instruction.h +++ b/libevmjit/Instruction.h @@ -1,5 +1,4 @@ #pragma once - #include "Common.h" namespace llvm diff --git a/libevmjit/Memory.cpp b/libevmjit/Memory.cpp index 6a46fa8ca..e29bbcaba 100644 --- a/libevmjit/Memory.cpp +++ b/libevmjit/Memory.cpp @@ -1,21 +1,14 @@ #include "Memory.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - #include "Type.h" #include "Runtime.h" #include "GasMeter.h" #include "Endianness.h" #include "RuntimeManager.h" +#include "preprocessor/llvm_includes_start.h" +#include +#include "preprocessor/llvm_includes_end.h" + namespace dev { namespace eth diff --git a/libevmjit/Memory.h b/libevmjit/Memory.h index e8edce735..90c01c1ca 100644 --- a/libevmjit/Memory.h +++ b/libevmjit/Memory.h @@ -1,5 +1,4 @@ #pragma once - #include "CompilerHelper.h" namespace dev diff --git a/libevmjit/Runtime.cpp b/libevmjit/Runtime.cpp index eb70e01d1..09ad7854f 100644 --- a/libevmjit/Runtime.cpp +++ b/libevmjit/Runtime.cpp @@ -1,9 +1,5 @@ - #include "Runtime.h" - -#include -#include -#include +#include namespace dev { diff --git a/libevmjit/Runtime.h b/libevmjit/Runtime.h index 20cf56984..31341d7d3 100644 --- a/libevmjit/Runtime.h +++ b/libevmjit/Runtime.h @@ -1,8 +1,6 @@ - #pragma once - -#include #include "RuntimeData.h" +#include namespace dev { diff --git a/libevmjit/RuntimeData.h b/libevmjit/RuntimeData.h index ff6e82fe8..50522f0bc 100644 --- a/libevmjit/RuntimeData.h +++ b/libevmjit/RuntimeData.h @@ -1,7 +1,5 @@ #pragma once - -#include "Utils.h" - +#include "Common.h" namespace dev { diff --git a/libevmjit/RuntimeManager.cpp b/libevmjit/RuntimeManager.cpp index 98386e1fe..7b3db7477 100644 --- a/libevmjit/RuntimeManager.cpp +++ b/libevmjit/RuntimeManager.cpp @@ -1,12 +1,8 @@ - #include "RuntimeManager.h" -#include -#include -#include - -#include "RuntimeData.h" -#include "Instruction.h" +#include "preprocessor/llvm_includes_start.h" +#include +#include "preprocessor/llvm_includes_end.h" namespace dev { diff --git a/libevmjit/RuntimeManager.h b/libevmjit/RuntimeManager.h index b3ce6f997..92c210289 100644 --- a/libevmjit/RuntimeManager.h +++ b/libevmjit/RuntimeManager.h @@ -1,5 +1,4 @@ #pragma once - #include "CompilerHelper.h" #include "Type.h" #include "RuntimeData.h" diff --git a/libevmjit/Stack.cpp b/libevmjit/Stack.cpp index 44f1c21c1..79864f3ca 100644 --- a/libevmjit/Stack.cpp +++ b/libevmjit/Stack.cpp @@ -1,10 +1,8 @@ #include "Stack.h" #include "RuntimeManager.h" #include "Runtime.h" -#include "Type.h" #include -#include namespace dev { diff --git a/libevmjit/Stack.h b/libevmjit/Stack.h index 3e8881e4f..f453d14c0 100644 --- a/libevmjit/Stack.h +++ b/libevmjit/Stack.h @@ -1,43 +1,40 @@ -#pragma once - -#include "CompilerHelper.h" - -#include - -namespace dev -{ -namespace eth -{ -namespace jit -{ -class RuntimeManager; - -class Stack : public CompilerHelper -{ -public: - Stack(llvm::IRBuilder<>& builder, RuntimeManager& runtimeManager); - - llvm::Value* get(size_t _index); - void set(size_t _index, llvm::Value* _value); - void pop(size_t _count); - void push(llvm::Value* _value); - - static size_t maxStackSize; - -private: - RuntimeManager& m_runtimeManager; - - llvm::Function* m_push; - llvm::Function* m_pop; - llvm::Function* m_get; - llvm::Function* m_set; - - llvm::Value* m_arg; -}; - - -} -} -} - - +#pragma once +#include "CompilerHelper.h" + +namespace dev +{ +namespace eth +{ +namespace jit +{ +class RuntimeManager; + +class Stack : public CompilerHelper +{ +public: + Stack(llvm::IRBuilder<>& builder, RuntimeManager& runtimeManager); + + llvm::Value* get(size_t _index); + void set(size_t _index, llvm::Value* _value); + void pop(size_t _count); + void push(llvm::Value* _value); + + static size_t maxStackSize; + +private: + RuntimeManager& m_runtimeManager; + + llvm::Function* m_push; + llvm::Function* m_pop; + llvm::Function* m_get; + llvm::Function* m_set; + + llvm::Value* m_arg; +}; + + +} +} +} + + diff --git a/libevmjit/Type.cpp b/libevmjit/Type.cpp index 2bbb3fa6f..8e2bc13fc 100644 --- a/libevmjit/Type.cpp +++ b/libevmjit/Type.cpp @@ -1,8 +1,4 @@ - #include "Type.h" - -#include - #include "RuntimeManager.h" namespace dev diff --git a/libevmjit/Type.h b/libevmjit/Type.h index e7757abbf..46fd5c9b7 100644 --- a/libevmjit/Type.h +++ b/libevmjit/Type.h @@ -1,9 +1,10 @@ - #pragma once +#include "Common.h" +#include "preprocessor/llvm_includes_start.h" #include -#include -#include "Common.h" +#include +#include "preprocessor/llvm_includes_end.h" namespace dev { diff --git a/libevmjit/Utils.cpp b/libevmjit/Utils.cpp index 5f7f75bfd..bf3bf93b3 100644 --- a/libevmjit/Utils.cpp +++ b/libevmjit/Utils.cpp @@ -1,4 +1,3 @@ - #include "Utils.h" namespace dev diff --git a/libevmjit/Utils.h b/libevmjit/Utils.h index 1e6705667..652c7bc35 100644 --- a/libevmjit/Utils.h +++ b/libevmjit/Utils.h @@ -1,5 +1,4 @@ #pragma once - #include "Common.h" namespace dev diff --git a/libevmjit/preprocessor/llvm_includes_start.h b/libevmjit/preprocessor/llvm_includes_start.h index 6600886f4..264a6e1ef 100644 --- a/libevmjit/preprocessor/llvm_includes_start.h +++ b/libevmjit/preprocessor/llvm_includes_start.h @@ -1,4 +1,5 @@ #pragma warning(push) +#pragma warning(disable: 4267 4244 4800) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter"