diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-10-29 14:49:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-29 14:49:26 +0800 |
| commit | f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch) | |
| tree | ea1d61342cd29368e19135000ec2948813096205 /source/slang/slang-ir-call-graph.cpp | |
| parent | a729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff) | |
format
* format
* Minor test fixes
* enable checking cpp format in ci
Diffstat (limited to 'source/slang/slang-ir-call-graph.cpp')
| -rw-r--r-- | source/slang/slang-ir-call-graph.cpp | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/source/slang/slang-ir-call-graph.cpp b/source/slang/slang-ir-call-graph.cpp index b3de60228..ee14c9809 100644 --- a/source/slang/slang-ir-call-graph.cpp +++ b/source/slang/slang-ir-call-graph.cpp @@ -1,21 +1,25 @@ #include "slang-ir-call-graph.h" -#include "slang-ir-insts.h" + #include "slang-ir-clone.h" +#include "slang-ir-insts.h" namespace Slang { -void buildEntryPointReferenceGraph(Dictionary<IRInst*, HashSet<IRFunc*>>& referencingEntryPoints, IRModule* module) +void buildEntryPointReferenceGraph( + Dictionary<IRInst*, HashSet<IRFunc*>>& referencingEntryPoints, + IRModule* module) { struct WorkItem { - IRFunc* entryPoint; IRInst* inst; + IRFunc* entryPoint; + IRInst* inst; HashCode getHashCode() const { return combineHash(Slang::getHashCode(entryPoint), Slang::getHashCode(inst)); } - bool operator == (const WorkItem& other) const + bool operator==(const WorkItem& other) const { return entryPoint == other.entryPoint && inst == other.inst; } @@ -46,35 +50,33 @@ void buildEntryPointReferenceGraph(Dictionary<IRInst*, HashSet<IRFunc*>>& refere registerEntryPointReference(entryPoint, inst); for (auto child : code->getChildren()) { - addToWorkList({ entryPoint, child }); + addToWorkList({entryPoint, child}); } return; } switch (inst->getOp()) { case kIROp_GlobalParam: - case kIROp_SPIRVAsmOperandBuiltinVar: - registerEntryPointReference(entryPoint, inst); - break; + case kIROp_SPIRVAsmOperandBuiltinVar: registerEntryPointReference(entryPoint, inst); break; case kIROp_Block: case kIROp_SPIRVAsm: for (auto child : inst->getChildren()) { - addToWorkList({ entryPoint, child }); + addToWorkList({entryPoint, child}); } break; case kIROp_Call: - { - auto call = as<IRCall>(inst); - addToWorkList({ entryPoint, call->getCallee() }); - } - break; + { + auto call = as<IRCall>(inst); + addToWorkList({entryPoint, call->getCallee()}); + } + break; case kIROp_SPIRVAsmOperandInst: - { - auto operand = as<IRSPIRVAsmOperandInst>(inst); - addToWorkList({ entryPoint, operand->getValue() }); - } - break; + { + auto operand = as<IRSPIRVAsmOperandInst>(inst); + addToWorkList({entryPoint, operand->getValue()}); + } + break; } for (UInt i = 0; i < inst->getOperandCount(); i++) { @@ -83,16 +85,15 @@ void buildEntryPointReferenceGraph(Dictionary<IRInst*, HashSet<IRFunc*>>& refere { case kIROp_GlobalParam: case kIROp_GlobalVar: - case kIROp_SPIRVAsmOperandBuiltinVar: - addToWorkList({ entryPoint, operand }); - break; + case kIROp_SPIRVAsmOperandBuiltinVar: addToWorkList({entryPoint, operand}); break; } } }; for (auto globalInst : module->getGlobalInsts()) { - if (globalInst->getOp() == kIROp_Func && globalInst->findDecoration<IREntryPointDecoration>()) + if (globalInst->getOp() == kIROp_Func && + globalInst->findDecoration<IREntryPointDecoration>()) { visit(as<IRFunc>(globalInst), globalInst); } @@ -101,7 +102,9 @@ void buildEntryPointReferenceGraph(Dictionary<IRInst*, HashSet<IRFunc*>>& refere visit(workList[i].entryPoint, workList[i].inst); } -HashSet<IRFunc*>* getReferencingEntryPoints(Dictionary<IRInst*, HashSet<IRFunc*>>& m_referencingEntryPoints, IRInst* inst) +HashSet<IRFunc*>* getReferencingEntryPoints( + Dictionary<IRInst*, HashSet<IRFunc*>>& m_referencingEntryPoints, + IRInst* inst) { auto* referencingEntryPoints = m_referencingEntryPoints.tryGetValue(inst); if (!referencingEntryPoints) @@ -109,4 +112,4 @@ HashSet<IRFunc*>* getReferencingEntryPoints(Dictionary<IRInst*, HashSet<IRFunc*> return referencingEntryPoints; } -} +} // namespace Slang |
