From a2d90fb275962da84611160f8ddd74d934a68dbd Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 4 Aug 2023 15:47:39 -0700 Subject: Redesign `DeclRef` and systematic `Val` deduplication (#3049) * Redesign DeclRef + Deduplicate Val. * Update project files * Fix warning. * Fix. * Fix. * Remove `Val::_equalsImplOverride`. * Rmove `Val::_getHashCodeOverride`. * Remove `semanticVisitor` param from `resolve`. * Cleanups. --------- Co-authored-by: Yong He --- source/slang/slang-ir.cpp | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) (limited to 'source/slang/slang-ir.cpp') diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index a27bf8658..38d1eb520 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -1003,32 +1003,6 @@ namespace Slang ioOperands.add(m_modeInst); } - // - // IRTaggedUnionTypeLayout - // - - IRTaggedUnionTypeLayout::Builder::Builder(IRBuilder* irBuilder, LayoutSize tagOffset) - : Super::Builder(irBuilder) - { - m_tagOffset = irBuilder->getIntValue(irBuilder->getIntType(), tagOffset.raw); - } - - void IRTaggedUnionTypeLayout::Builder::addCaseTypeLayout(IRTypeLayout* typeLayout) - { - m_caseTypeLayoutAttrs.add(getIRBuilder()->getCaseTypeLayoutAttr(typeLayout)); - } - - void IRTaggedUnionTypeLayout::Builder::addOperandsImpl(List& ioOperands) - { - ioOperands.add(m_tagOffset); - } - - void IRTaggedUnionTypeLayout::Builder::addAttrsImpl(List& ioOperands) - { - for(auto attr : m_caseTypeLayoutAttrs) - ioOperands.add(attr); - } - // // IRVarLayout // @@ -2981,17 +2955,6 @@ namespace Slang operands); } - IRType* IRBuilder::getTaggedUnionType( - UInt caseCount, - IRType* const* caseTypes) - { - return (IRType*)createIntrinsicInst( - getTypeKind(), - kIROp_TaggedUnionType, - caseCount, - (IRInst* const*) caseTypes); - } - IRType* IRBuilder::getBindExistentialsType( IRInst* baseType, UInt slotArgCount, @@ -3335,7 +3298,6 @@ namespace Slang IRInst* const* args) { auto innerReturnVal = findInnerMostGenericReturnVal(as(genericVal)); - if (as(innerReturnVal)) { return createIntrinsicInst( @@ -3371,7 +3333,7 @@ namespace Slang // the emit logic, but this is a reasonably early place // to catch it. // - SLANG_ASSERT(witnessTableVal->getOp() != kIROp_StructKey); + SLANG_ASSERT(witnessTableVal && witnessTableVal->getOp() != kIROp_StructKey); IRInst* args[] = {witnessTableVal, interfaceMethodVal}; @@ -5536,6 +5498,8 @@ namespace Slang return emitIntrinsicInst( getNativePtrType((IRType*)valueType->getOperand(0)), kIROp_GetNativePtr, 1, &value); break; + case kIROp_ExtractExistentialType: + return emitGetNativePtr(value->getOperand(0)); default: SLANG_UNEXPECTED("invalid operand type for `getNativePtr`."); UNREACHABLE_RETURN(nullptr); -- cgit v1.2.3