Skip to content

Commit ba0a84e

Browse files
committed
format code
1 parent fc18647 commit ba0a84e

4 files changed

+19
-15
lines changed

source/slang/slang-ir-legalize-global-values.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ void GlobalInstInliningContextGeneric::inlineGlobalValuesAndRemoveIfUnused(IRMod
4141

4242
// Since certain globals that appear in the IR are considered illegal for all targets,
4343
// e.g. calls to functions, we delete globals which no longer have uses after inlining.
44-
// TODO: Explain why tests/spirv/global-compute.slang fails if we don't exclude kIROp_SPIRVAsm
44+
// TODO: Explain why tests/spirv/global-compute.slang fails if we don't exclude
45+
// kIROp_SPIRVAsm
4546
if (!inst->hasUses() && inst->getOp() != kIROp_SPIRVAsm)
4647
inst->removeAndDeallocate();
4748
}
@@ -159,7 +160,10 @@ bool GlobalInstInliningContextGeneric::shouldInlineInst(IRInst* inst)
159160
return result;
160161
}
161162

162-
IRInst* GlobalInstInliningContextGeneric::inlineInst(IRBuilder& builder, IRCloneEnv& cloneEnv, IRInst* inst)
163+
IRInst* GlobalInstInliningContextGeneric::inlineInst(
164+
IRBuilder& builder,
165+
IRCloneEnv& cloneEnv,
166+
IRInst* inst)
163167
{
164168
IRInst* result;
165169
if (cloneEnv.mapOldValToNew.tryGetValue(inst, result))

source/slang/slang-ir-legalize-global-values.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ struct GlobalInstInliningContextGeneric
1414
Dictionary<IRInst*, bool> m_mapGlobalInstToShouldInline;
1515

1616
// Target-specific control over how inlining happens
17-
virtual bool isLegalGlobalInstForTarget(IRInst* inst) =0;
18-
virtual bool isInlinableGlobalInstForTarget(IRInst* inst) =0;
19-
virtual bool shouldBeInlinedForTarget(IRInst* user) =0;
20-
virtual IRInst* getOutsideASM(IRInst* beforeInst) =0;
17+
virtual bool isLegalGlobalInstForTarget(IRInst* inst) = 0;
18+
virtual bool isInlinableGlobalInstForTarget(IRInst* inst) = 0;
19+
virtual bool shouldBeInlinedForTarget(IRInst* user) = 0;
20+
virtual IRInst* getOutsideASM(IRInst* beforeInst) = 0;
2121

2222
// Inline global values that can't represented by the target to their use sites.
2323
// If this leaves any global unused, then remove it.
24-
void inlineGlobalValuesAndRemoveIfUnused(IRModule * module);
24+
void inlineGlobalValuesAndRemoveIfUnused(IRModule* module);
2525

2626
// Opcodes that can exist in global scope, as long as the operands are.
2727
bool isLegalGlobalInst(IRInst* inst);

source/slang/slang-ir-spirv-legalize.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include "slang-ir-glsl-legalize.h"
1212
#include "slang-ir-insts.h"
1313
#include "slang-ir-layout.h"
14-
#include "slang-ir-legalize-mesh-outputs.h"
1514
#include "slang-ir-legalize-global-values.h"
15+
#include "slang-ir-legalize-mesh-outputs.h"
1616
#include "slang-ir-loop-unroll.h"
1717
#include "slang-ir-lower-buffer-element-type.h"
1818
#include "slang-ir-peephole.h"
@@ -1591,7 +1591,7 @@ struct SPIRVLegalizationContext : public SourceEmitterBase
15911591
}
15921592
}
15931593

1594-
struct GlobalInstInliningContext: public GlobalInstInliningContextGeneric
1594+
struct GlobalInstInliningContext : public GlobalInstInliningContextGeneric
15951595
{
15961596
bool isLegalGlobalInstForTarget(IRInst* inst) override
15971597
{
@@ -1602,10 +1602,10 @@ struct SPIRVLegalizationContext : public SourceEmitterBase
16021602
{
16031603
switch (inst->getOp())
16041604
{
1605-
case kIROp_SPIRVAsm:
1606-
return true;
1607-
default:
1608-
break;
1605+
case kIROp_SPIRVAsm:
1606+
return true;
1607+
default:
1608+
break;
16091609
}
16101610

16111611
if (as<IRSPIRVAsmInst>(inst))

source/slang/slang-ir-wgsl-legalize.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include "slang-ir-wgsl-legalize.h"
22

33
#include "slang-ir-insts.h"
4-
#include "slang-ir-legalize-varying-params.h"
54
#include "slang-ir-legalize-global-values.h"
5+
#include "slang-ir-legalize-varying-params.h"
66
#include "slang-ir-util.h"
77
#include "slang-ir.h"
88
#include "slang-parameter-binding.h"
@@ -1588,7 +1588,7 @@ struct LegalizeWGSLEntryPointContext
15881588
}
15891589
};
15901590

1591-
struct GlobalInstInliningContext: public GlobalInstInliningContextGeneric
1591+
struct GlobalInstInliningContext : public GlobalInstInliningContextGeneric
15921592
{
15931593
bool isLegalGlobalInstForTarget(IRInst* /* inst */) override
15941594
{

0 commit comments

Comments
 (0)