diff options
author | Christopher Tetreault <ctetreau@quicinc.com> | 2020-04-22 08:02:02 -0700 |
---|---|---|
committer | Christopher Tetreault <ctetreau@quicinc.com> | 2020-04-22 08:59:01 -0700 |
commit | 2dea3f129878e929e5d1f00b91a622eb1ec8be4e (patch) | |
tree | 8199e47ebd1a535856124674a63a688f67a27079 /llvm/lib/IR/Constants.cpp | |
parent | 3df8135286a2180a8fadcdddfcf9d9c232fb6ad7 (diff) | |
download | llvm-2dea3f129878e929e5d1f00b91a622eb1ec8be4e.zip llvm-2dea3f129878e929e5d1f00b91a622eb1ec8be4e.tar.gz llvm-2dea3f129878e929e5d1f00b91a622eb1ec8be4e.tar.bz2 |
[SVE] Add new VectorType subclasses
Summary:
Introduce new types for fixed width and scalable vectors.
Does not remove getNumElements yet so as to not break code during transition
period.
Reviewers: deadalnix, efriedma, sdesmalen, craig.topper, huntergr
Reviewed By: sdesmalen
Subscribers: jholewinski, arsenm, jvesely, nhaehnle, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, liufengdb, kerbowa, Joonsoo, grosul1, frgossen, lldb-commits, tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm, #lldb
Differential Revision: https://reviews.llvm.org/D77587
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index b86b747..d180059 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -352,7 +352,8 @@ Constant *Constant::getNullValue(Type *Ty) { return ConstantPointerNull::get(cast<PointerType>(Ty)); case Type::StructTyID: case Type::ArrayTyID: - case Type::VectorTyID: + case Type::FixedVectorTyID: + case Type::ScalableVectorTyID: return ConstantAggregateZero::get(Ty); case Type::TokenTyID: return ConstantTokenNone::get(Ty->getContext()); @@ -1780,8 +1781,8 @@ Constant *ConstantExpr::getFPCast(Constant *C, Type *Ty) { Constant *ConstantExpr::getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) { #ifndef NDEBUG - bool fromVec = C->getType()->getTypeID() == Type::VectorTyID; - bool toVec = Ty->getTypeID() == Type::VectorTyID; + bool fromVec = isa<VectorType>(C->getType()); + bool toVec = isa<VectorType>(Ty); #endif assert((fromVec == toVec) && "Cannot convert from scalar to/from vector"); assert(C->getType()->isIntOrIntVectorTy() && "Trunc operand must be integer"); @@ -1794,8 +1795,8 @@ Constant *ConstantExpr::getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) { Constant *ConstantExpr::getSExt(Constant *C, Type *Ty, bool OnlyIfReduced) { #ifndef NDEBUG - bool fromVec = C->getType()->getTypeID() == Type::VectorTyID; - bool toVec = Ty->getTypeID() == Type::VectorTyID; + bool fromVec = isa<VectorType>(C->getType()); + bool toVec = isa<VectorType>(Ty); #endif assert((fromVec == toVec) && "Cannot convert from scalar to/from vector"); assert(C->getType()->isIntOrIntVectorTy() && "SExt operand must be integral"); @@ -1808,8 +1809,8 @@ Constant *ConstantExpr::getSExt(Constant *C, Type *Ty, bool OnlyIfReduced) { Constant *ConstantExpr::getZExt(Constant *C, Type *Ty, bool OnlyIfReduced) { #ifndef NDEBUG - bool fromVec = C->getType()->getTypeID() == Type::VectorTyID; - bool toVec = Ty->getTypeID() == Type::VectorTyID; + bool fromVec = isa<VectorType>(C->getType()); + bool toVec = isa<VectorType>(Ty); #endif assert((fromVec == toVec) && "Cannot convert from scalar to/from vector"); assert(C->getType()->isIntOrIntVectorTy() && "ZEXt operand must be integral"); @@ -1822,8 +1823,8 @@ Constant *ConstantExpr::getZExt(Constant *C, Type *Ty, bool OnlyIfReduced) { Constant *ConstantExpr::getFPTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) { #ifndef NDEBUG - bool fromVec = C->getType()->getTypeID() == Type::VectorTyID; - bool toVec = Ty->getTypeID() == Type::VectorTyID; + bool fromVec = isa<VectorType>(C->getType()); + bool toVec = isa<VectorType>(Ty); #endif assert((fromVec == toVec) && "Cannot convert from scalar to/from vector"); assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() && @@ -1834,8 +1835,8 @@ Constant *ConstantExpr::getFPTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) { Constant *ConstantExpr::getFPExtend(Constant *C, Type *Ty, bool OnlyIfReduced) { #ifndef NDEBUG - bool fromVec = C->getType()->getTypeID() == Type::VectorTyID; - bool toVec = Ty->getTypeID() == Type::VectorTyID; + bool fromVec = isa<VectorType>(C->getType()); + bool toVec = isa<VectorType>(Ty); #endif assert((fromVec == toVec) && "Cannot convert from scalar to/from vector"); assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() && @@ -1846,8 +1847,8 @@ Constant *ConstantExpr::getFPExtend(Constant *C, Type *Ty, bool OnlyIfReduced) { Constant *ConstantExpr::getUIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) { #ifndef NDEBUG - bool fromVec = C->getType()->getTypeID() == Type::VectorTyID; - bool toVec = Ty->getTypeID() == Type::VectorTyID; + bool fromVec = isa<VectorType>(C->getType()); + bool toVec = isa<VectorType>(Ty); #endif assert((fromVec == toVec) && "Cannot convert from scalar to/from vector"); assert(C->getType()->isIntOrIntVectorTy() && Ty->isFPOrFPVectorTy() && @@ -1857,8 +1858,8 @@ Constant *ConstantExpr::getUIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) { Constant *ConstantExpr::getSIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) { #ifndef NDEBUG - bool fromVec = C->getType()->getTypeID() == Type::VectorTyID; - bool toVec = Ty->getTypeID() == Type::VectorTyID; + bool fromVec = isa<VectorType>(C->getType()); + bool toVec = isa<VectorType>(Ty); #endif assert((fromVec == toVec) && "Cannot convert from scalar to/from vector"); assert(C->getType()->isIntOrIntVectorTy() && Ty->isFPOrFPVectorTy() && @@ -1868,8 +1869,8 @@ Constant *ConstantExpr::getSIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) { Constant *ConstantExpr::getFPToUI(Constant *C, Type *Ty, bool OnlyIfReduced) { #ifndef NDEBUG - bool fromVec = C->getType()->getTypeID() == Type::VectorTyID; - bool toVec = Ty->getTypeID() == Type::VectorTyID; + bool fromVec = isa<VectorType>(C->getType()); + bool toVec = isa<VectorType>(Ty); #endif assert((fromVec == toVec) && "Cannot convert from scalar to/from vector"); assert(C->getType()->isFPOrFPVectorTy() && Ty->isIntOrIntVectorTy() && @@ -1879,8 +1880,8 @@ Constant *ConstantExpr::getFPToUI(Constant *C, Type *Ty, bool OnlyIfReduced) { Constant *ConstantExpr::getFPToSI(Constant *C, Type *Ty, bool OnlyIfReduced) { #ifndef NDEBUG - bool fromVec = C->getType()->getTypeID() == Type::VectorTyID; - bool toVec = Ty->getTypeID() == Type::VectorTyID; + bool fromVec = isa<VectorType>(C->getType()); + bool toVec = isa<VectorType>(Ty); #endif assert((fromVec == toVec) && "Cannot convert from scalar to/from vector"); assert(C->getType()->isFPOrFPVectorTy() && Ty->isIntOrIntVectorTy() && |