[all-commits] [llvm/llvm-project] 721651: [HLSL][clang][Driver] Support target profile comma...

Xiang Li via All-commits all-commits at lists.llvm.org
Fri Apr 15 12:18:34 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 721651be246e26efd767c3ec55c8f06c7b5a9a3d
  Author: Xiang Li <python3kgae at outlook.com>
  Date:   2022-04-15 (Fri, 15 Apr 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Driver/Driver.h
    M clang/include/clang/Driver/Options.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/CMakeLists.txt
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChain.cpp
    A clang/lib/Driver/ToolChains/HLSL.cpp
    A clang/lib/Driver/ToolChains/HLSL.h
    M clang/lib/Driver/Types.cpp
    M clang/test/lit.cfg.py
    M clang/unittests/Driver/ToolChainTest.cpp

  Log Message:
  [HLSL][clang][Driver] Support target profile command line option.

The target profile option(/T) decide the shader model when compile hlsl.
The format is shaderKind_major_minor like ps_6_1.
The shader model is saved as llvm::Triple is clang/llvm like
The main job to support the option is translating ps_6_1 into
That is done inside tryParseProfile  at HLSL.cpp.

To integrate the option into clang Driver, a new DriverMode DxcMode is
created. When DxcMode is enabled, OSType for TargetTriple will be
forced into Triple::ShaderModel. And new ToolChain HLSLToolChain will
be created when OSType is Triple::ShaderModel.

In HLSLToolChain, ComputeEffectiveClangTriple is overridden to call
tryParseProfile when targetProfile option is set.

To make test work, Fo option is added and .hlsl is added for active

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D122865

Patch by: Xiang Li <python3kgae at outlook.com>

More information about the All-commits mailing list