r331370 - Add -foutline option to enable the MachineOutliner in AArch64

Jessica Paquette via cfe-commits cfe-commits at lists.llvm.org
Wed May 2 09:42:51 PDT 2018


Author: paquette
Date: Wed May  2 09:42:51 2018
New Revision: 331370

URL: http://llvm.org/viewvc/llvm-project?rev=331370&view=rev
Log:
Add -foutline option to enable the MachineOutliner in AArch64

Since we've been working on productizing the MachineOutliner in AArch64, it
makes sense to provide a more user-friendly way to enable it.

This allows users of AArch64 to enable the outliner using -foutline instead
of -mllvm -enable-machine-outliner. Other, less mature implementations (e.g,
x86-64) can still enable the pass using the -mllvm option.

Also add a test to make sure it works.

Added:
    cfe/trunk/test/Driver/aarch64-outliner.c
Modified:
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=331370&r1=331369&r2=331370&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed May  2 09:42:51 2018
@@ -1317,6 +1317,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 foutline : Flag<["-"], "foutline">, Group<f_clang_Group>, Flags<[CC1Option]>,
+    HelpText<"Enable function outlining (AArch64 only)">;
 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">,

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=331370&r1=331369&r2=331370&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed May  2 09:42:51 2018
@@ -1484,6 +1484,11 @@ void Clang::AddAArch64TargetArgs(const A
     else
       CmdArgs.push_back("-aarch64-enable-global-merge=true");
   }
+
+  if (Arg *A = Args.getLastArg(options::OPT_foutline)) {
+    CmdArgs.push_back("-mllvm");
+    CmdArgs.push_back("-enable-machine-outliner");
+  }
 }
 
 void Clang::AddMIPSTargetArgs(const ArgList &Args,

Added: cfe/trunk/test/Driver/aarch64-outliner.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-outliner.c?rev=331370&view=auto
==============================================================================
--- cfe/trunk/test/Driver/aarch64-outliner.c (added)
+++ cfe/trunk/test/Driver/aarch64-outliner.c Wed May  2 09:42:51 2018
@@ -0,0 +1,4 @@
+// REQUIRES: aarch64-registered-target
+
+// RUN: %clang -target aarch64 -foutline -S %s -### 2>&1 | FileCheck %s
+// CHECK: "-mllvm" "-enable-machine-outliner"




More information about the cfe-commits mailing list