diff options
author | Chris Lattner <sabre@nondot.org> | 2003-02-01 04:52:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-02-01 04:52:08 +0000 |
commit | 41c04f730b4fdce98b35603d1b02a1dc6b81e589 (patch) | |
tree | f08dfc8ff8348bc104ab699169d52d3673e55c6e /lib/Analysis/DataStructure/BottomUpClosure.cpp | |
parent | cbf2a3e5c1a88106c0085885772343bc9ee6b9c1 (diff) |
Change DSGraph stuff to use hash_(set|map) instead of std::(set|map)
This change provides a small (3%) but consistent speedup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5460 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/BottomUpClosure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/BottomUpClosure.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp index 26b7813482..8fa331c92d 100644 --- a/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -11,6 +11,7 @@ #include "llvm/Analysis/DSGraph.h" #include "llvm/Module.h" #include "Support/Statistic.h" +#include "Support/hash_map" namespace { Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph"); @@ -128,7 +129,7 @@ bool BUDataStructures::run(Module &M) { void BUDataStructures::calculateReachableGraphs(Function *F) { std::vector<Function*> Stack; - std::map<Function*, unsigned> ValMap; + hash_map<Function*, unsigned> ValMap; unsigned NextID = 1; calculateGraphs(F, Stack, NextID, ValMap); } @@ -152,7 +153,7 @@ DSGraph &BUDataStructures::getOrCreateGraph(Function *F) { unsigned BUDataStructures::calculateGraphs(Function *F, std::vector<Function*> &Stack, unsigned &NextID, - std::map<Function*, unsigned> &ValMap) { + hash_map<Function*, unsigned> &ValMap) { assert(ValMap.find(F) == ValMap.end() && "Shouldn't revisit functions!"); unsigned Min = NextID++, MyID = Min; ValMap[F] = Min; @@ -173,7 +174,7 @@ unsigned BUDataStructures::calculateGraphs(Function *F, Function *Callee = *I; unsigned M; // Have we visited the destination function yet? - std::map<Function*, unsigned>::iterator It = ValMap.find(Callee); + hash_map<Function*, unsigned>::iterator It = ValMap.find(Callee); if (It == ValMap.end()) // No, visit it now. M = calculateGraphs(Callee, Stack, NextID, ValMap); else // Yes, get it's number. @@ -206,7 +207,7 @@ unsigned BUDataStructures::calculateGraphs(Function *F, } else { // SCCFunctions - Keep track of the functions in the current SCC // - std::set<Function*> SCCFunctions; + hash_set<Function*> SCCFunctions; Function *NF; std::vector<Function*>::iterator FirstInSCC = Stack.end(); @@ -283,7 +284,7 @@ unsigned BUDataStructures::calculateGraphs(Function *F, // our memory... here... // void BUDataStructures::releaseMemory() { - for (std::map<const Function*, DSGraph*>::iterator I = DSInfo.begin(), + for (hash_map<const Function*, DSGraph*>::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; @@ -383,7 +384,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) { // IN the SCC at all. // DSGraph &BUDataStructures::inlineNonSCCGraphs(Function &F, - std::set<Function*> &SCCFunctions){ + hash_set<Function*> &SCCFunctions){ DSGraph &Graph = getDSGraph(F); DEBUG(std::cerr << " [BU] Inlining Non-SCC graphs for: " << F.getName() << "\n"); @@ -452,12 +453,12 @@ DSGraph &BUDataStructures::inlineNonSCCGraphs(Function &F, DSGraph &BUDataStructures::calculateSCCGraph(Function &F, - std::set<Function*> &SCCFunctions){ + hash_set<Function*> &SCCFunctions){ DSGraph &Graph = getDSGraph(F); DEBUG(std::cerr << " [BU] Calculating SCC graph for: " << F.getName()<<"\n"); std::vector<DSCallSite> UnresolvableCalls; - std::map<Function*, DSCallSite> SCCCallSiteMap; + hash_map<Function*, DSCallSite> SCCCallSiteMap; std::vector<DSCallSite> &AuxCallsList = Graph.getAuxFunctionCalls(); while (1) { // Loop until we run out of resolvable call sites! |