llvm.org GIT mirror llvm / 9933e4b
Move inliner pass header file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37664 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 12 years ago
1 changed file(s) with 64 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 //===- InlinerPass.h - Code common to all inliners --------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file was developed by the LLVM research group and is distributed under
5 // the University of Illinois Open Source License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines a simple policy-based bottom-up inliner. This file
10 // implements all of the boring mechanics of the bottom-up inlining, while the
11 // subclass determines WHAT to inline, which is the much more interesting
12 // component.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef INLINER_H
17 #define INLINER_H
18
19 #include "llvm/CallGraphSCCPass.h"
20
21 namespace llvm {
22 class CallSite;
23
24 /// Inliner - This class contains all of the helper code which is used to
25 /// perform the inlining operations that does not depend on the policy.
26 ///
27 struct Inliner : public CallGraphSCCPass {
28 Inliner(const void *ID);
29
30 /// getAnalysisUsage - For this class, we declare that we require and preserve
31 /// the call graph. If the derived class implements this method, it should
32 /// always explicitly call the implementation here.
33 virtual void getAnalysisUsage(AnalysisUsage &Info) const;
34
35 // Main run interface method, this implements the interface required by the
36 // Pass class.
37 virtual bool runOnSCC(const std::vector &SCC);
38
39 // doFinalization - Remove now-dead linkonce functions at the end of
40 // processing to avoid breaking the SCC traversal.
41 virtual bool doFinalization(CallGraph &CG);
42
43
44 /// This method returns the value specified by the -inline-threshold value,
45 /// specified on the command line. This is typically not directly needed.
46 ///
47 unsigned getInlineThreshold() const { return InlineThreshold; }
48
49 /// getInlineCost - This method must be implemented by the subclass to
50 /// determine the cost of inlining the specified call site. If the cost
51 /// returned is greater than the current inline threshold, the call site is
52 /// not inlined.
53 ///
54 virtual int getInlineCost(CallSite CS) = 0;
55
56 private:
57 // InlineThreshold - Cache the value here for easy access.
58 unsigned InlineThreshold;
59 };
60
61 } // End llvm namespace
62
63 #endif