From f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Tue, 29 Oct 2024 14:49:26 +0800 Subject: format * format * Minor test fixes * enable checking cpp format in ci --- source/slang/slang-ir-call-graph.cpp | 53 +++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'source/slang/slang-ir-call-graph.cpp') 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>& referencingEntryPoints, IRModule* module) +void buildEntryPointReferenceGraph( + Dictionary>& 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>& 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(inst); - addToWorkList({ entryPoint, call->getCallee() }); - } - break; + { + auto call = as(inst); + addToWorkList({entryPoint, call->getCallee()}); + } + break; case kIROp_SPIRVAsmOperandInst: - { - auto operand = as(inst); - addToWorkList({ entryPoint, operand->getValue() }); - } - break; + { + auto operand = as(inst); + addToWorkList({entryPoint, operand->getValue()}); + } + break; } for (UInt i = 0; i < inst->getOperandCount(); i++) { @@ -83,16 +85,15 @@ void buildEntryPointReferenceGraph(Dictionary>& 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()) + if (globalInst->getOp() == kIROp_Func && + globalInst->findDecoration()) { visit(as(globalInst), globalInst); } @@ -101,7 +102,9 @@ void buildEntryPointReferenceGraph(Dictionary>& refere visit(workList[i].entryPoint, workList[i].inst); } -HashSet* getReferencingEntryPoints(Dictionary>& m_referencingEntryPoints, IRInst* inst) +HashSet* getReferencingEntryPoints( + Dictionary>& m_referencingEntryPoints, + IRInst* inst) { auto* referencingEntryPoints = m_referencingEntryPoints.tryGetValue(inst); if (!referencingEntryPoints) @@ -109,4 +112,4 @@ HashSet* getReferencingEntryPoints(Dictionary return referencingEntryPoints; } -} +} // namespace Slang -- cgit v1.2.3