diff options
| author | Yong He <yonghe@outlook.com> | 2023-07-12 19:55:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-12 19:55:41 -0700 |
| commit | f3aba255f6d69ddbf255b33d0eb0f391908e60a8 (patch) | |
| tree | f43300b1bbbcc82caa1b547dd3922c608010cb98 /source/slang/slang-ir-lower-binding-query.cpp | |
| parent | 98ba936ed91328338ba95525dd658d5cde6582de (diff) | |
Pool inst worklists and hashsets to avoid rehashing. (#2982)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-lower-binding-query.cpp')
| -rw-r--r-- | source/slang/slang-ir-lower-binding-query.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/slang/slang-ir-lower-binding-query.cpp b/source/slang/slang-ir-lower-binding-query.cpp index d0128d365..116dcff61 100644 --- a/source/slang/slang-ir-lower-binding-query.cpp +++ b/source/slang/slang-ir-lower-binding-query.cpp @@ -76,8 +76,12 @@ namespace Slang // itself is straightforward, and not anything // that hasn't been seen in other files. - List<IRInst*> workList; - HashSet<IRInst*> workListSet; + InstWorkList workList; + InstHashSet workListSet; + + WorkListPass(IRModule* inModule) + : module(inModule), workList(inModule), workListSet(inModule), toBeDeleted(inModule), toBeDeletedSet(inModule) + {} void addToWorkList(IRInst* inst) { @@ -111,8 +115,8 @@ namespace Slang // frequent need to buffer up instructions to // be deleted when a pass is complete. - List<IRInst*> toBeDeleted; - HashSet<IRInst*> toBeDeletedSet; + InstWorkList toBeDeleted; + InstHashSet toBeDeletedSet; void addToBeDeleted(IRInst* inst) { @@ -139,6 +143,10 @@ namespace Slang // struct BindingQueryLoweringContext : public WorkListPass { + BindingQueryLoweringContext(IRModule* inModule) + : WorkListPass(inModule) + {} + // All of the intrinsics we will be processing use // the same result type (`uint`), so it is helpful // to cache a pointer to the IR type at the start @@ -602,8 +610,7 @@ namespace Slang IRModule* module, DiagnosticSink* sink) { - BindingQueryLoweringContext context; - context.module = module; + BindingQueryLoweringContext context(module); context.sink = sink; context.processModule(); } |
