Preliminary vector support

This commit is contained in:
Alexey Prokhin
2012-02-15 17:28:10 +04:00
parent 5af48edec3
commit ae7f0ca7e7
12 changed files with 190 additions and 9 deletions

View File

@@ -158,6 +158,14 @@ LLType* DtoType(Type* t)
case Taarray:
return getVoidPtrType();
#if DMDV2
case Tvector:
{
t->irtype = new IrTypeVector(t);
return t->irtype->buildType();
}
#endif
/*
Not needed atm as VarDecls for tuples are rewritten as a string of
VarDecls for the fields (u -> _u_field_0, ...)
@@ -679,6 +687,28 @@ LLValue* DtoExtractValue(LLValue* aggr, unsigned idx, const char* name)
//////////////////////////////////////////////////////////////////////////////////////////
LLValue* DtoInsertElement(LLValue* vec, LLValue* v, LLValue *idx, const char* name)
{
return gIR->ir->CreateInsertElement(vec, v, idx, name ? name : "tmp");
}
LLValue* DtoExtractElement(LLValue* vec, LLValue *idx, const char* name)
{
return gIR->ir->CreateExtractElement(vec, idx, name ? name : "tmp");
}
LLValue* DtoInsertElement(LLValue* vec, LLValue* v, unsigned idx, const char* name)
{
return DtoInsertElement(vec, v, DtoConstUint(idx), name);
}
LLValue* DtoExtractElement(LLValue* vec, unsigned idx, const char* name)
{
return DtoExtractElement(vec, DtoConstUint(idx), name);
}
//////////////////////////////////////////////////////////////////////////////////////////
LLPointerType* isaPointer(LLValue* v)
{
return llvm::dyn_cast<LLPointerType>(v->getType());