Remove generic routines to Support/SetOperations.h
authorChris Lattner <sabre@nondot.org>
Tue, 5 Feb 2002 03:35:31 +0000 (03:35 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 5 Feb 2002 03:35:31 +0000 (03:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1715 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LiveVar/ValueSet.h
include/llvm/CodeGen/ValueSet.h
lib/Analysis/PostDominators.cpp
lib/VMCore/Dominators.cpp

index 6c0a21f9095e9572ccf55d486d1a63185d86fdc0..048d8df4c55a2f324a5f0f723720bfb141a3e4e4 100644 (file)
@@ -16,39 +16,4 @@ ostream &operator<<(ostream &out, RAV Val);
 typedef std::set<const Value*> ValueSet;
 void printSet(const ValueSet &S);
 
-
-// set_union(A, B) - Compute A := A u B, return whether A changed.
-//
-template <class E>
-bool set_union(std::set<E> &S1, const std::set<E> &S2) {   
-  bool Changed = false;
-
-  for (std::set<E>::const_iterator SI = S2.begin(), SE = S2.end();
-       SI != SE; ++SI)
-    if (S1.insert(*SI).second)
-      Changed = true;
-
-  return Changed;
-}
-
-// set_difference(A, B) - Return A - B
-//
-template <class E>
-std::set<E> set_difference(const std::set<E> &S1, const std::set<E> &S2) {
-  std::set<E> Result;
-  for (std::set<E>::const_iterator SI = S1.begin(), SE = S1.end();
-       SI != SE; ++SI)
-    if (S2.find(*SI) == S2.end())       // if the element is not in set2
-      Result.insert(*SI);
-  return Result;
-}
-
-// set_subtract(A, B) - Compute A := A - B
-//
-template <class E>
-void set_subtract(std::set<E> &S1, const std::set<E> &S2) { 
-  for (std::set<E>::const_iterator SI = S2.begin() ; SI != S2.end(); ++SI)  
-    S1.erase(*SI);
-}
-
 #endif
index 6c0a21f9095e9572ccf55d486d1a63185d86fdc0..048d8df4c55a2f324a5f0f723720bfb141a3e4e4 100644 (file)
@@ -16,39 +16,4 @@ ostream &operator<<(ostream &out, RAV Val);
 typedef std::set<const Value*> ValueSet;
 void printSet(const ValueSet &S);
 
-
-// set_union(A, B) - Compute A := A u B, return whether A changed.
-//
-template <class E>
-bool set_union(std::set<E> &S1, const std::set<E> &S2) {   
-  bool Changed = false;
-
-  for (std::set<E>::const_iterator SI = S2.begin(), SE = S2.end();
-       SI != SE; ++SI)
-    if (S1.insert(*SI).second)
-      Changed = true;
-
-  return Changed;
-}
-
-// set_difference(A, B) - Return A - B
-//
-template <class E>
-std::set<E> set_difference(const std::set<E> &S1, const std::set<E> &S2) {
-  std::set<E> Result;
-  for (std::set<E>::const_iterator SI = S1.begin(), SE = S1.end();
-       SI != SE; ++SI)
-    if (S2.find(*SI) == S2.end())       // if the element is not in set2
-      Result.insert(*SI);
-  return Result;
-}
-
-// set_subtract(A, B) - Compute A := A - B
-//
-template <class E>
-void set_subtract(std::set<E> &S1, const std::set<E> &S2) { 
-  for (std::set<E>::const_iterator SI = S2.begin() ; SI != S2.end(); ++SI)  
-    S1.erase(*SI);
-}
-
 #endif
index 458978355a7dd7cc80a26d3696c9345e688c7514..aad6e1cb386ba3d96b9c4968c98d9fa7f998861f 100644 (file)
@@ -9,27 +9,10 @@
 #include "llvm/Method.h"
 #include "Support/DepthFirstIterator.h"
 #include "Support/STLExtras.h"
+#include "Support/SetOperations.h"
 #include <algorithm>
 using std::set;
 
-
-//===----------------------------------------------------------------------===//
-//  Helper Template
-//===----------------------------------------------------------------------===//
-
-// set_intersect - Identical to set_intersection, except that it works on 
-// set<>'s and is nicer to use.  Functionally, this iterates through S1, 
-// removing elements that are not contained in S2.
-//
-template <class Ty, class Ty2>
-void set_intersect(set<Ty> &S1, const set<Ty2> &S2) {
-  for (typename set<Ty>::iterator I = S1.begin(); I != S1.end();) {
-    const Ty &E = *I;
-    ++I;
-    if (!S2.count(E)) S1.erase(E);   // Erase element if not in S2
-  }
-}
-
 //===----------------------------------------------------------------------===//
 //  DominatorSet Implementation
 //===----------------------------------------------------------------------===//
index 458978355a7dd7cc80a26d3696c9345e688c7514..aad6e1cb386ba3d96b9c4968c98d9fa7f998861f 100644 (file)
@@ -9,27 +9,10 @@
 #include "llvm/Method.h"
 #include "Support/DepthFirstIterator.h"
 #include "Support/STLExtras.h"
+#include "Support/SetOperations.h"
 #include <algorithm>
 using std::set;
 
-
-//===----------------------------------------------------------------------===//
-//  Helper Template
-//===----------------------------------------------------------------------===//
-
-// set_intersect - Identical to set_intersection, except that it works on 
-// set<>'s and is nicer to use.  Functionally, this iterates through S1, 
-// removing elements that are not contained in S2.
-//
-template <class Ty, class Ty2>
-void set_intersect(set<Ty> &S1, const set<Ty2> &S2) {
-  for (typename set<Ty>::iterator I = S1.begin(); I != S1.end();) {
-    const Ty &E = *I;
-    ++I;
-    if (!S2.count(E)) S1.erase(E);   // Erase element if not in S2
-  }
-}
-
 //===----------------------------------------------------------------------===//
 //  DominatorSet Implementation
 //===----------------------------------------------------------------------===//