aboutsummaryrefslogtreecommitdiffstats
path: root/src/llvm.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-02 08:03:47 +0000
committerDavid Robillard <d@drobilla.net>2010-12-02 08:03:47 +0000
commitcf6c924f9cb10a583edbab2560773f2500a86323 (patch)
tree9073dbe14d904764d4af59141a03228f2e0fbf8e /src/llvm.cpp
parent563a807be78bfe12e5bfbb9ff0d6da44242696c4 (diff)
downloadresp-cf6c924f9cb10a583edbab2560773f2500a86323.tar.gz
resp-cf6c924f9cb10a583edbab2560773f2500a86323.tar.bz2
resp-cf6c924f9cb10a583edbab2560773f2500a86323.zip
Work towards removing different classes for each type of expression.
git-svn-id: http://svn.drobilla.net/resp/resp@278 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r--src/llvm.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp
index 3e55b98..3aaf21b 100644
--- a/src/llvm.cpp
+++ b/src/llvm.cpp
@@ -365,7 +365,7 @@ LLVMEngine::compileIf(CEnv& cenv, const AIf* aif)
if (++next == aif->end())
break;
- Value* condV = llVal((*i)->compile(cenv));
+ Value* condV = llVal(resp_compile(cenv, *i));
BasicBlock* thenBB = BasicBlock::Create(context, (format("then%1%") % ((idx+1)/2)).str());
nextBB = BasicBlock::Create(context, (format("else%1%") % ((idx+1)/2)).str());
@@ -375,7 +375,7 @@ LLVMEngine::compileIf(CEnv& cenv, const AIf* aif)
// Emit then block for this condition
parent->getBasicBlockList().push_back(thenBB);
engine->builder.SetInsertPoint(thenBB);
- Value* thenV = llVal((*next)->compile(cenv));
+ Value* thenV = llVal(resp_compile(cenv, *next));
engine->builder.CreateBr(mergeBB);
branches.push_back(make_pair(thenV, engine->builder.GetInsertBlock()));
@@ -386,7 +386,7 @@ LLVMEngine::compileIf(CEnv& cenv, const AIf* aif)
}
// Emit final else block
- Value* elseV = llVal(aif->list_last()->compile(cenv));
+ Value* elseV = llVal(resp_compile(cenv, aif->list_last()));
engine->builder.CreateBr(mergeBB);
branches.push_back(make_pair(elseV, engine->builder.GetInsertBlock()));
@@ -405,7 +405,7 @@ CVal
LLVMEngine::compileMatch(CEnv& cenv, const AMatch* match)
{
typedef vector< pair<Value*, BasicBlock*> > Branches;
- Value* matchee = llVal(match->list_ref(1)->compile(cenv));
+ Value* matchee = llVal(resp_compile(cenv, match->list_ref(1)));
Value* rttiPtr = builder.CreateStructGEP(matchee, 0, "matchRTTIPtr");
Value* rtti = builder.CreateLoad(rttiPtr, 0, "matchRTTI");
@@ -422,7 +422,7 @@ LLVMEngine::compileMatch(CEnv& cenv, const AMatch* match)
const ASymbol* sym = pat->to<const ATuple*>()->head()->as<const ASymbol*>();
const AType* patT = tup<AType>(Cursor(), const_cast<ASymbol*>(sym), 0);
- Value* typeV = llVal(patT->compile(cenv));
+ Value* typeV = llVal(resp_compile(cenv, patT));
Value* condV = engine->builder.CreateICmp(CmpInst::ICMP_EQ, rtti, typeV);
BasicBlock* thenBB = BasicBlock::Create(context, (format("case%1%") % ((idx+1)/2)).str());
@@ -433,7 +433,7 @@ LLVMEngine::compileMatch(CEnv& cenv, const AMatch* match)
// Emit then block for this condition
parent->getBasicBlockList().push_back(thenBB);
engine->builder.SetInsertPoint(thenBB);
- Value* thenV = llVal(body->compile(cenv));
+ Value* thenV = llVal(resp_compile(cenv, body));
engine->builder.CreateBr(mergeBB);
branches.push_back(make_pair(thenV, engine->builder.GetInsertBlock()));
@@ -463,8 +463,8 @@ LLVMEngine::compilePrimitive(CEnv& cenv, const APrimitive* prim)
LLVMEngine* engine = reinterpret_cast<LLVMEngine*>(cenv.engine());
bool isFloat = cenv.type(*++i)->str() == "Float";
- Value* a = llVal((*i++)->compile(cenv));
- Value* b = llVal((*i++)->compile(cenv));
+ Value* a = llVal(resp_compile(cenv, *i++));
+ Value* b = llVal(resp_compile(cenv, *i++));
const string n = prim->head()->to<const ASymbol*>()->str();
// Binary arithmetic operations
@@ -480,7 +480,7 @@ LLVMEngine::compilePrimitive(CEnv& cenv, const APrimitive* prim)
if (op != 0) {
Value* val = engine->builder.CreateBinOp(op, a, b);
while (i != prim->end())
- val = engine->builder.CreateBinOp(op, val, llVal((*i++)->compile(cenv)));
+ val = engine->builder.CreateBinOp(op, val, llVal(resp_compile(cenv, *i++)));
return val;
}