aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/ConstantRange.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-08 01:26:33 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-08 01:26:33 +0000
commite7ca042730a233591cece04f177209923e6fb478 (patch)
treec78639dffeae271976aee48742a44b712a4d4709 /lib/Support/ConstantRange.cpp
parentf1d2f96675a784626ab0ddc52fa88ce9dea1f3d6 (diff)
downloadexternal_llvm-e7ca042730a233591cece04f177209923e6fb478.zip
external_llvm-e7ca042730a233591cece04f177209923e6fb478.tar.gz
external_llvm-e7ca042730a233591cece04f177209923e6fb478.tar.bz2
Convert uses of getPrimitiveSize that should be getPrimitiveSizeInBits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33003 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/ConstantRange.cpp')
-rw-r--r--lib/Support/ConstantRange.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index 69d85c2..33a6702 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/ConstantRange.cpp
@@ -36,7 +36,7 @@ static ConstantIntegral *getMaxValue(const Type *Ty, bool isSigned = false) {
if (Ty->isInteger()) {
if (isSigned) {
// Calculate 011111111111111...
- unsigned TypeBits = Ty->getPrimitiveSize()*8;
+ unsigned TypeBits = Ty->getPrimitiveSizeInBits();
int64_t Val = INT64_MAX; // All ones
Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
return ConstantInt::get(Ty, Val);
@@ -53,7 +53,7 @@ static ConstantIntegral *getMinValue(const Type *Ty, bool isSigned = false) {
if (Ty->isInteger()) {
if (isSigned) {
// Calculate 1111111111000000000000
- unsigned TypeBits = Ty->getPrimitiveSize()*8;
+ unsigned TypeBits = Ty->getPrimitiveSizeInBits();
int64_t Val = -1; // All ones
Val <<= TypeBits-1; // Shift over to the right spot
return ConstantInt::get(Ty, Val);
@@ -334,13 +334,12 @@ ConstantRange ConstantRange::unionWith(const ConstantRange &CR,
/// correspond to the possible range of values as if the source range had been
/// zero extended.
ConstantRange ConstantRange::zeroExtend(const Type *Ty) const {
- assert(getLower()->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() &&
- "Not a value extension");
+ unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits();
+ assert(SrcTySize < Ty->getPrimitiveSizeInBits() && "Not a value extension");
if (isFullSet()) {
// Change a source full set into [0, 1 << 8*numbytes)
- unsigned SrcTySize = getLower()->getType()->getPrimitiveSize();
return ConstantRange(Constant::getNullValue(Ty),
- ConstantInt::get(Ty, 1ULL << SrcTySize*8));
+ ConstantInt::get(Ty, 1ULL << SrcTySize));
}
Constant *Lower = getLower();
@@ -355,9 +354,9 @@ ConstantRange ConstantRange::zeroExtend(const Type *Ty) const {
/// correspond to the possible range of values as if the source range had been
/// truncated to the specified type.
ConstantRange ConstantRange::truncate(const Type *Ty) const {
- assert(getLower()->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() &&
- "Not a value truncation");
- uint64_t Size = 1ULL << Ty->getPrimitiveSize()*8;
+ unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits();
+ assert(SrcTySize > Ty->getPrimitiveSize() && "Not a value truncation");
+ uint64_t Size = 1ULL << Ty->getPrimitiveSizeInBits();
if (isFullSet() || getSetSize() >= Size)
return ConstantRange(getType());