[llvm-commits] [poolalloc] r98732 - in /poolalloc/trunk: include/dsa/DSCallGraph.h include/dsa/DSNode.h include/dsa/DataStructure.h include/dsa/super_set.h include/dsa/svset.h lib/DSA/BottomUpClosure.cpp lib/DSA/DataStructure.cpp lib/DSA/Local.cpp lib/DSA/Printer.cpp lib/DSA/TopDownClosure.cpp
Andrew Lenharth
andrewl at lenharth.org
Wed Mar 17 09:29:18 PDT 2010
Author: alenhar2
Date: Wed Mar 17 11:29:18 2010
New Revision: 98732
URL: http://llvm.org/viewvc/llvm-project?rev=98732&view=rev
Log:
move headers and rename sv::set
Added:
poolalloc/trunk/include/dsa/super_set.h
- copied, changed from r98698, poolalloc/trunk/include/dsa/sv/super_set.h
poolalloc/trunk/include/dsa/svset.h
- copied, changed from r98699, poolalloc/trunk/include/dsa/sv/set.h
Modified:
poolalloc/trunk/include/dsa/DSCallGraph.h
poolalloc/trunk/include/dsa/DSNode.h
poolalloc/trunk/include/dsa/DataStructure.h
poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
poolalloc/trunk/lib/DSA/DataStructure.cpp
poolalloc/trunk/lib/DSA/Local.cpp
poolalloc/trunk/lib/DSA/Printer.cpp
poolalloc/trunk/lib/DSA/TopDownClosure.cpp
Modified: poolalloc/trunk/include/dsa/DSCallGraph.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSCallGraph.h?rev=98732&r1=98731&r2=98732&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSCallGraph.h (original)
+++ poolalloc/trunk/include/dsa/DSCallGraph.h Wed Mar 17 11:29:18 2010
@@ -14,7 +14,7 @@
#ifndef LLVM_DSCALLGRAPH_H
#define LLVM_DSCALLGRAPH_H
-#include "dsa/sv/set.h"
+#include "dsa/svset.h"
#include <map>
#include "llvm/Function.h"
@@ -98,7 +98,7 @@
class DSCallGraph {
public:
- typedef sv::set<const llvm::Function*> FuncSet;
+ typedef svset<const llvm::Function*> FuncSet;
typedef std::map<llvm::CallSite, FuncSet> ActualCalleesTy;
typedef std::map<const llvm::Function*, FuncSet> SimpleCalleesTy;
@@ -210,10 +210,10 @@
unsigned nextSCC;
//Functions we know about that aren't called
- sv::set<unsigned> knownRoots;
+ svset<unsigned> knownRoots;
- std::map<unsigned, sv::set<unsigned> > SCCCallees;
- std::map<unsigned, sv::set<unsigned> > ExtCallees;
+ std::map<unsigned, svset<unsigned> > SCCCallees;
+ std::map<unsigned, svset<unsigned> > ExtCallees;
DSCallGraph oldGraph;
@@ -306,14 +306,14 @@
}
void buildRoots() {
- sv::set<unsigned> knownCallees;
- sv::set<unsigned> knownCallers;
- for (std::map<unsigned, sv::set<unsigned> >::iterator
+ svset<unsigned> knownCallees;
+ svset<unsigned> knownCallers;
+ for (std::map<unsigned, svset<unsigned> >::iterator
ii = SCCCallees.begin(), ee = SCCCallees.end(); ii != ee; ++ii) {
knownCallees.insert(ii->second.begin(), ii->second.end());
knownCallers.insert(ii->first);
}
- for (sv::set<unsigned>::iterator ii = knownCallers.begin(),
+ for (svset<unsigned>::iterator ii = knownCallers.begin(),
ee = knownCallers.end(); ii != ee; ++ii)
if (!knownCallees.count(*ii))
knownRoots.insert(*ii);
@@ -368,10 +368,10 @@
// llvm::errs() << ii->first << " -> " << ii->second << "\n";
//SCC map
- for (std::map<unsigned, sv::set<unsigned> >::iterator ii = SCCCallees.begin(),
+ for (std::map<unsigned, svset<unsigned> >::iterator ii = SCCCallees.begin(),
ee = SCCCallees.end(); ii != ee; ++ii) {
llvm::errs() << "CallGraph[" << ii->first << "]";
- for (sv::set<unsigned>::iterator i = ii->second.begin(),
+ for (svset<unsigned>::iterator i = ii->second.begin(),
e = ii->second.end(); i != e; ++i)
llvm::errs() << " " << *i;
llvm::errs() << "\n";
@@ -379,7 +379,7 @@
//Functions we know about that aren't called
llvm::errs() << "Roots:";
- for (sv::set<unsigned>::iterator ii = knownRoots.begin(),
+ for (svset<unsigned>::iterator ii = knownRoots.begin(),
ee = knownRoots.end(); ii != ee; ++ii)
llvm::errs() << " " << *ii;
llvm::errs() << "\n";
Modified: poolalloc/trunk/include/dsa/DSNode.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSNode.h?rev=98732&r1=98731&r2=98732&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSNode.h (original)
+++ poolalloc/trunk/include/dsa/DSNode.h Wed Mar 17 11:29:18 2010
@@ -20,8 +20,8 @@
#include <map>
#include <set>
-#include "dsa/sv/set.h"
-#include "dsa/sv/super_set.h"
+#include "dsa/svset.h"
+#include "dsa/super_set.h"
#include "DSGraph.h"
namespace llvm {
@@ -79,7 +79,7 @@
/// Globals - The list of global values that are merged into this node.
///
- sv::set<const GlobalValue*> Globals;
+ svset<const GlobalValue*> Globals;
void operator=(const DSNode &); // DO NOT IMPLEMENT
DSNode(const DSNode &); // DO NOT IMPLEMENT
@@ -317,7 +317,7 @@
/// value leaders set that is merged into this node. Like the getGlobalsList
/// method, these iterators do not return globals that are part of the
/// equivalence classes for globals in this node, but aren't leaders.
- typedef sv::set<const GlobalValue*>::const_iterator globals_iterator;
+ typedef svset<const GlobalValue*>::const_iterator globals_iterator;
globals_iterator globals_begin() const { return Globals.begin(); }
globals_iterator globals_end() const { return Globals.end(); }
Modified: poolalloc/trunk/include/dsa/DataStructure.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=98732&r1=98731&r2=98732&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DataStructure.h (original)
+++ poolalloc/trunk/include/dsa/DataStructure.h Wed Mar 17 11:29:18 2010
@@ -21,8 +21,8 @@
#include "dsa/EntryPointAnalysis.h"
#include "dsa/DSCallGraph.h"
-#include "dsa/sv/set.h"
-#include "dsa/sv/super_set.h"
+#include "dsa/svset.h"
+#include "dsa/super_set.h"
#include <map>
@@ -57,9 +57,9 @@
/// Were are DSGraphs stolen by another pass?
bool DSGraphsStolen;
- void buildGlobalECs(sv::set<const GlobalValue*>& ECGlobals);
+ void buildGlobalECs(svset<const GlobalValue*>& ECGlobals);
- void eliminateUsesOfECGlobals(DSGraph& G, const sv::set<const GlobalValue*> &ECGlobals);
+ void eliminateUsesOfECGlobals(DSGraph& G, const svset<const GlobalValue*> &ECGlobals);
// DSInfo, one graph for each function
DSInfoTy DSInfo;
@@ -237,7 +237,7 @@
private:
void mergeSCCs(DSSCCGraph& DSG);
- DSGraph* postOrder(DSSCCGraph& DSG, unsigned scc, sv::set<unsigned>& marked);
+ DSGraph* postOrder(DSSCCGraph& DSG, unsigned scc, svset<unsigned>& marked);
void calculateGraph(DSGraph* G, DSSCCGraph& DSG);
@@ -301,7 +301,7 @@
/// by the bottom-up pass.
///
class TDDataStructures : public DataStructures {
- sv::set<const Function*> ArgsRemainIncomplete;
+ svset<const Function*> ArgsRemainIncomplete;
/// CallerCallEdges - For a particular graph, we keep a list of these records
/// which indicates which graphs call this function and from where.
@@ -353,10 +353,10 @@
private:
void markReachableFunctionsExternallyAccessible(DSNode *N,
- sv::set<DSNode*> &Visited);
+ svset<DSNode*> &Visited);
void InlineCallersIntoGraph(DSGraph* G);
- void ComputePostOrder(const Function &F, sv::set<DSGraph*> &Visited,
+ void ComputePostOrder(const Function &F, svset<DSGraph*> &Visited,
std::vector<DSGraph*> &PostOrder);
};
Copied: poolalloc/trunk/include/dsa/super_set.h (from r98698, poolalloc/trunk/include/dsa/sv/super_set.h)
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/super_set.h?p2=poolalloc/trunk/include/dsa/super_set.h&p1=poolalloc/trunk/include/dsa/sv/super_set.h&r1=98698&r2=98732&rev=98732&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/sv/super_set.h (original)
+++ poolalloc/trunk/include/dsa/super_set.h Wed Mar 17 11:29:18 2010
@@ -8,7 +8,7 @@
#ifndef _SUPER_SET_H
#define _SUPER_SET_H
-#include "./set.h"
+#include "dsa/svset.h"
#include <set>
// Contains stable references to a set
@@ -17,19 +17,19 @@
template<typename Ty>
class SuperSet {
//std::set provides stable iterators, and that matters a lot
- typedef sv::set<Ty> InnerSetTy;
+ typedef svset<Ty> InnerSetTy;
typedef std::set<InnerSetTy> OuterSetTy;
OuterSetTy container;
public:
typedef const typename OuterSetTy::value_type* setPtr;
- setPtr getOrCreate(sv::set<Ty>& S) {
+ setPtr getOrCreate(svset<Ty>& S) {
if (S.empty()) return 0;
return &(*container.insert(S).first);
}
setPtr getOrCreate(setPtr P, Ty t) {
- sv::set<Ty> s;
+ svset<Ty> s;
if (P)
s.insert(P->begin(), P->end());
s.insert(t);
Copied: poolalloc/trunk/include/dsa/svset.h (from r98699, poolalloc/trunk/include/dsa/sv/set.h)
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/svset.h?p2=poolalloc/trunk/include/dsa/svset.h&p1=poolalloc/trunk/include/dsa/sv/set.h&r1=98699&r2=98732&rev=98732&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/sv/set.h (original)
+++ poolalloc/trunk/include/dsa/svset.h Wed Mar 17 11:29:18 2010
@@ -3,15 +3,14 @@
#include <algorithm>
-namespace sv {
-
////////////////////////////////////////////////////////////////////////////////////////////////////
/// A set implemented atop a sorted vector.
+/// Iterators are not stable accross insert or delete
template< typename Key,
typename Compare = std::less<Key>,
typename Alloc = std::allocator<Key> >
-class set {
+class svset {
typedef std::vector<Key, Alloc> internal_type;
// Types
@@ -45,24 +44,24 @@
public:
/// Empty constructor.
- set()
+ svset()
: container_() { }
/// Constructor taking a range.
template< typename Iterator >
- set(const Iterator& begin, const Iterator& end)
+ svset(const Iterator& begin, const Iterator& end)
: container_(begin, end) {
sort_unique();
}
/// Copy-constructor.
- set(const set& rhs)
+ svset(const svset& rhs)
: container_(rhs.container_)
{}
/// Affectation of a sorted vector to another one.
- set & operator=(const set& rhs) {
+ svset & operator=(const svset& rhs) {
if (&rhs != this) {
this->container_ = rhs.container_;
}
@@ -159,7 +158,7 @@
}
/// Swap the content of two sorted_vector.
- void swap(set& s) {
+ void swap(svset& s) {
container_.swap(s.container_);
}
@@ -199,10 +198,10 @@
/// Tells if this sorted vector is equal to another one.
- bool operator==(const set& rhs) const {
+ bool operator==(const svset& rhs) const {
return container_ == rhs.container_;
}
- bool operator<(const set& rhs) const {
+ bool operator<(const svset& rhs) const {
if (rhs.size() < size()) return false;
if (size() < rhs.size()) return true;
const_iterator ii = begin();
@@ -223,6 +222,4 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
-} // end of namespace sv
-
#endif // _SV_ORDERED_SET_HH_
Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=98732&r1=98731&r2=98732&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Wed Mar 17 11:29:18 2010
@@ -69,8 +69,8 @@
//Post order traversal:
{
//errs() << *DSG.knownRoots.begin() << " -> " << *DSG.knownRoots.rbegin() << "\n";
- sv::set<unsigned> marked;
- for (sv::set<unsigned>::const_iterator ii = DSG.knownRoots.begin(),
+ svset<unsigned> marked;
+ for (svset<unsigned>::const_iterator ii = DSG.knownRoots.begin(),
ee = DSG.knownRoots.end(); ii != ee; ++ii) {
//errs() << *ii << " ";
DSGraph* G = postOrder(DSG, *ii, marked);
@@ -196,11 +196,11 @@
}
DSGraph* BUDataStructures::postOrder(DSSCCGraph& DSG, unsigned scc,
- sv::set<unsigned>& marked) {
+ svset<unsigned>& marked) {
DSGraph* G = getDSGraph(**DSG.SCCs[scc].begin());
if (marked.count(scc)) return G;
- for(sv::set<unsigned>::iterator ii = DSG.SCCCallees[scc].begin(),
+ for(svset<unsigned>::iterator ii = DSG.SCCCallees[scc].begin(),
ee = DSG.SCCCallees[scc].end(); ii != ee; ++ii)
postOrder(DSG, *ii, marked);
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=98732&r1=98731&r2=98732&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Wed Mar 17 11:29:18 2010
@@ -53,7 +53,7 @@
DEBUG(
{ //assert not looping
DSNode* NH = N;
- sv::set<DSNode*> seen;
+ svset<DSNode*> seen;
while(NH && NH->isForwarding()) {
assert(seen.find(NH) == seen.end() && "Loop detected");
seen.insert(NH);
@@ -339,7 +339,7 @@
if (!TyMap[Offset])
TyMap[Offset] = TyIt;
if (TyIt) {
- sv::set<const Type*> S(*TyMap[Offset]);
+ svset<const Type*> S(*TyMap[Offset]);
S.insert(TyIt->begin(), TyIt->end());
TyMap[Offset] = getParentGraph()->getTypeSS().getOrCreate(S);
}
@@ -1125,7 +1125,7 @@
void DataStructures::formGlobalECs() {
// Grow the equivalence classes for the globals to include anything that we
// now know to be aliased.
- sv::set<const GlobalValue*> ECGlobals;
+ svset<const GlobalValue*> ECGlobals;
buildGlobalECs(ECGlobals);
if (!ECGlobals.empty()) {
DEBUG(errs() << "Eliminating " << ECGlobals.size() << " EC Globals!\n");
@@ -1140,7 +1140,7 @@
/// apart. Instead of maintaining this information in all of the graphs
/// throughout the entire program, store only a single global (the "leader") in
/// the graphs, and build equivalence classes for the rest of the globals.
-void DataStructures::buildGlobalECs(sv::set<const GlobalValue*> &ECGlobals) {
+void DataStructures::buildGlobalECs(svset<const GlobalValue*> &ECGlobals) {
DSScalarMap &SM = GlobalsGraph->getScalarMap();
EquivalenceClasses<const GlobalValue*> &GlobalECs = SM.getGlobalECs();
for (DSGraph::node_iterator I = GlobalsGraph->node_begin(),
@@ -1179,7 +1179,7 @@
/// really just equivalent to some other globals, remove the globals from the
/// specified DSGraph (if present), and merge any nodes with their leader nodes.
void DataStructures::eliminateUsesOfECGlobals(DSGraph &G,
- const sv::set<const GlobalValue*> &ECGlobals) {
+ const svset<const GlobalValue*> &ECGlobals) {
DSScalarMap &SM = G.getScalarMap();
EquivalenceClasses<const GlobalValue*> &GlobalECs = SM.getGlobalECs();
Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=98732&r1=98731&r2=98732&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Wed Mar 17 11:29:18 2010
@@ -880,7 +880,7 @@
while (count) {
std::string section;
msf >> section;
- sv::set<Value*> inSection;
+ svset<Value*> inSection;
for (Module::iterator MI = M.begin(), ME = M.end();
MI != ME; ++MI)
if (MI->hasSection() && MI->getSection() == section)
@@ -896,7 +896,7 @@
Value* V = M.getNamedValue(global);
if (V) {
DSNodeHandle& DHV = GlobalsGraph->getNodeForValue(V);
- for (sv::set<Value*>::iterator SI = inSection.begin(),
+ for (svset<Value*>::iterator SI = inSection.begin(),
SE = inSection.end(); SI != SE; ++SI) {
DEBUG(errs() << "Merging " << V->getNameStr() << " with "
<< (*SI)->getNameStr() << "\n");
Modified: poolalloc/trunk/lib/DSA/Printer.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Printer.cpp?rev=98732&r1=98731&r2=98732&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Printer.cpp (original)
+++ poolalloc/trunk/lib/DSA/Printer.cpp Wed Mar 17 11:29:18 2010
@@ -65,7 +65,7 @@
ee = N->type_end(); ii != ee; ++ii) {
OS << ii->first << ": ";
if (ii->second)
- for (sv::set<const Type*>::const_iterator ni = ii->second->begin(),
+ for (svset<const Type*>::const_iterator ni = ii->second->begin(),
ne = ii->second->end(); ni != ne; ++ni) {
WriteTypeSymbolic(OS, *ni, M);
OS << ", ";
Modified: poolalloc/trunk/lib/DSA/TopDownClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TopDownClosure.cpp?rev=98732&r1=98731&r2=98732&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/TopDownClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/TopDownClosure.cpp Wed Mar 17 11:29:18 2010
@@ -54,7 +54,7 @@
}
void TDDataStructures::markReachableFunctionsExternallyAccessible(DSNode *N,
- sv::set<DSNode*> &Visited) {
+ svset<DSNode*> &Visited) {
if (!N || Visited.count(N)) return;
Visited.insert(N);
@@ -85,7 +85,7 @@
// arguments are functions which are reachable by global variables in the
// globals graph.
const DSScalarMap &GGSM = GlobalsGraph->getScalarMap();
- sv::set<DSNode*> Visited;
+ svset<DSNode*> Visited;
for (DSScalarMap::global_iterator I=GGSM.global_begin(), E=GGSM.global_end();
I != E; ++I) {
DSNode *N = GGSM.find(*I)->second.getNode();
@@ -114,7 +114,7 @@
// We want to traverse the call graph in reverse post-order. To do this, we
// calculate a post-order traversal, then reverse it.
- sv::set<DSGraph*> VisitedGraph;
+ svset<DSGraph*> VisitedGraph;
std::vector<DSGraph*> PostOrder;
{TIME_REGION(XXX, "td:Compute postorder");
@@ -156,7 +156,7 @@
void TDDataStructures::ComputePostOrder(const Function &F,
- sv::set<DSGraph*> &Visited,
+ svset<DSGraph*> &Visited,
std::vector<DSGraph*> &PostOrder) {
if (F.isDeclaration()) return;
DSGraph* G = getOrCreateGraph(&F);
More information about the llvm-commits
mailing list