1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[CallGraph] Add invalidate method.

Summary: Add invalidate method in CallGraph.

Reviewers: Eugene.Zelenko, chandlerc

Subscribers: hiraditya, sanjoy.google, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D72816
This commit is contained in:
Alina Sbirlea 2020-01-15 14:05:56 -08:00
parent 5c6acb04da
commit bff436cec6
2 changed files with 12 additions and 0 deletions

View File

@ -112,6 +112,9 @@ public:
/// Returns the module the call graph corresponds to.
Module &getModule() const { return M; }
bool invalidate(Module &, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &);
inline iterator begin() { return FunctionMap.begin(); }
inline iterator end() { return FunctionMap.end(); }
inline const_iterator begin() const { return FunctionMap.begin(); }

View File

@ -57,6 +57,15 @@ CallGraph::~CallGraph() {
#endif
}
bool CallGraph::invalidate(Module &, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &) {
// Check whether the analysis, all analyses on functions, or the function's
// CFG have been preserved.
auto PAC = PA.getChecker<CallGraphAnalysis>();
return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>() ||
PAC.preservedSet<CFGAnalyses>());
}
void CallGraph::addToCallGraph(Function *F) {
CallGraphNode *Node = getOrInsertFunction(F);