aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Instructions.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-22 23:43:29 +0000
committerChris Lattner <sabre@nondot.org>2007-11-22 23:43:29 +0000
commit8a3ba207cc78375066384d97eb06fa9930b00a9c (patch)
tree75989619980588b90b173348c37e84b83f632605 /include/llvm/Instructions.h
parente75e8c0386db577086c56ffa50418d89b8adbb27 (diff)
downloadexternal_llvm-8a3ba207cc78375066384d97eb06fa9930b00a9c.zip
external_llvm-8a3ba207cc78375066384d97eb06fa9930b00a9c.tar.gz
external_llvm-8a3ba207cc78375066384d97eb06fa9930b00a9c.tar.bz2
add some static icmpinst predicates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Instructions.h')
-rw-r--r--include/llvm/Instructions.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index a4fcb82..ba132cf 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -640,24 +640,34 @@ public:
/// @brief Return the signed version of the predicate.
static Predicate getSignedPredicate(Predicate pred);
- /// This also tests for commutativity. If isEquality() returns true then
- /// the predicate is also commutative.
- /// @returns true if the predicate of this instruction is EQ or NE.
- /// @brief Determine if this is an equality predicate.
+ /// isEquality - Return true if this predicate is either EQ or NE. This also
+ /// tests for commutativity.
+ static bool isEquality(Predicate P) {
+ return P == ICMP_EQ || P == ICMP_NE;
+ }
+
+ /// isEquality - Return true if this predicate is either EQ or NE. This also
+ /// tests for commutativity.
bool isEquality() const {
- return SubclassData == ICMP_EQ || SubclassData == ICMP_NE;
+ return isEquality(getPredicate());
}
/// @returns true if the predicate of this ICmpInst is commutative
/// @brief Determine if this relation is commutative.
bool isCommutative() const { return isEquality(); }
- /// @returns true if the predicate is relational (not EQ or NE).
- /// @brief Determine if this a relational predicate.
+ /// isRelational - Return true if the predicate is relational (not EQ or NE).
+ ///
bool isRelational() const {
return !isEquality();
}
+ /// isRelational - Return true if the predicate is relational (not EQ or NE).
+ ///
+ static bool isRelational(Predicate P) {
+ return !isEquality(P);
+ }
+
/// @returns true if the predicate of this ICmpInst is signed, false otherwise
/// @brief Determine if this instruction's predicate is signed.
bool isSignedPredicate() const { return isSignedPredicate(getPredicate()); }