summaryrefslogtreecommitdiff
path: root/lib/Support/Triple.cpp
diff options
context:
space:
mode:
authorViktor Kutuzov <vkutuzov@accesssoftek.com>2009-11-17 18:48:27 +0000
committerViktor Kutuzov <vkutuzov@accesssoftek.com>2009-11-17 18:48:27 +0000
commit51cdac02c4125b8545728eb30ab5f54e437d6377 (patch)
tree51ed0c60152d1534ce936f0614448a8db78a277a /lib/Support/Triple.cpp
parentaa60ddac394e8d79ecd9700e32b595c115585007 (diff)
downloadllvm-51cdac02c4125b8545728eb30ab5f54e437d6377.tar.gz
llvm-51cdac02c4125b8545728eb30ab5f54e437d6377.tar.bz2
llvm-51cdac02c4125b8545728eb30ab5f54e437d6377.tar.xz
Added getArchNameForAssembler method to the Triple class for which returns OS and Vendor independent target assembler arch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89122 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Triple.cpp')
-rw-r--r--lib/Support/Triple.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
index 40f055f462..840fb98fe9 100644
--- a/lib/Support/Triple.cpp
+++ b/lib/Support/Triple.cpp
@@ -179,6 +179,33 @@ Triple::ArchType Triple::getArchTypeForDarwinArchName(StringRef Str) {
return Triple::UnknownArch;
}
+// Returns architecture name that is unsderstood by the target assembler.
+const char *Triple::getArchNameForAssembler() {
+ if (getOS() != Triple::Darwin && getVendor() != Triple::Apple)
+ return NULL;
+
+ StringRef Str = getArchName();
+ if (Str == "i386")
+ return "i386";
+ if (Str == "x86_64")
+ return "x86_64";
+ if (Str == "powerpc")
+ return "ppc";
+ if (Str == "powerpc64")
+ return "ppc64";
+ if (Str == "arm")
+ return "arm";
+ if (Str == "armv4t" || Str == "thumbv4t")
+ return "armv4t";
+ if (Str == "armv5" || Str == "armv5e" || Str == "thumbv5" || Str == "thumbv5e")
+ return "armv5";
+ if (Str == "armv6" || Str == "thumbv6")
+ return "armv6";
+ if (Str == "armv7" || Str == "thumbv7")
+ return "armv7";
+ return NULL;
+}
+
//
void Triple::Parse() const {