]> granicus.if.org Git - clang/commitdiff
Add -foutline option to enable the MachineOutliner in AArch64
authorJessica Paquette <jpaquette@apple.com>
Wed, 2 May 2018 16:42:51 +0000 (16:42 +0000)
committerJessica Paquette <jpaquette@apple.com>
Wed, 2 May 2018 16:42:51 +0000 (16:42 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331370 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Options.td
lib/Driver/ToolChains/Clang.cpp
test/Driver/aarch64-outliner.c [new file with mode: 0644]

index 4a9e22b8460d5702de000a350782dee2e2972dcf..437006b9ff18533d6af504e8885e4dfe280b9a18 100644 (file)
@@ -1317,6 +1317,8 @@ def fno_exceptions : Flag<["-"], "fno-exceptions">, Group<f_Group>;
 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">,
index 5e5dfdeecae7d8d584ac46bf6c677cd4eb3ea1b7..26789f1b8159f4671a8ee307463fbde44b43e6a1 100644 (file)
@@ -1484,6 +1484,11 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
     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,
diff --git a/test/Driver/aarch64-outliner.c b/test/Driver/aarch64-outliner.c
new file mode 100644 (file)
index 0000000..2d539df
--- /dev/null
@@ -0,0 +1,4 @@
+// REQUIRES: aarch64-registered-target
+
+// RUN: %clang -target aarch64 -foutline -S %s -### 2>&1 | FileCheck %s
+// CHECK: "-mllvm" "-enable-machine-outliner"