diff options
| author | Yong He <yonghe@outlook.com> | 2024-09-20 20:21:18 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-20 20:21:18 -0700 |
| commit | 53684ed919ff2f5f3656aed2e95a111207452392 (patch) | |
| tree | cf6926f21797d99534f22da121beceb085b6035a /source/slang/slang-emit-c-like.cpp | |
| parent | c42b5e24b5b9d6b03352d809e0a49485d361154f (diff) | |
Fix handling of pointer logic in wgsl backend. (#5129)
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
| -rw-r--r-- | source/slang/slang-emit-c-like.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index c60397b85..28eb7da04 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -1646,16 +1646,11 @@ bool CLikeSourceEmitter::shouldFoldInstIntoUseSites(IRInst* inst) return true; } -bool CLikeSourceEmitter::isPointerSyntaxRequiredImpl(IRInst* /* inst */) -{ - return doesTargetSupportPtrTypes(); -} - void CLikeSourceEmitter::emitDereferenceOperand(IRInst* inst, EmitOpInfo const& outerPrec) { EmitOpInfo newOuterPrec = outerPrec; - if (isPointerSyntaxRequiredImpl(inst)) + if (doesTargetSupportPtrTypes()) { switch (inst->getOp()) { @@ -1754,7 +1749,7 @@ void CLikeSourceEmitter::emitDereferenceOperand(IRInst* inst, EmitOpInfo const& void CLikeSourceEmitter::emitVarExpr(IRInst* inst, EmitOpInfo const& outerPrec) { - if (isPointerSyntaxRequiredImpl(inst)) + if (doesTargetSupportPtrTypes()) { auto prec = getInfo(EmitOp::Prefix); auto newOuterPrec = outerPrec; @@ -2003,6 +1998,11 @@ void CLikeSourceEmitter::emitIntrinsicCallExprImpl( } } +void CLikeSourceEmitter::emitCallArg(IRInst* inst) +{ + emitOperand(inst, getInfo(EmitOp::General)); +} + void CLikeSourceEmitter::_emitCallArgList(IRCall* inst, int startingOperandIndex) { bool isFirstArg = true; @@ -2023,7 +2023,7 @@ void CLikeSourceEmitter::_emitCallArgList(IRCall* inst, int startingOperandIndex m_writer->emit(", "); else isFirstArg = false; - emitOperand(inst->getOperand(aa), getInfo(EmitOp::General)); + emitCallArg(inst->getOperand(aa)); } m_writer->emit(")"); } @@ -2296,7 +2296,7 @@ void CLikeSourceEmitter::defaultEmitInstExpr(IRInst* inst, const EmitOpInfo& inO IRFieldAddress* ii = (IRFieldAddress*) inst; - if (isPointerSyntaxRequiredImpl(inst)) + if (doesTargetSupportPtrTypes()) { auto prec = getInfo(EmitOp::Prefix); needClose = maybeEmitParens(outerPrec, prec); @@ -4206,7 +4206,7 @@ void CLikeSourceEmitter::emitGlobalParam(IRGlobalParam* varDecl) emitRateQualifiersAndAddressSpace(varDecl); emitVarKeyword(varType, varDecl); - emitGlobalParamType(varType, getName(varDecl)); + emitType(varType, getName(varDecl)); emitSemantics(varDecl); |
