[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Reid Spencer
reid at x10sys.com
Wed Dec 6 12:30:35 PST 2006
Changes in directory llvm/lib/VMCore:
Constants.cpp updated: 1.181 -> 1.182
---
Log message:
For PR950: http://llvm.org/PR950 :
Remove the getMaxValue and getMinValue functions from ConstantIntegral.
They don't make sense for a signless type. Also, for isMaxValue and
isMinValue, have the caller provided the signedness rather than obtaining
it from the constant's type.
---
Diffs of the changes: (+0 -47)
Constants.cpp | 47 -----------------------------------------------
1 files changed, 47 deletions(-)
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.181 llvm/lib/VMCore/Constants.cpp:1.182
--- llvm/lib/VMCore/Constants.cpp:1.181 Tue Dec 5 13:14:13 2006
+++ llvm/lib/VMCore/Constants.cpp Wed Dec 6 14:30:17 2006
@@ -152,53 +152,6 @@
}
}
-// Static constructor to create the maximum constant of an integral type...
-ConstantIntegral *ConstantIntegral::getMaxValue(const Type *Ty) {
- switch (Ty->getTypeID()) {
- case Type::BoolTyID: return ConstantBool::getTrue();
- case Type::SByteTyID:
- case Type::ShortTyID:
- case Type::IntTyID:
- case Type::LongTyID: {
- // Calculate 011111111111111...
- unsigned TypeBits = Ty->getPrimitiveSize()*8;
- int64_t Val = INT64_MAX; // All ones
- Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
- return ConstantInt::get(Ty, Val);
- }
-
- case Type::UByteTyID:
- case Type::UShortTyID:
- case Type::UIntTyID:
- case Type::ULongTyID: return getAllOnesValue(Ty);
-
- default: return 0;
- }
-}
-
-// Static constructor to create the minimum constant for an integral type...
-ConstantIntegral *ConstantIntegral::getMinValue(const Type *Ty) {
- switch (Ty->getTypeID()) {
- case Type::BoolTyID: return ConstantBool::getFalse();
- case Type::SByteTyID:
- case Type::ShortTyID:
- case Type::IntTyID:
- case Type::LongTyID: {
- // Calculate 1111111111000000000000
- unsigned TypeBits = Ty->getPrimitiveSize()*8;
- int64_t Val = -1; // All ones
- Val <<= TypeBits-1; // Shift over to the right spot
- return ConstantInt::get(Ty, Val);
- }
-
- case Type::UByteTyID:
- case Type::UShortTyID:
- case Type::UIntTyID:
- case Type::ULongTyID: return ConstantInt::get(Ty, 0);
-
- default: return 0;
- }
-}
// Static constructor to create an integral constant with all bits set
ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) {
More information about the llvm-commits
mailing list