diff options
author | Chris Lattner <sabre@nondot.org> | 2002-02-05 03:35:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-02-05 03:35:31 +0000 |
commit | eb5230c4f98bd94c019bc2faed9432ca892e2f11 (patch) | |
tree | d17085a4c11e098e34b536c4af624e850f75ce7c | |
parent | edcea4ba4ae049d5bb5cdb2931a04200ac1f0e38 (diff) | |
download | external_llvm-eb5230c4f98bd94c019bc2faed9432ca892e2f11.zip external_llvm-eb5230c4f98bd94c019bc2faed9432ca892e2f11.tar.gz external_llvm-eb5230c4f98bd94c019bc2faed9432ca892e2f11.tar.bz2 |
Remove generic routines to Support/SetOperations.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1715 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/LiveVar/ValueSet.h | 35 | ||||
-rw-r--r-- | include/llvm/CodeGen/ValueSet.h | 35 | ||||
-rw-r--r-- | lib/Analysis/PostDominators.cpp | 19 | ||||
-rw-r--r-- | lib/VMCore/Dominators.cpp | 19 |
4 files changed, 2 insertions, 106 deletions
diff --git a/include/llvm/Analysis/LiveVar/ValueSet.h b/include/llvm/Analysis/LiveVar/ValueSet.h index 6c0a21f..048d8df 100644 --- a/include/llvm/Analysis/LiveVar/ValueSet.h +++ b/include/llvm/Analysis/LiveVar/ValueSet.h @@ -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 diff --git a/include/llvm/CodeGen/ValueSet.h b/include/llvm/CodeGen/ValueSet.h index 6c0a21f..048d8df 100644 --- a/include/llvm/CodeGen/ValueSet.h +++ b/include/llvm/CodeGen/ValueSet.h @@ -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 diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp index 4589783..aad6e1c 100644 --- a/lib/Analysis/PostDominators.cpp +++ b/lib/Analysis/PostDominators.cpp @@ -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 //===----------------------------------------------------------------------===// diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index 4589783..aad6e1c 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -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 //===----------------------------------------------------------------------===// |