1 //===- CGSCCPassManager.cpp - Managing & running CGSCC passes -------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/Analysis/CGSCCPassManager.h"
11 #include "llvm/Support/CommandLine.h"
12 #include "llvm/Support/Debug.h"
16 char CGSCCAnalysisManagerModuleProxy::PassID;
18 CGSCCAnalysisManagerModuleProxy::Result
19 CGSCCAnalysisManagerModuleProxy::run(Module &M) {
20 assert(CGAM->empty() && "CGSCC analyses ran prior to the module proxy!");
24 CGSCCAnalysisManagerModuleProxy::Result::~Result() {
25 // Clear out the analysis manager if we're being destroyed -- it means we
26 // didn't even see an invalidate call when we got invalidated.
30 bool CGSCCAnalysisManagerModuleProxy::Result::invalidate(
31 Module &M, const PreservedAnalyses &PA) {
32 // If this proxy isn't marked as preserved, then we can't even invalidate
33 // individual CGSCC analyses, there may be an invalid set of SCC objects in
34 // the cache making it impossible to incrementally preserve them.
35 // Just clear the entire manager.
36 if (!PA.preserved(ID()))
39 // Return false to indicate that this result is still a valid proxy.
43 char ModuleAnalysisManagerCGSCCProxy::PassID;
45 char FunctionAnalysisManagerCGSCCProxy::PassID;
47 FunctionAnalysisManagerCGSCCProxy::Result
48 FunctionAnalysisManagerCGSCCProxy::run(LazyCallGraph::SCC &C) {
49 assert(FAM->empty() && "Function analyses ran prior to the CGSCC proxy!");
53 FunctionAnalysisManagerCGSCCProxy::Result::~Result() {
54 // Clear out the analysis manager if we're being destroyed -- it means we
55 // didn't even see an invalidate call when we got invalidated.
59 bool FunctionAnalysisManagerCGSCCProxy::Result::invalidate(
60 LazyCallGraph::SCC &C, const PreservedAnalyses &PA) {
61 // If this proxy isn't marked as preserved, then we can't even invalidate
62 // individual function analyses, there may be an invalid set of Function
63 // objects in the cache making it impossible to incrementally preserve them.
64 // Just clear the entire manager.
65 if (!PA.preserved(ID()))
68 // Return false to indicate that this result is still a valid proxy.
72 char CGSCCAnalysisManagerFunctionProxy::PassID;