コード例 #1
0
  RangeSet AddGT(BasicValueFactory &BV, Factory &F, const llvm::APSInt &V) {
    PrimRangeSet newRanges = F.GetEmptySet();

    for (PrimRangeSet::iterator i = begin(), e = end(); i != e; ++i) {
      if (i->Includes(V) && i->To() > V)
        newRanges = F.Add(newRanges, Range(BV.Add1(V), i->To()));
      else if (i->From() > V)
        newRanges = F.Add(newRanges, *i);
    }
    
    return newRanges;
  }
コード例 #2
0
 /// AddNE - Create a new RangeSet with the additional constraint that the
 ///  value be not be equal to V.
 RangeSet AddNE(BasicValueFactory &BV, Factory &F, const llvm::APSInt &V) {
   PrimRangeSet newRanges = ranges;
   
   // FIXME: We can perhaps enhance ImmutableSet to do this search for us
   // in log(N) time using the sorted property of the internal AVL tree.
   for (iterator i = begin(), e = end(); i != e; ++i) {
     if (i->Includes(V)) {
       // Remove the old range.
       newRanges = F.Remove(newRanges, *i);
       // Split the old range into possibly one or two ranges.
       if (V != i->From())
         newRanges = F.Add(newRanges, Range(i->From(), BV.Sub1(V)));
       if (V != i->To())
         newRanges = F.Add(newRanges, Range(BV.Add1(V), i->To()));
       // All of the ranges are non-overlapping, so we can stop.        
       break;
     }
   }
   
   return newRanges;
 }