diff options
author | David Robillard <d@drobilla.net> | 2010-12-08 20:50:17 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-08 20:50:17 +0000 |
commit | c3601526574d9f04779cea3a84c8b423e6b3fb26 (patch) | |
tree | 358a8e40b2b7cf6d8a85a41dbf90300511112e3a /src/llvm.cpp | |
parent | 41c9834662fdccfc8ae8abde2d279a70ff17c597 (diff) | |
download | resp-c3601526574d9f04779cea3a84c8b423e6b3fb26.tar.gz resp-c3601526574d9f04779cea3a84c8b423e6b3fb26.tar.bz2 resp-c3601526574d9f04779cea3a84c8b423e6b3fb26.zip |
Eliminate some backend specific code in LLVMEngine::compileMatch (towards moving it to compile.cpp).
git-svn-id: http://svn.drobilla.net/resp/resp@317 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r-- | src/llvm.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp index c7d03a8..6975861 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -326,7 +326,7 @@ LLVMEngine::compileCons(CEnv& cenv, const AType* type, CVal rtti, const vector<C CVal LLVMEngine::compileDot(CEnv& cenv, CVal tup, int32_t index) { - Value* ptr = builder.CreateStructGEP(llVal(tup), index + 1, "dotPtr"); // +1 to skip RTTI + Value* ptr = builder.CreateStructGEP(llVal(tup), index, "dotPtr"); return builder.CreateLoad(ptr, 0, "dotVal"); } @@ -424,9 +424,8 @@ LLVMEngine::compileMatch(CEnv& cenv, const ATuple* match) { LLVMEngine* engine = reinterpret_cast<LLVMEngine*>(cenv.engine()); IfState state = compileIfStart(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"); + CVal matchee = resp_compile(cenv, match->list_ref(1)); + Value* rtti = llVal(compileDot(cenv, matchee, 0)); size_t idx = 1; for (ATuple::const_iterator i = match->iter_at(2); i != match->end(); ++idx) { |