diff options
author | David Robillard <d@drobilla.net> | 2009-06-20 18:57:15 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-06-20 18:57:15 +0000 |
commit | f1e547a50a132afedbcd31700abb4ff79405e665 (patch) | |
tree | d4fdacdd70048514e0e754355d75c692f5ffea39 | |
parent | 5423a36aee3156332183bc59c097a907e4d8c503 (diff) | |
download | resp-f1e547a50a132afedbcd31700abb4ff79405e665.tar.gz resp-f1e547a50a132afedbcd31700abb4ff79405e665.tar.bz2 resp-f1e547a50a132afedbcd31700abb4ff79405e665.zip |
Move alloc function to backend.
git-svn-id: http://svn.drobilla.net/resp/tuplr@137 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r-- | llvm.cpp | 21 | ||||
-rw-r--r-- | tuplr.hpp | 1 |
2 files changed, 12 insertions, 10 deletions
@@ -51,10 +51,20 @@ llType(const AType* t) } struct LLVMEngine { - LLVMEngine() : module(new Module("tuplr")), engine(ExecutionEngine::create(module)) {} + LLVMEngine() + : module(new Module("tuplr")), engine(ExecutionEngine::create(module)) + { + // Host provided allocation primitive prototype + std::vector<const Type*> argsT(1, Type::Int32Ty); // unsigned size + argsT.push_back(Type::Int8Ty); // char tag + FunctionType* funcT = FunctionType::get(PointerType::get(Type::Int8Ty, 0), argsT, false); + alloc = Function::Create(funcT, Function::ExternalLinkage, + "tuplr_gc_allocate", module); + } Module* module; ExecutionEngine* engine; IRBuilder<> builder; + CFunction alloc; }; static LLVMEngine* @@ -82,7 +92,7 @@ struct CEnv::PImpl { }; CEnv::CEnv(PEnv& p, TEnv& t, CEngine e, ostream& os, ostream& es) - : out(os), err(es), penv(p), tenv(t), symID(0), alloc(0), _pimpl(new PImpl((LLVMEngine*)e)) + : out(os), err(es), penv(p), tenv(t), symID(0), _pimpl(new PImpl((LLVMEngine*)e)) { } @@ -520,13 +530,6 @@ newCenv(PEnv& penv, TEnv& tenv) LLVMEngine* engine = new LLVMEngine(); CEnv* cenv = new CEnv(penv, tenv, engine); - // Host provided allocation primitive prototypes - std::vector<const Type*> argsT(1, Type::Int32Ty); // size - argsT.push_back(Type::Int8Ty); // tag - FunctionType* funcT = FunctionType::get(PointerType::get(Type::Int8Ty, 0), argsT, false); - cenv->alloc = Function::Create(funcT, Function::ExternalLinkage, - "tuplr_gc_allocate", engine->module); - return cenv; } @@ -599,7 +599,6 @@ struct CEnv { Vals vals; unsigned symID; - CFunction alloc; Subst tsubst; map<string,string> args; |