1 //===- CallGraphSCCPass.h - Pass that operates BU on call graph -*- C++ -*-===//
3 // This file defines the CallGraphSCCPass class, which is used for passes which
4 // are implemented as bottom-up traversals on the call graph. Because there may
5 // be cycles in the call graph, passes of this type operate on the call-graph in
6 // SCC order: that is, they process function bottom-up, except for recursive
7 // functions, which they process all at once.
9 // These passes are inherently interprocedural, and are required to keep the
10 // call graph up-to-date if they do anything which could modify it.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CALL_GRAPH_SCC_PASS_H
15 #define LLVM_CALL_GRAPH_SCC_PASS_H
17 #include "llvm/Pass.h"
21 struct CallGraphSCCPass : public Pass {
23 /// runOnSCC - This method should be implemented by the subclass to perform
24 /// whatever action is necessary for the specified SCC. Note that
25 /// non-recursive (or only self-recursive) functions will have an SCC size of
26 /// 1, where recursive portions of the call graph will have SCC size > 1.
28 virtual bool runOnSCC(const std::vector<CallGraphNode *> &SCC) = 0;
30 /// run - Run this pass, returning true if a modification was made to the
31 /// module argument. This is implemented in terms of the runOnSCC method.
33 virtual bool run(Module &M);
36 /// getAnalysisUsage - For this class, we declare that we require and preserve
37 /// the call graph. If the derived class implements this method, it should
38 /// always explicitly call the implementation here.
39 virtual void getAnalysisUsage(AnalysisUsage &Info) const;