Skip to content

Commit 220c477

Browse files
authored
Merge pull request #27879 from gottesmm/pr-d11e7f75ea55227d39e30878723a079a3dbf2bb6
[sil] Rename ValueOwnershipKind::{Any,None}
2 parents c13db79 + 26a734e commit 220c477

35 files changed

+386
-392
lines changed

include/swift/SIL/SILBuilder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,8 +2087,7 @@ class SILBuilder {
20872087
/// lowering for the non-address value.
20882088
void emitDestroyValueOperation(SILLocation Loc, SILValue v) {
20892089
assert(!v->getType().isAddress());
2090-
if (F->hasOwnership() &&
2091-
v.getOwnershipKind() == ValueOwnershipKind::Any)
2090+
if (F->hasOwnership() && v.getOwnershipKind() == ValueOwnershipKind::None)
20922091
return;
20932092
auto &lowering = getTypeLowering(v->getType());
20942093
lowering.emitDestroyValue(*this, Loc, v);

include/swift/SIL/SILCloner.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,8 +2315,8 @@ void SILCloner<ImplClass>::visitUncheckedOwnershipConversionInst(
23152315

23162316
ValueOwnershipKind Kind = SILValue(Inst).getOwnershipKind();
23172317
if (getOpValue(Inst->getOperand()).getOwnershipKind() ==
2318-
ValueOwnershipKind::Any) {
2319-
Kind = ValueOwnershipKind::Any;
2318+
ValueOwnershipKind::None) {
2319+
Kind = ValueOwnershipKind::None;
23202320
}
23212321
recordClonedInstruction(Inst, getBuilder().createUncheckedOwnershipConversion(
23222322
getOpLocation(Inst->getLoc()),

include/swift/SIL/SILInstruction.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5070,7 +5070,7 @@ class ObjectInst final : public InstructionBaseWithTrailingOperands<
50705070
: InstructionBaseWithTrailingOperands(
50715071
Elements, DebugLoc, Ty,
50725072
HasOwnership ? *mergeSILValueOwnership(Elements)
5073-
: ValueOwnershipKind(ValueOwnershipKind::Any)) {
5073+
: ValueOwnershipKind(ValueOwnershipKind::None)) {
50745074
SILInstruction::Bits.ObjectInst.NumBaseElements = NumBaseElements;
50755075
}
50765076

@@ -5117,7 +5117,7 @@ class TupleInst final : public InstructionBaseWithTrailingOperands<
51175117
: InstructionBaseWithTrailingOperands(
51185118
Elems, DebugLoc, Ty,
51195119
HasOwnership ? *mergeSILValueOwnership(Elems)
5120-
: ValueOwnershipKind(ValueOwnershipKind::Any)) {}
5120+
: ValueOwnershipKind(ValueOwnershipKind::None)) {}
51215121

51225122
/// Construct a TupleInst.
51235123
static TupleInst *create(SILDebugLocation DebugLoc, SILType Ty,
@@ -5192,9 +5192,8 @@ class EnumInst : public InstructionBase<SILInstructionKind::EnumInst,
51925192
EnumInst(SILDebugLocation DebugLoc, SILValue Operand,
51935193
EnumElementDecl *Element, SILType ResultTy)
51945194
: InstructionBase(DebugLoc, ResultTy,
5195-
Operand
5196-
? Operand.getOwnershipKind()
5197-
: ValueOwnershipKind(ValueOwnershipKind::Any)),
5195+
Operand ? Operand.getOwnershipKind()
5196+
: ValueOwnershipKind(ValueOwnershipKind::None)),
51985197
Element(Element) {
51995198
if (Operand) {
52005199
OptionalOperand.emplace(this, Operand);
@@ -5488,7 +5487,7 @@ class SelectEnumInst final
54885487
Operand, CaseValues, DebugLoc, Type, bool(DefaultValue), CaseCounts,
54895488
DefaultCount,
54905489
HasOwnership ? *mergeSILValueOwnership(CaseValues)
5491-
: ValueOwnershipKind(ValueOwnershipKind::Any)) {
5490+
: ValueOwnershipKind(ValueOwnershipKind::None)) {
54925491
assert(CaseValues.size() - DefaultValue == CaseDecls.size());
54935492
std::uninitialized_copy(CaseDecls.begin(), CaseDecls.end(),
54945493
getTrailingObjects<EnumElementDecl *>());

include/swift/SIL/SILUndef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SILUndef : public ValueBase {
3838
static SILUndef *getSentinelValue(SILType type, OwnerTy owner) {
3939
// Ownership kind isn't used here, the value just needs to have a unique
4040
// address.
41-
return new (*owner) SILUndef(type, ValueOwnershipKind::Any);
41+
return new (*owner) SILUndef(type, ValueOwnershipKind::None);
4242
}
4343

4444
ValueOwnershipKind getOwnershipKind() const { return ownershipKind; }

include/swift/SIL/SILValue.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ struct ValueOwnershipKind {
117117
/// instruction exactly once along any path through the program.
118118
Guaranteed,
119119

120-
/// A SILValue with Any ownership kind is an independent value outside of
120+
/// A SILValue with None ownership kind is an independent value outside of
121121
/// the ownership system. It is used to model trivially typed values as well
122-
/// as trivial cases of non-trivial enums. Naturally Any can be merged with
122+
/// as trivial cases of non-trivial enums. Naturally None can be merged with
123123
/// any ValueOwnershipKind allowing us to naturally model merge and branch
124124
/// points in the SSA graph.
125-
Any,
125+
None,
126126

127-
LastValueOwnershipKind = Any,
127+
LastValueOwnershipKind = None,
128128
} Value;
129129

130130
using UnderlyingType = std::underlying_type<innerty>::type;
@@ -167,7 +167,7 @@ struct ValueOwnershipKind {
167167
/// kinds.
168168
UseLifetimeConstraint getForwardingLifetimeConstraint() const {
169169
switch (Value) {
170-
case ValueOwnershipKind::Any:
170+
case ValueOwnershipKind::None:
171171
case ValueOwnershipKind::Guaranteed:
172172
case ValueOwnershipKind::Unowned:
173173
return UseLifetimeConstraint::MustBeLive;
@@ -188,7 +188,7 @@ struct ValueOwnershipKind {
188188

189189
template <typename RangeTy>
190190
static Optional<ValueOwnershipKind> merge(RangeTy &&r) {
191-
auto initial = Optional<ValueOwnershipKind>(ValueOwnershipKind::Any);
191+
auto initial = Optional<ValueOwnershipKind>(ValueOwnershipKind::None);
192192
return accumulate(
193193
std::forward<RangeTy>(r), initial,
194194
[](Optional<ValueOwnershipKind> acc, ValueOwnershipKind x) {
@@ -519,7 +519,7 @@ struct OperandOwnershipKindMap {
519519

520520
void addCompatibilityConstraint(ValueOwnershipKind kind,
521521
UseLifetimeConstraint constraint) {
522-
add(ValueOwnershipKind::Any, UseLifetimeConstraint::MustBeLive);
522+
add(ValueOwnershipKind::None, UseLifetimeConstraint::MustBeLive);
523523
add(kind, constraint);
524524
}
525525

lib/IRGen/LoadableByAddress.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ SILArgument *LoadableStorageAllocation::replaceArgType(SILBuilder &argBuilder,
13531353
arg) == pass.largeLoadableArgs.end());
13541354

13551355
arg = arg->getParent()->replaceFunctionArgument(
1356-
arg->getIndex(), newSILType, ValueOwnershipKind::Any, arg->getDecl());
1356+
arg->getIndex(), newSILType, ValueOwnershipKind::None, arg->getDecl());
13571357

13581358
for (auto *use : useList) {
13591359
use->set(arg);
@@ -1382,7 +1382,7 @@ void LoadableStorageAllocation::insertIndirectReturnArgs() {
13821382
pass.F->getDeclContext());
13831383
var->setSpecifier(ParamSpecifier::InOut);
13841384
pass.F->begin()->insertFunctionArgument(
1385-
0, newResultStorageType.getAddressType(), ValueOwnershipKind::Any, var);
1385+
0, newResultStorageType.getAddressType(), ValueOwnershipKind::None, var);
13861386
}
13871387

13881388
void LoadableStorageAllocation::convertIndirectFunctionArgs() {

lib/ParseSIL/ParseSIL.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ namespace {
386386
if (!P.consumeIf(tok::at_sign)) {
387387
// If we fail, we must have @any ownership. We check elsewhere in the
388388
// parser that this matches what the function signature wants.
389-
OwnershipKind = ValueOwnershipKind::Any;
389+
OwnershipKind = ValueOwnershipKind::None;
390390
return false;
391391
}
392392

@@ -3003,8 +3003,8 @@ bool SILParser::parseSILInstruction(SILBuilder &B) {
30033003

30043004
// unchecked_ownership_conversion <reg> : <type>, <ownership> to <ownership>
30053005
case SILInstructionKind::UncheckedOwnershipConversionInst: {
3006-
ValueOwnershipKind LHSKind = ValueOwnershipKind::Any;
3007-
ValueOwnershipKind RHSKind = ValueOwnershipKind::Any;
3006+
ValueOwnershipKind LHSKind = ValueOwnershipKind::None;
3007+
ValueOwnershipKind RHSKind = ValueOwnershipKind::None;
30083008
SourceLoc Loc;
30093009

30103010
if (parseTypedValueRef(Val, Loc, B) ||
@@ -5326,7 +5326,7 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
53265326
if (P.consumeIf(tok::l_paren)) {
53275327
do {
53285328
SILType Ty;
5329-
ValueOwnershipKind OwnershipKind = ValueOwnershipKind::Any;
5329+
ValueOwnershipKind OwnershipKind = ValueOwnershipKind::None;
53305330
SourceLoc NameLoc;
53315331
StringRef Name = P.Tok.getText();
53325332
if (P.parseToken(tok::sil_local_name, NameLoc,

0 commit comments

Comments
 (0)