summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ast-builder.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-07-12 16:00:05 -0700
committerGitHub <noreply@github.com>2023-07-12 16:00:05 -0700
commit261b2f1f2bc13ccf7db5ec68c825ffc7b0781f7f (patch)
tree4953e376e705a8110cb8164dda5b239c04f2768b /source/slang/slang-ast-builder.cpp
parentbbd9c2e6d7b57f5acc3238083ab2f7c7b140df5e (diff)
Use scratchData on `IRInst` to replace HashSets. (#2978)
* Use scratchData on `IRInst` to replace HashSets. * Update test results. * Initialize scratchData. * Update autodiff documentation. * Use enum instead of bool. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ast-builder.cpp')
-rw-r--r--source/slang/slang-ast-builder.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/slang/slang-ast-builder.cpp b/source/slang/slang-ast-builder.cpp
index 33bd23f43..e6e1b5e75 100644
--- a/source/slang/slang-ast-builder.cpp
+++ b/source/slang/slang-ast-builder.cpp
@@ -445,6 +445,7 @@ TypeType* ASTBuilder::getTypeType(Type* type)
bool ASTBuilder::NodeDesc::operator==(NodeDesc const& that) const
{
+ if (hashCode != that.hashCode) return false;
if(type != that.type) return false;
if(operands.getCount() != that.operands.getCount()) return false;
for(Index i = 0; i < operands.getCount(); ++i)
@@ -461,7 +462,8 @@ bool ASTBuilder::NodeDesc::operator==(NodeDesc const& that) const
}
return true;
}
-HashCode ASTBuilder::NodeDesc::getHashCode() const
+
+void ASTBuilder::NodeDesc::init()
{
Hasher hasher;
hasher.hashValue(Int(type));
@@ -474,7 +476,7 @@ HashCode ASTBuilder::NodeDesc::getHashCode() const
//
hasher.hashValue(operands[i].values.nodeOperand);
}
- return hasher.getResult();
+ hashCode = hasher.getResult();
}
DeclRef<Decl> _getSpecializedDeclRef(ASTBuilder* builder, Decl* decl, Substitutions* subst)