Add llvm::Triple::getArchTypePrefix for getting the intrinsic prefix for an
authorDaniel Dunbar <daniel@zuster.org>
Mon, 24 Aug 2009 09:53:06 +0000 (09:53 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 24 Aug 2009 09:53:06 +0000 (09:53 +0000)
identifier architecture.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79906 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/Triple.h
lib/Support/Triple.cpp

index 106084d0745f3ae55e3c52456374499203f4747d..46bf90082ec02e8bd92dd661608dfb3627690d30 100644 (file)
@@ -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);
index dd767e260cbc4d7048061bc7a86a7814c8d5c1db..c4792e3efd88babb25b61500abbb7352793eb18e 100644 (file)
@@ -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";