summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-specialize-resources.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-02-16 16:44:04 -0800
committerGitHub <noreply@github.com>2023-02-16 16:44:04 -0800
commit245466d89cfe54b78da486f06d470bc6daaf4625 (patch)
tree522e0af1a9d2756182e143cdc85031ea1bbc2aa0 /source/slang/slang-ir-specialize-resources.cpp
parent4c4826d47eeef4675daae4ae53ff76f4d5ebd84a (diff)
Remove `SharedIRBuilder`. (#2657)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-specialize-resources.cpp')
-rw-r--r--source/slang/slang-ir-specialize-resources.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/source/slang/slang-ir-specialize-resources.cpp b/source/slang/slang-ir-specialize-resources.cpp
index 03eda0d99..83f280d9b 100644
--- a/source/slang/slang-ir-specialize-resources.cpp
+++ b/source/slang/slang-ir-specialize-resources.cpp
@@ -115,9 +115,6 @@ struct ResourceOutputSpecializationPass
TargetRequest* targetRequest;
IRModule* module;
- SharedIRBuilder sharedBuilder;
- SharedIRBuilder* getSharedBuilder() { return &sharedBuilder; }
-
// Functions that requires specialization but are currently unspecializable.
List<IRFunc*>* unspecializableFuncs;
@@ -125,10 +122,6 @@ struct ResourceOutputSpecializationPass
{
bool changed = false;
- // We start by setting up the shared IR building state.
- //
- sharedBuilder.init(module);
-
// The main logic consists of iterating over all functions
// (which must appear at the global level) and specializing
// them if needed.
@@ -173,7 +166,7 @@ struct ResourceOutputSpecializationPass
// We start the specialization process by making a clone of the
// original function.
//
- IRBuilder builder(&sharedBuilder);
+ IRBuilder builder(module);
builder.setInsertBefore(oldFunc);
IRFunc* newFunc = builder.createFunc();
newFunc->setFullType(oldFunc->getFullType());
@@ -181,7 +174,7 @@ struct ResourceOutputSpecializationPass
IRCloneEnv cloneEnv;
cloneInstDecorationsAndChildren(
&cloneEnv,
- &sharedBuilder,
+ module,
oldFunc,
newFunc);
@@ -560,7 +553,7 @@ struct ResourceOutputSpecializationPass
auto value = returnInst->getVal();
- IRBuilder builder(getSharedBuilder());
+ IRBuilder builder(module);
builder.setInsertBefore(returnInst);
// Given the `value` being returned, we need to determine
@@ -750,14 +743,14 @@ struct ResourceOutputSpecializationPass
// replacements, and we want any replacements to end up
// at the same point in the function signature.
//
- IRBuilder paramsBuilder(getSharedBuilder());
+ IRBuilder paramsBuilder(module);
paramsBuilder.setInsertBefore(param);
// We also need to introduce new instructions into the function
// body, as part of the entry block.
//
IRBlock* block = as<IRBlock>(param->getParent());
- IRBuilder bodyBuilder(getSharedBuilder());
+ IRBuilder bodyBuilder(module);
bodyBuilder.setInsertBefore(block->getFirstOrdinaryInst());
// No matter what, we create a local variable that will be
@@ -882,7 +875,7 @@ struct ResourceOutputSpecializationPass
// Given an existing call, we will insert a new call right before
// it and then remove the old one.
//
- IRBuilder builder(getSharedBuilder());
+ IRBuilder builder(module);
builder.setInsertBefore(oldCall);
// The new callee may have additional `out` parameters that