mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[semantic-sil] Move ValueOwnershipKind -> SILArgument and have subclasses pass in said value.
This in the case of insertFunctionArgument requires a ValueOwnershipKind to be specified since we use that for transformations of function argument lists that are only correct after the transformation is complete. This only occurs in FunctionSignatureOptimizations. On the other hand, createFunctionArgument is only used to construct completely new argument lists, so we can instead just rely on the function we are in rather than require the user to pass it in. rdar://29791263
This commit is contained in:
@@ -107,8 +107,10 @@ void SILBasicBlock::cloneArgumentList(SILBasicBlock *Other) {
|
||||
assert(Other->isEntry() == isEntry() &&
|
||||
"Expected to both blocks to be entries or not");
|
||||
if (isEntry()) {
|
||||
assert(args_empty() && "Expected to have no arguments");
|
||||
for (auto *FuncArg : Other->getFunctionArguments()) {
|
||||
createFunctionArgument(FuncArg->getType(), FuncArg->getDecl());
|
||||
createFunctionArgument(FuncArg->getType(),
|
||||
FuncArg->getDecl());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -122,14 +124,16 @@ void SILBasicBlock::cloneArgumentList(SILBasicBlock *Other) {
|
||||
SILFunctionArgument *SILBasicBlock::createFunctionArgument(SILType Ty,
|
||||
const ValueDecl *D) {
|
||||
assert(isEntry() && "Function Arguments can only be in the entry block");
|
||||
return new (getModule()) SILFunctionArgument(this, Ty, D);
|
||||
auto OwnershipKind = ValueOwnershipKind::Any;
|
||||
return new (getModule()) SILFunctionArgument(this, Ty, OwnershipKind, D);
|
||||
}
|
||||
|
||||
SILFunctionArgument *SILBasicBlock::insertFunctionArgument(arg_iterator Iter,
|
||||
SILType Ty,
|
||||
ValueOwnershipKind OwnershipKind,
|
||||
const ValueDecl *D) {
|
||||
assert(isEntry() && "Function Arguments can only be in the entry block");
|
||||
return new (getModule()) SILFunctionArgument(this, Iter, Ty, D);
|
||||
return new (getModule()) SILFunctionArgument(this, Iter, Ty, OwnershipKind, D);
|
||||
}
|
||||
|
||||
/// Replace the ith BB argument with a new one with type Ty (and optional
|
||||
|
||||
Reference in New Issue
Block a user