aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DataStructure')
-rw-r--r--lib/Analysis/DataStructure/BottomUpClosure.cpp6
-rw-r--r--lib/Analysis/DataStructure/CompleteBottomUp.cpp8
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp14
-rw-r--r--lib/Analysis/DataStructure/EquivClassGraphs.cpp21
-rw-r--r--lib/Analysis/DataStructure/Printer.cpp17
-rw-r--r--lib/Analysis/DataStructure/TopDownClosure.cpp7
6 files changed, 34 insertions, 39 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index 5fca3ad433..6c26602889 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -228,8 +228,8 @@ unsigned BUDataStructures::calculateGraphs(Function *F,
SCCGraph->getReturnNodes(), NodeMap);
}
// Update the DSInfo map and delete the old graph...
- for (DSGraph::ReturnNodesTy::iterator I = G.getReturnNodes().begin(),
- E = G.getReturnNodes().end(); I != E; ++I)
+ for (DSGraph::retnodes_iterator I = G.retnodes_begin(),
+ E = G.retnodes_end(); I != E; ++I)
DSInfo[I->first] = SCCGraph;
delete &G;
}
@@ -496,7 +496,7 @@ void BUDataStructures::copyValue(Value *From, Value *To) {
assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!");
// Change the Function* is the returnnodes map to the ToF.
- DSNodeHandle Ret = NG->getReturnNodes().begin()->second;
+ DSNodeHandle Ret = NG->retnodes_begin()->second;
NG->getReturnNodes().clear();
NG->getReturnNodes()[ToF] = Ret;
return;
diff --git a/lib/Analysis/DataStructure/CompleteBottomUp.cpp b/lib/Analysis/DataStructure/CompleteBottomUp.cpp
index e38aebfb81..4dcfc35483 100644
--- a/lib/Analysis/DataStructure/CompleteBottomUp.cpp
+++ b/lib/Analysis/DataStructure/CompleteBottomUp.cpp
@@ -127,8 +127,8 @@ DSGraph &CompleteBUDataStructures::getOrCreateGraph(Function &F) {
// Make sure to update the DSInfo map for all of the functions currently in
// this graph!
- for (DSGraph::ReturnNodesTy::iterator I = Graph->getReturnNodes().begin();
- I != Graph->getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = Graph->retnodes_begin();
+ I != Graph->retnodes_end(); ++I)
DSInfo[I->first] = Graph;
return *Graph;
@@ -180,8 +180,8 @@ unsigned CompleteBUDataStructures::calculateSCCGraphs(DSGraph &FG,
FG.cloneInto(*NG, FG.getScalarMap(), FG.getReturnNodes(), NodeMap);
// Update the DSInfo map and delete the old graph...
- for (DSGraph::ReturnNodesTy::iterator I = NG->getReturnNodes().begin();
- I != NG->getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = NG->retnodes_begin();
+ I != NG->retnodes_end(); ++I)
DSInfo[I->first] = &FG;
// Remove NG from the ValMap since the pointer may get recycled.
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index ac2abb308b..aa96276324 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -547,8 +547,8 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
}
Module *M = 0;
- if (getParentGraph()->getReturnNodes().size())
- M = getParentGraph()->getReturnNodes().begin()->first->getParent();
+ if (getParentGraph()->retnodes_begin() != getParentGraph()->retnodes_end())
+ M = getParentGraph()->retnodes_begin()->first->getParent();
DEBUG(std::cerr << "MergeTypeInfo Folding OrigTy: ";
WriteTypeSymbolic(std::cerr, Ty, M) << "\n due to:";
WriteTypeSymbolic(std::cerr, NewTy, M) << " @ " << Offset << "!\n"
@@ -1058,11 +1058,11 @@ void DSCallSite::InitNH(DSNodeHandle &NH, const DSNodeHandle &Src,
std::string DSGraph::getFunctionNames() const {
switch (getReturnNodes().size()) {
case 0: return "Globals graph";
- case 1: return getReturnNodes().begin()->first->getName();
+ case 1: return retnodes_begin()->first->getName();
default:
std::string Return;
- for (DSGraph::ReturnNodesTy::const_iterator I = getReturnNodes().begin();
- I != getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = retnodes_begin();
+ I != retnodes_end(); ++I)
Return += I->first->getName() + " ";
Return.erase(Return.end()-1, Return.end()); // Remove last space character
return Return;
@@ -1233,8 +1233,8 @@ void DSGraph::cloneInto(const DSGraph &G, DSScalarMap &OldValMap,
}
// Map the return node pointers over...
- for (ReturnNodesTy::const_iterator I = G.getReturnNodes().begin(),
- E = G.getReturnNodes().end(); I != E; ++I) {
+ for (retnodes_iterator I = G.retnodes_begin(),
+ E = G.retnodes_end(); I != E; ++I) {
const DSNodeHandle &Ret = I->second;
DSNodeHandle &MappedRet = OldNodeMap[Ret.getNode()];
DSNode *MappedRetN = MappedRet.getNode();
diff --git a/lib/Analysis/DataStructure/EquivClassGraphs.cpp b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
index bc8f6a6b8c..daefb673cb 100644
--- a/lib/Analysis/DataStructure/EquivClassGraphs.cpp
+++ b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
@@ -45,7 +45,7 @@ static void CheckAllGraphs(Module *M, GT &ECGraphs) {
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
if (!I->isExternal()) {
DSGraph &G = ECGraphs.getDSGraph(*I);
- if (G.getReturnNodes().begin()->first != I)
+ if (G.retnodes_begin()->first != I)
continue; // Only check a graph once.
DSGraph::NodeMapTy GlobalsGraphNodeMapping;
@@ -181,9 +181,8 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
// Currently, that is just the functions in the same call-graph-SCC as F.
//
DSGraph& funcDSGraph = CBU->getDSGraph(*I->second);
- const DSGraph::ReturnNodesTy &RetNodes = funcDSGraph.getReturnNodes();
- for (DSGraph::ReturnNodesTy::const_iterator RI=RetNodes.begin(),
- RE=RetNodes.end(); RI != RE; ++RI)
+ for (DSGraph::retnodes_iterator RI = funcDSGraph.retnodes_begin(),
+ RE = funcDSGraph.retnodes_end(); RI != RE; ++RI)
FuncECs.unionSetsWith(FirstFunc, RI->first);
}
@@ -235,10 +234,8 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
continue;
// Record the "folded" graph for the function.
- for (DSGraph::ReturnNodesTy::iterator
- I = CBUGraph.getReturnNodes().begin(),
- E = CBUGraph.getReturnNodes().end();
- I != E; ++I) {
+ for (DSGraph::retnodes_iterator I = CBUGraph.retnodes_begin(),
+ E = CBUGraph.retnodes_end(); I != E; ++I) {
assert(DSInfo[I->first] == 0 && "Graph already exists for Fn!");
DSInfo[I->first] = &MergedG;
}
@@ -284,8 +281,8 @@ DSGraph &EquivClassGraphs::getOrCreateGraph(Function &F) {
Graph->setPrintAuxCalls();
// Make sure to update the DSInfo map for all functions in the graph!
- for (DSGraph::ReturnNodesTy::iterator I = Graph->getReturnNodes().begin();
- I != Graph->getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = Graph->retnodes_begin();
+ I != Graph->retnodes_end(); ++I)
if (I->first != &F) {
DSGraph *&FG = DSInfo[I->first];
assert(FG == 0 && "Merging function in SCC twice?");
@@ -342,8 +339,8 @@ processSCC(DSGraph &FG, std::vector<DSGraph*> &Stack, unsigned &NextID,
FG.cloneInto(*NG, FG.getScalarMap(), FG.getReturnNodes(), NodeMap);
// Update the DSInfo map and delete the old graph...
- for (DSGraph::ReturnNodesTy::iterator I = NG->getReturnNodes().begin();
- I != NG->getReturnNodes().end(); ++I)
+ for (DSGraph::retnodes_iterator I = NG->retnodes_begin();
+ I != NG->retnodes_end(); ++I)
DSInfo[I->first] = &FG;
// Remove NG from the ValMap since the pointer may get recycled.
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp
index ee143f6689..05fba215d5 100644
--- a/lib/Analysis/DataStructure/Printer.cpp
+++ b/lib/Analysis/DataStructure/Printer.cpp
@@ -44,8 +44,8 @@ static std::string getCaption(const DSNode *N, const DSGraph *G) {
if (!G) G = N->getParentGraph();
// Get the module from ONE of the functions in the graph it is available.
- if (G && !G->getReturnNodes().empty())
- M = G->getReturnNodes().begin()->first->getParent();
+ if (G && G->retnodes_begin() != G->retnodes_end())
+ M = G->retnodes_begin()->first->getParent();
if (M == 0 && G) {
// If there is a global in the graph, we can use it to find the module.
const DSScalarMap &SM = G->getScalarMap();
@@ -126,8 +126,8 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
static void addCustomGraphFeatures(const DSGraph *G,
GraphWriter<const DSGraph*> &GW) {
Module *CurMod = 0;
- if (!G->getReturnNodes().empty())
- CurMod = G->getReturnNodes().begin()->first->getParent();
+ if (G->retnodes_begin() != G->retnodes_end())
+ CurMod = G->retnodes_begin()->first->getParent();
else {
// If there is a global in the graph, we can use it to find the module.
const DSScalarMap &SM = G->getScalarMap();
@@ -154,12 +154,11 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
// Output the returned value pointer...
- const DSGraph::ReturnNodesTy &RetNodes = G->getReturnNodes();
- for (DSGraph::ReturnNodesTy::const_iterator I = RetNodes.begin(),
- E = RetNodes.end(); I != E; ++I)
+ for (DSGraph::retnodes_iterator I = G->retnodes_begin(),
+ E = G->retnodes_end(); I != E; ++I)
if (I->second.getNode()) {
std::string Label;
- if (RetNodes.size() == 1)
+ if (G->getReturnNodes().size() == 1)
Label = "returning";
else
Label = I->first->getName() + " ret node";
@@ -276,7 +275,7 @@ static void printCollection(const Collection &C, std::ostream &O,
TotalCallNodes += NumCalls;
if (I->getName() == "main" || !OnlyPrintMain) {
- Function *SCCFn = Gr.getReturnNodes().begin()->first;
+ Function *SCCFn = Gr.retnodes_begin()->first;
if (&*I == SCCFn)
Gr.writeGraphToFile(O, Prefix+I->getName());
else
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index bbce45b568..580f22884f 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -179,9 +179,8 @@ void TDDataStructures::inlineGraphIntoCallees(DSGraph &Graph) {
// If any of the functions has incomplete incoming arguments, don't mark any
// of them as complete.
bool HasIncompleteArgs = false;
- const DSGraph::ReturnNodesTy &GraphReturnNodes = Graph.getReturnNodes();
- for (DSGraph::ReturnNodesTy::const_iterator I = GraphReturnNodes.begin(),
- E = GraphReturnNodes.end(); I != E; ++I)
+ for (DSGraph::retnodes_iterator I = Graph.retnodes_begin(),
+ E = Graph.retnodes_end(); I != E; ++I)
if (ArgsRemainIncomplete.count(I->first)) {
HasIncompleteArgs = true;
break;
@@ -330,7 +329,7 @@ void TDDataStructures::copyValue(Value *From, Value *To) {
assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!");
// Change the Function* is the returnnodes map to the ToF.
- DSNodeHandle Ret = NG->getReturnNodes().begin()->second;
+ DSNodeHandle Ret = NG->retnodes_begin()->second;
NG->getReturnNodes().clear();
NG->getReturnNodes()[ToF] = Ret;
return;