mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-20 11:29:24 +00:00
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
42 lines
1.5 KiB
C++
42 lines
1.5 KiB
C++
//===- CallGraphSCCPass.cpp - Pass that operates BU on call graph ---------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements the CallGraphSCCPass class, which is used for passes
|
|
// which are implemented as bottom-up traversals on the call graph. Because
|
|
// there may be cycles in the call graph, passes of this type operate on the
|
|
// call-graph in SCC order: that is, they process function bottom-up, except for
|
|
// recursive functions, which they process all at once.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/CallGraphSCCPass.h"
|
|
#include "llvm/Analysis/CallGraph.h"
|
|
#include "Support/SCCIterator.h"
|
|
|
|
namespace llvm {
|
|
|
|
/// getAnalysisUsage - For this class, we declare that we require and preserve
|
|
/// the call graph. If the derived class implements this method, it should
|
|
/// always explicitly call the implementation here.
|
|
void CallGraphSCCPass::getAnalysisUsage(AnalysisUsage &AU) const {
|
|
AU.addRequired<CallGraph>();
|
|
AU.addPreserved<CallGraph>();
|
|
}
|
|
|
|
bool CallGraphSCCPass::run(Module &M) {
|
|
CallGraph &CG = getAnalysis<CallGraph>();
|
|
bool Changed = false;
|
|
for (scc_iterator<CallGraph*> I = scc_begin(&CG), E = scc_end(&CG);
|
|
I != E; ++I)
|
|
Changed = runOnSCC(*I);
|
|
return Changed;
|
|
}
|
|
|
|
} // End llvm namespace
|