[llvm-commits] CVS: poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp EquivClassGraphs.h
Chris Lattner
lattner at cs.uiuc.edu
Sun Oct 31 15:01:44 PST 2004
Changes in directory poolalloc/lib/PoolAllocate:
EquivClassGraphs.cpp updated: 1.7 -> 1.8
EquivClassGraphs.h updated: 1.5 -> 1.6
---
Log message:
Simplify graph traversal, improve grammar
---
Diffs of the changes: (+10 -11)
Index: poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp
diff -u poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp:1.7 poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp:1.8
--- poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp:1.7 Sun Oct 31 15:56:11 2004
+++ poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp Sun Oct 31 17:01:34 2004
@@ -37,7 +37,6 @@
"Number of graphs inlined");
}
-
// getDSGraphForCallSite - Return the common data structure graph for
// callees at the specified call site.
//
@@ -67,7 +66,7 @@
// Stack of functions used for Tarjan's SCC-finding algorithm.
std::vector<Function*> Stack;
- hash_map<Function*, unsigned> ValMap;
+ std::map<Function*, unsigned> ValMap;
unsigned NextID = 1;
if (Function *Main = M.getMainFunction()) {
@@ -259,13 +258,16 @@
}
-unsigned PA::EquivClassGraphs::processSCC(DSGraph &FG, Function& F,
+unsigned PA::EquivClassGraphs::processSCC(DSGraph &FG, Function &F,
std::vector<Function*> &Stack,
unsigned &NextID,
- hash_map<Function*,unsigned> &ValMap){
+ std::map<Function*,unsigned> &ValMap){
DEBUG(std::cerr << " ProcessSCC for function " << F.getName() << "\n");
- assert(!ValMap.count(&F) && "Shouldn't revisit functions!");
+ std::map<Function*, unsigned>::iterator It = ValMap.lower_bound(&F);
+ if (It != ValMap.end() && It->first == &F)
+ return It->second;
+
unsigned Min = NextID++, MyID = Min;
ValMap[&F] = Min;
Stack.push_back(&F);
@@ -281,11 +283,8 @@
DSGraph &CalleeG = getOrCreateGraph(*I->second);
// Have we visited the destination function yet?
- hash_map<Function*, unsigned>::iterator It = ValMap.find(I->second);
- unsigned M = (It == ValMap.end()) // No, visit it now.
- ? processSCC(CalleeG, *I->second, Stack, NextID, ValMap)
- : It->second; // Yes, get it's number.
-
+ std::map<Function*, unsigned>::iterator It = ValMap.find(I->second);
+ unsigned M = processSCC(CalleeG, *I->second, Stack, NextID, ValMap);
if (M < Min) Min = M;
}
}
Index: poolalloc/lib/PoolAllocate/EquivClassGraphs.h
diff -u poolalloc/lib/PoolAllocate/EquivClassGraphs.h:1.5 poolalloc/lib/PoolAllocate/EquivClassGraphs.h:1.6
--- poolalloc/lib/PoolAllocate/EquivClassGraphs.h:1.5 Sun Oct 31 15:56:11 2004
+++ poolalloc/lib/PoolAllocate/EquivClassGraphs.h Sun Oct 31 17:01:34 2004
@@ -141,7 +141,7 @@
unsigned processSCC(DSGraph &FG, Function &F, std::vector<Function*> &Stack,
unsigned &NextID,
- hash_map<Function*, unsigned> &ValMap);
+ std::map<Function*, unsigned> &ValMap);
void processGraph(DSGraph &FG, Function &F);
More information about the llvm-commits
mailing list