From 6337f15b5a73c3eeb644d59cf34d37d4a278f5f7 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 26 Jul 2009 04:23:03 +0000 Subject: [PATCH] Update for API change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77124 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/Triple.h | 22 +++++++++++++---- lib/Support/Triple.cpp | 52 ++++++++++++++++++++++++++++++++++----- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index 5476d82dd56..f4bc612eb28 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -36,10 +36,19 @@ public: enum ArchType { UnknownArch, - x86, // i?86 - ppc, // powerpc - ppc64, // powerpc64 - x86_64, // amd64, x86_64 + alpha, // alpha + arm, // arm, armv.* + cellspu, // spu, cellspu + mips, // mips, mipsallegrex + mipsel, // mipsel, mipsallegrexel, psp + msp430, // msp430 + ppc, // powerpc + ppc64, // powerpc64 + sparc, // sparc + systemz, // s390x + thumb, // thumb, thumbv.* + x86, // i[3-9]86 + x86_64, // amd64, x86_64 InvalidArch }; @@ -53,12 +62,15 @@ public: UnknownOS, AuroraUX, + Cygwin, Darwin, DragonFly, FreeBSD, Linux, + MinGW32, NetBSD, - OpenBSD + OpenBSD, + Win32 }; private: diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 5231e8b4e37..89d95ca15fb 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -20,11 +20,20 @@ const char *Triple::getArchTypeName(ArchType Kind) { switch (Kind) { case InvalidArch: return ""; case UnknownArch: return "unknown"; - - case x86: return "i386"; - case x86_64: return "x86_64"; - case ppc: return "powerpc"; - case ppc64: return "powerpc64"; + + case alpha: return "alpha"; + case arm: return "arm"; + case cellspu: return "cellspu"; + case mips: return "mips"; + case mipsel: return "mipsel"; + case msp430: return "msp430"; + case sparc: return "sparc"; + case systemz: return "s390x"; + case thumb: return "thumb"; + case x86: return "i386"; + case x86_64: return "x86_64"; + case ppc: return "powerpc"; + case ppc64: return "powerpc64"; } return ""; @@ -46,12 +55,15 @@ const char *Triple::getOSTypeName(OSType Kind) { case UnknownOS: return "unknown"; case AuroraUX: return "auroraux"; + case Cygwin: return "cygwin"; case Darwin: return "darwin"; case DragonFly: return "dragonfly"; case FreeBSD: return "freebsd"; case Linux: return "linux"; + case MinGW32: return "mingw32"; case NetBSD: return "netbsd"; case OpenBSD: return "openbsd"; + case Win32: return "win32"; } return ""; @@ -64,7 +76,8 @@ void Triple::Parse() const { StringRef ArchName = getArchName(); if (ArchName.size() == 4 && ArchName[0] == 'i' && - ArchName[2] == '8' && ArchName[3] == '6') + ArchName[2] == '8' && ArchName[3] == '6' && + ArchName[1] - '3' < 6) // i[3-9]86 Arch = x86; else if (ArchName == "amd64" || ArchName == "x86_64") Arch = x86_64; @@ -72,6 +85,27 @@ void Triple::Parse() const { Arch = ppc; else if (ArchName == "powerpc64") Arch = ppc64; + else if (ArchName == "arm" || + ArchName.startswith("armv")) + Arch = arm; + else if (ArchName == "thumb" || + ArchName.startswith("thumbv")) + Arch = thumb; + else if (ArchName.startswith("alpha")) + Arch = alpha; + else if (ArchName == "spu" || ArchName == "cellspu") + Arch = cellspu; + else if (ArchName == "msp430") + Arch = msp430; + else if (ArchName == "mips" || ArchName == "mipsallegrex") + Arch = mips; + else if (ArchName == "mipsel" || ArchName == "mipsallegrexel" || + ArchName == "psp") + Arch = mipsel; + else if (ArchName == "sparc") + Arch = sparc; + else if (ArchName == "s390x") + Arch = systemz; else Arch = UnknownArch; @@ -86,6 +120,8 @@ void Triple::Parse() const { StringRef OSName = getOSName(); if (OSName.startswith("auroraux")) OS = AuroraUX; + else if (OSName.startswith("cygwin")) + OS = Cygwin; else if (OSName.startswith("darwin")) OS = Darwin; else if (OSName.startswith("dragonfly")) @@ -94,10 +130,14 @@ void Triple::Parse() const { OS = FreeBSD; else if (OSName.startswith("linux")) OS = Linux; + else if (OSName.startswith("mingw32")) + OS = MinGW32; else if (OSName.startswith("netbsd")) OS = NetBSD; else if (OSName.startswith("openbsd")) OS = OpenBSD; + else if (OSName.startswith("win32")) + OS = Win32; else OS = UnknownOS; -- 2.34.1