llvm.org GIT mirror llvm / 360cbd4
Model ARM backend ABI selection after the front end code doing the same. This will change the "bare metal" ABI from APCS to AAPCS. The only difference between the front and back end code is that the code for Triple::GNU was added for environment. That will migrate to the front end shortly. Tests updated with the ABI they were originally testing in the case of bare metal (e.g. -mtriple armv7) or with a -gnu for arm-linux triples. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224489 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 5 years ago
6 changed file(s) with 42 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
224224 // Insert the architecture feature derived from the target triple into the
225225 // feature string. This is important for setting features that are implied
226226 // based on the architecture version.
227 std::string ArchFS = ARM_MC::ParseARMTriple(TargetTriple.getTriple(),
228 CPUString);
227 std::string ArchFS =
228 ARM_MC::ParseARMTriple(TargetTriple.getTriple(), CPUString);
229229 if (!FS.empty()) {
230230 if (!ArchFS.empty())
231231 ArchFS = ArchFS + "," + FS.str();
245245 InstrItins = getInstrItineraryForCPU(CPUString);
246246
247247 if (TargetABI == ARM_ABI_UNKNOWN) {
248 switch (TargetTriple.getEnvironment()) {
249 case Triple::Android:
250 case Triple::EABI:
251 case Triple::EABIHF:
252 case Triple::GNUEABI:
253 case Triple::GNUEABIHF:
248 // FIXME: This is duplicated code from the front end and should be unified.
249 if (TargetTriple.isOSBinFormatMachO()) {
250 if (TargetTriple.getEnvironment() == llvm::Triple::EABI ||
251 (TargetTriple.getOS() == llvm::Triple::UnknownOS &&
252 TargetTriple.getObjectFormat() == llvm::Triple::MachO) ||
253 CPU.startswith("cortex-m")) {
254 TargetABI = ARM_ABI_AAPCS;
255 } else {
256 TargetABI = ARM_ABI_APCS;
257 }
258 } else if (TargetTriple.isOSWindows()) {
259 // FIXME: this is invalid for WindowsCE
254260 TargetABI = ARM_ABI_AAPCS;
255 break;
256 default:
257 if (TargetTriple.isOSBinFormatMachO() &&
258 TargetTriple.getOS() == Triple::UnknownOS)
261 } else {
262 // Select the default based on the platform.
263 switch (TargetTriple.getEnvironment()) {
264 case llvm::Triple::Android:
265 case llvm::Triple::GNUEABI:
266 case llvm::Triple::GNUEABIHF:
267 case llvm::Triple::EABIHF:
268 case llvm::Triple::EABI:
259269 TargetABI = ARM_ABI_AAPCS;
260 else
261 TargetABI = ARM_ABI_APCS;
262 break;
270 break;
271 case llvm::Triple::GNU:
272 TargetABI = ARM_ABI_APCS;
273 break;
274 default:
275 if (TargetTriple.getOS() == llvm::Triple::NetBSD)
276 TargetABI = ARM_ABI_APCS;
277 else
278 TargetABI = ARM_ABI_AAPCS;
279 break;
280 }
263281 }
264282 }
265283
266284 // FIXME: this is invalid for WindowsCE
267 if (isTargetWindows()) {
268 TargetABI = ARM_ABI_AAPCS;
285 if (isTargetWindows())
269286 NoARM = true;
270 }
271287
272288 if (isAAPCS_ABI())
273289 stackAlignment = 8;
None ; RUN: llc -mtriple=arm-linux < %s | FileCheck %s --check-prefix=APCS
1 ; RUN: llc -mtriple=arm-linux -mattr=apcs < %s | \
0 ; RUN: llc -mtriple=arm-linux-gnu < %s | FileCheck %s --check-prefix=APCS
1 ; RUN: llc -mtriple=arm-linux-gnu -mattr=apcs < %s | \
22 ; RUN: FileCheck %s --check-prefix=APCS
33 ; RUN: llc -mtriple=arm-linux-gnueabi -mattr=apcs < %s | \
44 ; RUN: FileCheck %s --check-prefix=APCS
0 ; RUN: llc < %s -mtriple=armv7-apple-ios | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-LE
11 ; RUN: llc < %s -mtriple=thumbv7-none-linux-gnueabihf | FileCheck %s --check-prefix=CHECK-THUMB --check-prefix=CHECK-THUMB-LE
2 ; RUN: llc < %s -mtriple=armebv7 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-BE
2 ; RUN: llc < %s -mtriple=armebv7 -mattr=apcs | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-BE
33 ; RUN: llc < %s -mtriple=thumbebv7-none-linux-gnueabihf | FileCheck %s --check-prefix=CHECK-THUMB --check-prefix=CHECK-THUMB-BE
44
55 define i64 @test1(i64* %ptr, i64 %val) {
0 ; RUN: llc < %s -mtriple=thumbv7s-apple-ios3.0.0 -mcpu=generic | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-LE
1 ; RUN: llc < %s -mtriple=thumbeb -mattr=v7,neon | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BE
1 ; RUN: llc < %s -mtriple=thumbeb -mattr=apcs -mattr=v7,neon | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BE
22
33 ; PR15525
44 ; CHECK-LABEL: test1:
None ; RUN: llc -mtriple=thumbv7-unknown-unknown < %s | FileCheck %s
0 ; RUN: llc -mtriple=thumbv7-unknown-unknown -mattr=apcs < %s | FileCheck %s
11 ; Check assembly printing of odd constants.
22
33 ; CHECK: bigCst:
None ; RUN: llc -mtriple armv7 -O0 -o - < %s | FileCheck %s -check-prefix CHECK-TAIL
1 ; RUN: llc -mtriple armv7 -O0 -disable-tail-calls -o - < %s \
0 ; RUN: llc -mtriple armv7 -mattr=apcs -O0 -o - < %s \
1 ; RUN: | FileCheck %s -check-prefix CHECK-TAIL
2 ; RUN: llc -mtriple armv7 -mattr=apcs -O0 -disable-tail-calls -o - < %s \
23 ; RUN: | FileCheck %s -check-prefix CHECK-NO-TAIL
34
45 declare i32 @callee(i32 %i)