summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-02 00:27:06 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-02 00:27:06 +0000
commit3f770e4afdcc7e1fd7b933c5ec98f38c69ba0c89 (patch)
treeb811de6c08a9516f44f10d93a9858993556ba588
parent76b2ce19fc0c6eaedb46dc9bfab3f361fd0c80f9 (diff)
downloadbcm5719-llvm-3f770e4afdcc7e1fd7b933c5ec98f38c69ba0c89.tar.gz
bcm5719-llvm-3f770e4afdcc7e1fd7b933c5ec98f38c69ba0c89.zip
Add a non-virtual test for zero, isZero, and rename isUnitValue isOne.
These will be used in upcoming patches to avoid virtual function call when the client knows it is a ConstantInt. llvm-svn: 34820
-rw-r--r--llvm/include/llvm/Constants.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/include/llvm/Constants.h b/llvm/include/llvm/Constants.h
index f17e02a4aa7..988b53a284c 100644
--- a/llvm/include/llvm/Constants.h
+++ b/llvm/include/llvm/Constants.h
@@ -127,10 +127,18 @@ public:
return Val == 0;
}
+ /// This is just a convenience method to make client code smaller for a
+ /// common code. It also correctly performs the comparison without the
+ /// potential for an assertion from getZExtValue().
+ bool isZero() const {
+ return Val == 0;
+ }
+
/// This is just a convenience method to make client code smaller for a
- /// common case.
+ /// common case. It also correctly performs the comparison without the
+ /// potential for an assertion from getZExtValue().
/// @brief Determine if the value is one.
- bool isUnitValue() const {
+ bool isOne() const {
return Val == 1;
}
OpenPOWER on IntegriCloud