[PATCH] D42276: [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel
This revision was automatically updated to reflect the committed changes. Closed by commit rC323485: [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel. (authored by aemerson, committed by ). Repository: rC Clang https://reviews.llvm.org/D42276 Files: include/clang/Basic/DiagnosticDriverKinds.td include/clang/Basic/DiagnosticGroups.td include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp test/Driver/global-isel.c Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -4694,6 +4694,37 @@ CmdArgs.push_back("-fwhole-program-vtables"); } + if (Arg *A = Args.getLastArg(options::OPT_fexperimental_isel, + options::OPT_fno_experimental_isel)) { +CmdArgs.push_back("-mllvm"); +if (A->getOption().matches(options::OPT_fexperimental_isel)) { + CmdArgs.push_back("-global-isel=1"); + + // GISel is on by default on AArch64 -O0, so don't bother adding + // the fallback remarks for it. Other combinations will add a warning of + // some kind. + bool IsArchSupported = Triple.getArch() == llvm::Triple::aarch64; + bool IsOptLevelSupported = false; + + Arg *A = Args.getLastArg(options::OPT_O_Group); + if (Triple.getArch() == llvm::Triple::aarch64) { +if (!A || A->getOption().matches(options::OPT_O0)) + IsOptLevelSupported = true; + } + if (!IsArchSupported || !IsOptLevelSupported) { +CmdArgs.push_back("-mllvm"); +CmdArgs.push_back("-global-isel-abort=2"); + +if (!IsArchSupported) + D.Diag(diag::warn_drv_experimental_isel_incomplete) << Triple.getArchName(); +else + D.Diag(diag::warn_drv_experimental_isel_incomplete_opt); + } +} else { + CmdArgs.push_back("-global-isel=0"); +} + } + // Finally add the compile command to the compilation. if (Args.hasArg(options::OPT__SLASH_fallback) && Output.getType() == types::TY_Object && Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1033,6 +1033,8 @@ def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>, HelpText<"Inline functions which are (explicitly or implicitly) marked inline">; def finline : Flag<["-"], "finline">, Group; +def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group, + HelpText<"Enables the experimental global instruction selector">; def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Enables an experimental new pass manager in LLVM.">; @@ -1244,6 +1246,8 @@ def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>; def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>; def fno_inline : Flag<["-"], "fno-inline">, Group, Flags<[CC1Option]>; +def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group, + HelpText<"Disables the experimental global instruction selector">; def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Disables an experimental new pass manager in LLVM.">; Index: include/clang/Basic/DiagnosticDriverKinds.td === --- include/clang/Basic/DiagnosticDriverKinds.td +++ include/clang/Basic/DiagnosticDriverKinds.td @@ -361,4 +361,12 @@ def note_drv_verify_prefix_spelling : Note< "-verify prefixes must start with a letter and contain only alphanumeric" " characters, hyphens, and underscores">; + +def warn_drv_experimental_isel_incomplete : Warning< + "-fexperimental-isel support for the '%0' architecture is incomplete">, + InGroup; + +def warn_drv_experimental_isel_incomplete_opt : Warning< + "-fexperimental-isel support is incomplete for this architecture at the current optimization level">, + InGroup; } Index: include/clang/Basic/DiagnosticGroups.td === --- include/clang/Basic/DiagnosticGroups.td +++ include/clang/Basic/DiagnosticGroups.td @@ -985,3 +985,6 @@ // A warning group for warnings about code that clang accepts when // compiling OpenCL C/C++ but which is not compatible with the SPIR spec. def SpirCompat : DiagGroup<"spir-compat">; + +// Warning for the experimental-isel options. +def ExperimentalISel : DiagGroup<"experimental-isel">; Index: test/Driver/global-isel.c === --- test/Driver/global-isel.c +++ test/Driver/global-isel.c @@ -0,0 +1,24 @@ +// REQUIRES: x86-registered-target,aarch64-registered-target + +// RUN: %clang -fexperimental-isel -S -### %s 2>&1 |
[PATCH] D42276: [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel
qcolombet accepted this revision. qcolombet added a comment. This revision is now accepted and ready to land. LGTM Repository: rC Clang https://reviews.llvm.org/D42276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42276: [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel
aemerson updated this revision to Diff 131191. aemerson added a comment. I've added two kinds of warnings, one for targets which have incomplete GISel support, and another for unsupported optimisation levels (for ARM64 -O{1,2,3,s,z}). Repository: rC Clang https://reviews.llvm.org/D42276 Files: include/clang/Basic/DiagnosticDriverKinds.td include/clang/Basic/DiagnosticGroups.td include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp test/Driver/global-isel.c Index: test/Driver/global-isel.c === --- /dev/null +++ test/Driver/global-isel.c @@ -0,0 +1,24 @@ +// REQUIRES: x86-registered-target,aarch64-registered-target + +// RUN: %clang -fexperimental-isel -S -### %s 2>&1 | FileCheck --check-prefix=ENABLED %s +// RUN: %clang -fno-experimental-isel -S -### %s 2>&1 | FileCheck --check-prefix=DISABLED %s + +// RUN: %clang -target aarch64 -fexperimental-isel -S %s -### 2>&1 | FileCheck --check-prefix=ARM64-DEFAULT %s +// RUN: %clang -target aarch64 -fexperimental-isel -S -O0 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O0 %s +// RUN: %clang -target aarch64 -fexperimental-isel -S -O2 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O2 %s +// RUN: %clang -target aarch64 -fexperimental-isel -Wno-experimental-isel -S -O2 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O2-NOWARN %s + +// RUN: %clang -target x86_64 -fexperimental-isel -S %s -### 2>&1 | FileCheck --check-prefix=X86_64 %s + +// ENABLED: "-mllvm" "-global-isel=1" +// DISABLED: "-mllvm" "-global-isel=0" + +// ARM64-DEFAULT-NOT: warning: -fexperimental-sel +// ARM64-DEFAULT-NOT: "-global-isel-abort=2" +// ARM64-O0-NOT: warning: -fexperimental-sel +// ARM64-O2: warning: -fexperimental-isel support is incomplete for this architecture at the current optimization level +// ARM64-O2: "-mllvm" "-global-isel-abort=2" +// ARM64-O2-NOWARN-NOT: warning: -fexperimental-isel + +// X86_64: -fexperimental-isel support for the 'x86_64' architecture is incomplete +// X86_64: "-mllvm" "-global-isel-abort=2" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -4690,6 +4690,37 @@ CmdArgs.push_back("-fwhole-program-vtables"); } + if (Arg *A = Args.getLastArg(options::OPT_fexperimental_isel, + options::OPT_fno_experimental_isel)) { +CmdArgs.push_back("-mllvm"); +if (A->getOption().matches(options::OPT_fexperimental_isel)) { + CmdArgs.push_back("-global-isel=1"); + + // GISel is on by default on AArch64 -O0, so don't bother adding + // the fallback remarks for it. Other combinations will add a warning of + // some kind. + bool IsArchSupported = Triple.getArch() == llvm::Triple::aarch64; + bool IsOptLevelSupported = false; + + Arg *A = Args.getLastArg(options::OPT_O_Group); + if (Triple.getArch() == llvm::Triple::aarch64) { +if (!A || A->getOption().matches(options::OPT_O0)) + IsOptLevelSupported = true; + } + if (!IsArchSupported || !IsOptLevelSupported) { +CmdArgs.push_back("-mllvm"); +CmdArgs.push_back("-global-isel-abort=2"); + +if (!IsArchSupported) + D.Diag(diag::warn_drv_experimental_isel_incomplete) << Triple.getArchName(); +else + D.Diag(diag::warn_drv_experimental_isel_incomplete_opt); + } +} else { + CmdArgs.push_back("-global-isel=0"); +} + } + // Finally add the compile command to the compilation. if (Args.hasArg(options::OPT__SLASH_fallback) && Output.getType() == types::TY_Object && Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1033,6 +1033,8 @@ def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>, HelpText<"Inline functions which are (explicitly or implicitly) marked inline">; def finline : Flag<["-"], "finline">, Group; +def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group, + HelpText<"Enables the experimental global instruction selector">; def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Enables an experimental new pass manager in LLVM.">; @@ -1244,6 +1246,8 @@ def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>; def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>; def fno_inline : Flag<["-"], "fno-inline">, Group, Flags<[CC1Option]>; +def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group, + HelpText<"Disables the experimental global instruction selector">; def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Disables
[PATCH] D42276: [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel
qcolombet added inline comments. Comment at: lib/Driver/ToolChains/Clang.cpp:4699 +else + CmdArgs.push_back("-global-isel=0"); + } aemerson wrote: > qcolombet wrote: > > qcolombet wrote: > > > I think that it would be useful to also set -global-isel-abort=2, so that > > > users can report problem early. > > > > > > What do you think? > > > > > > > > Should we have some kind of "target validation"? > > What I'd like to avoid is people trying the new allocator on unsupported > > target (as in the GISel base classes are not present) that would just crash > > the compiler. > > > > Alternatively, we could fix the backend to fallback gracefully/abort > > properly in those situation. > > Right now I believe we would get a segfault on RegisterBankInfo or > > something along those lines. > > I think that it would be useful to also set -global-isel-abort=2, so that > > users can report problem early. > > > > What do you think? > > Yes that makes sense, although should we ignore it for ARM64 O0 since we will > officially support it? > > > > > Should we have some kind of "target validation"? > > What I'd like to avoid is people trying the new allocator on unsupported > > target (as in the GISel base classes are not present) that would just crash > > the compiler. > > Perhaps a warning like "GlobalISel support is incomplete for [target]"? I > don't know the GISel status for other targets. > > > Yes that makes sense, although should we ignore it for ARM64 O0 since we will > officially support it? Sounds sensible. We can advertise the remark option if people want to know what is going on. Repository: rC Clang https://reviews.llvm.org/D42276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42276: [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel
aemerson added inline comments. Comment at: lib/Driver/ToolChains/Clang.cpp:4699 +else + CmdArgs.push_back("-global-isel=0"); + } qcolombet wrote: > qcolombet wrote: > > I think that it would be useful to also set -global-isel-abort=2, so that > > users can report problem early. > > > > What do you think? > > > > > Should we have some kind of "target validation"? > What I'd like to avoid is people trying the new allocator on unsupported > target (as in the GISel base classes are not present) that would just crash > the compiler. > > Alternatively, we could fix the backend to fallback gracefully/abort properly > in those situation. > Right now I believe we would get a segfault on RegisterBankInfo or something > along those lines. > I think that it would be useful to also set -global-isel-abort=2, so that > users can report problem early. > > What do you think? Yes that makes sense, although should we ignore it for ARM64 O0 since we will officially support it? > > Should we have some kind of "target validation"? > What I'd like to avoid is people trying the new allocator on unsupported > target (as in the GISel base classes are not present) that would just crash > the compiler. Perhaps a warning like "GlobalISel support is incomplete for [target]"? I don't know the GISel status for other targets. Repository: rC Clang https://reviews.llvm.org/D42276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42276: [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel
qcolombet added inline comments. Comment at: lib/Driver/ToolChains/Clang.cpp:4699 +else + CmdArgs.push_back("-global-isel=0"); + } I think that it would be useful to also set -global-isel-abort=2, so that users can report problem early. What do you think? Comment at: lib/Driver/ToolChains/Clang.cpp:4699 +else + CmdArgs.push_back("-global-isel=0"); + } qcolombet wrote: > I think that it would be useful to also set -global-isel-abort=2, so that > users can report problem early. > > What do you think? > > Should we have some kind of "target validation"? What I'd like to avoid is people trying the new allocator on unsupported target (as in the GISel base classes are not present) that would just crash the compiler. Alternatively, we could fix the backend to fallback gracefully/abort properly in those situation. Right now I believe we would get a segfault on RegisterBankInfo or something along those lines. Repository: rC Clang https://reviews.llvm.org/D42276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42276: [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel
aemerson updated this revision to Diff 130530. Repository: rC Clang https://reviews.llvm.org/D42276 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp test/Driver/global-isel.c Index: test/Driver/global-isel.c === --- /dev/null +++ test/Driver/global-isel.c @@ -0,0 +1,5 @@ +// RUN: %clang -fexperimental-isel -S -### %s 2>&1 | FileCheck -check-prefix=ENABLED %s +// RUN: %clang -fno-experimental-isel -S -### %s 2>&1 | FileCheck -check-prefix=DISABLED %s + +// ENABLED: "-mllvm" "-global-isel=1" +// DISABLED: "-mllvm" "-global-isel=0" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -4690,6 +4690,15 @@ CmdArgs.push_back("-fwhole-program-vtables"); } + if (Arg *A = Args.getLastArg(options::OPT_fexperimental_isel, + options::OPT_fno_experimental_isel)) { +CmdArgs.push_back("-mllvm"); +if (A->getOption().matches(options::OPT_fexperimental_isel)) + CmdArgs.push_back("-global-isel=1"); +else + CmdArgs.push_back("-global-isel=0"); + } + // Finally add the compile command to the compilation. if (Args.hasArg(options::OPT__SLASH_fallback) && Output.getType() == types::TY_Object && Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1033,6 +1033,8 @@ def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>, HelpText<"Inline functions which are (explicitly or implicitly) marked inline">; def finline : Flag<["-"], "finline">, Group; +def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group, + HelpText<"Enables the experimental global instruction selector">; def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Enables an experimental new pass manager in LLVM.">; @@ -1244,6 +1246,8 @@ def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>; def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>; def fno_inline : Flag<["-"], "fno-inline">, Group, Flags<[CC1Option]>; +def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group, + HelpText<"Disables the experimental global instruction selector">; def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Disables an experimental new pass manager in LLVM.">; Index: test/Driver/global-isel.c === --- /dev/null +++ test/Driver/global-isel.c @@ -0,0 +1,5 @@ +// RUN: %clang -fexperimental-isel -S -### %s 2>&1 | FileCheck -check-prefix=ENABLED %s +// RUN: %clang -fno-experimental-isel -S -### %s 2>&1 | FileCheck -check-prefix=DISABLED %s + +// ENABLED: "-mllvm" "-global-isel=1" +// DISABLED: "-mllvm" "-global-isel=0" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -4690,6 +4690,15 @@ CmdArgs.push_back("-fwhole-program-vtables"); } + if (Arg *A = Args.getLastArg(options::OPT_fexperimental_isel, + options::OPT_fno_experimental_isel)) { +CmdArgs.push_back("-mllvm"); +if (A->getOption().matches(options::OPT_fexperimental_isel)) + CmdArgs.push_back("-global-isel=1"); +else + CmdArgs.push_back("-global-isel=0"); + } + // Finally add the compile command to the compilation. if (Args.hasArg(options::OPT__SLASH_fallback) && Output.getType() == types::TY_Object && Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1033,6 +1033,8 @@ def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>, HelpText<"Inline functions which are (explicitly or implicitly) marked inline">; def finline : Flag<["-"], "finline">, Group; +def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group, + HelpText<"Enables the experimental global instruction selector">; def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Enables an experimental new pass manager in LLVM.">; @@ -1244,6 +1246,8 @@ def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>; def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>; def fno_inline : Flag<["-"], "fno-inline">, Group, Flags<[CC1Option]>; +def fno_experimental_isel : Flag<["-"],
[PATCH] D42276: [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel
aemerson created this revision. aemerson added reviewers: qcolombet, echristo. Herald added subscribers: kristof.beyls, rovka. Add an -fexperimental-isel driver option to enable/disable GlobalISel. This is a more user friendly way of enabling GlobalISel instead of doing -mllvm -global-isel. Repository: rC Clang https://reviews.llvm.org/D42276 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp test/Driver/global-isel.c Index: test/Driver/global-isel.c === --- /dev/null +++ test/Driver/global-isel.c @@ -0,0 +1,5 @@ +// RUN: %clang -fexperimental-isel -S -### %s 2>&1 | FileCheck -check-prefix=ENABLED %s +// RUN: %clang -fno-experimental-isel -S -### %s 2>&1 | FileCheck -check-prefix=DISABLED %s + +// ENABLED: "-mllvm" "-global-isel=1" +// DISABLED: "-mllvm" "-global-isel=0" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -4690,6 +4690,15 @@ CmdArgs.push_back("-fwhole-program-vtables"); } + if (Arg *A = Args.getLastArg(options::OPT_fexperimental_isel, + options::OPT_fno_experimental_isel)) { +CmdArgs.push_back("-mllvm"); +if (A->getOption().matches(options::OPT_fexperimental_isel)) + CmdArgs.push_back("-global-isel=1"); +else + CmdArgs.push_back("-global-isel=0"); + } + // Finally add the compile command to the compilation. if (Args.hasArg(options::OPT__SLASH_fallback) && Output.getType() == types::TY_Object && Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1033,6 +1033,9 @@ def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>, HelpText<"Inline functions which are (explicitly or implicitly) marked inline">; def finline : Flag<["-"], "finline">, Group; +def fexperimental_isel : Flag<["-"], "fexperimental-isel">, + Group, Flags<[CC1Option]>, + HelpText<"Enables the experimental global instruction selector">; def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Enables an experimental new pass manager in LLVM.">; @@ -1244,6 +1247,9 @@ def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>; def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>; def fno_inline : Flag<["-"], "fno-inline">, Group, Flags<[CC1Option]>; +def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, + Group, Flags<[CC1Option]>, + HelpText<"Disables the experimental global instruction selector">; def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Disables an experimental new pass manager in LLVM.">; Index: test/Driver/global-isel.c === --- /dev/null +++ test/Driver/global-isel.c @@ -0,0 +1,5 @@ +// RUN: %clang -fexperimental-isel -S -### %s 2>&1 | FileCheck -check-prefix=ENABLED %s +// RUN: %clang -fno-experimental-isel -S -### %s 2>&1 | FileCheck -check-prefix=DISABLED %s + +// ENABLED: "-mllvm" "-global-isel=1" +// DISABLED: "-mllvm" "-global-isel=0" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -4690,6 +4690,15 @@ CmdArgs.push_back("-fwhole-program-vtables"); } + if (Arg *A = Args.getLastArg(options::OPT_fexperimental_isel, + options::OPT_fno_experimental_isel)) { +CmdArgs.push_back("-mllvm"); +if (A->getOption().matches(options::OPT_fexperimental_isel)) + CmdArgs.push_back("-global-isel=1"); +else + CmdArgs.push_back("-global-isel=0"); + } + // Finally add the compile command to the compilation. if (Args.hasArg(options::OPT__SLASH_fallback) && Output.getType() == types::TY_Object && Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1033,6 +1033,9 @@ def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>, HelpText<"Inline functions which are (explicitly or implicitly) marked inline">; def finline : Flag<["-"], "finline">, Group; +def fexperimental_isel : Flag<["-"], "fexperimental-isel">, + Group, Flags<[CC1Option]>, + HelpText<"Enables the experimental global instruction selector">; def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Enables an experimental new pass manager in LLVM.">; @@