summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/Mangle.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2010-11-16 00:32:18 +0000
committerBob Wilson <bob.wilson@apple.com>2010-11-16 00:32:18 +0000
commite4652b1f22014cf8d9e52689f681e20c506e13d8 (patch)
tree94cd8d0aae7d11d8451de840638461ffffcb59ae /clang/lib/CodeGen/Mangle.cpp
parent4348a800caf5764e09e9699d3db9b9945ec4da3c (diff)
downloadbcm5719-llvm-e4652b1f22014cf8d9e52689f681e20c506e13d8.tar.gz
bcm5719-llvm-e4652b1f22014cf8d9e52689f681e20c506e13d8.zip
Change CXXNameMangler::mangleNeonVectorType to require the vector type to be
one of the special Neon types. We'll check for invalid Neon vectors when they are created, so there's no point in handling them when mangling. llvm-svn: 119299
Diffstat (limited to 'clang/lib/CodeGen/Mangle.cpp')
-rw-r--r--clang/lib/CodeGen/Mangle.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp
index 316ab7111aa..602c5f065fb 100644
--- a/clang/lib/CodeGen/Mangle.cpp
+++ b/clang/lib/CodeGen/Mangle.cpp
@@ -235,7 +235,7 @@ private:
void mangleType(TemplateName);
void mangleBareFunctionType(const FunctionType *T,
bool MangleReturnType);
- bool mangleNeonVectorType(const VectorType *T);
+ void mangleNeonVectorType(const VectorType *T);
void mangleIntegerLiteral(QualType T, const llvm::APSInt &Value);
void mangleMemberExpr(const Expr *Base, bool IsArrow,
@@ -1404,19 +1404,17 @@ void CXXNameMangler::mangleType(const ComplexType *T) {
}
// ARM's ABI for Neon vector types specifies that they should be mangled as
-// if they are structs (to match ARM's initial implementation). If the
-// vector type is not one of the special types predefined by ARM, return false
-// so it will be mangled as an ordinary vector type.
-bool CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
+// if they are structs (to match ARM's initial implementation). The
+// vector type must be one of the special types predefined by ARM.
+void CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
QualType EltType = T->getElementType();
- if (!EltType->isBuiltinType())
- return false;
+ assert(EltType->isBuiltinType() && "Neon vector element not a BuiltinType");
const char *EltName = 0;
if (T->getVectorKind() == VectorType::NeonPolyVector) {
switch (cast<BuiltinType>(EltType)->getKind()) {
case BuiltinType::SChar: EltName = "poly8_t"; break;
case BuiltinType::Short: EltName = "poly16_t"; break;
- default: return false;
+ default: llvm_unreachable("unexpected Neon polynomial vector element type");
}
} else {
switch (cast<BuiltinType>(EltType)->getKind()) {
@@ -1429,7 +1427,7 @@ bool CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
case BuiltinType::LongLong: EltName = "int64_t"; break;
case BuiltinType::ULongLong: EltName = "uint64_t"; break;
case BuiltinType::Float: EltName = "float32_t"; break;
- default: return false;
+ default: llvm_unreachable("unexpected Neon vector element type");
}
}
const char *BaseName = 0;
@@ -1437,13 +1435,12 @@ bool CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
getASTContext().getTypeSize(EltType));
if (BitSize == 64)
BaseName = "__simd64_";
- else if (BitSize == 128)
+ else {
+ assert(BitSize == 128 && "Neon vector type not 64 or 128 bits");
BaseName = "__simd128_";
- else
- return false;
+ }
Out << strlen(BaseName) + strlen(EltName);
Out << BaseName << EltName;
- return true;
}
// GNU extension: vector types
@@ -1455,9 +1452,10 @@ bool CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
// ::= p # AltiVec vector pixel
void CXXNameMangler::mangleType(const VectorType *T) {
if ((T->getVectorKind() == VectorType::NeonVector ||
- T->getVectorKind() == VectorType::NeonPolyVector) &&
- mangleNeonVectorType(T))
+ T->getVectorKind() == VectorType::NeonPolyVector)) {
+ mangleNeonVectorType(T);
return;
+ }
Out << "Dv" << T->getNumElements() << '_';
if (T->getVectorKind() == VectorType::AltiVecPixel)
Out << 'p';
OpenPOWER on IntegriCloud