diff options
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 2f27bbebc..37841c35f 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -2232,6 +2232,8 @@ namespace Slang return (IRStringType*)getType(kIROp_StringType); } + IRDynamicType* IRBuilder::getDynamicType() { return (IRDynamicType*)getType(kIROp_DynamicType); } + IRAssociatedType* IRBuilder::getAssociatedType(ArrayView<IRInterfaceType*> constraintTypes) { return (IRAssociatedType*)getType(kIROp_AssociatedType, @@ -2331,6 +2333,12 @@ namespace Slang operands); } + IRExistentialBoxType* IRBuilder::getExistentialBoxType(IRType* concreteType, IRType* interfaceType) + { + IRInst* operands[] = {concreteType, interfaceType}; + return (IRExistentialBoxType*)getType(kIROp_ExistentialBoxType, 2, operands); + } + IRArrayTypeBase* IRBuilder::getArrayTypeBase( IROp op, IRType* elementType, @@ -2471,7 +2479,7 @@ namespace Slang // so we just want to return `ExistentialBox<someConcreteType>`. // auto concreteType = (IRType*) slotArgs[0]; - auto ptrType = getPtrType(kIROp_ExistentialBoxType, concreteType); + auto ptrType = getExistentialBoxType(concreteType, (IRType*)baseType); return ptrType; } } @@ -2524,6 +2532,14 @@ namespace Slang } } + IRInst* IRBuilder::emitGetValueFromExistentialBox(IRType* type, IRInst* existentialBox) + { + auto inst = + createInst<IRInst>(this, kIROp_GetValueFromExistentialBox, type, 1, &existentialBox); + addInst(inst); + return inst; + } + IRUndefined* IRBuilder::emitUndefined(IRType* type) { @@ -5273,6 +5289,7 @@ namespace Slang case kIROp_Specialize: case kIROp_lookup_interface_method: case kIROp_getAddr: + case kIROp_GetValueFromExistentialBox: case kIROp_Construct: case kIROp_makeVector: case kIROp_MakeMatrix: |
