[cfe-commits] r119302 - /cfe/trunk/lib/AST/TypePrinter.cpp

Bob Wilson bob.wilson at apple.com
Mon Nov 15 16:32:26 PST 2010


Author: bwilson
Date: Mon Nov 15 18:32:26 2010
New Revision: 119302

URL: http://llvm.org/viewvc/llvm-project?rev=119302&view=rev
Log:
Update TypePrinter::PrintVector to handle new Neon vector types.

Modified:
    cfe/trunk/lib/AST/TypePrinter.cpp

Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=119302&r1=119301&r2=119302&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Mon Nov 15 18:32:26 2010
@@ -251,15 +251,29 @@
 }
 
 void TypePrinter::PrintVector(const VectorType *T, std::string &S) { 
-  if (T->getVectorKind() != VectorType::GenericVector) {
-    if (T->getVectorKind() == VectorType::AltiVecPixel)
-      S = "__vector __pixel " + S;
-    else {
-      Print(T->getElementType(), S);
-      S = ((T->getVectorKind() == VectorType::AltiVecBool)
-           ? "__vector __bool " : "__vector ") + S;
-    }
-  } else {
+  switch (T->getVectorKind()) {
+  case VectorType::AltiVecPixel:
+    S = "__vector __pixel " + S;
+    break;
+  case VectorType::AltiVecBool:
+    Print(T->getElementType(), S);
+    S = "__vector __bool " + S;
+    break;
+  case VectorType::AltiVecVector:
+    Print(T->getElementType(), S);
+    S = "__vector " + S;
+    break;
+  case VectorType::NeonVector:
+    Print(T->getElementType(), S);
+    S = ("__attribute__((neon_vector_type(" +
+         llvm::utostr_32(T->getNumElements()) + "))) " + S);
+    break;
+  case VectorType::NeonPolyVector:
+    Print(T->getElementType(), S);
+    S = ("__attribute__((neon_polyvector_type(" +
+         llvm::utostr_32(T->getNumElements()) + "))) " + S);
+    break;
+  case VectorType::GenericVector: {
     // FIXME: We prefer to print the size directly here, but have no way
     // to get the size of the type.
     Print(T->getElementType(), S);
@@ -269,6 +283,8 @@
     Print(T->getElementType(), ET);
     V += " * sizeof(" + ET + ")))) ";
     S = V + S;
+    break;
+  }
   }
 }
 





More information about the cfe-commits mailing list