From 7bec36818542d53a52fb285757b1c5947b77b443 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 13 Apr 2010 23:26:56 +0000 Subject: Better (but still not correct...) computation of lifted function implementation type. git-svn-id: http://svn.drobilla.net/resp/resp@258 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/llvm.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/llvm.cpp') diff --git a/src/llvm.cpp b/src/llvm.cpp index 6243919..e606062 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -192,8 +192,8 @@ struct LLVMEngine : public Engine { CVal compileLiteral(CEnv& cenv, AST* lit); CVal compilePrimitive(CEnv& cenv, APrimitive* prim); CVal compileIf(CEnv& cenv, AIf* aif); - CVal compileGlobal(CEnv& cenv, const AType* type, const string& name, CVal val); - CVal getGlobal(CEnv& cenv, CVal val); + CVal compileGlobal(CEnv& cenv, const AType* type, const string& sym, CVal val); + CVal getGlobal(CEnv& cenv, const string& sym, CVal val); void writeModule(CEnv& cenv, std::ostream& os) { AssemblyAnnotationWriter writer; @@ -300,9 +300,8 @@ LLVMEngine::compileFunction(CEnv& cenv, AFn* fn, const AType* type) { assert(type->concrete()); - LLVMEngine* engine = reinterpret_cast(cenv.engine()); - const AType* argsT = type->prot()->as(); - const AType* retT = type->last()->as(); + const AType* argsT = type->prot()->as(); + const AType* retT = type->last()->as(); vector argNames; for (ATuple::const_iterator i = fn->prot()->begin(); i != fn->prot()->end(); ++i) @@ -449,7 +448,6 @@ CVal LLVMEngine::compileGlobal(CEnv& cenv, const AType* type, const string& sym, CVal val) { LLVMEngine* engine = reinterpret_cast(cenv.engine()); - Constant* init = Constant::getNullValue(llType(type)); GlobalVariable* global = new GlobalVariable(*module, llType(type), false, GlobalValue::ExternalLinkage, Constant::getNullValue(llType(type)), sym); @@ -458,8 +456,8 @@ LLVMEngine::compileGlobal(CEnv& cenv, const AType* type, const string& sym, CVal } CVal -LLVMEngine::getGlobal(CEnv& cenv, CVal val) +LLVMEngine::getGlobal(CEnv& cenv, const string& sym, CVal val) { LLVMEngine* engine = reinterpret_cast(cenv.engine()); - return engine->builder.CreateLoad(llVal(val), "globalPtr"); + return engine->builder.CreateLoad(llVal(val), sym + "Ptr"); } -- cgit v1.2.1