From 3e0535eabbcf4d8068bbd8be51c1e38ee8ac4d5e Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Mon, 27 Jul 2015 19:29:04 +0000 Subject: [PATCH] [AArch64] Unconditionally pass subtarget feature reserve-x18 on Darwin. After r243308, the front-end is responsible for checking the target OS and passing reserve-x18 if the target is Darwin. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243310 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 8 +++++--- test/Driver/aarch64-fixed-x18.c | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index becd9baffc..b2e8403fe1 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1927,7 +1927,9 @@ getAArch64MicroArchFeaturesFromMcpu(const Driver &D, StringRef Mcpu, return getAArch64MicroArchFeaturesFromMtune(D, CPU, Args, Features); } -static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args, +static void getAArch64TargetFeatures(const Driver &D, + const llvm::Triple &Triple, + const ArgList &Args, std::vector &Features) { Arg *A; bool success = true; @@ -1968,7 +1970,7 @@ static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args, Features.push_back("-crc"); } - if (Args.hasArg(options::OPT_ffixed_x18)) + if (Args.hasArg(options::OPT_ffixed_x18) || Triple.isOSDarwin()) Features.push_back("+reserve-x18"); } @@ -2003,7 +2005,7 @@ static void getTargetFeatures(const Driver &D, const llvm::Triple &Triple, break; case llvm::Triple::aarch64: case llvm::Triple::aarch64_be: - getAArch64TargetFeatures(D, Args, Features); + getAArch64TargetFeatures(D, Triple, Args, Features); break; case llvm::Triple::x86: case llvm::Triple::x86_64: diff --git a/test/Driver/aarch64-fixed-x18.c b/test/Driver/aarch64-fixed-x18.c index 631865f9aa..a79ac6cbcd 100644 --- a/test/Driver/aarch64-fixed-x18.c +++ b/test/Driver/aarch64-fixed-x18.c @@ -1,4 +1,9 @@ // RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s +// RUN: %clang -target aarch64-none-gnu -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-NO-FIXED-X18 < %t %s +// RUN: %clang -target -arm64-apple-ios -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s // CHECK-FIXED-X18: "-target-feature" "+reserve-x18" +// CHECK-NO-FIXED-X18-NOT: "-target-feature" "+reserve-x18" -- 2.40.0