summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-08-12 21:21:21 +0000
committerChris Lattner <sabre@nondot.org>2002-08-12 21:21:21 +0000
commit994b9f337ba9e15f3fa537c2a2d443b890c2a617 (patch)
treec624093377089ce23d1ec26295756976b76e368d /lib
parentc0c4d70ad8eeb417f55e491a8f47c35c7586cea8 (diff)
downloadexternal_llvm-994b9f337ba9e15f3fa537c2a2d443b890c2a617.zip
external_llvm-994b9f337ba9e15f3fa537c2a2d443b890c2a617.tar.gz
external_llvm-994b9f337ba9e15f3fa537c2a2d443b890c2a617.tar.bz2
- Added a new superclass of ConstantBool/ConstantInt: ConstantGenericIntegral
- Moved InstCombine: isMaxValue, isMinValue, isAllOnesValue to Constants.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3293 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Constants.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index faef147..856cd1a 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -93,11 +93,12 @@ void Constant::destroyConstantImpl() {
//===----------------------------------------------------------------------===//
// Normal Constructors
-ConstantBool::ConstantBool(bool V) : Constant(Type::BoolTy) {
+ConstantBool::ConstantBool(bool V) : ConstantGenericIntegral(Type::BoolTy) {
Val = V;
}
-ConstantInt::ConstantInt(const Type *Ty, uint64_t V) : Constant(Ty) {
+ConstantInt::ConstantInt(const Type *Ty, uint64_t V)
+ : ConstantGenericIntegral(Ty) {
Val.Unsigned = V;
}
@@ -163,6 +164,11 @@ ConstantExpr::ConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
//===----------------------------------------------------------------------===//
// classof implementations
+bool ConstantGenericIntegral::classof(const Constant *CPV) {
+ return (CPV->getType()->isIntegral() || CPV->getType() == Type::BoolTy) &&
+ !isa<ConstantExpr>(CPV);
+}
+
bool ConstantInt::classof(const Constant *CPV) {
return CPV->getType()->isIntegral() && !isa<ConstantExpr>(CPV);
}