Add a variant of GCC-style vector types for ARM NEON.
NEON vector types need to be mangled in a special way to comply with ARM's ABI,
similar to some of the AltiVec-specific vector types.  This patch is mostly
just renaming a bunch of "AltiVecSpecific" things, since they will no longer
be specific to AltiVec.  Besides that, it just adds the new "NeonVector" enum.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118724 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index c9c7e5c..9146eb57 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1602,7 +1602,7 @@
 /// getVectorType - Return the unique reference to a vector type of
 /// the specified element type and size. VectorType must be a built-in type.
 QualType ASTContext::getVectorType(QualType vecType, unsigned NumElts,
-                                   VectorType::AltiVecSpecific AltiVecSpec) {
+                                   VectorType::VectorKind VecKind) {
   BuiltinType *BaseType;
 
   BaseType = dyn_cast<BuiltinType>(getCanonicalType(vecType).getTypePtr());
@@ -1610,7 +1610,7 @@
 
   // Check if we've already instantiated a vector of this type.
   llvm::FoldingSetNodeID ID;
-  VectorType::Profile(ID, vecType, NumElts, Type::Vector, AltiVecSpec);
+  VectorType::Profile(ID, vecType, NumElts, Type::Vector, VecKind);
 
   void *InsertPos = 0;
   if (VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
@@ -1621,14 +1621,14 @@
   QualType Canonical;
   if (!vecType.isCanonical()) {
     Canonical = getVectorType(getCanonicalType(vecType), NumElts,
-      VectorType::NotAltiVec);
+      VectorType::GenericVector);
 
     // Get the new insert position for the node we care about.
     VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
   }
   VectorType *New = new (*this, TypeAlignment)
-    VectorType(vecType, NumElts, Canonical, AltiVecSpec);
+    VectorType(vecType, NumElts, Canonical, VecKind);
   VectorTypes.InsertNode(New, InsertPos);
   Types.push_back(New);
   return QualType(New, 0);
@@ -1645,7 +1645,7 @@
   // Check if we've already instantiated a vector of this type.
   llvm::FoldingSetNodeID ID;
   VectorType::Profile(ID, vecType, NumElts, Type::ExtVector,
-                      VectorType::NotAltiVec);
+                      VectorType::GenericVector);
   void *InsertPos = 0;
   if (VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(VTP, 0);
@@ -4287,10 +4287,10 @@
   // AltiVec vectors types are identical to equivalent GCC vector types
   const VectorType *First = FirstVec->getAs<VectorType>();
   const VectorType *Second = SecondVec->getAs<VectorType>();
-  if ((((First->getAltiVecSpecific() == VectorType::AltiVec) &&
-        (Second->getAltiVecSpecific() == VectorType::NotAltiVec)) ||
-       ((First->getAltiVecSpecific() == VectorType::NotAltiVec) &&
-        (Second->getAltiVecSpecific() == VectorType::AltiVec))) &&
+  if ((((First->getVectorKind() == VectorType::AltiVecVector) &&
+        (Second->getVectorKind() == VectorType::GenericVector)) ||
+       ((First->getVectorKind() == VectorType::GenericVector) &&
+        (Second->getVectorKind() == VectorType::AltiVecVector))) &&
       hasSameType(First->getElementType(), Second->getElementType()) &&
       (First->getNumElements() == Second->getNumElements()))
     return true;
@@ -5243,7 +5243,7 @@
   // Turn <4 x signed int> -> <4 x unsigned int>
   if (const VectorType *VTy = T->getAs<VectorType>())
     return getVectorType(getCorrespondingUnsignedType(VTy->getElementType()),
-             VTy->getNumElements(), VTy->getAltiVecSpecific());
+                         VTy->getNumElements(), VTy->getVectorKind());
 
   // For enums, we return the unsigned version of the base type.
   if (const EnumType *ETy = T->getAs<EnumType>())
@@ -5422,7 +5422,7 @@
     
     // TODO: No way to make AltiVec vectors in builtins yet.
     Type = Context.getVectorType(ElementType, NumElements,
-                                 VectorType::NotAltiVec);
+                                 VectorType::GenericVector);
     break;
   }
   case 'X': {
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp
index 7747e61..159a269 100644
--- a/lib/AST/ASTImporter.cpp
+++ b/lib/AST/ASTImporter.cpp
@@ -441,7 +441,7 @@
       return false;
     if (Vec1->getNumElements() != Vec2->getNumElements())
       return false;
-    if (Vec1->getAltiVecSpecific() != Vec2->getAltiVecSpecific())
+    if (Vec1->getVectorKind() != Vec2->getVectorKind())
       return false;
     break;
   }
@@ -1190,7 +1190,7 @@
   
   return Importer.getToContext().getVectorType(ToElementType, 
                                                T->getNumElements(),
-                                               T->getAltiVecSpecific());
+                                               T->getVectorKind());
 }
 
 QualType ASTNodeImporter::VisitExtVectorType(ExtVectorType *T) {
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp
index 333a10e..2e7e06f 100644
--- a/lib/AST/TypePrinter.cpp
+++ b/lib/AST/TypePrinter.cpp
@@ -251,12 +251,12 @@
 }
 
 void TypePrinter::PrintVector(const VectorType *T, std::string &S) { 
-  if (T->getAltiVecSpecific() != VectorType::NotAltiVec) {
-    if (T->getAltiVecSpecific() == VectorType::Pixel)
+  if (T->getVectorKind() != VectorType::GenericVector) {
+    if (T->getVectorKind() == VectorType::AltiVecPixel)
       S = "__vector __pixel " + S;
     else {
       Print(T->getElementType(), S);
-      S = ((T->getAltiVecSpecific() == VectorType::Bool)
+      S = ((T->getVectorKind() == VectorType::AltiVecBool)
            ? "__vector __bool " : "__vector ") + S;
     }
   } else {
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index d1e3a98..9deb021 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -1411,9 +1411,9 @@
 //                         ::= p # AltiVec vector pixel
 void CXXNameMangler::mangleType(const VectorType *T) {
   Out << "Dv" << T->getNumElements() << '_';
-  if (T->getAltiVecSpecific() == VectorType::Pixel)
+  if (T->getVectorKind() == VectorType::AltiVecPixel)
     Out << 'p';
-  else if (T->getAltiVecSpecific() == VectorType::Bool)
+  else if (T->getVectorKind() == VectorType::AltiVecBool)
     Out << 'b';
   else
     mangleType(T->getElementType());
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index e69ebe2..921df8e 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -811,7 +811,7 @@
     } else if (numElements != numResElements) {
       QualType eltType = LHSType->getAs<VectorType>()->getElementType();
       resType = Context.getVectorType(eltType, numResElements,
-                                      VectorType::NotAltiVec);
+                                      VectorType::GenericVector);
     }
   }
 
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index e601a7d..7a2db63 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -914,7 +914,7 @@
         VecType = SemaRef.Context.getExtVectorType(elementType, numIElts);
       else
         VecType = SemaRef.Context.getVectorType(elementType, numIElts,
-                                                IVT->getAltiVecSpecific());
+                                                IVT->getVectorKind());
       CheckSubElementType(ElementEntity, IList, VecType, Index,
                           StructuredList, StructuredIndex);
       numEltsInit += numIElts;
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index e721930..cb99a9f 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -388,12 +388,12 @@
   } else if (DS.isTypeAltiVecVector()) {
     unsigned typeSize = static_cast<unsigned>(Context.getTypeSize(Result));
     assert(typeSize > 0 && "type size for vector must be greater than 0 bits");
-    VectorType::AltiVecSpecific AltiVecSpec = VectorType::AltiVec;
+    VectorType::VectorKind VecKind = VectorType::AltiVecVector;
     if (DS.isTypeAltiVecPixel())
-      AltiVecSpec = VectorType::Pixel;
+      VecKind = VectorType::AltiVecPixel;
     else if (DS.isTypeAltiVecBool())
-      AltiVecSpec = VectorType::Bool;
-    Result = Context.getVectorType(Result, 128/typeSize, AltiVecSpec);
+      VecKind = VectorType::AltiVecBool;
+    Result = Context.getVectorType(Result, 128/typeSize, VecKind);
   }
 
   // FIXME: Imaginary.
@@ -2044,7 +2044,7 @@
   // Success! Instantiate the vector type, the number of elements is > 0, and
   // not required to be a power of 2, unlike GCC.
   CurType = S.Context.getVectorType(CurType, vectorSize/typeSize,
-                                    VectorType::NotAltiVec);
+                                    VectorType::GenericVector);
 }
 
 void ProcessTypeAttributeList(Sema &S, QualType &Result,
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 47822c5..655980c 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -440,7 +440,7 @@
   /// By default, performs semantic analysis when building the vector type.
   /// Subclasses may override this routine to provide different behavior.
   QualType RebuildVectorType(QualType ElementType, unsigned NumElements,
-    VectorType::AltiVecSpecific AltiVecSpec);
+                             VectorType::VectorKind VecKind);
 
   /// \brief Build a new extended vector type given the element type and
   /// number of elements.
@@ -2841,7 +2841,7 @@
   if (getDerived().AlwaysRebuild() ||
       ElementType != T->getElementType()) {
     Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
-      T->getAltiVecSpecific());
+                                            T->getVectorKind());
     if (Result.isNull())
       return QualType();
   }
@@ -6458,10 +6458,10 @@
 
 template<typename Derived>
 QualType TreeTransform<Derived>::RebuildVectorType(QualType ElementType,
-                                     unsigned NumElements,
-                                     VectorType::AltiVecSpecific AltiVecSpec) {
+                                               unsigned NumElements,
+                                               VectorType::VectorKind VecKind) {
   // FIXME: semantic checking!
-  return SemaRef.Context.getVectorType(ElementType, NumElements, AltiVecSpec);
+  return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
 }
 
 template<typename Derived>
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index c0d347d..2a6692a 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -2783,9 +2783,9 @@
 
     QualType ElementType = GetType(Record[0]);
     unsigned NumElements = Record[1];
-    unsigned AltiVecSpec = Record[2];
+    unsigned VecKind = Record[2];
     return Context->getVectorType(ElementType, NumElements,
-                                  (VectorType::AltiVecSpecific)AltiVecSpec);
+                                  (VectorType::VectorKind)VecKind);
   }
 
   case TYPE_EXT_VECTOR: {
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 8fc60ce..27862ae 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -143,7 +143,7 @@
 void ASTTypeWriter::VisitVectorType(const VectorType *T) {
   Writer.AddTypeRef(T->getElementType(), Record);
   Record.push_back(T->getNumElements());
-  Record.push_back(T->getAltiVecSpecific());
+  Record.push_back(T->getVectorKind());
   Code = TYPE_VECTOR;
 }