Replace SmallVector/vector with C array for type lists

This commit is contained in:
kai
2013-02-02 13:48:23 +01:00
parent 26e6503258
commit 045d50deb5
3 changed files with 11 additions and 20 deletions

View File

@@ -57,10 +57,8 @@ IrTypeBasic* IrTypeBasic::get(Type* dt)
LLType* IrTypeBasic::getComplexType(llvm::LLVMContext& ctx, LLType* type)
{
llvm::SmallVector<LLType*, 2> types;
types.push_back(type);
types.push_back(type);
return llvm::StructType::get(ctx, types);
llvm::Type *types[] = { type, type };
return llvm::StructType::get(ctx, types, false);
}
//////////////////////////////////////////////////////////////////////////////
@@ -235,10 +233,8 @@ IrTypeArray* IrTypeArray::get(Type* dt)
// just as for pointers.
if (!dt->irtype)
{
llvm::SmallVector<LLType*, 2> types;
types.push_back(DtoSize_t());
types.push_back(llvm::PointerType::get(elemType, 0));
LLType* at = llvm::StructType::get(llvm::getGlobalContext(), types/*, t->toChars()*/);
llvm::Type *types[] = { DtoSize_t(), llvm::PointerType::get(elemType, 0) };
LLType* at = llvm::StructType::get(llvm::getGlobalContext(), types, false);
dt->irtype = new IrTypeArray(dt, at);
}

View File

@@ -72,10 +72,9 @@ IrTypeDelegate* IrTypeDelegate::get(Type* dt)
"picked up random pre-existing type?"
);
llvm::SmallVector<LLType*, 2> types;
types.push_back(getVoidPtrType());
types.push_back(getPtrToType(dt->nextOf()->irtype->getLLType()));
LLStructType* lt = LLStructType::get(gIR->context(), types);
llvm::Type *types[] = { getVoidPtrType(),
getPtrToType(dt->nextOf()->irtype->getLLType()) };
LLStructType* lt = LLStructType::get(gIR->context(), types, false);
dt->irtype = new IrTypeDelegate(dt, lt);
}