Cloning.h (210299) | Cloning.h (212904) |
---|---|
1//===- Cloning.h - Clone various parts of LLVM programs ---------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 107 unchanged lines hidden (view full) --- 116/// embedding the function into another module. Also, any references specified 117/// in the VMap are changed to refer to their mapped value instead of the 118/// original one. If any of the arguments to the function are in the VMap, 119/// the arguments are deleted from the resultant function. The VMap is 120/// updated to include mappings from all of the instructions and basicblocks in 121/// the function from their old to new values. The final argument captures 122/// information about the cloned code if non-null. 123/// | 1//===- Cloning.h - Clone various parts of LLVM programs ---------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 107 unchanged lines hidden (view full) --- 116/// embedding the function into another module. Also, any references specified 117/// in the VMap are changed to refer to their mapped value instead of the 118/// original one. If any of the arguments to the function are in the VMap, 119/// the arguments are deleted from the resultant function. The VMap is 120/// updated to include mappings from all of the instructions and basicblocks in 121/// the function from their old to new values. The final argument captures 122/// information about the cloned code if non-null. 123/// |
124/// If ModuleLevelChanges is false, VMap contains no non-identity GlobalValue 125/// mappings. 126/// |
|
124Function *CloneFunction(const Function *F, 125 ValueMap<const Value*, Value*> &VMap, | 127Function *CloneFunction(const Function *F, 128 ValueMap<const Value*, Value*> &VMap, |
129 bool ModuleLevelChanges, |
|
126 ClonedCodeInfo *CodeInfo = 0); 127 128/// CloneFunction - Version of the function that doesn't need the VMap. 129/// 130inline Function *CloneFunction(const Function *F, ClonedCodeInfo *CodeInfo = 0){ 131 ValueMap<const Value*, Value*> VMap; 132 return CloneFunction(F, VMap, CodeInfo); 133} 134 135/// Clone OldFunc into NewFunc, transforming the old arguments into references | 130 ClonedCodeInfo *CodeInfo = 0); 131 132/// CloneFunction - Version of the function that doesn't need the VMap. 133/// 134inline Function *CloneFunction(const Function *F, ClonedCodeInfo *CodeInfo = 0){ 135 ValueMap<const Value*, Value*> VMap; 136 return CloneFunction(F, VMap, CodeInfo); 137} 138 139/// Clone OldFunc into NewFunc, transforming the old arguments into references |
136/// to ArgMap values. Note that if NewFunc already has basic blocks, the ones | 140/// to VMap values. Note that if NewFunc already has basic blocks, the ones |
137/// cloned into it will be added to the end of the function. This function 138/// fills in a list of return instructions, and can optionally append the 139/// specified suffix to all values cloned. 140/// | 141/// cloned into it will be added to the end of the function. This function 142/// fills in a list of return instructions, and can optionally append the 143/// specified suffix to all values cloned. 144/// |
145/// If ModuleLevelChanges is false, VMap contains no non-identity GlobalValue 146/// mappings. 147/// |
|
141void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, 142 ValueMap<const Value*, Value*> &VMap, | 148void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, 149 ValueMap<const Value*, Value*> &VMap, |
150 bool ModuleLevelChanges, |
|
143 SmallVectorImpl<ReturnInst*> &Returns, 144 const char *NameSuffix = "", 145 ClonedCodeInfo *CodeInfo = 0); 146 147/// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto, 148/// except that it does some simple constant prop and DCE on the fly. The 149/// effect of this is to copy significantly less code in cases where (for 150/// example) a function call with constant arguments is inlined, and those 151/// constant arguments cause a significant amount of code in the callee to be 152/// dead. Since this doesn't produce an exactly copy of the input, it can't be 153/// used for things like CloneFunction or CloneModule. | 151 SmallVectorImpl<ReturnInst*> &Returns, 152 const char *NameSuffix = "", 153 ClonedCodeInfo *CodeInfo = 0); 154 155/// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto, 156/// except that it does some simple constant prop and DCE on the fly. The 157/// effect of this is to copy significantly less code in cases where (for 158/// example) a function call with constant arguments is inlined, and those 159/// constant arguments cause a significant amount of code in the callee to be 160/// dead. Since this doesn't produce an exactly copy of the input, it can't be 161/// used for things like CloneFunction or CloneModule. |
162/// 163/// If ModuleLevelChanges is false, VMap contains no non-identity GlobalValue 164/// mappings. 165/// |
|
154void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, 155 ValueMap<const Value*, Value*> &VMap, | 166void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, 167 ValueMap<const Value*, Value*> &VMap, |
168 bool ModuleLevelChanges, |
|
156 SmallVectorImpl<ReturnInst*> &Returns, 157 const char *NameSuffix = "", 158 ClonedCodeInfo *CodeInfo = 0, 159 const TargetData *TD = 0, 160 Instruction *TheCall = 0); 161 162 163/// InlineFunctionInfo - This class captures the data input to the --- 42 unchanged lines hidden --- | 169 SmallVectorImpl<ReturnInst*> &Returns, 170 const char *NameSuffix = "", 171 ClonedCodeInfo *CodeInfo = 0, 172 const TargetData *TD = 0, 173 Instruction *TheCall = 0); 174 175 176/// InlineFunctionInfo - This class captures the data input to the --- 42 unchanged lines hidden --- |