LLVM API Documentation

ConstantRange.cpp

Go to the documentation of this file.
00001 //===-- ConstantRange.cpp - ConstantRange implementation ------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // Represent a range of possible values that may occur when the program is run
00011 // for an integral value.  This keeps track of a lower and upper bound for the
00012 // constant, which MAY wrap around the end of the numeric range.  To do this, it
00013 // keeps track of a [lower, upper) bound, which specifies an interval just like
00014 // STL iterators.  When used with boolean values, the following are important
00015 // ranges (other integral ranges use min/max values for special range values):
00016 //
00017 //  [F, F) = {}     = Empty set
00018 //  [T, F) = {T}
00019 //  [F, T) = {F}
00020 //  [T, T) = {F, T} = Full set
00021 //
00022 //===----------------------------------------------------------------------===//
00023 
00024 #include "llvm/Support/ConstantRange.h"
00025 #include "llvm/Support/raw_ostream.h"
00026 #include "llvm/Instructions.h"
00027 using namespace llvm;
00028 
00029 /// Initialize a full (the default) or empty set for the specified type.
00030 ///
00031 ConstantRange::ConstantRange(uint32_t BitWidth, bool Full) {
00032   if (Full)
00033     Lower = Upper = APInt::getMaxValue(BitWidth);
00034   else
00035     Lower = Upper = APInt::getMinValue(BitWidth);
00036 }
00037 
00038 /// Initialize a range to hold the single specified value.
00039 ///
00040 ConstantRange::ConstantRange(const APInt & V) : Lower(V), Upper(V + 1) {}
00041 
00042 ConstantRange::ConstantRange(const APInt &L, const APInt &U) :
00043   Lower(L), Upper(U) {
00044   assert(L.getBitWidth() == U.getBitWidth() &&
00045          "ConstantRange with unequal bit widths");
00046   assert((L != U || (L.isMaxValue() || L.isMinValue())) &&
00047          "Lower == Upper, but they aren't min or max value!");
00048 }
00049 
00050 ConstantRange ConstantRange::makeICmpRegion(unsigned Pred,
00051                                             const ConstantRange &CR) {
00052   uint32_t W = CR.getBitWidth();
00053   switch (Pred) {
00054     default: assert(!"Invalid ICmp predicate to makeICmpRegion()");
00055     case ICmpInst::ICMP_EQ:
00056       return CR;
00057     case ICmpInst::ICMP_NE:
00058       if (CR.isSingleElement())
00059         return ConstantRange(CR.getUpper(), CR.getLower());
00060       return ConstantRange(W);
00061     case ICmpInst::ICMP_ULT:
00062       return ConstantRange(APInt::getMinValue(W), CR.getUnsignedMax());
00063     case ICmpInst::ICMP_SLT:
00064       return ConstantRange(APInt::getSignedMinValue(W), CR.getSignedMax());
00065     case ICmpInst::ICMP_ULE: {
00066       APInt UMax(CR.getUnsignedMax());
00067       if (UMax.isMaxValue())
00068         return ConstantRange(W);
00069       return ConstantRange(APInt::getMinValue(W), UMax + 1);
00070     }
00071     case ICmpInst::ICMP_SLE: {
00072       APInt SMax(CR.getSignedMax());
00073       if (SMax.isMaxSignedValue() || (SMax+1).isMaxSignedValue())
00074         return ConstantRange(W);
00075       return ConstantRange(APInt::getSignedMinValue(W), SMax + 1);
00076     }
00077     case ICmpInst::ICMP_UGT:
00078       return ConstantRange(CR.getUnsignedMin() + 1, APInt::getNullValue(W));
00079     case ICmpInst::ICMP_SGT:
00080       return ConstantRange(CR.getSignedMin() + 1,
00081                            APInt::getSignedMinValue(W));
00082     case ICmpInst::ICMP_UGE: {
00083       APInt UMin(CR.getUnsignedMin());
00084       if (UMin.isMinValue())
00085         return ConstantRange(W);
00086       return ConstantRange(UMin, APInt::getNullValue(W));
00087     }
00088     case ICmpInst::ICMP_SGE: {
00089       APInt SMin(CR.getSignedMin());
00090       if (SMin.isMinSignedValue())
00091         return ConstantRange(W);
00092       return ConstantRange(SMin, APInt::getSignedMinValue(W));
00093     }
00094   }
00095 }
00096 
00097 /// isFullSet - Return true if this set contains all of the elements possible
00098 /// for this data-type
00099 bool ConstantRange::isFullSet() const {
00100   return Lower == Upper && Lower.isMaxValue();
00101 }
00102 
00103 /// isEmptySet - Return true if this set contains no members.
00104 ///
00105 bool ConstantRange::isEmptySet() const {
00106   return Lower == Upper && Lower.isMinValue();
00107 }
00108 
00109 /// isWrappedSet - Return true if this set wraps around the top of the range,
00110 /// for example: [100, 8)
00111 ///
00112 bool ConstantRange::isWrappedSet() const {
00113   return Lower.ugt(Upper);
00114 }
00115 
00116 /// getSetSize - Return the number of elements in this set.
00117 ///
00118 APInt ConstantRange::getSetSize() const {
00119   if (isEmptySet()) 
00120     return APInt(getBitWidth(), 0);
00121   if (getBitWidth() == 1) {
00122     if (Lower != Upper)  // One of T or F in the set...
00123       return APInt(2, 1);
00124     return APInt(2, 2);      // Must be full set...
00125   }
00126 
00127   // Simply subtract the bounds...
00128   return Upper - Lower;
00129 }
00130 
00131 /// getUnsignedMax - Return the largest unsigned value contained in the
00132 /// ConstantRange.
00133 ///
00134 APInt ConstantRange::getUnsignedMax() const {
00135   if (isFullSet() || isWrappedSet())
00136     return APInt::getMaxValue(getBitWidth());
00137   else
00138     return getUpper() - 1;
00139 }
00140 
00141 /// getUnsignedMin - Return the smallest unsigned value contained in the
00142 /// ConstantRange.
00143 ///
00144 APInt ConstantRange::getUnsignedMin() const {
00145   if (isFullSet() || (isWrappedSet() && getUpper() != 0))
00146     return APInt::getMinValue(getBitWidth());
00147   else
00148     return getLower();
00149 }
00150 
00151 /// getSignedMax - Return the largest signed value contained in the
00152 /// ConstantRange.
00153 ///
00154 APInt ConstantRange::getSignedMax() const {
00155   APInt SignedMax(APInt::getSignedMaxValue(getBitWidth()));
00156   if (!isWrappedSet()) {
00157     if (getLower().sle(getUpper() - 1))
00158       return getUpper() - 1;
00159     else
00160       return SignedMax;
00161   } else {
00162     if (getLower().isNegative() == getUpper().isNegative())
00163       return SignedMax;
00164     else
00165       return getUpper() - 1;
00166   }
00167 }
00168 
00169 /// getSignedMin - Return the smallest signed value contained in the
00170 /// ConstantRange.
00171 ///
00172 APInt ConstantRange::getSignedMin() const {
00173   APInt SignedMin(APInt::getSignedMinValue(getBitWidth()));
00174   if (!isWrappedSet()) {
00175     if (getLower().sle(getUpper() - 1))
00176       return getLower();
00177     else
00178       return SignedMin;
00179   } else {
00180     if ((getUpper() - 1).slt(getLower())) {
00181       if (getUpper() != SignedMin)
00182         return SignedMin;
00183       else
00184         return getLower();
00185     } else {
00186       return getLower();
00187     }
00188   }
00189 }
00190 
00191 /// contains - Return true if the specified value is in the set.
00192 ///
00193 bool ConstantRange::contains(const APInt &V) const {
00194   if (Lower == Upper)
00195     return isFullSet();
00196 
00197   if (!isWrappedSet())
00198     return Lower.ule(V) && V.ult(Upper);
00199   else
00200     return Lower.ule(V) || V.ult(Upper);
00201 }
00202 
00203 /// contains - Return true if the argument is a subset of this range.
00204 /// Two equal set contain each other. The empty set is considered to be
00205 /// contained by all other sets.
00206 ///
00207 bool ConstantRange::contains(const ConstantRange &Other) const {
00208   if (isFullSet()) return true;
00209   if (Other.isFullSet()) return false;
00210   if (Other.isEmptySet()) return true;
00211   if (isEmptySet()) return false;
00212 
00213   if (!isWrappedSet()) {
00214     if (Other.isWrappedSet())
00215       return false;
00216 
00217     return Lower.ule(Other.getLower()) && Other.getUpper().ule(Upper);
00218   }
00219 
00220   if (!Other.isWrappedSet())
00221     return Other.getUpper().ule(Upper) ||
00222            Lower.ule(Other.getLower());
00223 
00224   return Other.getUpper().ule(Upper) && Lower.ule(Other.getLower());
00225 }
00226 
00227 /// subtract - Subtract the specified constant from the endpoints of this
00228 /// constant range.
00229 ConstantRange ConstantRange::subtract(const APInt &Val) const {
00230   assert(Val.getBitWidth() == getBitWidth() && "Wrong bit width");
00231   // If the set is empty or full, don't modify the endpoints.
00232   if (Lower == Upper) 
00233     return *this;
00234   return ConstantRange(Lower - Val, Upper - Val);
00235 }
00236 
00237 
00238 // intersect1Wrapped - This helper function is used to intersect two ranges when
00239 // it is known that LHS is wrapped and RHS isn't.
00240 //
00241 ConstantRange 
00242 ConstantRange::intersect1Wrapped(const ConstantRange &LHS,
00243                                  const ConstantRange &RHS) {
00244   assert(LHS.isWrappedSet() && !RHS.isWrappedSet());
00245 
00246   // Check to see if we overlap on the Left side of RHS...
00247   //
00248   if (RHS.Lower.ult(LHS.Upper)) {
00249     // We do overlap on the left side of RHS, see if we overlap on the right of
00250     // RHS...
00251     if (RHS.Upper.ugt(LHS.Lower)) {
00252       // Ok, the result overlaps on both the left and right sides.  See if the
00253       // resultant interval will be smaller if we wrap or not...
00254       //
00255       if (LHS.getSetSize().ult(RHS.getSetSize()))
00256         return LHS;
00257       else
00258         return RHS;
00259 
00260     } else {
00261       // No overlap on the right, just on the left.
00262       return ConstantRange(RHS.Lower, LHS.Upper);
00263     }
00264   } else {
00265     // We don't overlap on the left side of RHS, see if we overlap on the right
00266     // of RHS...
00267     if (RHS.Upper.ugt(LHS.Lower)) {
00268       // Simple overlap...
00269       return ConstantRange(LHS.Lower, RHS.Upper);
00270     } else {
00271       // No overlap...
00272       return ConstantRange(LHS.getBitWidth(), false);
00273     }
00274   }
00275 }
00276 
00277 /// intersectWith - Return the range that results from the intersection of this
00278 /// range with another range.  The resultant range is guaranteed to include all
00279 /// elements contained in both input ranges, and to have the smallest possible
00280 /// set size that does so.  Because there may be two intersections with the
00281 /// same set size, A.intersectWith(B) might not be equal to B.intersectWith(A).
00282 ConstantRange ConstantRange::intersectWith(const ConstantRange &CR) const {
00283   assert(getBitWidth() == CR.getBitWidth() && 
00284          "ConstantRange types don't agree!");
00285 
00286   // Handle common cases.
00287   if (   isEmptySet() || CR.isFullSet()) return *this;
00288   if (CR.isEmptySet() ||    isFullSet()) return CR;
00289 
00290   if (!isWrappedSet() && CR.isWrappedSet())
00291     return CR.intersectWith(*this);
00292 
00293   if (!isWrappedSet() && !CR.isWrappedSet()) {
00294     if (Lower.ult(CR.Lower)) {
00295       if (Upper.ule(CR.Lower))
00296         return ConstantRange(getBitWidth(), false);
00297 
00298       if (Upper.ult(CR.Upper))
00299         return ConstantRange(CR.Lower, Upper);
00300 
00301       return CR;
00302     } else {
00303       if (Upper.ult(CR.Upper))
00304         return *this;
00305 
00306       if (Lower.ult(CR.Upper))
00307         return ConstantRange(Lower, CR.Upper);
00308 
00309       return ConstantRange(getBitWidth(), false);
00310     }
00311   }
00312 
00313   if (isWrappedSet() && !CR.isWrappedSet()) {
00314     if (CR.Lower.ult(Upper)) {
00315       if (CR.Upper.ult(Upper))
00316         return CR;
00317 
00318       if (CR.Upper.ult(Lower))
00319         return ConstantRange(CR.Lower, Upper);
00320 
00321       if (getSetSize().ult(CR.getSetSize()))
00322         return *this;
00323       else
00324         return CR;
00325     } else if (CR.Lower.ult(Lower)) {
00326       if (CR.Upper.ule(Lower))
00327         return ConstantRange(getBitWidth(), false);
00328 
00329       return ConstantRange(Lower, CR.Upper);
00330     }
00331     return CR;
00332   }
00333 
00334   if (CR.Upper.ult(Upper)) {
00335     if (CR.Lower.ult(Upper)) {
00336       if (getSetSize().ult(CR.getSetSize()))
00337         return *this;
00338       else
00339         return CR;
00340     }
00341 
00342     if (CR.Lower.ult(Lower))
00343       return ConstantRange(Lower, CR.Upper);
00344 
00345     return CR;
00346   } else if (CR.Upper.ult(Lower)) {
00347     if (CR.Lower.ult(Lower))
00348       return *this;
00349 
00350     return ConstantRange(CR.Lower, Upper);
00351   }
00352   if (getSetSize().ult(CR.getSetSize()))
00353     return *this;
00354   else
00355     return CR;
00356 }
00357 
00358 
00359 /// unionWith - Return the range that results from the union of this range with
00360 /// another range.  The resultant range is guaranteed to include the elements of
00361 /// both sets, but may contain more.  For example, [3, 9) union [12,15) is
00362 /// [3, 15), which includes 9, 10, and 11, which were not included in either
00363 /// set before.
00364 ///
00365 ConstantRange ConstantRange::unionWith(const ConstantRange &CR) const {
00366   assert(getBitWidth() == CR.getBitWidth() && 
00367          "ConstantRange types don't agree!");
00368 
00369   if (   isFullSet() || CR.isEmptySet()) return *this;
00370   if (CR.isFullSet() ||    isEmptySet()) return CR;
00371 
00372   if (!isWrappedSet() && CR.isWrappedSet()) return CR.unionWith(*this);
00373 
00374   if (!isWrappedSet() && !CR.isWrappedSet()) {
00375     if (CR.Upper.ult(Lower) || Upper.ult(CR.Lower)) {
00376       // If the two ranges are disjoint, find the smaller gap and bridge it.
00377       APInt d1 = CR.Lower - Upper, d2 = Lower - CR.Upper;
00378       if (d1.ult(d2))
00379         return ConstantRange(Lower, CR.Upper);
00380       else
00381         return ConstantRange(CR.Lower, Upper);
00382     }
00383 
00384     APInt L = Lower, U = Upper;
00385     if (CR.Lower.ult(L))
00386       L = CR.Lower;
00387     if ((CR.Upper - 1).ugt(U - 1))
00388       U = CR.Upper;
00389 
00390     if (L == 0 && U == 0)
00391       return ConstantRange(getBitWidth());
00392 
00393     return ConstantRange(L, U);
00394   }
00395 
00396   if (!CR.isWrappedSet()) {
00397     // ------U   L-----  and  ------U   L----- : this
00398     //   L--U                            L--U  : CR
00399     if (CR.Upper.ule(Upper) || CR.Lower.uge(Lower))
00400       return *this;
00401 
00402     // ------U   L----- : this
00403     //    L---------U   : CR
00404     if (CR.Lower.ule(Upper) && Lower.ule(CR.Upper))
00405       return ConstantRange(getBitWidth());
00406 
00407     // ----U       L---- : this
00408     //       L---U       : CR
00409     //    <d1>  <d2>
00410     if (Upper.ule(CR.Lower) && CR.Upper.ule(Lower)) {
00411       APInt d1 = CR.Lower - Upper, d2 = Lower - CR.Upper;
00412       if (d1.ult(d2))
00413         return ConstantRange(Lower, CR.Upper);
00414       else
00415         return ConstantRange(CR.Lower, Upper);
00416     }
00417 
00418     // ----U     L----- : this
00419     //        L----U    : CR
00420     if (Upper.ult(CR.Lower) && Lower.ult(CR.Upper))
00421       return ConstantRange(CR.Lower, Upper);
00422 
00423     // ------U    L---- : this
00424     //    L-----U       : CR
00425     if (CR.Lower.ult(Upper) && CR.Upper.ult(Lower))
00426       return ConstantRange(Lower, CR.Upper);
00427   }
00428 
00429   assert(isWrappedSet() && CR.isWrappedSet() &&
00430          "ConstantRange::unionWith missed wrapped union unwrapped case");
00431 
00432   // ------U    L----  and  ------U    L---- : this
00433   // -U  L-----------  and  ------------U  L : CR
00434   if (CR.Lower.ule(Upper) || Lower.ule(CR.Upper))
00435     return ConstantRange(getBitWidth());
00436 
00437   APInt L = Lower, U = Upper;
00438   if (CR.Upper.ugt(U))
00439     U = CR.Upper;
00440   if (CR.Lower.ult(L))
00441     L = CR.Lower;
00442 
00443   return ConstantRange(L, U);
00444 }
00445 
00446 /// zeroExtend - Return a new range in the specified integer type, which must
00447 /// be strictly larger than the current type.  The returned range will
00448 /// correspond to the possible range of values as if the source range had been
00449 /// zero extended.
00450 ConstantRange ConstantRange::zeroExtend(uint32_t DstTySize) const {
00451   unsigned SrcTySize = getBitWidth();
00452   assert(SrcTySize < DstTySize && "Not a value extension");
00453   if (isFullSet())
00454     // Change a source full set into [0, 1 << 8*numbytes)
00455     return ConstantRange(APInt(DstTySize,0), APInt(DstTySize,1).shl(SrcTySize));
00456 
00457   APInt L = Lower; L.zext(DstTySize);
00458   APInt U = Upper; U.zext(DstTySize);
00459   return ConstantRange(L, U);
00460 }
00461 
00462 /// signExtend - Return a new range in the specified integer type, which must
00463 /// be strictly larger than the current type.  The returned range will
00464 /// correspond to the possible range of values as if the source range had been
00465 /// sign extended.
00466 ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const {
00467   unsigned SrcTySize = getBitWidth();
00468   assert(SrcTySize < DstTySize && "Not a value extension");
00469   if (isFullSet()) {
00470     return ConstantRange(APInt::getHighBitsSet(DstTySize,DstTySize-SrcTySize+1),
00471                          APInt::getLowBitsSet(DstTySize, SrcTySize-1) + 1);
00472   }
00473 
00474   APInt L = Lower; L.sext(DstTySize);
00475   APInt U = Upper; U.sext(DstTySize);
00476   return ConstantRange(L, U);
00477 }
00478 
00479 /// truncate - Return a new range in the specified integer type, which must be
00480 /// strictly smaller than the current type.  The returned range will
00481 /// correspond to the possible range of values as if the source range had been
00482 /// truncated to the specified type.
00483 ConstantRange ConstantRange::truncate(uint32_t DstTySize) const {
00484   unsigned SrcTySize = getBitWidth();
00485   assert(SrcTySize > DstTySize && "Not a value truncation");
00486   APInt Size(APInt::getLowBitsSet(SrcTySize, DstTySize));
00487   if (isFullSet() || getSetSize().ugt(Size))
00488     return ConstantRange(DstTySize);
00489 
00490   APInt L = Lower; L.trunc(DstTySize);
00491   APInt U = Upper; U.trunc(DstTySize);
00492   return ConstantRange(L, U);
00493 }
00494 
00495 ConstantRange
00496 ConstantRange::add(const ConstantRange &Other) const {
00497   if (isEmptySet() || Other.isEmptySet())
00498     return ConstantRange(getBitWidth(), /*isFullSet=*/false);
00499   if (isFullSet() || Other.isFullSet())
00500     return ConstantRange(getBitWidth(), /*isFullSet=*/true);
00501 
00502   APInt Spread_X = getSetSize(), Spread_Y = Other.getSetSize();
00503   APInt NewLower = getLower() + Other.getLower();
00504   APInt NewUpper = getUpper() + Other.getUpper() - 1;
00505   if (NewLower == NewUpper)
00506     return ConstantRange(getBitWidth(), /*isFullSet=*/true);
00507 
00508   ConstantRange X = ConstantRange(NewLower, NewUpper);
00509   if (X.getSetSize().ult(Spread_X) || X.getSetSize().ult(Spread_Y))
00510     // We've wrapped, therefore, full set.
00511     return ConstantRange(getBitWidth(), /*isFullSet=*/true);
00512 
00513   return X;
00514 }
00515 
00516 ConstantRange
00517 ConstantRange::multiply(const ConstantRange &Other) const {
00518   if (isEmptySet() || Other.isEmptySet())
00519     return ConstantRange(getBitWidth(), /*isFullSet=*/false);
00520   if (isFullSet() || Other.isFullSet())
00521     return ConstantRange(getBitWidth(), /*isFullSet=*/true);
00522 
00523   APInt this_min = getUnsignedMin().zext(getBitWidth() * 2);
00524   APInt this_max = getUnsignedMax().zext(getBitWidth() * 2);
00525   APInt Other_min = Other.getUnsignedMin().zext(getBitWidth() * 2);
00526   APInt Other_max = Other.getUnsignedMax().zext(getBitWidth() * 2);
00527 
00528   ConstantRange Result_zext = ConstantRange(this_min * Other_min,
00529                                             this_max * Other_max + 1);
00530   return Result_zext.truncate(getBitWidth());
00531 }
00532 
00533 ConstantRange
00534 ConstantRange::smax(const ConstantRange &Other) const {
00535   // X smax Y is: range(smax(X_smin, Y_smin),
00536   //                    smax(X_smax, Y_smax))
00537   if (isEmptySet() || Other.isEmptySet())
00538     return ConstantRange(getBitWidth(), /*isFullSet=*/false);
00539   APInt NewL = APIntOps::smax(getSignedMin(), Other.getSignedMin());
00540   APInt NewU = APIntOps::smax(getSignedMax(), Other.getSignedMax()) + 1;
00541   if (NewU == NewL)
00542     return ConstantRange(getBitWidth(), /*isFullSet=*/true);
00543   return ConstantRange(NewL, NewU);
00544 }
00545 
00546 ConstantRange
00547 ConstantRange::umax(const ConstantRange &Other) const {
00548   // X umax Y is: range(umax(X_umin, Y_umin),
00549   //                    umax(X_umax, Y_umax))
00550   if (isEmptySet() || Other.isEmptySet())
00551     return ConstantRange(getBitWidth(), /*isFullSet=*/false);
00552   APInt NewL = APIntOps::umax(getUnsignedMin(), Other.getUnsignedMin());
00553   APInt NewU = APIntOps::umax(getUnsignedMax(), Other.getUnsignedMax()) + 1;
00554   if (NewU == NewL)
00555     return ConstantRange(getBitWidth(), /*isFullSet=*/true);
00556   return ConstantRange(NewL, NewU);
00557 }
00558 
00559 ConstantRange
00560 ConstantRange::udiv(const ConstantRange &RHS) const {
00561   if (isEmptySet() || RHS.isEmptySet() || RHS.getUnsignedMax() == 0)
00562     return ConstantRange(getBitWidth(), /*isFullSet=*/false);
00563   if (RHS.isFullSet())
00564     return ConstantRange(getBitWidth(), /*isFullSet=*/true);
00565 
00566   APInt Lower = getUnsignedMin().udiv(RHS.getUnsignedMax());
00567 
00568   APInt RHS_umin = RHS.getUnsignedMin();
00569   if (RHS_umin == 0) {
00570     // We want the lowest value in RHS excluding zero. Usually that would be 1
00571     // except for a range in the form of [X, 1) in which case it would be X.
00572     if (RHS.getUpper() == 1)
00573       RHS_umin = RHS.getLower();
00574     else
00575       RHS_umin = APInt(getBitWidth(), 1);
00576   }
00577 
00578   APInt Upper = getUnsignedMax().udiv(RHS_umin) + 1;
00579 
00580   // If the LHS is Full and the RHS is a wrapped interval containing 1 then
00581   // this could occur.
00582   if (Lower == Upper)
00583     return ConstantRange(getBitWidth(), /*isFullSet=*/true);
00584 
00585   return ConstantRange(Lower, Upper);
00586 }
00587 
00588 /// print - Print out the bounds to a stream...
00589 ///
00590 void ConstantRange::print(raw_ostream &OS) const {
00591   OS << "[" << Lower << "," << Upper << ")";
00592 }
00593 
00594 /// dump - Allow printing from a debugger easily...
00595 ///
00596 void ConstantRange::dump() const {
00597   print(errs());
00598 }
00599 
00600 std::ostream &llvm::operator<<(std::ostream &o,
00601                                const ConstantRange &CR) {
00602   raw_os_ostream OS(o);
00603   OS << CR;
00604   return o;
00605 }