[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.

llvm-svn: 243310
This commit is contained in:
Akira Hatanaka 2015-07-27 19:29:04 +00:00
parent 6cfb894892
commit 9250047032
2 changed files with 10 additions and 3 deletions

View File

@ -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<const char *> &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:

View File

@ -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"