summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index c97c04f88..1441b0567 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -2802,6 +2802,11 @@ namespace Slang
return getTupleType(SLANG_COUNT_OF(operands), operands);
}
+ IRTypePack* IRBuilder::getTypePack(UInt count, IRType* const* types)
+ {
+ return (IRTypePack*)getType(kIROp_TypePack, count, (IRInst* const*)types);
+ }
+
IRExpandType* IRBuilder::getExpandTypeOrVal(IRType* type, IRInst* pattern, ArrayView<IRInst*> capture)
{
ShortList<IRInst*> args;
@@ -4046,6 +4051,21 @@ namespace Slang
return inst;
}
+ IRInst* IRBuilder::emitMakeValuePack(IRType* type, UInt count, IRInst* const* args)
+ {
+ return emitIntrinsicInst(type, kIROp_MakeValuePack, count, args);
+ }
+
+ IRInst* IRBuilder::emitMakeValuePack(UInt count, IRInst* const* args)
+ {
+ ShortList<IRType*> types;
+ for (UInt i = 0; i < count; ++i)
+ types.add(args[i]->getFullType());
+
+ auto type = getTypePack((UInt)types.getCount(), types.getArrayView().getBuffer());
+ return emitIntrinsicInst(type, kIROp_MakeValuePack, count, args);
+ }
+
IRInst* IRBuilder::emitMakeTuple(IRType* type, UInt count, IRInst* const* args)
{
return emitIntrinsicInst(type, kIROp_MakeTuple, count, args);
@@ -5778,6 +5798,19 @@ namespace Slang
return inst;
}
+ IRInst* IRBuilder::emitCountOf(
+ IRType* type,
+ IRInst* sizedType)
+ {
+ auto inst = createInst<IRInst>(
+ this,
+ kIROp_CountOf,
+ type,
+ sizedType);
+ addInst(inst);
+ return inst;
+ }
+
IRInst* IRBuilder::emitBitCast(
IRType* type,
IRInst* val)