aboutsummaryrefslogtreecommitdiffstats
path: root/src/llvm.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-08-18 18:53:44 +0000
committerDavid Robillard <d@drobilla.net>2010-08-18 18:53:44 +0000
commit34de70a553c0863626f254ed89d689611b7f9c0a (patch)
tree59e3e7f05acee64b62b2ef72caf2c263f8c65029 /src/llvm.cpp
parent7bec36818542d53a52fb285757b1c5947b77b443 (diff)
downloadresp-34de70a553c0863626f254ed89d689611b7f9c0a.tar.gz
resp-34de70a553c0863626f254ed89d689611b7f9c0a.tar.bz2
resp-34de70a553c0863626f254ed89d689611b7f9c0a.zip
Update for LLVM 2.7.
Factor out mostly duplicated code in Env::topLevel and Env::innerMost. git-svn-id: http://svn.drobilla.net/resp/resp@259 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r--src/llvm.cpp14
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;
};