Update for API change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77124 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-07-26 04:23:03 +00:00
parent 38b77f8c93
commit 6337f15b5a
2 changed files with 63 additions and 11 deletions

View File

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

View File

@ -20,11 +20,20 @@ const char *Triple::getArchTypeName(ArchType Kind) {
switch (Kind) {
case InvalidArch: return "<invalid>";
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 "<invalid>";
@ -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 "<invalid>";
@ -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;