summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-24 09:53:06 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-24 09:53:06 +0000
commit688b55b436b4a3a036f0827dc484b5f219ace1a3 (patch)
treea19ccaa5a12483dc2aa18e5075bef108716eab32
parent2b1d3d76d78353d3d7c793d437c6ee355dd0f9ab (diff)
downloadllvm-688b55b436b4a3a036f0827dc484b5f219ace1a3.tar.gz
llvm-688b55b436b4a3a036f0827dc484b5f219ace1a3.tar.bz2
llvm-688b55b436b4a3a036f0827dc484b5f219ace1a3.tar.xz
Add llvm::Triple::getArchTypePrefix for getting the intrinsic prefix for an
identifier architecture. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79906 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ADT/Triple.h8
-rw-r--r--lib/Support/Triple.cpp25
2 files changed, 33 insertions, 0 deletions
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
index 106084d074..46bf90082e 100644
--- a/include/llvm/ADT/Triple.h
+++ b/include/llvm/ADT/Triple.h
@@ -238,6 +238,14 @@ public:
/// architecture.
static const char *getArchTypeName(ArchType Kind);
+ /// getArchTypePrefix - Get the "prefix" canonical name for the \arg Kind
+ /// architecture. This is the prefix used by the architecture specific
+ /// builtins, and is suitable for passing to \see
+ /// Intrinsic::getIntrinsicForGCCBuiltin().
+ ///
+ /// \return - The architecture prefix, or 0 if none is defined.
+ static const char *getArchTypePrefix(ArchType Kind);
+
/// getVendorTypeName - Get the canonical name for the \arg Kind
/// vendor.
static const char *getVendorTypeName(VendorType Kind);
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
index dd767e260c..c4792e3efd 100644
--- a/lib/Support/Triple.cpp
+++ b/lib/Support/Triple.cpp
@@ -43,6 +43,31 @@ const char *Triple::getArchTypeName(ArchType Kind) {
return "<invalid>";
}
+const char *Triple::getArchTypePrefix(ArchType Kind) {
+ switch (Kind) {
+ default:
+ return 0;
+
+ case alpha: return "alpha";
+
+ case arm:
+ case thumb: return "arm";
+
+ case bfin: return "bfin";
+
+ case cellspu: return "spu";
+
+ case ppc64:
+ case ppc: return "ppc";
+
+ case sparc: return "sparc";
+
+ case x86:
+ case x86_64: return "x86";
+ case xcore: return "xcore";
+ }
+}
+
const char *Triple::getVendorTypeName(VendorType Kind) {
switch (Kind) {
case UnknownVendor: return "unknown";