[llvm-branch-commits] [cfe-branch] r323745 - Merging r323485:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 30 02:43:43 PST 2018


Author: hans
Date: Tue Jan 30 02:43:43 2018
New Revision: 323745

URL: http://llvm.org/viewvc/llvm-project?rev=323745&view=rev
Log:
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
------------------------------------------------------------------------

Added:
    cfe/branches/release_60/test/Driver/global-isel.c
      - copied unchanged from r323485, cfe/trunk/test/Driver/global-isel.c
Modified:
    cfe/branches/release_60/   (props changed)
    cfe/branches/release_60/include/clang/Basic/DiagnosticDriverKinds.td
    cfe/branches/release_60/include/clang/Basic/DiagnosticGroups.td
    cfe/branches/release_60/include/clang/Driver/Options.td
    cfe/branches/release_60/lib/Driver/ToolChains/Clang.cpp

Propchange: cfe/branches/release_60/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 30 02:43:43 2018
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123
+/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123,323485
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_60/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/include/clang/Basic/DiagnosticDriverKinds.td?rev=323745&r1=323744&r2=323745&view=diff
==============================================================================
--- cfe/branches/release_60/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/branches/release_60/include/clang/Basic/DiagnosticDriverKinds.td Tue Jan 30 02:43:43 2018
@@ -354,4 +354,12 @@ def warn_drv_fine_grained_bitfield_acces
 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<ExperimentalISel>;
+
+def warn_drv_experimental_isel_incomplete_opt : Warning<
+  "-fexperimental-isel support is incomplete for this architecture at the current optimization level">,
+  InGroup<ExperimentalISel>;
 }

Modified: cfe/branches/release_60/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/include/clang/Basic/DiagnosticGroups.td?rev=323745&r1=323744&r2=323745&view=diff
==============================================================================
--- cfe/branches/release_60/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/branches/release_60/include/clang/Basic/DiagnosticGroups.td Tue Jan 30 02:43:43 2018
@@ -985,3 +985,6 @@ def UnknownArgument : DiagGroup<"unknown
 // 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">;

Modified: cfe/branches/release_60/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/include/clang/Driver/Options.td?rev=323745&r1=323744&r2=323745&view=diff
==============================================================================
--- cfe/branches/release_60/include/clang/Driver/Options.td (original)
+++ cfe/branches/release_60/include/clang/Driver/Options.td Tue Jan 30 02:43:43 2018
@@ -1031,6 +1031,8 @@ def finline_functions : Flag<["-"], "fin
 def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group<f_clang_Group>, Flags<[CC1Option]>,
   HelpText<"Inline functions which are (explicitly or implicitly) marked inline">;
 def finline : Flag<["-"], "finline">, Group<clang_ignored_f_Group>;
+def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group<f_clang_Group>,
+  HelpText<"Enables the experimental global instruction selector">;
 def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">,
   Group<f_clang_Group>, Flags<[CC1Option]>,
   HelpText<"Enables an experimental new pass manager in LLVM.">;
@@ -1237,6 +1239,8 @@ def fno_exceptions : Flag<["-"], "fno-ex
 def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group<f_Group>, Flags<[CC1Option]>;
 def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group<f_clang_Group>, Flags<[CC1Option]>;
 def fno_inline : Flag<["-"], "fno-inline">, Group<f_clang_Group>, Flags<[CC1Option]>;
+def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group<f_clang_Group>,
+  HelpText<"Disables the experimental global instruction selector">;
 def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">,
   Group<f_clang_Group>, Flags<[CC1Option]>,
   HelpText<"Disables an experimental new pass manager in LLVM.">;

Modified: cfe/branches/release_60/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/lib/Driver/ToolChains/Clang.cpp?rev=323745&r1=323744&r2=323745&view=diff
==============================================================================
--- cfe/branches/release_60/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/branches/release_60/lib/Driver/ToolChains/Clang.cpp Tue Jan 30 02:43:43 2018
@@ -4639,6 +4639,37 @@ void Clang::ConstructJob(Compilation &C,
     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 &&




More information about the llvm-branch-commits mailing list