From 245466d89cfe54b78da486f06d470bc6daaf4625 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 16 Feb 2023 16:44:04 -0800 Subject: Remove `SharedIRBuilder`. (#2657) Co-authored-by: Yong He --- source/slang/slang-ir-any-value-marshalling.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'source/slang/slang-ir-any-value-marshalling.cpp') diff --git a/source/slang/slang-ir-any-value-marshalling.cpp b/source/slang/slang-ir-any-value-marshalling.cpp index de8fd4dd5..79a41f0d5 100644 --- a/source/slang/slang-ir-any-value-marshalling.cpp +++ b/source/slang/slang-ir-any-value-marshalling.cpp @@ -52,7 +52,7 @@ namespace Slang if (auto typeInfo = generatedAnyValueTypes.TryGetValue(size)) return typeInfo->Ptr(); RefPtr info = new AnyValueTypeInfo(); - IRBuilder builder(sharedContext->sharedBuilderStorage); + IRBuilder builder(sharedContext->module); builder.setInsertBefore(type); auto structType = builder.createStructType(); info->type = structType; @@ -359,7 +359,7 @@ namespace Slang IRFunc* generatePackingFunc(IRType* type, IRAnyValueType* anyValueType) { - IRBuilder builder(sharedContext->sharedBuilderStorage); + IRBuilder builder(sharedContext->module); builder.setInsertBefore(type); auto anyValInfo = ensureAnyValueType(anyValueType); @@ -519,7 +519,7 @@ namespace Slang IRFunc* generateUnpackingFunc(IRType* type, IRAnyValueType* anyValueType) { - IRBuilder builder(sharedContext->sharedBuilderStorage); + IRBuilder builder(sharedContext->module); builder.setInsertBefore(type); auto anyValInfo = ensureAnyValueType(anyValueType); @@ -574,7 +574,7 @@ namespace Slang auto func = ensureMarshallingFunc( operand->getDataType(), cast(packInst->getDataType())); - IRBuilder builderStorage(sharedContext->sharedBuilderStorage); + IRBuilder builderStorage(sharedContext->module); auto builder = &builderStorage; builder->setInsertBefore(packInst); auto callInst = builder->emitCallInst(packInst->getDataType(), func.packFunc, 1, &operand); @@ -588,7 +588,7 @@ namespace Slang auto func = ensureMarshallingFunc( unpackInst->getDataType(), cast(operand->getDataType())); - IRBuilder builderStorage(sharedContext->sharedBuilderStorage); + IRBuilder builderStorage(sharedContext->module); auto builder = &builderStorage; builder->setInsertBefore(unpackInst); auto callInst = builder->emitCallInst(unpackInst->getDataType(), func.unpackFunc, 1, &operand); @@ -620,9 +620,6 @@ namespace Slang // since we will re-use that state for any code we // generate along the way. // - SharedIRBuilder* sharedBuilder = &sharedContext->sharedBuilderStorage; - sharedBuilder->init(sharedContext->module); - sharedContext->addToWorkList(sharedContext->module->getModuleInst()); while (sharedContext->workList.getCount() != 0) @@ -646,10 +643,6 @@ namespace Slang if (auto anyValueType = as(inst)) processAnyValueType(anyValueType); } - // Because we replaced all `AnyValueType` uses, some old type definitions (e.g. PtrType(AnyValueType)) - // will become duplicates with new types we introduced (e.g. PtrType(AnyValueStruct)), and therefore - // invalidates our `globalValueNumberingMap` hash map. We need to rebuild it. - sharedContext->sharedBuilderStorage.deduplicateAndRebuildGlobalNumberingMap(); sharedContext->mapInterfaceRequirementKeyValue.Clear(); } }; -- cgit v1.2.3