Skip to content

Commit

Permalink
Merge pull request #18 from slangbot/format-5768-aleino/global-call-fix
Browse files Browse the repository at this point in the history
Format code for PR shader-slang#5768
  • Loading branch information
aleino-nv authored Dec 5, 2024
2 parents a542a7b + 18ac073 commit f2f9e56
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
5 changes: 4 additions & 1 deletion source/slang/slang-ir-legalize-global-values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,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))
Expand Down
10 changes: 5 additions & 5 deletions source/slang/slang-ir-legalize-global-values.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ struct GlobalInstInliningContextGeneric
Dictionary<IRInst*, bool> 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);
Expand Down
12 changes: 6 additions & 6 deletions source/slang/slang-ir-spirv-legalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -1591,7 +1591,7 @@ struct SPIRVLegalizationContext : public SourceEmitterBase
}
}

struct GlobalInstInliningContext: public GlobalInstInliningContextGeneric
struct GlobalInstInliningContext : public GlobalInstInliningContextGeneric
{
bool isLegalGlobalInstForTarget(IRInst* inst) override
{
Expand All @@ -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<IRSPIRVAsmInst>(inst))
Expand Down
4 changes: 2 additions & 2 deletions source/slang/slang-ir-wgsl-legalize.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -1588,7 +1588,7 @@ struct LegalizeWGSLEntryPointContext
}
};

struct GlobalInstInliningContext: public GlobalInstInliningContextGeneric
struct GlobalInstInliningContext : public GlobalInstInliningContextGeneric
{
bool isLegalGlobalInstForTarget(IRInst* /* inst */) override
{
Expand Down

0 comments on commit f2f9e56

Please sign in to comment.