mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-27 17:31:33 +00:00
Change the ActualCallees callgraph from hash_multimap<Instruction,Function>
to std::set<std::pair<Inst,Func>> to avoid duplicate entries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21030 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7332f3e05d
commit
df968b8b37
@ -102,7 +102,7 @@ protected:
|
|||||||
// DSInfo, one graph for each function
|
// DSInfo, one graph for each function
|
||||||
hash_map<Function*, DSGraph*> DSInfo;
|
hash_map<Function*, DSGraph*> DSInfo;
|
||||||
DSGraph *GlobalsGraph;
|
DSGraph *GlobalsGraph;
|
||||||
hash_multimap<Instruction*, Function*> ActualCallees;
|
std::set<std::pair<Instruction*, Function*> > ActualCallees;
|
||||||
|
|
||||||
// This map is only maintained during construction of BU Graphs
|
// This map is only maintained during construction of BU Graphs
|
||||||
std::map<std::vector<Function*>,
|
std::map<std::vector<Function*>,
|
||||||
@ -152,11 +152,20 @@ public:
|
|||||||
AU.addRequired<LocalDataStructures>();
|
AU.addRequired<LocalDataStructures>();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef hash_multimap<Instruction*, Function*> ActualCalleesTy;
|
typedef std::set<std::pair<Instruction*, Function*> > ActualCalleesTy;
|
||||||
const ActualCalleesTy &getActualCallees() const {
|
const ActualCalleesTy &getActualCallees() const {
|
||||||
return ActualCallees;
|
return ActualCallees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActualCalleesTy::iterator callee_begin(Instruction *I) const {
|
||||||
|
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
ActualCalleesTy::iterator callee_end(Instruction *I) const {
|
||||||
|
I = (Instruction*)((char*)I + 1);
|
||||||
|
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void calculateGraph(DSGraph &G);
|
void calculateGraph(DSGraph &G);
|
||||||
|
|
||||||
@ -177,6 +186,7 @@ class TDDataStructures : public ModulePass {
|
|||||||
hash_map<Function*, DSGraph*> DSInfo;
|
hash_map<Function*, DSGraph*> DSInfo;
|
||||||
hash_set<Function*> ArgsRemainIncomplete;
|
hash_set<Function*> ArgsRemainIncomplete;
|
||||||
DSGraph *GlobalsGraph;
|
DSGraph *GlobalsGraph;
|
||||||
|
BUDataStructures *BUInfo;
|
||||||
|
|
||||||
/// GlobalECs - The equivalence classes for each global value that is merged
|
/// GlobalECs - The equivalence classes for each global value that is merged
|
||||||
/// with other global values in the DSGraphs.
|
/// with other global values in the DSGraphs.
|
||||||
@ -257,8 +267,7 @@ private:
|
|||||||
void InlineCallersIntoGraph(DSGraph &G);
|
void InlineCallersIntoGraph(DSGraph &G);
|
||||||
DSGraph &getOrCreateDSGraph(Function &F);
|
DSGraph &getOrCreateDSGraph(Function &F);
|
||||||
void ComputePostOrder(Function &F, hash_set<DSGraph*> &Visited,
|
void ComputePostOrder(Function &F, hash_set<DSGraph*> &Visited,
|
||||||
std::vector<DSGraph*> &PostOrder,
|
std::vector<DSGraph*> &PostOrder);
|
||||||
const BUDataStructures::ActualCalleesTy &ActualCallees);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// ActualCallees - The actual functions callable from indirect call sites.
|
/// ActualCallees - The actual functions callable from indirect call sites.
|
||||||
///
|
///
|
||||||
hash_multimap<Instruction*, Function*> ActualCallees;
|
std::set<std::pair<Instruction*, Function*> > ActualCallees;
|
||||||
|
|
||||||
// Equivalence class where functions that can potentially be called via the
|
// Equivalence class where functions that can potentially be called via the
|
||||||
// same function pointer are in the same class.
|
// same function pointer are in the same class.
|
||||||
@ -96,10 +96,19 @@ namespace llvm {
|
|||||||
return *GlobalsGraph;
|
return *GlobalsGraph;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef hash_multimap<Instruction*, Function*> ActualCalleesTy;
|
typedef std::set<std::pair<Instruction*, Function*> > ActualCalleesTy;
|
||||||
const ActualCalleesTy &getActualCallees() const {
|
const ActualCalleesTy &getActualCallees() const {
|
||||||
return ActualCallees;
|
return ActualCallees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActualCalleesTy::iterator callee_begin(Instruction *I) const {
|
||||||
|
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
ActualCalleesTy::iterator callee_end(Instruction *I) const {
|
||||||
|
I = (Instruction*)((char*)I + 1);
|
||||||
|
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
|
||||||
|
}
|
||||||
|
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.setPreservesAll();
|
AU.setPreservesAll();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user