diff --git a/libevmjit/BasicBlock.cpp b/libevmjit/BasicBlock.cpp index 7371ed54b..d233ea744 100644 --- a/libevmjit/BasicBlock.cpp +++ b/libevmjit/BasicBlock.cpp @@ -3,17 +3,12 @@ #include +#include #include #include #include #include -#if defined(LLVM_VERSION_PATCH) // Correct llvm-3.5 -#include -#else // Ubuntu 14.04 crap -#include -#endif - #include "Type.h" namespace dev diff --git a/libevmjit/Compiler.cpp b/libevmjit/Compiler.cpp index 3cbce715b..20b17e9fe 100644 --- a/libevmjit/Compiler.cpp +++ b/libevmjit/Compiler.cpp @@ -8,18 +8,13 @@ #include #include +#include #include #include #include #include -#if defined(LLVM_VERSION_PATCH) // Correct llvm-3.5 -#include -#else // Ubuntu 14.04 crap -#include -#endif - #include "Instruction.h" #include "Type.h" #include "Memory.h" @@ -486,7 +481,7 @@ void Compiler::compileBasicBlock(BasicBlock& _basicBlock, bytes const& _bytecode auto idx = stack.pop(); auto word = stack.pop(); - auto k32_ = m_builder.CreateTrunc(idx, llvm::IntegerType::get(m_builder.getContext(), 5), "k_32"); + auto k32_ = m_builder.CreateTrunc(idx, m_builder.getIntNTy(5), "k_32"); auto k32 = m_builder.CreateZExt(k32_, Type::Word); auto k32x8 = m_builder.CreateMul(k32, Constant::get(8), "kx8"); diff --git a/libevmjit/ExecutionEngine.cpp b/libevmjit/ExecutionEngine.cpp index bdba78129..162851ae8 100644 --- a/libevmjit/ExecutionEngine.cpp +++ b/libevmjit/ExecutionEngine.cpp @@ -63,10 +63,8 @@ ReturnCode ExecutionEngine::run(std::unique_ptr _module, RuntimeDa builder.setOptLevel(llvm::CodeGenOpt::None); auto triple = llvm::Triple(llvm::sys::getProcessTriple()); - #if defined(LLVM_VERSION_PATCH) // Not available in llvm-3.5-dev on Ubuntu 14.04 if (triple.getOS() == llvm::Triple::OSType::Win32) triple.setObjectFormat(llvm::Triple::ObjectFormatType::ELF); // MCJIT does not support COFF format - #endif _module->setTargetTriple(triple.str()); ExecBundle exec; diff --git a/libevmjit/Ext.cpp b/libevmjit/Ext.cpp index d51aa4458..139255a6a 100644 --- a/libevmjit/Ext.cpp +++ b/libevmjit/Ext.cpp @@ -27,7 +27,7 @@ Ext::Ext(RuntimeManager& _runtimeManager, Memory& _memoryMan): auto&& ctx = m_builder.getContext(); auto module = getModule(); - auto i256Ty = Type::Word; + auto i256Ty = m_builder.getIntNTy(256); m_args[0] = m_builder.CreateAlloca(i256Ty, nullptr, "ext.index"); m_args[1] = m_builder.CreateAlloca(i256Ty, nullptr, "ext.value"); diff --git a/libevmjit/Memory.cpp b/libevmjit/Memory.cpp index fa95b90b9..116840684 100644 --- a/libevmjit/Memory.cpp +++ b/libevmjit/Memory.cpp @@ -42,7 +42,7 @@ Memory::Memory(RuntimeManager& _runtimeManager, GasMeter& _gasMeter): llvm::Type* resizeArgs[] = {Type::RuntimePtr, Type::WordPtr}; m_resize = llvm::Function::Create(llvm::FunctionType::get(Type::BytePtr, resizeArgs, false), llvm::Function::ExternalLinkage, "mem_resize", module); llvm::AttrBuilder attrBuilder; - attrBuilder.addAttribute(llvm::Attribute::NoAlias).addAttribute(llvm::Attribute::NoCapture).addAttribute(llvm::Attribute::ReadOnly); + attrBuilder.addAttribute(llvm::Attribute::NoAlias).addAttribute(llvm::Attribute::NoCapture).addAttribute(llvm::Attribute::NonNull).addAttribute(llvm::Attribute::ReadOnly); m_resize->setAttributes(llvm::AttributeSet::get(m_resize->getContext(), 1, attrBuilder)); m_require = createRequireFunc(_gasMeter, _runtimeManager);