mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-07 11:33:44 +00:00
Add CallGraphSCCPass::assignPassManager().
This enables CalLGraphPassManager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33466 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a6f567c89e
commit
97fd2439f2
@ -27,6 +27,7 @@ namespace llvm {
|
|||||||
|
|
||||||
class CallGraphNode;
|
class CallGraphNode;
|
||||||
class CallGraph;
|
class CallGraph;
|
||||||
|
class PMStack;
|
||||||
|
|
||||||
struct CallGraphSCCPass : public ModulePass {
|
struct CallGraphSCCPass : public ModulePass {
|
||||||
|
|
||||||
@ -54,6 +55,9 @@ struct CallGraphSCCPass : public ModulePass {
|
|||||||
///
|
///
|
||||||
virtual bool runOnModule(Module &M);
|
virtual bool runOnModule(Module &M);
|
||||||
|
|
||||||
|
/// Assign pass manager to manager this pass
|
||||||
|
virtual void assignPassManager(PMStack &PMS,
|
||||||
|
PassManagerType PMT = PMT_CallGraphPassManager);
|
||||||
|
|
||||||
/// getAnalysisUsage - For this class, we declare that we require and preserve
|
/// getAnalysisUsage - For this class, we declare that we require and preserve
|
||||||
/// the call graph. If the derived class implements this method, it should
|
/// the call graph. If the derived class implements this method, it should
|
||||||
|
@ -144,6 +144,44 @@ bool CGPassManager::doFinalization(CallGraph &CG) {
|
|||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Assign pass manager to manager this pass
|
||||||
|
void CallGraphSCCPass::assignPassManager(PMStack &PMS,
|
||||||
|
PassManagerType PreferredType) {
|
||||||
|
// Find CGPassManager
|
||||||
|
while (!PMS.empty()) {
|
||||||
|
if (PMS.top()->getPassManagerType() > PMT_CallGraphPassManager)
|
||||||
|
PMS.pop();
|
||||||
|
else;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGPassManager *CGP = dynamic_cast<CGPassManager *>(PMS.top());
|
||||||
|
|
||||||
|
// Create new Call Graph SCC Pass Manager if it does not exist.
|
||||||
|
if (!CGP) {
|
||||||
|
|
||||||
|
assert (!PMS.empty() && "Unable to create Call Graph Pass Manager");
|
||||||
|
PMDataManager *PMD = PMS.top();
|
||||||
|
|
||||||
|
// [1] Create new Call Graph Pass Manager
|
||||||
|
CGP = new CGPassManager(PMD->getDepth() + 1);
|
||||||
|
|
||||||
|
// [2] Set up new manager's top level manager
|
||||||
|
PMTopLevelManager *TPM = PMD->getTopLevelManager();
|
||||||
|
TPM->addIndirectPassManager(CGP);
|
||||||
|
|
||||||
|
// [3] Assign manager to manage this new manager. This may create
|
||||||
|
// and push new managers into PMS
|
||||||
|
Pass *P = dynamic_cast<Pass *>(CGP);
|
||||||
|
P->assignPassManager(PMS);
|
||||||
|
|
||||||
|
// [4] Push new manager into PMS
|
||||||
|
PMS.push(CGP);
|
||||||
|
}
|
||||||
|
|
||||||
|
CGP->add(this);
|
||||||
|
}
|
||||||
|
|
||||||
/// getAnalysisUsage - For this class, we declare that we require and preserve
|
/// getAnalysisUsage - For this class, we declare that we require and preserve
|
||||||
/// the call graph. If the derived class implements this method, it should
|
/// the call graph. If the derived class implements this method, it should
|
||||||
/// always explicitly call the implementation here.
|
/// always explicitly call the implementation here.
|
||||||
|
Loading…
Reference in New Issue
Block a user