diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2010-11-10 21:56:12 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2010-11-10 21:56:12 +0000 |
| commit | aeb56444f9b551ca34e68181844a64c04ebcc8b3 (patch) | |
| tree | ae4c32a7b8099bb4ece1d194a94a0a031672df4e /clang/lib/AST | |
| parent | 1d760ce8b3a095f61792484ed7ff566c36f73e2b (diff) | |
| download | bcm5719-llvm-aeb56444f9b551ca34e68181844a64c04ebcc8b3.tar.gz bcm5719-llvm-aeb56444f9b551ca34e68181844a64c04ebcc8b3.zip | |
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.
llvm-svn: 118724
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 22 | ||||
| -rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/AST/TypePrinter.cpp | 6 |
3 files changed, 16 insertions, 16 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index c9c7e5c2af8..9146eb57aa9 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1602,7 +1602,7 @@ QualType ASTContext::getIncompleteArrayType(QualType EltTy, /// 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 @@ QualType ASTContext::getVectorType(QualType vecType, unsigned NumElts, // 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 ASTContext::getVectorType(QualType vecType, unsigned NumElts, 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 @@ QualType ASTContext::getExtVectorType(QualType vecType, unsigned NumElts) { // 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 @@ bool ASTContext::areCompatibleVectorTypes(QualType FirstVec, // 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 @@ QualType ASTContext::getCorrespondingUnsignedType(QualType T) { // 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 @@ static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context, // 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/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 7747e617e3a..159a2695348 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -441,7 +441,7 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, 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 @@ QualType ASTNodeImporter::VisitVectorType(VectorType *T) { return Importer.getToContext().getVectorType(ToElementType, T->getNumElements(), - T->getAltiVecSpecific()); + T->getVectorKind()); } QualType ASTNodeImporter::VisitExtVectorType(ExtVectorType *T) { diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index 333a10ede70..2e7e06fef78 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -251,12 +251,12 @@ void TypePrinter::PrintDependentSizedExtVector( } 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 { |

