From 6eec5c0bce47a5363236f04fc233d63f51091690 Mon Sep 17 00:00:00 2001 From: slangbot <186143334+slangbot@users.noreply.github.com> Date: Wed, 11 Dec 2024 13:29:35 +0000 Subject: [PATCH] format code --- source/slang/slang-ir-legalize-global-values.cpp | 15 ++++++++++----- source/slang/slang-ir-legalize-global-values.h | 10 +++++----- source/slang/slang-ir-spirv-legalize.cpp | 12 ++++++------ source/slang/slang-ir-wgsl-legalize.cpp | 4 ++-- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/source/slang/slang-ir-legalize-global-values.cpp b/source/slang/slang-ir-legalize-global-values.cpp index d82ba17347..2a29139cab 100644 --- a/source/slang/slang-ir-legalize-global-values.cpp +++ b/source/slang/slang-ir-legalize-global-values.cpp @@ -65,13 +65,15 @@ void GlobalInstInliningContextGeneric::inlineGlobalValuesAndRemoveIfUnused(IRMod } // Since certain globals that appear in the IR are considered illegal for all targets, - // e.g. calls to functions, we delete globals which no longer have uses (or children with uses) after inlining. - for (auto& globalInst: globalInstsToConsiderDeleting) + // e.g. calls to functions, we delete globals which no longer have uses (or children with uses) + // after inlining. + for (auto& globalInst : globalInstsToConsiderDeleting) { - if (!hasDescendantSatisfyingPredicate(globalInst, [](IRInst* inst){return inst->hasUses();})) + if (!hasDescendantSatisfyingPredicate( + globalInst, + [](IRInst* inst) { return inst->hasUses(); })) globalInst->removeAndDeallocate(); } - } bool GlobalInstInliningContextGeneric::isLegalGlobalInst(IRInst* inst) @@ -186,7 +188,10 @@ bool GlobalInstInliningContextGeneric::shouldInlineInst(IRInst* inst) return result; } -IRInst* GlobalInstInliningContextGeneric::inlineInst(IRBuilder& builder, IRCloneEnv& cloneEnv, IRInst* inst) +IRInst* GlobalInstInliningContextGeneric::inlineInst( + IRBuilder& builder, + IRCloneEnv& cloneEnv, + IRInst* inst) { IRInst* result; if (cloneEnv.mapOldValToNew.tryGetValue(inst, result)) diff --git a/source/slang/slang-ir-legalize-global-values.h b/source/slang/slang-ir-legalize-global-values.h index 8dbafc0c0f..c563b02c9c 100644 --- a/source/slang/slang-ir-legalize-global-values.h +++ b/source/slang/slang-ir-legalize-global-values.h @@ -14,14 +14,14 @@ struct GlobalInstInliningContextGeneric Dictionary m_mapGlobalInstToShouldInline; // Target-specific control over how inlining happens - virtual bool isLegalGlobalInstForTarget(IRInst* inst) =0; - virtual bool isInlinableGlobalInstForTarget(IRInst* inst) =0; - virtual bool shouldBeInlinedForTarget(IRInst* user) =0; - virtual IRInst* getOutsideASM(IRInst* beforeInst) =0; + virtual bool isLegalGlobalInstForTarget(IRInst* inst) = 0; + virtual bool isInlinableGlobalInstForTarget(IRInst* inst) = 0; + virtual bool shouldBeInlinedForTarget(IRInst* user) = 0; + virtual IRInst* getOutsideASM(IRInst* beforeInst) = 0; // Inline global values that can't represented by the target to their use sites. // If this leaves any global unused, then remove it. - void inlineGlobalValuesAndRemoveIfUnused(IRModule * module); + void inlineGlobalValuesAndRemoveIfUnused(IRModule* module); // Opcodes that can exist in global scope, as long as the operands are. bool isLegalGlobalInst(IRInst* inst); diff --git a/source/slang/slang-ir-spirv-legalize.cpp b/source/slang/slang-ir-spirv-legalize.cpp index 1618b639aa..c9764b2032 100644 --- a/source/slang/slang-ir-spirv-legalize.cpp +++ b/source/slang/slang-ir-spirv-legalize.cpp @@ -11,8 +11,8 @@ #include "slang-ir-glsl-legalize.h" #include "slang-ir-insts.h" #include "slang-ir-layout.h" -#include "slang-ir-legalize-mesh-outputs.h" #include "slang-ir-legalize-global-values.h" +#include "slang-ir-legalize-mesh-outputs.h" #include "slang-ir-loop-unroll.h" #include "slang-ir-lower-buffer-element-type.h" #include "slang-ir-peephole.h" @@ -1591,7 +1591,7 @@ struct SPIRVLegalizationContext : public SourceEmitterBase } } - struct GlobalInstInliningContext: public GlobalInstInliningContextGeneric + struct GlobalInstInliningContext : public GlobalInstInliningContextGeneric { bool isLegalGlobalInstForTarget(IRInst* inst) override { @@ -1602,10 +1602,10 @@ struct SPIRVLegalizationContext : public SourceEmitterBase { switch (inst->getOp()) { - case kIROp_SPIRVAsm: - return true; - default: - break; + case kIROp_SPIRVAsm: + return true; + default: + break; } if (as(inst)) diff --git a/source/slang/slang-ir-wgsl-legalize.cpp b/source/slang/slang-ir-wgsl-legalize.cpp index 6b89b45025..afdf412b13 100644 --- a/source/slang/slang-ir-wgsl-legalize.cpp +++ b/source/slang/slang-ir-wgsl-legalize.cpp @@ -1,8 +1,8 @@ #include "slang-ir-wgsl-legalize.h" #include "slang-ir-insts.h" -#include "slang-ir-legalize-varying-params.h" #include "slang-ir-legalize-global-values.h" +#include "slang-ir-legalize-varying-params.h" #include "slang-ir-util.h" #include "slang-ir.h" #include "slang-parameter-binding.h" @@ -1588,7 +1588,7 @@ struct LegalizeWGSLEntryPointContext } }; -struct GlobalInstInliningContext: public GlobalInstInliningContextGeneric +struct GlobalInstInliningContext : public GlobalInstInliningContextGeneric { bool isLegalGlobalInstForTarget(IRInst* /* inst */) override {