diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-08 23:32:51 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-08 23:32:51 +0000 |
commit | a8597a374933ba03be837b3508803e18e8c961ed (patch) | |
tree | 692da5ce935dda1048c11f9ed23fa38a8026426d /llvm/lib/Support/Triple.cpp | |
parent | 9e5674ae3fad6fb307900e4b1b72e36e6eec483d (diff) | |
download | bcm5719-llvm-a8597a374933ba03be837b3508803e18e8c961ed.tar.gz bcm5719-llvm-a8597a374933ba03be837b3508803e18e8c961ed.zip |
Add Triple::getArchTypeForDarwinArchName, which converts a "Darwin" architecture
name (e.g. "ppc") to the appropriate constant.
Also, StringRefize additional Triple constructor.
llvm-svn: 81274
Diffstat (limited to 'llvm/lib/Support/Triple.cpp')
-rw-r--r-- | llvm/lib/Support/Triple.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index 8b482473a50..e986fb83f71 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -139,6 +139,40 @@ Triple::ArchType Triple::getArchTypeForLLVMName(const StringRef &Name) { return UnknownArch; } +Triple::ArchType Triple::getArchTypeForDarwinArchName(const StringRef &Str) { + // See arch(3) and llvm-gcc's driver-driver.c. We don't implement support for + // archs which Darwin doesn't use. + + // The matching this routine does is fairly pointless, since it is neither the + // complete architecture list, nor a reasonable subset. The problem is that + // historically the driver driver accepts this and also ties its -march= + // handling to the architecture name, so we need to be careful before removing + // support for it. + + if (Str == "ppc" || Str == "ppc601" || Str == "ppc603" || Str == "ppc604" || + Str == "ppc604e" || Str == "ppc750" || Str == "ppc7400" || + Str == "ppc7450" || Str == "ppc970") + return Triple::ppc; + + if (Str == "ppc64") + return Triple::ppc64; + + if (Str == "i386" || Str == "i486" || Str == "i486SX" || Str == "pentium" || + Str == "i586" || Str == "pentpro" || Str == "i686" || Str == "pentIIm3" || + Str == "pentIIm5" || Str == "pentium4") + return Triple::x86; + + if (Str == "x86_64") + return Triple::x86_64; + + // This is derived from the driver driver. + if (Str == "arm" || Str == "armv4t" || Str == "armv5" || Str == "xscale" || + Str == "armv6" || Str == "armv7") + return Triple::arm; + + return Triple::UnknownArch; +} + // void Triple::Parse() const { |