diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-28 19:57:34 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-28 19:57:34 +0000 |
commit | 581b0d453a63f7f657248f80317976995262be11 (patch) | |
tree | eb1a0259be67fdad03b5708f43ba80107d378380 /lib/Support/ConstantRange.cpp | |
parent | f57fc81faebf3eb81fb30fe17c4295d46060e03f (diff) | |
download | external_llvm-581b0d453a63f7f657248f80317976995262be11.zip external_llvm-581b0d453a63f7f657248f80317976995262be11.tar.gz external_llvm-581b0d453a63f7f657248f80317976995262be11.tar.bz2 |
For PR1205:
Remove ConstantInt from ConstantRange interface and adjust its users to
compensate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34758 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/ConstantRange.cpp')
-rw-r--r-- | lib/Support/ConstantRange.cpp | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index c000c73..f419edc 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -22,7 +22,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/ConstantRange.h" -#include "llvm/Constants.h" #include "llvm/Instruction.h" #include "llvm/Instructions.h" #include "llvm/Type.h" @@ -107,14 +106,6 @@ const Type *ConstantRange::getType() const { return IntegerType::get(Lower.getBitWidth()); } -ConstantInt *ConstantRange::getLower() const { - return ConstantInt::get(getType(), Lower); -} - -ConstantInt *ConstantRange::getUpper() const { - return ConstantInt::get(getType(), Upper); -} - /// isFullSet - Return true if this set contains all of the elements possible /// for this data-type bool ConstantRange::isFullSet() const { @@ -136,14 +127,6 @@ bool ConstantRange::isWrappedSet(bool isSigned) const { return Lower.ugt(Upper); } -/// getSingleElement - If this set contains a single element, return it, -/// otherwise return null. -ConstantInt *ConstantRange::getSingleElement() const { - if (Upper == Lower + 1) // Is it a single element range? - return ConstantInt::get(getType(), Lower); - return 0; -} - /// getSetSize - Return the number of elements in this set. /// APInt ConstantRange::getSetSize() const { @@ -161,14 +144,13 @@ APInt ConstantRange::getSetSize() const { /// contains - Return true if the specified value is in the set. /// -bool ConstantRange::contains(ConstantInt *Val, bool isSigned) const { +bool ConstantRange::contains(const APInt &V, bool isSigned) const { if (Lower == Upper) { if (isFullSet()) return true; return false; } - const APInt &V = Val->getValue(); if (!isWrappedSet(isSigned)) if (isSigned) return Lower.sle(V) && V.slt(Upper); @@ -182,14 +164,11 @@ bool ConstantRange::contains(ConstantInt *Val, bool isSigned) const { /// subtract - Subtract the specified constant from the endpoints of this /// constant range. -ConstantRange ConstantRange::subtract(ConstantInt *CI) const { - assert(CI->getType() == getType() && - "Cannot subtract from different type range or non-integer!"); +ConstantRange ConstantRange::subtract(const APInt &Val) const { + assert(Val.getBitWidth() == Lower.getBitWidth() && "Wrong bit width"); // If the set is empty or full, don't modify the endpoints. if (Lower == Upper) return *this; - - const APInt &Val = CI->getValue(); return ConstantRange(Lower - Val, Upper - Val); } |