[PATCH] D124983: [HLSL] add -fcgl option flag.
Xiang Li via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 6 08:54:59 PDT 2022
python3kgae updated this revision to Diff 427656.
python3kgae added a comment.
Remove HelpText for alias option.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124983/new/
https://reviews.llvm.org/D124983
Files:
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/HLSL.cpp
clang/test/Driver/dxc_fcgl.hlsl
Index: clang/test/Driver/dxc_fcgl.hlsl
===================================================================
--- /dev/null
+++ clang/test/Driver/dxc_fcgl.hlsl
@@ -0,0 +1,5 @@
+// RUN: %clang_dxc -fcgl foo.hlsl -### %s 2>&1 | FileCheck %s
+
+// Make sure fcgl option flag which translated into "-S" "-emit-llvm" "-disable-llvm-passes".
+// CHECK:"-S" "-emit-llvm" "-disable-llvm-passes"
+
Index: clang/lib/Driver/ToolChains/HLSL.cpp
===================================================================
--- clang/lib/Driver/ToolChains/HLSL.cpp
+++ clang/lib/Driver/ToolChains/HLSL.cpp
@@ -169,6 +169,15 @@
if (!isLegalValidatorVersion(ValVerStr, getDriver()))
continue;
}
+ if (A->getOption().getID() == options::OPT_emit_pristine_llvm) {
+ // Translate fcgl into -S -emit-llvm and -disable-llvm-passes.
+ DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_S));
+ DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_emit_llvm));
+ DAL->AddFlagArg(nullptr,
+ Opts.getOption(options::OPT_disable_llvm_passes));
+ A->claim();
+ continue;
+ }
DAL->append(A);
}
// Add default validator version if not set.
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3470,7 +3470,9 @@
static void RenderHLSLOptions(const ArgList &Args, ArgStringList &CmdArgs,
types::ID InputType) {
- const unsigned ForwardedArguments[] = {options::OPT_dxil_validator_version};
+ const unsigned ForwardedArguments[] = {options::OPT_dxil_validator_version,
+ options::OPT_S, options::OPT_emit_llvm,
+ options::OPT_disable_llvm_passes};
for (const auto &Arg : ForwardedArguments)
if (const auto *A = Args.getLastArg(Arg))
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -6736,6 +6736,8 @@
def dxc_Group : OptionGroup<"<clang-dxc options>">, Flags<[DXCOption]>,
HelpText<"dxc compatibility options">;
+class DXCFlag<string name> : Option<["/", "-"], name, KIND_FLAG>,
+ Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>;
class DXCJoinedOrSeparate<string name> : Option<["/", "-"], name,
KIND_JOINED_OR_SEPARATE>, Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>;
@@ -6760,3 +6762,7 @@
"lib_6_3, lib_6_4, lib_6_5, lib_6_6, lib_6_7, lib_6_x,"
"ms_6_5, ms_6_6, ms_6_7,"
"as_6_5, as_6_6, as_6_7">;
+def emit_pristine_llvm : DXCFlag<"emit-pristine-llvm">,
+ HelpText<"Emit pristine LLVM IR from the frontend by not running any LLVM passes at all."
+ "Same as -S + -emit-llvm + -disable-llvm-passes.">;
+def fcgl : DXCFlag<"fcgl">, Alias<emit_pristine_llvm>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124983.427656.patch
Type: text/x-patch
Size: 2994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220506/195c2afd/attachment-0001.bin>
More information about the cfe-commits
mailing list