summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2018-01-30 10:43:43 +0000
committerHans Wennborg <hans@hanshq.net>2018-01-30 10:43:43 +0000
commitb3a6ebf0b9344f321cc35ed43dd8d8915f2eb26b (patch)
treeea5bba56e0a22881160aa487f948cc150c324db3 /lib
parentf685e442bc0cef1796890d68ec4df83d8c581a43 (diff)
Merging r323485:
------------------------------------------------------------------------ r323485 | aemerson | 2018-01-26 01:27:22 +0100 (Fri, 26 Jan 2018) | 3 lines [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel. Differential Revision: https://reviews.llvm.org/D42276 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_60@323745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Driver/ToolChains/Clang.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp
index c445669a5a..484df52001 100644
--- a/lib/Driver/ToolChains/Clang.cpp
+++ b/lib/Driver/ToolChains/Clang.cpp
@@ -4639,6 +4639,37 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
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 &&