[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-31 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `clang-aarch64-sve-vls` running on `linaro-g3-02` while building `clang` at step 7 "ninja check 1". Full details are available at: https://lab.llvm.org/buildbot/#/builders/143/builds/1833 Here is the relevant piece of the bui

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-31 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-30 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. Thanks, LGTM. https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-30 Thread John McCall via cfe-commits
@@ -11427,6 +11427,19 @@ static void AnalyzeImplicitConversions( return; } + if (auto *OutArgE = dyn_cast(E)) { +// The base expression is only used to initialize the parameter for +// arguments to `inout` parameters, so we only traverse down the base +// ex

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-30 Thread John McCall via cfe-commits
@@ -5915,6 +5916,16 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, ProtoArgType->isBlockPointerType()) if (auto *BE = dyn_cast(Arg->IgnoreParenNoopCasts(Context))) BE->getBlockDecl()->setDoesNotEscape(); + //

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-30 Thread John McCall via cfe-commits
@@ -5432,6 +5434,57 @@ LValue CodeGenFunction::EmitOpaqueValueLValue(const OpaqueValueExpr *e) { return getOrCreateOpaqueLValueMapping(e); } +LValue CodeGenFunction::BindHLSLOutArgExpr(const HLSLOutArgExpr *E, + Address OutTemp) { +

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-30 Thread John McCall via cfe-commits
@@ -285,6 +285,13 @@ class CallArgList : public SmallVector { /// A value to "use" after the writeback, or null. llvm::Value *ToUse; + +/// An Expression representing a cast from the temporary's type to the +/// source l-value's type. +const Expr *CastExpr;

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-30 Thread John McCall via cfe-commits
@@ -7071,6 +7071,102 @@ class ArraySectionExpr : public Expr { void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } }; +/// This class represents temporary values used to represent inout and out +/// arguments in HLSL. From the callee perspective these parameters are m

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-30 Thread John McCall via cfe-commits
@@ -7071,6 +7071,102 @@ class ArraySectionExpr : public Expr { void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } }; +/// This class represents temporary values used to represent inout and out +/// arguments in HLSL. From the callee perspective these parameters are m

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-30 Thread John McCall via cfe-commits
@@ -7071,6 +7071,102 @@ class ArraySectionExpr : public Expr { void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } }; +/// This class represents temporary values used to represent inout and out +/// arguments in HLSL. From the callee perspective these parameters are m

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-30 Thread Chris B via cfe-commits
llvm-beanz wrote: ping @rjmccall. I think I've updated to address all your feedback. Let me know if there's anything else you think I should change. https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-28 Thread Chris B via cfe-commits
@@ -11427,6 +11427,19 @@ static void AnalyzeImplicitConversions( return; } + if (auto *OutArgE = dyn_cast(E)) { +// The base expression is only used to initialize the parameter for +// arguments to `inout` parameters, so we only traverse down the base +// ex

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-28 Thread Chris B via cfe-commits
@@ -8511,7 +8514,7 @@ static void HandleHLSLParamModifierAttr(QualType &CurType, return; if (Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_inout || Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_out) -CurType = S.getASTContext().getL

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-28 Thread John McCall via cfe-commits
@@ -8511,7 +8514,7 @@ static void HandleHLSLParamModifierAttr(QualType &CurType, return; if (Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_inout || Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_out) -CurType = S.getASTContext().getL

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-28 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-28 Thread John McCall via cfe-commits
@@ -11427,6 +11427,19 @@ static void AnalyzeImplicitConversions( return; } + if (auto *OutArgE = dyn_cast(E)) { +// The base expression is only used to initialize the parameter for +// arguments to `inout` parameters, so we only traverse down the base +// ex

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread Chris B via cfe-commits
@@ -11427,6 +11427,19 @@ static void AnalyzeImplicitConversions( return; } + if (auto *OutArgE = dyn_cast(E)) { +// The base expression is only used to initialize the parameter for +// arguments to `inout` parameters, so we only traverse down the base +// ex

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread Chris B via cfe-commits
@@ -8511,7 +8514,7 @@ static void HandleHLSLParamModifierAttr(QualType &CurType, return; if (Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_inout || Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_out) -CurType = S.getASTContext().getL

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Thanks, this is looking a lot better. https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread John McCall via cfe-commits
@@ -5432,6 +5434,57 @@ LValue CodeGenFunction::EmitOpaqueValueLValue(const OpaqueValueExpr *e) { return getOrCreateOpaqueLValueMapping(e); } +LValue CodeGenFunction::BindHLSLOutArgExpr(const HLSLOutArgExpr *E, + Address OutTemp) { +

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread John McCall via cfe-commits
@@ -5432,6 +5434,57 @@ LValue CodeGenFunction::EmitOpaqueValueLValue(const OpaqueValueExpr *e) { return getOrCreateOpaqueLValueMapping(e); } +LValue CodeGenFunction::BindHLSLOutArgExpr(const HLSLOutArgExpr *E, rjmccall wrote: This seems to be dead now. ht

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread John McCall via cfe-commits
@@ -8511,7 +8514,7 @@ static void HandleHLSLParamModifierAttr(QualType &CurType, return; if (Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_inout || Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_out) -CurType = S.getASTContext().getL

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread John McCall via cfe-commits
@@ -7061,6 +7061,67 @@ class ArraySectionExpr : public Expr { void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } }; +/// This class represents temporary values used to represent inout and out +/// arguments in HLSL. From the callee perspective these parameters are mo

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread John McCall via cfe-commits
@@ -7071,6 +7071,93 @@ class ArraySectionExpr : public Expr { void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } }; +/// This class represents temporary values used to represent inout and out +/// arguments in HLSL. From the callee perspective these parameters are mo

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread John McCall via cfe-commits
@@ -11427,6 +11427,19 @@ static void AnalyzeImplicitConversions( return; } + if (auto *OutArgE = dyn_cast(E)) { +// The base expression is only used to initialize the parameter for +// arguments to `inout` parameters, so we only traverse down the base +// ex

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-26 Thread Chris B via cfe-commits
@@ -1121,3 +1121,99 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { } return false; } + +bool SemaHLSL::CheckCompatibleParameterABI(FunctionDecl *New, + FunctionDecl *Old) { + if (New->getNumPar

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-19 Thread John McCall via cfe-commits
@@ -4148,6 +4152,30 @@ static void emitWriteback(CodeGenFunction &CGF, assert(!isProvablyNull(srcAddr.getBasePointer()) && "shouldn't have writeback for provably null argument"); + if (CGF.getLangOpts().HLSL) { +if (!isa(writeback.CastExpr)) { + RValue Tmp

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-19 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/101083 >From e8ec3e24e0061714b5dc440b1b92086965809483 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 29 Jul 2024 16:05:11 -0500 Subject: [PATCH 01/10] [HLSL] Implement output parameter HLSL output paramet

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-16 Thread John McCall via cfe-commits
@@ -1121,3 +1121,99 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { } return false; } + +bool SemaHLSL::CheckCompatibleParameterABI(FunctionDecl *New, + FunctionDecl *Old) { + if (New->getNumPar

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-16 Thread Chris B via cfe-commits
@@ -1121,3 +1121,99 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { } return false; } + +bool SemaHLSL::CheckCompatibleParameterABI(FunctionDecl *New, + FunctionDecl *Old) { + if (New->getNumPar

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -4148,6 +4152,30 @@ static void emitWriteback(CodeGenFunction &CGF, assert(!isProvablyNull(srcAddr.getBasePointer()) && "shouldn't have writeback for provably null argument"); + if (CGF.getLangOpts().HLSL) { +if (!isa(writeback.CastExpr)) { + RValue Tmp

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -4148,6 +4152,30 @@ static void emitWriteback(CodeGenFunction &CGF, assert(!isProvablyNull(srcAddr.getBasePointer()) && "shouldn't have writeback for provably null argument"); + if (CGF.getLangOpts().HLSL) { +if (!isa(writeback.CastExpr)) { + RValue Tmp

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -5703,6 +5709,12 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity, Out << "E"; break; } + case Expr::HLSLOutArgExprClass: { +const auto *OAE = cast(E); +Out << (OAE->isInOut() ? "_inout_" : "_out_"); +mangleType(E->getType()); +

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -7061,6 +7061,67 @@ class ArraySectionExpr : public Expr { void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } }; +/// This class represents temporary values used to represent inout and out +/// arguments in HLSL. From the callee perspective these parameters are mo

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -4148,6 +4152,30 @@ static void emitWriteback(CodeGenFunction &CGF, assert(!isProvablyNull(srcAddr.getBasePointer()) && "shouldn't have writeback for provably null argument"); + if (CGF.getLangOpts().HLSL) { +if (!isa(writeback.CastExpr)) {

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -7061,6 +7061,67 @@ class ArraySectionExpr : public Expr { void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } }; +/// This class represents temporary values used to represent inout and out +/// arguments in HLSL. From the callee perspective these parameters are mo

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -7061,6 +7061,67 @@ class ArraySectionExpr : public Expr { void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } }; +/// This class represents temporary values used to represent inout and out +/// arguments in HLSL. From the callee perspective these parameters are mo

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -1121,3 +1121,99 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { } return false; } + +bool SemaHLSL::CheckCompatibleParameterABI(FunctionDecl *New, + FunctionDecl *Old) { + if (New->getNumPar

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -4148,6 +4152,30 @@ static void emitWriteback(CodeGenFunction &CGF, assert(!isProvablyNull(srcAddr.getBasePointer()) && "shouldn't have writeback for provably null argument"); + if (CGF.getLangOpts().HLSL) { +if (!isa(writeback.CastExpr)) { + RValue Tmp

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -4689,6 +4720,31 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, assert(type->isReferenceType() == E->isGLValue() && "reference binding to unmaterialized r-value!"); + // Add writeback for HLSLOutParamExpr. + if (const HLSLOutArgExpr *OE

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -11427,6 +11427,19 @@ static void AnalyzeImplicitConversions( return; } + if (auto *OutArgE = dyn_cast(E)) { +// The base expression is only used to initialize the parameter for +// arguments to `inout` parameters, so we only traverse down the base +// ex

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -7061,6 +7061,67 @@ class ArraySectionExpr : public Expr { void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } }; +/// This class represents temporary values used to represent inout and out +/// arguments in HLSL. From the callee perspective these parameters are mo

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -4689,6 +4720,31 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, assert(type->isReferenceType() == E->isGLValue() && "reference binding to unmaterialized r-value!"); + // Add writeback for HLSLOutParamExpr. + if (const HLSLOutArgExpr *OE

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
@@ -1121,3 +1121,99 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { } return false; } + +bool SemaHLSL::CheckCompatibleParameterABI(FunctionDecl *New, + FunctionDecl *Old) { + if (New->getNumPar

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-15 Thread John McCall via cfe-commits
https://github.com/rjmccall requested changes to this pull request. https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-07 Thread Cooper Partin via cfe-commits
https://github.com/coopp approved this pull request. That was a lot!. Didn't see anything to call out, so it looks good to me. https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-05 Thread Chris B via cfe-commits
llvm-beanz wrote: @rjmccall curious if you have some time to look at this PR. I've made some small changes to extend parameter ABI annotations and write back arguments (used by ObjC) to cover HLSL's odd parameter behaviors. https://github.com/llvm/llvm-project/pull/101083 _

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-05 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/101083 >From e8ec3e24e0061714b5dc440b1b92086965809483 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 29 Jul 2024 16:05:11 -0500 Subject: [PATCH 1/9] [HLSL] Implement output parameter HLSL output parameter

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-01 Thread Chris B via cfe-commits
@@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion -Wconversion %s + +void OutVecFn(out float3) {} +void InOutVecFn(inout float3) {} + +// Case 1: Calling out and inout parameters with types that cannot

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/101083 >From e8ec3e24e0061714b5dc440b1b92086965809483 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 29 Jul 2024 16:05:11 -0500 Subject: [PATCH 1/8] [HLSL] Implement output parameter HLSL output parameter

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-31 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/101083 >From e8ec3e24e0061714b5dc440b1b92086965809483 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 29 Jul 2024 16:05:11 -0500 Subject: [PATCH 1/7] [HLSL] Implement output parameter HLSL output parameter

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-31 Thread Chris B via cfe-commits
@@ -4689,6 +4719,32 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, assert(type->isReferenceType() == E->isGLValue() && "reference binding to unmaterialized r-value!"); + // Add writeback for HLSLOutParamExpr. + if (const HLSLOutArgExpr *OE

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-31 Thread Chris B via cfe-commits
@@ -5318,3 +5319,13 @@ OMPIteratorExpr *OMPIteratorExpr::CreateEmpty(const ASTContext &Context, alignof(OMPIteratorExpr)); return new (Mem) OMPIteratorExpr(EmptyShell(), NumIterators); } + +HLSLOutArgExpr *HLSLOutArgExpr::Create(const ASTContext &C, QualType Ty, +

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-31 Thread Chris B via cfe-commits
@@ -4613,14 +4613,13 @@ def HLSLGroupSharedAddressSpace : TypeAttr { let Documentation = [HLSLGroupSharedAddressSpaceDocs]; } -def HLSLParamModifier : TypeAttr { +def HLSLParamModifier : ParameterABIAttr { llvm-beanz wrote: DXC currently parses but ignores

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-30 Thread Damyan Pepper via cfe-commits
@@ -5318,3 +5319,13 @@ OMPIteratorExpr *OMPIteratorExpr::CreateEmpty(const ASTContext &Context, alignof(OMPIteratorExpr)); return new (Mem) OMPIteratorExpr(EmptyShell(), NumIterators); } + +HLSLOutArgExpr *HLSLOutArgExpr::Create(const ASTContext &C, QualType Ty, +

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-30 Thread Damyan Pepper via cfe-commits
@@ -4613,14 +4613,13 @@ def HLSLGroupSharedAddressSpace : TypeAttr { let Documentation = [HLSLGroupSharedAddressSpaceDocs]; } -def HLSLParamModifier : TypeAttr { +def HLSLParamModifier : ParameterABIAttr { damyanp wrote: as an aside: what's the plan for / s

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-30 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion -Wconversion %s + +void OutVecFn(out float3) {} +void InOutVecFn(inout float3) {} + +// Case 1: Calling out and inout parameters with types that cannot

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-30 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-30 Thread Damyan Pepper via cfe-commits
@@ -4689,6 +4719,32 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, assert(type->isReferenceType() == E->isGLValue() && "reference binding to unmaterialized r-value!"); + // Add writeback for HLSLOutParamExpr. + if (const HLSLOutArgExpr *OE

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-30 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion -Wconversion %s + +void OutVecFn(out float3) {} +void InOutVecFn(inout float3) {} + +// Case 1: Calling out and inout parameters with types that cannot

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Eli Friedman via cfe-commits
@@ -4057,6 +4057,10 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S, NewQType)) return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); +if (getLangOpts().HLSL && Cont

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
@@ -4148,6 +4151,30 @@ static void emitWriteback(CodeGenFunction &CGF, assert(!isProvablyNull(srcAddr.getBasePointer()) && "shouldn't have writeback for provably null argument"); + if (CGF.getLangOpts().HLSL) { +if (writeback.CastExpr) { + RValue TmpVal =

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
@@ -4057,6 +4057,10 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S, NewQType)) return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); +if (getLangOpts().HLSL && Cont

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Eli Friedman via cfe-commits
@@ -4057,6 +4057,10 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S, NewQType)) return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); +if (getLangOpts().HLSL && Cont

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Approach generally seems fine; not sure I'll have time to look more closely. https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/101083 >From e8ec3e24e0061714b5dc440b1b92086965809483 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 29 Jul 2024 16:05:11 -0500 Subject: [PATCH] [HLSL] Implement output parameter HLSL output parameters ar

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff fb7028237bac1dccd328b6c3150e50e222a0879b 874a9d50b63f2ed7220b2e19e8377b545455cd69 --e

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/101083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang @llvm/pr-subscribers-hlsl @llvm/pr-subscribers-clang-static-analyzer-1 Author: Chris B (llvm-beanz) Changes HLSL output parameters are denoted with the `inout` and `out` keywords in the function declaration. When an argument to an output parameter

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/101083 HLSL output parameters are denoted with the `inout` and `out` keywords in the function declaration. When an argument to an output parameter is constructed a temporary value is constructed for the argument.