RegisterPresssureTracker: Track live physical register by unit.
[oota-llvm.git] / include / llvm / ADT / SmallSet.h
index 75e8c64885a92754dbd5b6ac4e80f52145ec518f..4eb7de895a68933d74c573ef669e382f5a670b10 100644 (file)
@@ -14,8 +14,8 @@
 #ifndef LLVM_ADT_SMALLSET_H
 #define LLVM_ADT_SMALLSET_H
 
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
 #include <set>
 
 namespace llvm {
@@ -27,13 +27,13 @@ namespace llvm {
 ///
 /// Note that this set does not provide a way to iterate over members in the
 /// set.
-template <typename T, unsigned N>
+template <typename T, unsigned N,  typename C = std::less<T> >
 class SmallSet {
   /// Use a SmallVector to hold the elements here (even though it will never
-  /// reach it's 'large' stage) to avoid calling the default ctors of elements
+  /// reach its 'large' stage) to avoid calling the default ctors of elements
   /// we will never use.
   SmallVector<T, N> Vector;
-  std::set<T> Set;
+  std::set<T, C> Set;
   typedef typename SmallVector<T, N>::const_iterator VIterator;
   typedef typename SmallVector<T, N>::iterator mutable_iterator;
 public:
@@ -76,6 +76,12 @@ public:
     return true;
   }
 
+  template <typename IterT>
+  void insert(IterT I, IterT E) {
+    for (; I != E; ++I)
+      insert(*I);
+  }
+  
   bool erase(const T &V) {
     if (!isSmall())
       return Set.erase(V);