[all-commits] [llvm/llvm-project] 9434c0: [HLSL] Implement array temporary support (#79382)

Chris B via All-commits all-commits at lists.llvm.org
Mon Apr 1 10:10:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9434c083475e42f47383f3067fe2a155db5c6a30
      https://github.com/llvm/llvm-project/commit/9434c083475e42f47383f3067fe2a155db5c6a30
  Author: Chris B <chris.bieneman at me.com>
  Date:   2024-04-01 (Mon, 01 Apr 2024)

  Changed paths:
    M clang/docs/HLSL/FunctionCalls.rst
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/AST/OperationKinds.def
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/AST/Type.h
    M clang/include/clang/AST/TypeLoc.h
    M clang/include/clang/AST/TypeProperties.td
    M clang/include/clang/Basic/TypeNodes.td
    M clang/include/clang/Sema/Overload.h
    M clang/include/clang/Serialization/TypeBitCodes.def
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/ASTStructuralEquivalence.cpp
    M clang/lib/AST/Expr.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/MicrosoftMangle.cpp
    M clang/lib/AST/ODRHash.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprAgg.cpp
    M clang/lib/CodeGen/CGExprComplex.cpp
    M clang/lib/CodeGen/CGExprConstant.cpp
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/CodeGen/CodeGenTypes.cpp
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    M clang/lib/Edit/RewriteObjCFoundationAPI.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaInit.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
    A clang/test/CodeGenHLSL/ArrayTemporary.hlsl
    A clang/test/SemaHLSL/ArrayParams.hlsl
    A clang/test/SemaHLSL/ArrayTemporary.hlsl
    A clang/test/SemaHLSL/ArrayTemporary.ll
    M clang/tools/libclang/CIndex.cpp

  Log Message:
  -----------
  [HLSL] Implement array temporary support (#79382)

HLSL constant sized array function parameters do not decay to pointers.
Instead constant sized array types are preserved as unique types for
overload resolution, template instantiation and name mangling.

This implements the change by adding a new `ArrayParameterType` which
represents a non-decaying `ConstantArrayType`. The new type behaves the
same as `ConstantArrayType` except that it does not decay to a pointer.

Values of `ConstantArrayType` in HLSL decay during overload resolution
via a new `HLSLArrayRValue` cast to `ArrayParameterType`.

`ArrayParamterType` values are passed indirectly by-value to functions
in IR generation resulting in callee generated memcpy instructions.

The behavior of HLSL function calls is documented in the [draft language
specification](https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf)
under the Expr.Post.Call heading.

Additionally the design of this implementation approach is documented in
[Clang's
documentation](https://clang.llvm.org/docs/HLSL/FunctionCalls.html)

Resolves #70123



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list