diff options
| author | Yong He <yonghe@outlook.com> | 2023-04-12 22:58:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-12 22:58:22 -0700 |
| commit | ca7bf79df3a3f5f4494912cb0572c36662755b9d (patch) | |
| tree | 64b14034326be8285c0265e74ad3ed11e29ff062 /source/slang/slang-ir-any-value-marshalling.cpp | |
| parent | 12ec9b832fc74faba7162e54e04f7f48878ea88e (diff) | |
Combine lookupWitness lowering with specialization. (#2794)
Diffstat (limited to 'source/slang/slang-ir-any-value-marshalling.cpp')
| -rw-r--r-- | source/slang/slang-ir-any-value-marshalling.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/slang/slang-ir-any-value-marshalling.cpp b/source/slang/slang-ir-any-value-marshalling.cpp index 79a41f0d5..27bba3fde 100644 --- a/source/slang/slang-ir-any-value-marshalling.cpp +++ b/source/slang/slang-ir-any-value-marshalling.cpp @@ -666,6 +666,7 @@ namespace Slang case kIROp_IntType: case kIROp_FloatType: case kIROp_UIntType: + case kIROp_BoolType: return alignUp(offset, 4) + 4; case kIROp_UInt64Type: case kIROp_Int64Type: @@ -755,6 +756,21 @@ namespace Slang size += kRTTIHeaderSize; return alignUp(offset, 4) + alignUp((SlangInt)size, 4); } + case kIROp_AssociatedType: + { + auto associatedType = cast<IRAssociatedType>(type); + SlangInt maxSize = 0; + for (UInt i = 0; i < associatedType->getOperandCount(); i++) + maxSize = Math::Max(maxSize, _getAnyValueSizeRaw((IRType*)associatedType->getOperand(i), offset)); + return maxSize; + } + case kIROp_ThisType: + { + auto thisType = cast<IRThisType>(type); + auto interfaceType = thisType->getConstraintType(); + auto size = SharedGenericsLoweringContext::getInterfaceAnyValueSize(interfaceType, interfaceType->sourceLoc); + return alignUp(offset, 4) + alignUp((SlangInt)size, 4); + } case kIROp_ExtractExistentialType: { auto existentialValue = type->getOperand(0); |
