diff options
| author | Owen Anderson <resistor@mac.com> | 2010-08-07 05:47:46 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2010-08-07 05:47:46 +0000 |
| commit | c9723388045268d8275883fd53997f7a48467112 (patch) | |
| tree | db9e2c980a9a3b752b6bb1e93e4cdd3877cbeefc /lib/Support | |
| parent | b7294f50051dcb3ac9619514a0e8c18acfa15b22 (diff) | |
| download | external_llvm-c9723388045268d8275883fd53997f7a48467112.zip external_llvm-c9723388045268d8275883fd53997f7a48467112.tar.gz external_llvm-c9723388045268d8275883fd53997f7a48467112.tar.bz2 | |
Add an inverse() method to ConstantRange.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110504 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
| -rw-r--r-- | lib/Support/ConstantRange.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index fb04428..26a23ef 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -655,6 +655,17 @@ ConstantRange::lshr(const ConstantRange &Amount) const { return ConstantRange(min, max); } +ConstantRange ConstantRange::inverse() const { + if (isFullSet()) { + return ConstantRange(APInt::getNullValue(Lower.getBitWidth()), + APInt::getNullValue(Lower.getBitWidth())); + } else if (isEmptySet()) { + return ConstantRange(APInt::getAllOnesValue(Lower.getBitWidth()), + APInt::getAllOnesValue(Lower.getBitWidth())); + } + return ConstantRange(Upper, Lower); +} + /// print - Print out the bounds to a stream... /// void ConstantRange::print(raw_ostream &OS) const { |
