AArch64: remove arm64 triple enumerator.

Having both Triple::arm64 and Triple::aarch64 is extremely confusing, and
invites bugs where only one is checked. In reality, the only legitimate
difference between the two (arm64 usually means iOS) is also present in the OS
part of the triple and that's what should be checked.

We still parse the "arm64" triple, just canonicalise it to Triple::aarch64, so
there aren't any LLVM-side test changes.

llvm-svn: 213743
This commit is contained in:
Tim Northover 2014-07-23 12:32:47 +00:00
parent e373d3d06d
commit 3e8fd62854
12 changed files with 24 additions and 47 deletions

View File

@ -48,8 +48,6 @@ public:
arm, // ARM (little endian): arm, armv.*, xscale
armeb, // ARM (big endian): armeb
arm64, // ARM64 (little endian): arm64
arm64_be, // ARM64 (big endian): arm64_be
aarch64, // AArch64 (little endian): aarch64
aarch64_be, // AArch64 (big endian): aarch64_be
hexagon, // Hexagon: hexagon

View File

@ -525,8 +525,7 @@ void RuntimeDyldImpl::addRelocationForSymbol(const RelocationEntry &RE,
uint8_t *RuntimeDyldImpl::createStubFunction(uint8_t *Addr,
unsigned AbiVariant) {
if (Arch == Triple::aarch64 || Arch == Triple::aarch64_be ||
Arch == Triple::arm64 || Arch == Triple::arm64_be) {
if (Arch == Triple::aarch64 || Arch == Triple::aarch64_be) {
// This stub has to be able to access the full address space,
// since symbol lookup won't necessarily find a handy, in-range,
// PLT stub for functions which could be anywhere.

View File

@ -911,8 +911,6 @@ void RuntimeDyldELF::resolveRelocation(const SectionEntry &Section,
break;
case Triple::aarch64:
case Triple::aarch64_be:
case Triple::arm64:
case Triple::arm64_be:
resolveAArch64Relocation(Section, Offset, Value, Type, Addend);
break;
case Triple::arm: // Fall through.
@ -1018,8 +1016,7 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
DEBUG(dbgs() << "\t\tSectionID: " << SectionID << " Offset: " << Offset
<< "\n");
if ((Arch == Triple::aarch64 || Arch == Triple::aarch64_be ||
Arch == Triple::arm64 || Arch == Triple::arm64_be) &&
if ((Arch == Triple::aarch64 || Arch == Triple::aarch64_be) &&
(RelType == ELF::R_AARCH64_CALL26 || RelType == ELF::R_AARCH64_JUMP26)) {
// This is an AArch64 branch relocation, need to use a stub function.
DEBUG(dbgs() << "\t\tThis is an AArch64 branch relocation.");
@ -1431,8 +1428,6 @@ size_t RuntimeDyldELF::getGOTEntrySize() {
case Triple::x86_64:
case Triple::aarch64:
case Triple::aarch64_be:
case Triple::arm64:
case Triple::arm64_be:
case Triple::ppc64:
case Triple::ppc64le:
case Triple::systemz:

View File

@ -58,8 +58,7 @@ class RuntimeDyldELF : public RuntimeDyldImpl {
uint64_t Value, uint32_t Type, int64_t Addend);
unsigned getMaxStubSize() override {
if (Arch == Triple::aarch64 || Arch == Triple::arm64 ||
Arch == Triple::aarch64_be || Arch == Triple::arm64_be)
if (Arch == Triple::aarch64 || Arch == Triple::aarch64_be)
return 20; // movz; movk; movk; movk; br
if (Arch == Triple::arm || Arch == Triple::thumb)
return 8; // 32-bit instruction and 32-bit address

View File

@ -214,7 +214,7 @@ llvm::RuntimeDyldMachO::create(Triple::ArchType Arch, RTDyldMemoryManager *MM) {
llvm_unreachable("Unsupported target for RuntimeDyldMachO.");
break;
case Triple::arm: return make_unique<RuntimeDyldMachOARM>(MM);
case Triple::arm64: return make_unique<RuntimeDyldMachOAArch64>(MM);
case Triple::aarch64: return make_unique<RuntimeDyldMachOAArch64>(MM);
case Triple::x86: return make_unique<RuntimeDyldMachOI386>(MM);
case Triple::x86_64: return make_unique<RuntimeDyldMachOX86_64>(MM);
}

View File

@ -299,8 +299,7 @@ bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
MCpu = "core2";
else if (Triple.getArch() == llvm::Triple::x86)
MCpu = "yonah";
else if (Triple.getArch() == llvm::Triple::arm64 ||
Triple.getArch() == llvm::Triple::aarch64)
else if (Triple.getArch() == llvm::Triple::aarch64)
MCpu = "cyclone";
}

View File

@ -138,8 +138,7 @@ LTOModule *LTOModule::makeLTOModule(std::unique_ptr<MemoryBuffer> Buffer,
CPU = "core2";
else if (Triple.getArch() == llvm::Triple::x86)
CPU = "yonah";
else if (Triple.getArch() == llvm::Triple::arm64 ||
Triple.getArch() == llvm::Triple::aarch64)
else if (Triple.getArch() == llvm::Triple::aarch64)
CPU = "cyclone";
}

View File

@ -24,7 +24,7 @@ static bool useCompactUnwind(const Triple &T) {
return false;
// aarch64 always has it.
if (T.getArch() == Triple::arm64 || T.getArch() == Triple::aarch64)
if (T.getArch() == Triple::aarch64)
return true;
// Use it on newer version of OS X.
@ -43,8 +43,7 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
// MachO
SupportsWeakOmittedEHFrame = false;
if (T.isOSDarwin() &&
(T.getArch() == Triple::arm64 || T.getArch() == Triple::aarch64))
if (T.isOSDarwin() && T.getArch() == Triple::aarch64)
SupportsCompactUnwindWithoutEHFrame = true;
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel
@ -178,7 +177,7 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86)
CompactUnwindDwarfEHFrameOnly = 0x04000000;
else if (T.getArch() == Triple::arm64 || T.getArch() == Triple::aarch64)
else if (T.getArch() == Triple::aarch64)
CompactUnwindDwarfEHFrameOnly = 0x03000000;
}
@ -321,8 +320,6 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
break;
case Triple::aarch64:
case Triple::aarch64_be:
case Triple::arm64:
case Triple::arm64_be:
// The small model guarantees static code/data size < 4GB, but not where it
// will be in memory. Most of these could end up >2GB away so even a signed
// pc-relative 32-bit address is insufficient, theoretically.
@ -827,7 +824,7 @@ void MCObjectFileInfo::InitMCObjectFileInfo(StringRef T, Reloc::Model relocm,
// cellspu-apple-darwin. Perhaps we should fix in Triple?
if ((Arch == Triple::x86 || Arch == Triple::x86_64 ||
Arch == Triple::arm || Arch == Triple::thumb ||
Arch == Triple::arm64 || Arch == Triple::aarch64 ||
Arch == Triple::aarch64 ||
Arch == Triple::ppc || Arch == Triple::ppc64 ||
Arch == Triple::UnknownArch) &&
(TT.isOSDarwin() || TT.isOSBinFormatMachO())) {

View File

@ -755,7 +755,6 @@ MachOObjectFile::getRelocationTypeName(DataRefImpl Rel,
res = Table[RType];
break;
}
case Triple::arm64:
case Triple::aarch64: {
static const char *const Table[] = {
"ARM64_RELOC_UNSIGNED", "ARM64_RELOC_SUBTRACTOR",
@ -1303,7 +1302,7 @@ Triple::ArchType MachOObjectFile::getArch(uint32_t CPUType) {
case llvm::MachO::CPU_TYPE_ARM:
return Triple::arm;
case llvm::MachO::CPU_TYPE_ARM64:
return Triple::arm64;
return Triple::aarch64;
case llvm::MachO::CPU_TYPE_POWERPC:
return Triple::ppc;
case llvm::MachO::CPU_TYPE_POWERPC64:

View File

@ -23,8 +23,6 @@ const char *Triple::getArchTypeName(ArchType Kind) {
case aarch64_be: return "aarch64_be";
case arm: return "arm";
case armeb: return "armeb";
case arm64: return "arm64";
case arm64_be: return "arm64_be";
case hexagon: return "hexagon";
case mips: return "mips";
case mipsel: return "mipsel";
@ -61,8 +59,6 @@ const char *Triple::getArchTypePrefix(ArchType Kind) {
default:
return nullptr;
case arm64:
case arm64_be:
case aarch64:
case aarch64_be: return "aarch64";
@ -181,10 +177,10 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
return StringSwitch<Triple::ArchType>(Name)
.Case("aarch64", aarch64)
.Case("aarch64_be", aarch64_be)
.Case("arm64", aarch64) // "arm64" is an alias for "aarch64"
.Case("arm64_be", aarch64_be) // "arm64_be" is an alias for "aarch64_be"
.Case("arm", arm)
.Case("armeb", armeb)
.Case("arm64", arm64)
.Case("arm64_be", arm64_be)
.Case("mips", mips)
.Case("mipsel", mipsel)
.Case("mips64", mips64)
@ -233,7 +229,6 @@ const char *Triple::getArchNameForAssembler() {
.Cases("armv7", "thumbv7", "armv7")
.Case("armeb", "armeb")
.Case("arm64", "arm64")
.Case("arm64_be", "arm64")
.Case("r600", "r600")
.Case("nvptx", "nvptx")
.Case("nvptx64", "nvptx64")
@ -255,6 +250,8 @@ static Triple::ArchType parseArch(StringRef ArchName) {
.Case("powerpc64le", Triple::ppc64le)
.Case("aarch64", Triple::aarch64)
.Case("aarch64_be", Triple::aarch64_be)
.Case("arm64", Triple::aarch64)
.Case("arm64_be", Triple::aarch64_be)
.Cases("arm", "xscale", Triple::arm)
// FIXME: It would be good to replace these with explicit names for all the
// various suffixes supported.
@ -265,8 +262,6 @@ static Triple::ArchType parseArch(StringRef ArchName) {
.StartsWith("thumbv", Triple::thumb)
.Case("thumbeb", Triple::thumbeb)
.StartsWith("thumbebv", Triple::thumbeb)
.Case("arm64", Triple::arm64)
.Case("arm64_be", Triple::arm64_be)
.Case("msp430", Triple::msp430)
.Cases("mips", "mipseb", "mipsallegrex", Triple::mips)
.Cases("mipsel", "mipsallegrexel", Triple::mipsel)
@ -742,7 +737,7 @@ void Triple::getiOSVersion(unsigned &Major, unsigned &Minor,
getOSVersion(Major, Minor, Micro);
// Default to 5.0 (or 7.0 for arm64).
if (Major == 0)
Major = (getArch() == arm64) ? 7 : 5;
Major = (getArch() == aarch64) ? 7 : 5;
break;
}
}
@ -835,8 +830,6 @@ static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
case llvm::Triple::kalimba:
return 32;
case llvm::Triple::arm64:
case llvm::Triple::arm64_be:
case llvm::Triple::aarch64:
case llvm::Triple::aarch64_be:
case llvm::Triple::mips64:
@ -871,8 +864,6 @@ Triple Triple::get32BitArchVariant() const {
case Triple::UnknownArch:
case Triple::aarch64:
case Triple::aarch64_be:
case Triple::arm64:
case Triple::arm64_be:
case Triple::msp430:
case Triple::systemz:
case Triple::ppc64le:
@ -941,8 +932,6 @@ Triple Triple::get64BitArchVariant() const {
case Triple::sparcv9:
case Triple::systemz:
case Triple::x86_64:
case Triple::arm64:
case Triple::arm64_be:
// Already 64-bit.
break;

View File

@ -66,7 +66,7 @@ const MCExpr *AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol(
AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(StringRef TT) {
Triple T(TT);
if (T.getArch() == Triple::arm64_be || T.getArch() == Triple::aarch64_be)
if (T.getArch() == Triple::aarch64_be)
IsLittleEndian = false;
// We prefer NEON instructions to be printed in the short form.

View File

@ -19,13 +19,16 @@ Target TheARM64beTarget;
} // end namespace llvm
extern "C" void LLVMInitializeAArch64TargetInfo() {
RegisterTarget<Triple::arm64, /*HasJIT=*/true> X(TheARM64leTarget, "arm64",
"AArch64 (little endian)");
RegisterTarget<Triple::arm64_be, /*HasJIT=*/true> Y(TheARM64beTarget, "arm64_be",
"AArch64 (big endian)");
// Now register the "arm64" name for use with "-march". We don't want it to
// take possession of the Triple::aarch64 tag though.
RegisterTarget<Triple::UnknownArch, /*HasJIT=*/true> X(
TheARM64leTarget, "arm64", "ARM64 (little endian)");
RegisterTarget<Triple::UnknownArch, /*HasJIT=*/true> Y(
TheARM64beTarget, "arm64_be", "ARM64 (big endian)");
RegisterTarget<Triple::aarch64, /*HasJIT=*/true> Z(
TheAArch64leTarget, "aarch64", "AArch64 (little endian)");
RegisterTarget<Triple::aarch64_be, /*HasJIT=*/true> W(
TheAArch64beTarget, "aarch64_be", "AArch64 (big endian)");
}