SPV arrays: Add support for runtime-sized array types and arrays of arrays.

This includes run-time block.member.length() (OpArrayLength).
This commit is contained in:
John Kessenich 2015-09-12 12:17:44 -06:00
parent 9312269d09
commit c9a808319a
9 changed files with 369 additions and 27 deletions

View file

@ -264,6 +264,16 @@ Id Builder::makeArrayType(Id element, unsigned size)
return type->getResultId();
}
Id Builder::makeRuntimeArray(Id element)
{
Instruction* type = new Instruction(getUniqueId(), NoType, OpTypeRuntimeArray);
type->addIdOperand(element);
constantsTypesGlobals.push_back(type);
module.mapInstruction(type);
return type->getResultId();
}
Id Builder::makeFunctionType(Id returnType, std::vector<Id>& paramTypes)
{
// try to find it
@ -280,7 +290,7 @@ Id Builder::makeFunctionType(Id returnType, std::vector<Id>& paramTypes)
}
}
if (! mismatch)
return type->getResultId();
return type->getResultId();
}
// not found, make it