aboutsummaryrefslogtreecommitdiffstats
path: root/src/llvm.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-04-13 23:26:56 +0000
committerDavid Robillard <d@drobilla.net>2010-04-13 23:26:56 +0000
commit7bec36818542d53a52fb285757b1c5947b77b443 (patch)
treea494f1e2bdadab6d8f60c82f80b2d9d95193dae9 /src/llvm.cpp
parentd868d225ea641d81b43e7c574343cd45a1e13700 (diff)
downloadresp-7bec36818542d53a52fb285757b1c5947b77b443.tar.gz
resp-7bec36818542d53a52fb285757b1c5947b77b443.tar.bz2
resp-7bec36818542d53a52fb285757b1c5947b77b443.zip
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
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 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<LLVMEngine*>(cenv.engine());
- const AType* argsT = type->prot()->as<const AType*>();
- const AType* retT = type->last()->as<const AType*>();
+ const AType* argsT = type->prot()->as<const AType*>();
+ const AType* retT = type->last()->as<const AType*>();
vector<string> 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<LLVMEngine*>(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<LLVMEngine*>(cenv.engine());
- return engine->builder.CreateLoad(llVal(val), "globalPtr");
+ return engine->builder.CreateLoad(llVal(val), sym + "Ptr");
}