diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index d2331e1bbd5..8e83f3037b1 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -102,7 +102,7 @@ protected: // DSInfo, one graph for each function hash_map DSInfo; DSGraph *GlobalsGraph; - hash_multimap ActualCallees; + std::set > ActualCallees; // This map is only maintained during construction of BU Graphs std::map, @@ -152,11 +152,20 @@ public: AU.addRequired(); } - typedef hash_multimap ActualCalleesTy; + typedef std::set > ActualCalleesTy; const ActualCalleesTy &getActualCallees() const { return ActualCallees; } + ActualCalleesTy::iterator callee_begin(Instruction *I) const { + return ActualCallees.lower_bound(std::pair(I, 0)); + } + + ActualCalleesTy::iterator callee_end(Instruction *I) const { + I = (Instruction*)((char*)I + 1); + return ActualCallees.lower_bound(std::pair(I, 0)); + } + private: void calculateGraph(DSGraph &G); @@ -177,6 +186,7 @@ class TDDataStructures : public ModulePass { hash_map DSInfo; hash_set ArgsRemainIncomplete; DSGraph *GlobalsGraph; + BUDataStructures *BUInfo; /// GlobalECs - The equivalence classes for each global value that is merged /// with other global values in the DSGraphs. @@ -257,8 +267,7 @@ private: void InlineCallersIntoGraph(DSGraph &G); DSGraph &getOrCreateDSGraph(Function &F); void ComputePostOrder(Function &F, hash_set &Visited, - std::vector &PostOrder, - const BUDataStructures::ActualCalleesTy &ActualCallees); + std::vector &PostOrder); }; diff --git a/include/llvm/Analysis/DataStructure/EquivClassGraphs.h b/include/llvm/Analysis/DataStructure/EquivClassGraphs.h index 5b0a2206d6f..d97739acbf3 100644 --- a/include/llvm/Analysis/DataStructure/EquivClassGraphs.h +++ b/include/llvm/Analysis/DataStructure/EquivClassGraphs.h @@ -39,7 +39,7 @@ namespace llvm { /// ActualCallees - The actual functions callable from indirect call sites. /// - hash_multimap ActualCallees; + std::set > ActualCallees; // Equivalence class where functions that can potentially be called via the // same function pointer are in the same class. @@ -96,10 +96,19 @@ namespace llvm { return *GlobalsGraph; } - typedef hash_multimap ActualCalleesTy; + typedef std::set > ActualCalleesTy; const ActualCalleesTy &getActualCallees() const { return ActualCallees; } + + ActualCalleesTy::iterator callee_begin(Instruction *I) const { + return ActualCallees.lower_bound(std::pair(I, 0)); + } + + ActualCalleesTy::iterator callee_end(Instruction *I) const { + I = (Instruction*)((char*)I + 1); + return ActualCallees.lower_bound(std::pair(I, 0)); + } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll();