[llvm-commits] [llvm] r121208 - in /llvm/trunk/utils/TableGen: NeonEmitter.cpp NeonEmitter.h

Bob Wilson bob.wilson at apple.com
Tue Dec 7 15:53:32 PST 2010


Author: bwilson
Date: Tue Dec  7 17:53:32 2010
New Revision: 121208

URL: http://llvm.org/viewvc/llvm-project?rev=121208&view=rev
Log:
Emit vmovl intrinsics first in the arm_neon.h header
so they can be used in the implementations of other intrinsics.

Modified:
    llvm/trunk/utils/TableGen/NeonEmitter.cpp
    llvm/trunk/utils/TableGen/NeonEmitter.h

Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=121208&r1=121207&r2=121208&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Tue Dec  7 17:53:32 2010
@@ -1040,47 +1040,58 @@
 
   std::vector<Record*> RV = Records.getAllDerivedDefinitions("Inst");
 
+  // Emit vmovl intrinsics first so they can be used by other intrinsics.
+  emitIntrinsic(OS, Records.getDef("VMOVL"));
+
   // Unique the return+pattern types, and assign them.
   for (unsigned i = 0, e = RV.size(); i != e; ++i) {
     Record *R = RV[i];
-    std::string name = R->getValueAsString("Name");
-    std::string Proto = R->getValueAsString("Prototype");
-    std::string Types = R->getValueAsString("Types");
-
-    SmallVector<StringRef, 16> TypeVec;
-    ParseTypes(R, Types, TypeVec);
-
-    OpKind kind = OpMap[R->getValueAsDef("Operand")->getName()];
+    if (R->getName() != "VMOVL")
+      emitIntrinsic(OS, R);
+  }
 
-    ClassKind classKind = ClassNone;
-    if (R->getSuperClasses().size() >= 2)
-      classKind = ClassMap[R->getSuperClasses()[1]];
-    if (classKind == ClassNone && kind == OpNone)
-      throw TGError(R->getLoc(), "Builtin has no class kind");
+  OS << "#undef __ai\n\n";
+  OS << "#endif /* __ARM_NEON_H */\n";
+}
 
-    for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
-      if (kind == OpReinterpret) {
-        bool outQuad = false;
-        bool dummy = false;
-        (void)ClassifyType(TypeVec[ti], outQuad, dummy, dummy);
-        for (unsigned srcti = 0, srcte = TypeVec.size();
-             srcti != srcte; ++srcti) {
-          bool inQuad = false;
-          (void)ClassifyType(TypeVec[srcti], inQuad, dummy, dummy);
-          if (srcti == ti || inQuad != outQuad)
-            continue;
-          OS << GenIntrinsic(name, Proto, TypeVec[ti], TypeVec[srcti],
-                             OpCast, ClassS);
-        }
-      } else {
-        OS << GenIntrinsic(name, Proto, TypeVec[ti], TypeVec[ti],
-                           kind, classKind);
+/// emitIntrinsic - Write out the arm_neon.h header file definitions for the
+/// intrinsics specified by record R.
+void NeonEmitter::emitIntrinsic(raw_ostream &OS, Record *R) {
+  std::string name = R->getValueAsString("Name");
+  std::string Proto = R->getValueAsString("Prototype");
+  std::string Types = R->getValueAsString("Types");
+
+  SmallVector<StringRef, 16> TypeVec;
+  ParseTypes(R, Types, TypeVec);
+
+  OpKind kind = OpMap[R->getValueAsDef("Operand")->getName()];
+
+  ClassKind classKind = ClassNone;
+  if (R->getSuperClasses().size() >= 2)
+    classKind = ClassMap[R->getSuperClasses()[1]];
+  if (classKind == ClassNone && kind == OpNone)
+    throw TGError(R->getLoc(), "Builtin has no class kind");
+
+  for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
+    if (kind == OpReinterpret) {
+      bool outQuad = false;
+      bool dummy = false;
+      (void)ClassifyType(TypeVec[ti], outQuad, dummy, dummy);
+      for (unsigned srcti = 0, srcte = TypeVec.size();
+           srcti != srcte; ++srcti) {
+        bool inQuad = false;
+        (void)ClassifyType(TypeVec[srcti], inQuad, dummy, dummy);
+        if (srcti == ti || inQuad != outQuad)
+          continue;
+        OS << GenIntrinsic(name, Proto, TypeVec[ti], TypeVec[srcti],
+                           OpCast, ClassS);
       }
+    } else {
+      OS << GenIntrinsic(name, Proto, TypeVec[ti], TypeVec[ti],
+                         kind, classKind);
     }
-    OS << "\n";
   }
-  OS << "#undef __ai\n\n";
-  OS << "#endif /* __ARM_NEON_H */\n";
+  OS << "\n";
 }
 
 static unsigned RangeFromType(StringRef typestr) {

Modified: llvm/trunk/utils/TableGen/NeonEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.h?rev=121208&r1=121207&r2=121208&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/NeonEmitter.h (original)
+++ llvm/trunk/utils/TableGen/NeonEmitter.h Tue Dec  7 17:53:32 2010
@@ -131,6 +131,9 @@
 
     // runHeader - Emit all the __builtin prototypes used in arm_neon.h
     void runHeader(raw_ostream &o);
+
+  private:
+    void emitIntrinsic(raw_ostream &OS, Record *R);
   };
 
 } // End llvm namespace





More information about the llvm-commits mailing list