summaryrefslogtreecommitdiff
path: root/include/llvm/Support/ConstantRange.h
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-02-28 19:57:34 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-02-28 19:57:34 +0000
commit581b0d453a63f7f657248f80317976995262be11 (patch)
treeeb1a0259be67fdad03b5708f43ba80107d378380 /include/llvm/Support/ConstantRange.h
parentf57fc81faebf3eb81fb30fe17c4295d46060e03f (diff)
downloadllvm-581b0d453a63f7f657248f80317976995262be11.tar.gz
llvm-581b0d453a63f7f657248f80317976995262be11.tar.bz2
llvm-581b0d453a63f7f657248f80317976995262be11.tar.xz
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 'include/llvm/Support/ConstantRange.h')
-rw-r--r--include/llvm/Support/ConstantRange.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/llvm/Support/ConstantRange.h b/include/llvm/Support/ConstantRange.h
index b7e98181b3..ae36f42e12 100644
--- a/include/llvm/Support/ConstantRange.h
+++ b/include/llvm/Support/ConstantRange.h
@@ -37,7 +37,6 @@
namespace llvm {
class Constant;
-class ConstantInt;
class Type;
class ConstantRange {
@@ -66,11 +65,11 @@ class ConstantRange {
/// getLower - Return the lower value for this range...
///
- ConstantInt *getLower() const;
+ const APInt &getLower() const { return Lower; }
/// getUpper - Return the upper value for this range...
///
- ConstantInt *getUpper() const;
+ const APInt &getUpper() const { return Upper; }
/// getType - Return the LLVM data type of this range.
///
@@ -94,12 +93,16 @@ class ConstantRange {
/// The isSigned parameter indicates whether the comparisons should be
/// performed as if the values are signed or not.
///
- bool contains(ConstantInt *Val, bool isSigned) const;
+ bool contains(const APInt &Val, bool isSigned) const;
/// getSingleElement - If this set contains a single element, return it,
/// otherwise return null.
///
- ConstantInt *getSingleElement() const;
+ const APInt *getSingleElement() const {
+ if (Upper == Lower + 1)
+ return &Lower;
+ return 0;
+ }
/// isSingleElement - Return true if this set contains exactly one member.
///
@@ -120,7 +123,7 @@ class ConstantRange {
/// subtract - Subtract the specified constant from the endpoints of this
/// constant range.
- ConstantRange subtract(ConstantInt *CI) const;
+ ConstantRange subtract(const APInt &CI) const;
/// intersectWith - Return the range that results from the intersection of
/// this range with another range. The resultant range is pruned as much as