diff options
| author | Eric Christopher <echristo@gmail.com> | 2014-12-18 02:08:45 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@gmail.com> | 2014-12-18 02:08:45 +0000 |
| commit | 1971c3508a3e781104803d750496339460dfac1e (patch) | |
| tree | 393bb5e7e0cd55aa403b56ea88075c06b57a816f /llvm/lib | |
| parent | 7a6f5e47cf3144ea1fdf4105279f0a2bc23aa59f (diff) | |
| download | bcm5719-llvm-1971c3508a3e781104803d750496339460dfac1e.tar.gz bcm5719-llvm-1971c3508a3e781104803d750496339460dfac1e.zip | |
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.
llvm-svn: 224489
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMSubtarget.cpp | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/llvm/lib/Target/ARM/ARMSubtarget.cpp b/llvm/lib/Target/ARM/ARMSubtarget.cpp index fa653759df4..199000f71f0 100644 --- a/llvm/lib/Target/ARM/ARMSubtarget.cpp +++ b/llvm/lib/Target/ARM/ARMSubtarget.cpp @@ -225,8 +225,8 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { // Insert the architecture feature derived from the target triple into the // feature string. This is important for setting features that are implied // based on the architecture version. - std::string ArchFS = ARM_MC::ParseARMTriple(TargetTriple.getTriple(), - CPUString); + std::string ArchFS = + ARM_MC::ParseARMTriple(TargetTriple.getTriple(), CPUString); if (!FS.empty()) { if (!ArchFS.empty()) ArchFS = ArchFS + "," + FS.str(); @@ -246,29 +246,45 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { InstrItins = getInstrItineraryForCPU(CPUString); if (TargetABI == ARM_ABI_UNKNOWN) { - switch (TargetTriple.getEnvironment()) { - case Triple::Android: - case Triple::EABI: - case Triple::EABIHF: - case Triple::GNUEABI: - case Triple::GNUEABIHF: - TargetABI = ARM_ABI_AAPCS; - break; - default: - if (TargetTriple.isOSBinFormatMachO() && - TargetTriple.getOS() == Triple::UnknownOS) + // FIXME: This is duplicated code from the front end and should be unified. + if (TargetTriple.isOSBinFormatMachO()) { + if (TargetTriple.getEnvironment() == llvm::Triple::EABI || + (TargetTriple.getOS() == llvm::Triple::UnknownOS && + TargetTriple.getObjectFormat() == llvm::Triple::MachO) || + CPU.startswith("cortex-m")) { TargetABI = ARM_ABI_AAPCS; - else + } else { TargetABI = ARM_ABI_APCS; - break; + } + } else if (TargetTriple.isOSWindows()) { + // FIXME: this is invalid for WindowsCE + TargetABI = ARM_ABI_AAPCS; + } else { + // Select the default based on the platform. + switch (TargetTriple.getEnvironment()) { + case llvm::Triple::Android: + case llvm::Triple::GNUEABI: + case llvm::Triple::GNUEABIHF: + case llvm::Triple::EABIHF: + case llvm::Triple::EABI: + TargetABI = ARM_ABI_AAPCS; + break; + case llvm::Triple::GNU: + TargetABI = ARM_ABI_APCS; + break; + default: + if (TargetTriple.getOS() == llvm::Triple::NetBSD) + TargetABI = ARM_ABI_APCS; + else + TargetABI = ARM_ABI_AAPCS; + break; + } } } // FIXME: this is invalid for WindowsCE - if (isTargetWindows()) { - TargetABI = ARM_ABI_AAPCS; + if (isTargetWindows()) NoARM = true; - } if (isAAPCS_ABI()) stackAlignment = 8; |

