Added LLVM copyright header (for lack of a better term).
[oota-llvm.git] / include / llvm / CallGraphSCCPass.h
1 //===- CallGraphSCCPass.h - Pass that operates BU on call graph -*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the CallGraphSCCPass class, which is used for passes which
11 // are implemented as bottom-up traversals on the call graph.  Because there may
12 // be cycles in the call graph, passes of this type operate on the call-graph in
13 // SCC order: that is, they process function bottom-up, except for recursive
14 // functions, which they process all at once.
15 //
16 // These passes are inherently interprocedural, and are required to keep the
17 // call graph up-to-date if they do anything which could modify it.
18 //
19 //===----------------------------------------------------------------------===//
20
21 #ifndef LLVM_CALL_GRAPH_SCC_PASS_H
22 #define LLVM_CALL_GRAPH_SCC_PASS_H
23
24 #include "llvm/Pass.h"
25
26 class CallGraphNode;
27
28 struct CallGraphSCCPass : public Pass {
29
30   /// runOnSCC - This method should be implemented by the subclass to perform
31   /// whatever action is necessary for the specified SCC.  Note that
32   /// non-recursive (or only self-recursive) functions will have an SCC size of
33   /// 1, where recursive portions of the call graph will have SCC size > 1.
34   ///
35   virtual bool runOnSCC(const std::vector<CallGraphNode *> &SCC) = 0;
36
37   /// run - Run this pass, returning true if a modification was made to the
38   /// module argument.  This is implemented in terms of the runOnSCC method.
39   ///
40   virtual bool run(Module &M);
41
42
43   /// getAnalysisUsage - For this class, we declare that we require and preserve
44   /// the call graph.  If the derived class implements this method, it should
45   /// always explicitly call the implementation here.
46   virtual void getAnalysisUsage(AnalysisUsage &Info) const;
47 };
48
49 #endif