Skip to content

Commit

Permalink
Add -foutline option to enable the MachineOutliner in AArch64
Browse files Browse the repository at this point in the history
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.

llvm-svn: 331370
  • Loading branch information
Jessica Paquette committed May 2, 2018
1 parent a3a4df3 commit 8e71ee3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -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">,
Expand Down
5 changes: 5 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions clang/test/Driver/aarch64-outliner.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// REQUIRES: aarch64-registered-target

// RUN: %clang -target aarch64 -foutline -S %s -### 2>&1 | FileCheck %s
// CHECK: "-mllvm" "-enable-machine-outliner"

0 comments on commit 8e71ee3

Please sign in to comment.