diff options
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r-- | src/llvm.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp index e606062..e4d7c07 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -25,6 +25,7 @@ #include <map> #include <sstream> #include <boost/format.hpp> +#include "llvm/Value.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Assembly/AsmAnnotationWriter.h" #include "llvm/DerivedTypes.h" @@ -33,8 +34,8 @@ #include "llvm/Instructions.h" #include "llvm/LLVMContext.h" #include "llvm/Module.h" -#include "llvm/ModuleProvider.h" #include "llvm/PassManager.h" +#include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/IRBuilder.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetSelect.h" @@ -55,9 +56,8 @@ struct LLVMEngine : public Engine { { InitializeNativeTarget(); module = new Module("resp", context); - emp = new ExistingModuleProvider(module); engine = EngineBuilder(module).create(); - opt = new FunctionPassManager(emp); + opt = new FunctionPassManager(module); // Set up optimiser pipeline const TargetData* target = engine->getTargetData(); @@ -76,10 +76,8 @@ struct LLVMEngine : public Engine { ~LLVMEngine() { - emp->releaseModule(); delete engine; delete opt; - delete emp; } inline Value* llVal(CVal v) { return static_cast<Value*>(v); } @@ -123,7 +121,7 @@ struct LLVMEngine : public Engine { return PointerType::get(StructType::get(context, ctypes, false), 0); } - return PointerType::get(Type::getVoidTy(context), NULL); + return PointerType::get(Type::getInt8Ty(context), NULL); } CFunc startFunction(CEnv& cenv, @@ -197,7 +195,8 @@ struct LLVMEngine : public Engine { void writeModule(CEnv& cenv, std::ostream& os) { AssemblyAnnotationWriter writer; - module->print(os, &writer); + llvm::raw_os_ostream raw_stream(os); + module->print(raw_stream, &writer); } const string call(CEnv& cenv, CFunc f, const AType* retT) { @@ -225,7 +224,6 @@ struct LLVMEngine : public Engine { ExecutionEngine* engine; IRBuilder<> builder; Function* alloc; - ExistingModuleProvider* emp; FunctionPassManager* opt; }; |