Split AllOpts.h into lots of little .h files.
[oota-llvm.git] / include / llvm / Transforms / FunctionInlining.h
1 //===-- MethodInlining.h - Functions that perform Inlining -------*- C++ -*--=//
2 //
3 // This family of functions is useful for performing method inlining.
4 //
5 //===----------------------------------------------------------------------===//
6
7 #ifndef LLVM_OPT_METHOD_INLINING_H
8 #define LLVM_OPT_METHOD_INLINING_H
9
10 #include "llvm/Module.h"
11 #include "llvm/BasicBlock.h"
12 class CallInst;
13
14 namespace opt {
15
16 // DoMethodInlining - Use a heuristic based approach to inline methods that seem
17 // to look good.
18 //
19 bool DoMethodInlining(Method *M);
20
21 static inline bool DoMethodInlining(Module *M) { 
22   return M->reduceApply(DoMethodInlining); 
23 }
24
25 // InlineMethod - This function forcibly inlines the called method into the
26 // basic block of the caller.  This returns true if it is not possible to inline
27 // this call.  The program is still in a well defined state if this occurs 
28 // though.
29 //
30 // Note that this only does one level of inlining.  For example, if the 
31 // instruction 'call B' is inlined, and 'B' calls 'C', then the call to 'C' now 
32 // exists in the instruction stream.  Similiarly this will inline a recursive
33 // method by one level.
34 //
35 bool InlineMethod(CallInst *C);
36 bool InlineMethod(BasicBlock::iterator CI);  // *CI must be CallInst
37
38 }  // end namespace opt
39
40 #endif