[PATCH] D81684: [SVE] Break dependency of Type.h on DerivedTypes.h
Christopher Tetreault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 13:13:59 PDT 2020
ctetreau created this revision.
Herald added subscribers: llvm-commits, psnobl, rkruppe, tschuett.
Herald added a reviewer: rengolin.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.
ctetreau added a reviewer: echristo.
Inline functions in Type.h depended upon inline functions isVectorTy and
getScalarType defined in DerivedTypes.h. Reimplement these functions in
Type.h in terms of Type
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D81684
Files:
llvm/include/llvm/IR/DerivedTypes.h
llvm/include/llvm/IR/Type.h
Index: llvm/include/llvm/IR/Type.h
===================================================================
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -228,7 +228,9 @@
bool isPtrOrPtrVectorTy() const { return getScalarType()->isPointerTy(); }
/// True if this is an instance of VectorType.
- inline bool isVectorTy() const;
+ inline bool isVectorTy() const {
+ return getTypeID() == ScalableVectorTyID || getTypeID() == FixedVectorTyID;
+ }
/// Return true if this type could be converted with a lossless BitCast to
/// type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the
@@ -304,7 +306,11 @@
/// If this is a vector type, return the element type, otherwise return
/// 'this'.
- inline Type *getScalarType() const;
+ inline Type *getScalarType() const {
+ if (isVectorTy())
+ return getContainedType(0);
+ return const_cast<Type *>(this);
+ }
//===--------------------------------------------------------------------===//
// Type Iteration support.
Index: llvm/include/llvm/IR/DerivedTypes.h
===================================================================
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -537,8 +537,6 @@
}
};
-bool Type::isVectorTy() const { return isa<VectorType>(this); }
-
/// Class to represent fixed width SIMD vectors
class FixedVectorType : public VectorType {
protected:
@@ -705,12 +703,6 @@
return cast<PointerType>(getScalarType())->getAddressSpace();
}
-Type *Type::getScalarType() const {
- if (isVectorTy())
- return cast<VectorType>(this)->getElementType();
- return const_cast<Type *>(this);
-}
-
} // end namespace llvm
#endif // LLVM_IR_DERIVEDTYPES_H
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81684.270211.patch
Type: text/x-patch
Size: 1741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200611/b32afc7a/attachment.bin>
More information about the llvm-commits
mailing list