summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-10-30 13:38:54 +0000
committerDuncan Sands <baldrick@free.fr>2012-10-30 13:38:54 +0000
commit7adfe3fd60f2480969f307b5dd377864f7c3eacd (patch)
tree40ef01599d274715f3ee06b5e05b22729f6d96c3 /include/llvm
parent3467b9fd5d0c4ebc726e96c2af96610e2d6915f9 (diff)
downloadllvm-7adfe3fd60f2480969f307b5dd377864f7c3eacd.tar.gz
llvm-7adfe3fd60f2480969f307b5dd377864f7c3eacd.tar.bz2
llvm-7adfe3fd60f2480969f307b5dd377864f7c3eacd.tar.xz
Add a helper for telling whether a type is a pointer or vector of pointer type.
Simplify the implementation of the corresponding integer and float functions and move them inline while there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167014 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Type.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index 5a867045af..10e14dd8de 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -153,7 +153,7 @@ public:
/// isPPC_FP128Ty - Return true if this is powerpc long double.
bool isPPC_FP128Ty() const { return getTypeID() == PPC_FP128TyID; }
- /// isFloatingPointTy - Return true if this is one of the five floating point
+ /// isFloatingPointTy - Return true if this is one of the six floating point
/// types
bool isFloatingPointTy() const {
return getTypeID() == HalfTyID || getTypeID() == FloatTyID ||
@@ -167,7 +167,7 @@ public:
/// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP.
///
- bool isFPOrFPVectorTy() const;
+ bool isFPOrFPVectorTy() const { return getScalarType()->isFloatingPointTy(); }
/// isLabelTy - Return true if this is 'label'.
bool isLabelTy() const { return getTypeID() == LabelTyID; }
@@ -185,7 +185,7 @@ public:
/// isIntOrIntVectorTy - Return true if this is an integer type or a vector of
/// integer types.
///
- bool isIntOrIntVectorTy() const;
+ bool isIntOrIntVectorTy() const { return getScalarType()->isIntegerTy(); }
/// isFunctionTy - True if this is an instance of FunctionType.
///
@@ -203,6 +203,11 @@ public:
///
bool isPointerTy() const { return getTypeID() == PointerTyID; }
+ /// isPtrOrPtrVectorTy - Return true if this is a pointer type or a vector of
+ /// pointer types.
+ ///
+ bool isPtrOrPtrVectorTy() const { return getScalarType()->isPointerTy(); }
+
/// isVectorTy - True if this is an instance of VectorType.
///
bool isVectorTy() const { return getTypeID() == VectorTyID; }
@@ -293,6 +298,7 @@ public:
/// getScalarType - If this is a vector type, return the element type,
/// otherwise return 'this'.
+ const Type *getScalarType() const;
Type *getScalarType();
//===--------------------------------------------------------------------===//