Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/AST/ItaniumMangle.cpp
Show First 20 Lines • Show All 557 Lines • ▼ Show 20 Lines | #include "clang/AST/TypeNodes.inc" | ||||
void mangleBareFunctionType(const FunctionProtoType *T, bool MangleReturnType, | void mangleBareFunctionType(const FunctionProtoType *T, bool MangleReturnType, | ||||
const FunctionDecl *FD = nullptr); | const FunctionDecl *FD = nullptr); | ||||
void mangleNeonVectorType(const VectorType *T); | void mangleNeonVectorType(const VectorType *T); | ||||
void mangleNeonVectorType(const DependentVectorType *T); | void mangleNeonVectorType(const DependentVectorType *T); | ||||
void mangleAArch64NeonVectorType(const VectorType *T); | void mangleAArch64NeonVectorType(const VectorType *T); | ||||
void mangleAArch64NeonVectorType(const DependentVectorType *T); | void mangleAArch64NeonVectorType(const DependentVectorType *T); | ||||
void mangleAArch64FixedSveVectorType(const VectorType *T); | void mangleAArch64FixedSveVectorType(const VectorType *T); | ||||
void mangleAArch64FixedSveVectorType(const DependentVectorType *T); | void mangleAArch64FixedSveVectorType(const DependentVectorType *T); | ||||
void mangleRISCVFixedRVVVectorType(const VectorType *T); | |||||
void mangleRISCVFixedRVVVectorType(const DependentVectorType *T); | |||||
void mangleIntegerLiteral(QualType T, const llvm::APSInt &Value); | void mangleIntegerLiteral(QualType T, const llvm::APSInt &Value); | ||||
void mangleFloatLiteral(QualType T, const llvm::APFloat &V); | void mangleFloatLiteral(QualType T, const llvm::APFloat &V); | ||||
void mangleFixedPointLiteral(); | void mangleFixedPointLiteral(); | ||||
void mangleNullPointer(QualType T); | void mangleNullPointer(QualType T); | ||||
void mangleMemberExprBase(const Expr *base, bool isArrow); | void mangleMemberExprBase(const Expr *base, bool isArrow); | ||||
void mangleMemberExpr(const Expr *base, bool isArrow, | void mangleMemberExpr(const Expr *base, bool isArrow, | ||||
▲ Show 20 Lines • Show All 3,233 Lines • ▼ Show 20 Lines | void CXXNameMangler::mangleAArch64FixedSveVectorType( | ||||
const DependentVectorType *T) { | const DependentVectorType *T) { | ||||
DiagnosticsEngine &Diags = Context.getDiags(); | DiagnosticsEngine &Diags = Context.getDiags(); | ||||
unsigned DiagID = Diags.getCustomDiagID( | unsigned DiagID = Diags.getCustomDiagID( | ||||
DiagnosticsEngine::Error, | DiagnosticsEngine::Error, | ||||
"cannot mangle this dependent fixed-length SVE vector type yet"); | "cannot mangle this dependent fixed-length SVE vector type yet"); | ||||
Diags.Report(T->getAttributeLoc(), DiagID); | Diags.Report(T->getAttributeLoc(), DiagID); | ||||
} | } | ||||
void CXXNameMangler::mangleRISCVFixedRVVVectorType(const VectorType *T) { | |||||
assert(T->getVectorKind() == VectorType::RVVFixedLengthDataVector && | |||||
"expected fixed-length RVV vector!"); | |||||
QualType EltType = T->getElementType(); | |||||
assert(EltType->isBuiltinType() && | |||||
"expected builtin type for fixed-length RVV vector!"); | |||||
StringRef TypeName; | |||||
switch (cast<BuiltinType>(EltType)->getKind()) { | |||||
case BuiltinType::SChar: | |||||
TypeName = "__rvv_int8m1_t"; | |||||
break; | |||||
case BuiltinType::UChar: | |||||
TypeName = "__rvv_uint8m1_t"; | |||||
break; | |||||
case BuiltinType::Short: | |||||
TypeName = "__rvv_int16m1_t"; | |||||
break; | |||||
case BuiltinType::UShort: | |||||
TypeName = "__rvv_uint16m1_t"; | |||||
break; | |||||
case BuiltinType::Int: | |||||
TypeName = "__rvv_int32m1_t"; | |||||
break; | |||||
case BuiltinType::UInt: | |||||
TypeName = "__rvv_uint32m1_t"; | |||||
break; | |||||
case BuiltinType::Long: | |||||
TypeName = "__rvv_int64m1_t"; | |||||
break; | |||||
case BuiltinType::ULong: | |||||
TypeName = "__rvv_uint64m1_t"; | |||||
break; | |||||
case BuiltinType::Half: | |||||
TypeName = "__rvv_float16m1_t"; | |||||
break; | |||||
case BuiltinType::Float: | |||||
TypeName = "__rvv_float32m1_t"; | |||||
break; | |||||
case BuiltinType::Double: | |||||
TypeName = "__rvv_float64m1_t"; | |||||
break; | |||||
default: | |||||
llvm_unreachable("unexpected element type for fixed-length RVV vector!"); | |||||
} | |||||
unsigned VecSizeInBits = getASTContext().getTypeInfo(T).Width; | |||||
Out << "9__RVV_VLSI" << 'u' << TypeName.size() << TypeName << "Lj" | |||||
<< VecSizeInBits << "EE"; | |||||
} | |||||
void CXXNameMangler::mangleRISCVFixedRVVVectorType( | |||||
const DependentVectorType *T) { | |||||
DiagnosticsEngine &Diags = Context.getDiags(); | |||||
unsigned DiagID = Diags.getCustomDiagID( | |||||
DiagnosticsEngine::Error, | |||||
"cannot mangle this dependent fixed-length RVV vector type yet"); | |||||
Diags.Report(T->getAttributeLoc(), DiagID); | |||||
} | |||||
// GNU extension: vector types | // GNU extension: vector types | ||||
// <type> ::= <vector-type> | // <type> ::= <vector-type> | ||||
// <vector-type> ::= Dv <positive dimension number> _ | // <vector-type> ::= Dv <positive dimension number> _ | ||||
// <extended element type> | // <extended element type> | ||||
// ::= Dv [<dimension expression>] _ <element type> | // ::= Dv [<dimension expression>] _ <element type> | ||||
// <extended element type> ::= <element type> | // <extended element type> ::= <element type> | ||||
// ::= p # AltiVec vector pixel | // ::= p # AltiVec vector pixel | ||||
// ::= b # Altivec vector bool | // ::= b # Altivec vector bool | ||||
void CXXNameMangler::mangleType(const VectorType *T) { | void CXXNameMangler::mangleType(const VectorType *T) { | ||||
if ((T->getVectorKind() == VectorType::NeonVector || | if ((T->getVectorKind() == VectorType::NeonVector || | ||||
T->getVectorKind() == VectorType::NeonPolyVector)) { | T->getVectorKind() == VectorType::NeonPolyVector)) { | ||||
llvm::Triple Target = getASTContext().getTargetInfo().getTriple(); | llvm::Triple Target = getASTContext().getTargetInfo().getTriple(); | ||||
llvm::Triple::ArchType Arch = | llvm::Triple::ArchType Arch = | ||||
getASTContext().getTargetInfo().getTriple().getArch(); | getASTContext().getTargetInfo().getTriple().getArch(); | ||||
if ((Arch == llvm::Triple::aarch64 || | if ((Arch == llvm::Triple::aarch64 || | ||||
Arch == llvm::Triple::aarch64_be) && !Target.isOSDarwin()) | Arch == llvm::Triple::aarch64_be) && !Target.isOSDarwin()) | ||||
mangleAArch64NeonVectorType(T); | mangleAArch64NeonVectorType(T); | ||||
else | else | ||||
mangleNeonVectorType(T); | mangleNeonVectorType(T); | ||||
return; | return; | ||||
} else if (T->getVectorKind() == VectorType::SveFixedLengthDataVector || | } else if (T->getVectorKind() == VectorType::SveFixedLengthDataVector || | ||||
T->getVectorKind() == VectorType::SveFixedLengthPredicateVector) { | T->getVectorKind() == VectorType::SveFixedLengthPredicateVector) { | ||||
mangleAArch64FixedSveVectorType(T); | mangleAArch64FixedSveVectorType(T); | ||||
return; | return; | ||||
} else if (T->getVectorKind() == VectorType::RVVFixedLengthDataVector) { | |||||
mangleRISCVFixedRVVVectorType(T); | |||||
return; | |||||
aaron.ballman: Should there be corresponding changes to the Microsoft mangler as well? | |||||
Good question. I don't see the equivalent SVE handling in the Microsoft mangler. craig.topper: Good question. I don't see the equivalent SVE handling in the Microsoft mangler. | |||||
Not Done ReplyInline ActionsI'm fine if you want to address that issue in a follow-up. aaron.ballman: I'm fine if you want to address that issue in a follow-up. | |||||
} | } | ||||
Out << "Dv" << T->getNumElements() << '_'; | Out << "Dv" << T->getNumElements() << '_'; | ||||
if (T->getVectorKind() == VectorType::AltiVecPixel) | if (T->getVectorKind() == VectorType::AltiVecPixel) | ||||
Out << 'p'; | Out << 'p'; | ||||
else if (T->getVectorKind() == VectorType::AltiVecBool) | else if (T->getVectorKind() == VectorType::AltiVecBool) | ||||
Out << 'b'; | Out << 'b'; | ||||
else | else | ||||
mangleType(T->getElementType()); | mangleType(T->getElementType()); | ||||
Show All 10 Lines | if ((Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_be) && | ||||
mangleAArch64NeonVectorType(T); | mangleAArch64NeonVectorType(T); | ||||
else | else | ||||
mangleNeonVectorType(T); | mangleNeonVectorType(T); | ||||
return; | return; | ||||
} else if (T->getVectorKind() == VectorType::SveFixedLengthDataVector || | } else if (T->getVectorKind() == VectorType::SveFixedLengthDataVector || | ||||
T->getVectorKind() == VectorType::SveFixedLengthPredicateVector) { | T->getVectorKind() == VectorType::SveFixedLengthPredicateVector) { | ||||
mangleAArch64FixedSveVectorType(T); | mangleAArch64FixedSveVectorType(T); | ||||
return; | return; | ||||
} else if (T->getVectorKind() == VectorType::RVVFixedLengthDataVector) { | |||||
mangleRISCVFixedRVVVectorType(T); | |||||
return; | |||||
Not Done ReplyInline ActionsSame here. aaron.ballman: Same here. | |||||
} | } | ||||
Out << "Dv"; | Out << "Dv"; | ||||
mangleExpression(T->getSizeExpr()); | mangleExpression(T->getSizeExpr()); | ||||
Out << '_'; | Out << '_'; | ||||
if (T->getVectorKind() == VectorType::AltiVecPixel) | if (T->getVectorKind() == VectorType::AltiVecPixel) | ||||
Out << 'p'; | Out << 'p'; | ||||
else if (T->getVectorKind() == VectorType::AltiVecBool) | else if (T->getVectorKind() == VectorType::AltiVecBool) | ||||
▲ Show 20 Lines • Show All 2,810 Lines • Show Last 20 Lines |
Should there be corresponding changes to the Microsoft mangler as well?