1 //===- Cloning.h - Clone various parts of LLVM programs ---------*- C++ -*-===//
3 // This file defines various functions that are used to clone chunks of LLVM
4 // code for various purposes. This varies from copying whole modules into new
5 // modules, to cloning functions with different arguments, to inlining
6 // functions, to copying basic blocks to support loop unrolling or superblock
9 //===----------------------------------------------------------------------===//
11 #ifndef LLVM_TRANSFORMS_UTIlS_CLONING_H
12 #define LLVM_TRANSFORMS_UTIlS_CLONING_H
21 // Clone OldFunc into NewFunc, transforming the old arguments into references to
22 // ArgMap values. Note that if NewFunc already has basic blocks, the ones
23 // cloned into it will be added to the end of the function.
25 void CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
26 const std::vector<Value*> &ArgMap);
29 // InlineFunction - This function forcibly inlines the called function into the
30 // basic block of the caller. This returns true if it is not possible to inline
31 // this call. The program is still in a well defined state if this occurs
34 // Note that this only does one level of inlining. For example, if the
35 // instruction 'call B' is inlined, and 'B' calls 'C', then the call to 'C' now
36 // exists in the instruction stream. Similiarly this will inline a recursive
37 // function by one level.
39 bool InlineFunction(CallInst *C);