[cfe-commits] r44712 - in /cfe/trunk: Basic/TargetInfo.cpp Driver/Targets.cpp include/clang/Basic/TargetInfo.h

Anders Carlsson andersca at mac.com
Sat Dec 8 11:32:58 PST 2007


Author: andersca
Date: Sat Dec  8 13:32:57 2007
New Revision: 44712

URL: http://llvm.org/viewvc/llvm-project?rev=44712&view=rev
Log:
Add getTargetPrefix to TargetInfo, to be used with target specific intrinsics.

Modified:
    cfe/trunk/Basic/TargetInfo.cpp
    cfe/trunk/Driver/Targets.cpp
    cfe/trunk/include/clang/Basic/TargetInfo.h

Modified: cfe/trunk/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Basic/TargetInfo.cpp?rev=44712&r1=44711&r2=44712&view=diff

==============================================================================
--- cfe/trunk/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/Basic/TargetInfo.cpp Sat Dec  8 13:32:57 2007
@@ -56,6 +56,10 @@
   return PrimaryTarget->getTargetTriple();
 }
 
+const char *TargetInfo::getTargetPrefix() const {
+ return PrimaryTarget->getTargetPrefix();
+}
+
 /// DiagnoseNonPortability - When a use of a non-portable target feature is
 /// used, this method emits the diagnostic and marks the translation unit as
 /// non-portable.
@@ -417,6 +421,9 @@
         // Eventually, an unknown constraint should just be treated as 'g'.
         assert(0 && "Unknown input constraint type!");
       }        
+    case '%': // commutative
+      // FIXME: Fail if % is used with the last operand.
+      break;
     case 'i': // immediate integer.
       break;
     case 'r': // general register.

Modified: cfe/trunk/Driver/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/Targets.cpp?rev=44712&r1=44711&r2=44712&view=diff

==============================================================================
--- cfe/trunk/Driver/Targets.cpp (original)
+++ cfe/trunk/Driver/Targets.cpp Sat Dec  8 13:32:57 2007
@@ -402,6 +402,10 @@
     return 0;
   }
 
+  const char *getTargetPrefix() {
+    return "ppc";
+  }
+  
 } // End namespace PPC
 
 
@@ -480,6 +484,10 @@
     return "~{dirflag},~{fpsr},~{flags}";
   }
   
+  const char *getTargetPrefix() {
+    return "x86";
+  }
+  
 } // End namespace X86
 
 //===----------------------------------------------------------------------===//
@@ -503,6 +511,9 @@
   virtual const char *getVAListDeclaration() const {
     return getPPCVAListDeclaration();
   }
+  virtual const char *getTargetPrefix() const {
+    return PPC::getTargetPrefix();
+  }
   virtual void getGCCRegNames(const char * const *&Names, 
                               unsigned &NumNames) const {
     PPC::getGCCRegNames(Names, NumNames);
@@ -537,6 +548,9 @@
   virtual const char *getVAListDeclaration() const {
     return getPPCVAListDeclaration();
   }  
+  virtual const char *getTargetPrefix() const {
+    return PPC::getTargetPrefix();
+  }  
   virtual void getGCCRegNames(const char * const *&Names, 
                                    unsigned &NumNames) const {
     PPC::getGCCRegNames(Names, NumNames);
@@ -571,6 +585,9 @@
   virtual const char *getVAListDeclaration() const {
     return getI386VAListDeclaration();
   }  
+  virtual const char *getTargetPrefix() const {
+    return X86::getTargetPrefix();
+  }  
   virtual void getGCCRegNames(const char * const *&Names, 
                                    unsigned &NumNames) const {
     X86::getGCCRegNames(Names, NumNames);
@@ -605,6 +622,9 @@
   virtual const char *getVAListDeclaration() const {
     return getX86_64VAListDeclaration();
   }
+  virtual const char *getTargetPrefix() const {
+    return X86::getTargetPrefix();
+  }
   virtual void getGCCRegNames(const char * const *&Names, 
                                    unsigned &NumNames) const {
     X86::getGCCRegNames(Names, NumNames);
@@ -643,6 +663,9 @@
   virtual const char *getVAListDeclaration() const {
     return getI386VAListDeclaration();
   }
+  virtual const char *getTargetPrefix() const {
+    return X86::getTargetPrefix();
+  }  
   virtual void getGCCRegNames(const char * const *&Names, 
                                    unsigned &NumNames) const {
     X86::getGCCRegNames(Names, NumNames);

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=44712&r1=44711&r2=44712&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Sat Dec  8 13:32:57 2007
@@ -245,6 +245,10 @@
     return static_cast<unsigned>(Size);
   }
 
+  /// getTargetPrefix - Return the target prefix used for identifying
+  /// llvm intrinsics.
+  const char *getTargetPrefix() const;
+    
   /// getTargetTriple - Return the target triple of the primary target.
   const char *getTargetTriple() const;
   
@@ -280,6 +284,8 @@
   ///  TargetInfoImpl object was created from.
   const char* getTargetTriple() const { return Triple.c_str(); }
   
+  virtual const char *getTargetPrefix() const = 0;
+
   /// getTargetDefines - Return a list of the target-specific #define values set
   /// when compiling to this target.  Each string should be of the form
   /// "#define X Y\n".





More information about the cfe-commits mailing list