diff options
| author | Renato Golin <renato.golin@linaro.org> | 2015-01-25 23:17:48 +0000 |
|---|---|---|
| committer | Renato Golin <renato.golin@linaro.org> | 2015-01-25 23:17:48 +0000 |
| commit | b625f488623ad21cfd6cc6287502b2ff458017ec (patch) | |
| tree | 4d204d21915bc5e0d38ba717ad391ef63b7a9731 | |
| parent | 1dba307c0fbd5116688e821598373310312b7543 (diff) | |
| download | bcm5719-llvm-b625f488623ad21cfd6cc6287502b2ff458017ec.tar.gz bcm5719-llvm-b625f488623ad21cfd6cc6287502b2ff458017ec.zip | |
Allows Clang to use LLVM's fixes-x18 option
This patch allows clang to have llvm reserve the x18
platform register on AArch64. FreeBSD will use this in the kernel for
per-cpu data but has no need to reserve this register in userland so
will need this flag to reserve it.
This uses llvm r226664 to allow this register to be reserved.
Patch by Andrew Turner.
llvm-svn: 227062
| -rw-r--r-- | clang/include/clang/Driver/Options.td | 2 | ||||
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 5 | ||||
| -rw-r--r-- | clang/test/Driver/aarch64-fixed-x18.c | 4 |
3 files changed, 11 insertions, 0 deletions
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index f96da515631..3d1b5bf68be 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1218,6 +1218,8 @@ def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">, def mno_fix_cortex_a53_835769 : Flag<["-"], "mno-fix-cortex-a53-835769">, Group<m_aarch64_Features_Group>, HelpText<"Don't workaround Cortex-A53 erratum 835769 (AArch64 only)">; +def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group<m_aarch64_Features_Group>, + HelpText<"Reserve the x18 register (AArch64 only)">; def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>; def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>; diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 1f0d4f09f81..21c8580e320 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -958,6 +958,11 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args, if (A->getOption().matches(options::OPT_mno_global_merge)) CmdArgs.push_back("-mno-global-merge"); } + + if (Args.hasArg(options::OPT_ffixed_x18)) { + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-aarch64-reserve-x18"); + } } // Get CPU and ABI names. They are not independent diff --git a/clang/test/Driver/aarch64-fixed-x18.c b/clang/test/Driver/aarch64-fixed-x18.c new file mode 100644 index 00000000000..35d0caf0321 --- /dev/null +++ b/clang/test/Driver/aarch64-fixed-x18.c @@ -0,0 +1,4 @@ +// RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s + +// CHECK-FIXED-X18: "-backend-option" "-aarch64-reserve-x18" |

