diff options
author | Chris Lattner <sabre@nondot.org> | 2002-03-28 17:56:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-03-28 17:56:03 +0000 |
commit | 1120c8b34ada1f7ce103f617a0dfa4526bf9e207 (patch) | |
tree | bf50db8005a275bcf7d65a8e90a6ae80154be8b2 /lib/Analysis/DataStructure/DataStructure.cpp | |
parent | 1d8ec6194a3c8d6e676f373af04171e5ad2ed4eb (diff) |
Many changes
* Simplify a lot of the inlining stuff. There are still problems, but not
many
* Break up the Function representation to have a vector for every different
node type so it is fast to find nodes of a particular flavor.
* Do more intelligent merging of call values
* Allow elimination of unreachable shadow and allocation nodes
* Generalize indistinguishability testing to allow merging of identical calls.
* Increase shadow node merging power
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/DataStructure.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index d90d84a06b..13d3dce174 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -90,6 +90,28 @@ const PointerValSet &PointerValSet::operator=(const PointerValSet &PVS) { return *this; } +// operator< - Allow insertion into a map... +bool PointerValSet::operator<(const PointerValSet &PVS) const { + if (Vals.size() < PVS.Vals.size()) return true; + if (Vals.size() > PVS.Vals.size()) return false; + if (Vals.size() == 1) return Vals[0] < PVS.Vals[0]; // Most common case + + vector<PointerVal> S1(Vals), S2(PVS.Vals); + sort(S1.begin(), S1.end()); + sort(S2.begin(), S2.end()); + return S1 < S2; +} + +bool PointerValSet::operator==(const PointerValSet &PVS) const { + if (Vals.size() != PVS.Vals.size()) return false; + if (Vals.size() == 1) return Vals[0] == PVS.Vals[0]; // Most common case... + + vector<PointerVal> S1(Vals), S2(PVS.Vals); + sort(S1.begin(), S1.end()); + sort(S2.begin(), S2.end()); + return S1 == S2; +} + bool PointerValSet::add(const PointerVal &PV, Value *Pointer) { if (std::find(Vals.begin(), Vals.end(), PV) != Vals.end()) |