diff options
author | Erich Keane <erich.keane@intel.com> | 2018-07-13 19:46:04 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-07-13 19:46:04 +0000 |
commit | 12e2fde436d38782477f681dbf3fc83b8095e188 (patch) | |
tree | 86442dc143d91a91cbeaddee88bbe3fa6a8c0bc5 /lib/AST/ItaniumMangle.cpp | |
parent | d119a80874f84aed19417020a5ab04d4568f1743 (diff) |
PR15730/PR16986 Allow dependently typed vector_size types.
As listed in the above PRs, vector_size doesn't allow
dependent types/values. This patch introduces a new
DependentVectorType to handle a VectorType that has a dependent
size or type.
In the future, ALL the vector-types should be able to create one
of these to handle dependent types/sizes as well. For example,
DependentSizedExtVectorType could likely be switched to just use
this instead, though that is left as an exercise for the future.
Differential Revision: https://reviews.llvm.org/D49045
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337036 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ItaniumMangle.cpp')
-rw-r--r-- | lib/AST/ItaniumMangle.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp index d8c435991e..6f7efcbe1b 100644 --- a/lib/AST/ItaniumMangle.cpp +++ b/lib/AST/ItaniumMangle.cpp @@ -539,7 +539,9 @@ private: void mangleBareFunctionType(const FunctionProtoType *T, bool MangleReturnType, const FunctionDecl *FD = nullptr); void mangleNeonVectorType(const VectorType *T); + void mangleNeonVectorType(const DependentVectorType *T); void mangleAArch64NeonVectorType(const VectorType *T); + void mangleAArch64NeonVectorType(const DependentVectorType *T); void mangleIntegerLiteral(QualType T, const llvm::APSInt &Value); void mangleMemberExprBase(const Expr *base, bool isArrow); @@ -1930,6 +1932,7 @@ bool CXXNameMangler::mangleUnresolvedTypeOrSimpleId(QualType Ty, case Type::VariableArray: case Type::DependentSizedArray: case Type::DependentAddressSpace: + case Type::DependentVector: case Type::DependentSizedExtVector: case Type::Vector: case Type::ExtVector: @@ -3000,6 +3003,14 @@ void CXXNameMangler::mangleNeonVectorType(const VectorType *T) { Out << BaseName << EltName; } +void CXXNameMangler::mangleNeonVectorType(const DependentVectorType *T) { + DiagnosticsEngine &Diags = Context.getDiags(); + unsigned DiagID = Diags.getCustomDiagID( + DiagnosticsEngine::Error, + "cannot mangle this dependent neon vector type yet"); + Diags.Report(T->getAttributeLoc(), DiagID); +} + static StringRef mangleAArch64VectorBase(const BuiltinType *EltType) { switch (EltType->getKind()) { case BuiltinType::SChar: @@ -3067,6 +3078,13 @@ void CXXNameMangler::mangleAArch64NeonVectorType(const VectorType *T) { ("__" + EltName + "x" + Twine(T->getNumElements()) + "_t").str(); Out << TypeName.length() << TypeName; } +void CXXNameMangler::mangleAArch64NeonVectorType(const DependentVectorType *T) { + DiagnosticsEngine &Diags = Context.getDiags(); + unsigned DiagID = Diags.getCustomDiagID( + DiagnosticsEngine::Error, + "cannot mangle this dependent neon vector type yet"); + Diags.Report(T->getAttributeLoc(), DiagID); +} // GNU extension: vector types // <type> ::= <vector-type> @@ -3097,6 +3115,32 @@ void CXXNameMangler::mangleType(const VectorType *T) { else mangleType(T->getElementType()); } + +void CXXNameMangler::mangleType(const DependentVectorType *T) { + if ((T->getVectorKind() == VectorType::NeonVector || + T->getVectorKind() == VectorType::NeonPolyVector)) { + llvm::Triple Target = getASTContext().getTargetInfo().getTriple(); + llvm::Triple::ArchType Arch = + getASTContext().getTargetInfo().getTriple().getArch(); + if ((Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_be) && + !Target.isOSDarwin()) + mangleAArch64NeonVectorType(T); + else + mangleNeonVectorType(T); + return; + } + + Out << "Dv"; + mangleExpression(T->getSizeExpr()); + Out << '_'; + if (T->getVectorKind() == VectorType::AltiVecPixel) + Out << 'p'; + else if (T->getVectorKind() == VectorType::AltiVecBool) + Out << 'b'; + else + mangleType(T->getElementType()); +} + void CXXNameMangler::mangleType(const ExtVectorType *T) { mangleType(static_cast<const VectorType*>(T)); } |