diff options
author | David Robillard <d@drobilla.net> | 2010-12-31 01:44:49 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-31 01:44:49 +0000 |
commit | 9b181a9be13efff7e404ca1712e5933a330d83cd (patch) | |
tree | 0c3062adc014e1042f867104e54349b3088f115c /src/llvm.cpp | |
parent | eb46c908460bd9d3563c85aff249cfa0a0b0bee2 (diff) | |
download | resp-9b181a9be13efff7e404ca1712e5933a330d83cd.tar.gz resp-9b181a9be13efff7e404ca1712e5933a330d83cd.tar.bz2 resp-9b181a9be13efff7e404ca1712e5933a330d83cd.zip |
Remove duplicated type compilation code.
git-svn-id: http://svn.drobilla.net/resp/resp@385 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r-- | src/llvm.cpp | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp index 4bbc75f..fcac73c 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -283,32 +283,10 @@ LLVMEngine::compileType(CEnv& cenv, const char* name, const AST* expr) if (i != compiledTypes.end()) return i->second; - const ATuple* const tup = expr->as_tuple(); - vector<const Type*> ctypes; - ctypes.push_back(PointerType::get(Type::getInt8Ty(context), NULL)); // RTTI - for (ATuple::const_iterator i = tup->iter_at(1); i != tup->end(); ++i) { - const ATuple* tup = (*i)->to_tuple(); - const Type* lt = (tup) - ? (const Type*)compileType(cenv, tup->fst()->as_symbol()->sym(), *i) - : llType(*i); - if (!lt) - return NULL; - ctypes.push_back(lt); - } - - Type* structT = StructType::get(context, ctypes, false); - - // Tell LLVM opaqueT and structT are the same (for recursive types) - //PATypeHolder opaqueT = OpaqueType::get(context); - //((OpaqueType*)opaqueT.get())->refineAbstractTypeTo(structT); - //structT = cast<StructType>(opaqueT.get()); // updated potentially invalidated structT - - Type* ret = PointerType::get(structT, 0); - module->addTypeName(name, structT); - - compiledTypes.insert(make_pair(name, ret)); - - return ret; + const Type* type = llType(expr); + module->addTypeName(name, type); + compiledTypes.insert(make_pair(name, type)); + return type; } CType |