mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
Factor code to copy global value attributes like
the section or the visibility from one global value to another: copyAttributesFrom. This is particularly useful for duplicating functions: previously this was done by explicitly copying each attribute in turn at each place where a new function was created out of an old one, with the result that obscure attributes were regularly forgotten (like the collector or the section). Hopefully now everything is uniform and nothing is forgotten. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51567 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -80,11 +80,8 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
|
||||
assert(ValueMap.count(I) && "No mapping from source argument specified!");
|
||||
#endif
|
||||
|
||||
// Clone the parameter attributes
|
||||
NewFunc->setParamAttrs(OldFunc->getParamAttrs());
|
||||
|
||||
// Clone the calling convention
|
||||
NewFunc->setCallingConv(OldFunc->getCallingConv());
|
||||
// Clone any attributes.
|
||||
NewFunc->copyAttributesFrom(OldFunc);
|
||||
|
||||
// Loop over all of the basic blocks in the function, cloning them as
|
||||
// appropriate. Note that we save BE this way in order to handle cloning of
|
||||
@ -339,8 +336,8 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
|
||||
E = OldFunc->arg_end(); II != E; ++II)
|
||||
assert(ValueMap.count(II) && "No mapping from source argument specified!");
|
||||
#endif
|
||||
|
||||
PruningFunctionCloner PFC(NewFunc, OldFunc, ValueMap, Returns,
|
||||
|
||||
PruningFunctionCloner PFC(NewFunc, OldFunc, ValueMap, Returns,
|
||||
NameSuffix, CodeInfo, TD);
|
||||
|
||||
// Clone the entry block, and anything recursively reachable from it.
|
||||
|
Reference in New Issue
Block a user