Skip to content

Commit 2c6139d

Browse files
committed
Rename SILArgument::isEscaping -> SILArgument::hasPointerEscape
1 parent bc5e8ba commit 2c6139d

File tree

9 files changed

+31
-29
lines changed

9 files changed

+31
-29
lines changed

include/swift/SIL/SILArgument.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ class SILArgument : public ValueBase {
7676
SILArgument(ValueKind subClassKind, SILBasicBlock *inputParentBlock,
7777
SILType type, ValueOwnershipKind ownershipKind,
7878
const ValueDecl *inputDecl = nullptr, bool reborrow = false,
79-
bool escaping = false);
79+
bool pointerEscape = false);
8080

8181
// A special constructor, only intended for use in
8282
// SILBasicBlock::replacePHIArg and replaceFunctionArg.
8383
explicit SILArgument(ValueKind subClassKind, SILType type,
8484
ValueOwnershipKind ownershipKind,
8585
const ValueDecl *inputDecl = nullptr,
86-
bool reborrow = false, bool escaping = false)
86+
bool reborrow = false, bool pointerEscape = false)
8787
: ValueBase(subClassKind, type), parentBlock(nullptr), decl(inputDecl) {
8888
sharedUInt8().SILArgument.valueOwnershipKind = uint8_t(ownershipKind);
8989
// When the optimizer creates reborrows, reborrow flag needs to be set by
9090
// calling setReborrow.
9191
sharedUInt8().SILArgument.reborrow = false;
92-
sharedUInt8().SILArgument.escaping = false;
92+
sharedUInt8().SILArgument.pointerEscape = false;
9393
}
9494

9595
public:
@@ -119,8 +119,8 @@ class SILArgument : public ValueBase {
119119
return getOwnershipKind() == OwnershipKind::Guaranteed && !isReborrow();
120120
}
121121

122-
bool isEscaping() const {
123-
return ValueOwnershipKind(sharedUInt8().SILArgument.escaping);
122+
bool hasPointerEscape() const {
123+
return ValueOwnershipKind(sharedUInt8().SILArgument.pointerEscape);
124124
}
125125

126126
void setOwnershipKind(ValueOwnershipKind newKind) {
@@ -131,8 +131,8 @@ class SILArgument : public ValueBase {
131131
sharedUInt8().SILArgument.reborrow = isReborrow;
132132
}
133133

134-
void setEscaping(bool isEscaping) {
135-
sharedUInt8().SILArgument.escaping = isEscaping;
134+
void setEscaping(bool hasPointerEscape) {
135+
sharedUInt8().SILArgument.pointerEscape = hasPointerEscape;
136136
}
137137

138138
SILBasicBlock *getParent() const { return parentBlock; }
@@ -260,17 +260,18 @@ class SILPhiArgument : public SILArgument {
260260
SILPhiArgument(SILBasicBlock *parentBlock, SILType type,
261261
ValueOwnershipKind ownershipKind,
262262
const ValueDecl *decl = nullptr, bool isReborrow = false,
263-
bool isEscaping = false)
263+
bool hasPointerEscape = false)
264264
: SILArgument(ValueKind::SILPhiArgument, parentBlock, type, ownershipKind,
265-
decl, isReborrow, isEscaping) {}
265+
decl, isReborrow, hasPointerEscape) {}
266266

267267
// A special constructor, only intended for use in
268268
// SILBasicBlock::replacePHIArg.
269269
explicit SILPhiArgument(SILType type, ValueOwnershipKind ownershipKind,
270270
const ValueDecl *decl = nullptr,
271-
bool isReborrow = false, bool isEscaping = false)
271+
bool isReborrow = false,
272+
bool hasPointerEscape = false)
272273
: SILArgument(ValueKind::SILPhiArgument, type, ownershipKind, decl,
273-
isReborrow, isEscaping) {}
274+
isReborrow, hasPointerEscape) {}
274275

275276
public:
276277
/// Return true if this is block argument is a phi, as opposed to a terminator

include/swift/SIL/SILCloner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ void SILCloner<ImplClass>::clonePhiArgs(SILBasicBlock *oldBB) {
735735
for (auto *Arg : oldBB->getSILPhiArguments()) {
736736
SILValue mappedArg = mappedBB->createPhiArgument(
737737
getOpType(Arg->getType()), Arg->getOwnershipKind(), Arg->getDecl(),
738-
Arg->isReborrow(), Arg->isEscaping());
738+
Arg->isReborrow(), Arg->hasPointerEscape());
739739

740740
asImpl().mapValue(Arg, mappedArg);
741741
}

include/swift/SIL/SILNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class alignas(8) SILNode :
205205
SHARED_FIELD(SILArgument, uint8_t
206206
valueOwnershipKind : NumVOKindBits,
207207
reborrow : 1,
208-
escaping : 1);
208+
pointerEscape : 1);
209209

210210
SHARED_FIELD(DebugValueInst, uint8_t
211211
poisonRefs : 1,

lib/SIL/IR/SILArgument.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ SILArgument::SILArgument(ValueKind subClassKind,
2828
SILBasicBlock *inputParentBlock, SILType type,
2929
ValueOwnershipKind ownershipKind,
3030
const ValueDecl *inputDecl, bool reborrow,
31-
bool escaping)
31+
bool pointerEscape)
3232
: ValueBase(subClassKind, type), parentBlock(inputParentBlock),
3333
decl(inputDecl) {
3434
sharedUInt8().SILArgument.valueOwnershipKind = uint8_t(ownershipKind);
3535
sharedUInt8().SILArgument.reborrow = reborrow;
36-
sharedUInt8().SILArgument.escaping = escaping;
36+
sharedUInt8().SILArgument.pointerEscape = pointerEscape;
3737
inputParentBlock->insertArgument(inputParentBlock->args_end(), this);
3838
}
3939

lib/SIL/IR/SILPrinter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
683683
if (i.IsReborrow)
684684
*this << "@reborrow ";
685685
if (i.IsEscaping)
686-
*this << "@escaping ";
686+
*this << "@pointer_escape ";
687687
if (i.OwnershipKind && *i.OwnershipKind != OwnershipKind::None) {
688688
*this << "@" << i.OwnershipKind.value() << " ";
689689
}
@@ -720,7 +720,7 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
720720
return {Ctx.getID(arg), arg->getType(),
721721
arg->isNoImplicitCopy(), arg->getLifetimeAnnotation(),
722722
arg->isClosureCapture(), arg->isReborrow(),
723-
arg->isEscaping()};
723+
arg->hasPointerEscape()};
724724
}
725725

726726
SILValuePrinterInfo getIDAndTypeAndOwnership(SILValue V) {
@@ -734,11 +734,11 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
734734
arg->getLifetimeAnnotation(),
735735
arg->isClosureCapture(),
736736
arg->isReborrow(),
737-
arg->isEscaping()};
737+
arg->hasPointerEscape()};
738738
}
739739
SILValuePrinterInfo getIDAndTypeAndOwnership(SILArgument *arg) {
740740
return {Ctx.getID(arg), arg->getType(), arg->getOwnershipKind(),
741-
arg->isReborrow(), arg->isEscaping()};
741+
arg->isReborrow(), arg->hasPointerEscape()};
742742
}
743743

744744
//===--------------------------------------------------------------------===//

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6810,10 +6810,10 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
68106810
bool foundLexical = false;
68116811
bool foundEagerMove = false;
68126812
bool foundReborrow = false;
6813-
bool foundEscaping = false;
6813+
bool hasPointerEscape = false;
68146814
while (auto attributeName = parseOptionalAttribute(
68156815
{"noImplicitCopy", "_lexical", "_eagerMove",
6816-
"closureCapture", "reborrow", "escaping"})) {
6816+
"closureCapture", "reborrow", "pointer_escape"})) {
68176817
if (*attributeName == "noImplicitCopy")
68186818
foundNoImplicitCopy = true;
68196819
else if (*attributeName == "_lexical")
@@ -6824,8 +6824,8 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
68246824
foundClosureCapture = true;
68256825
else if (*attributeName == "reborrow")
68266826
foundReborrow = true;
6827-
else if (*attributeName == "escaping")
6828-
foundEscaping = true;
6827+
else if (*attributeName == "pointer_escape")
6828+
hasPointerEscape = true;
68296829
else {
68306830
llvm_unreachable("Unexpected attribute!");
68316831
}
@@ -6857,7 +6857,7 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
68576857
fArg->setClosureCapture(foundClosureCapture);
68586858
fArg->setLifetimeAnnotation(lifetime);
68596859
fArg->setReborrow(foundReborrow);
6860-
fArg->setEscaping(foundEscaping);
6860+
fArg->setEscaping(hasPointerEscape);
68616861
Arg = fArg;
68626862

68636863
// Today, we construct the ownership kind straight from the function
@@ -6874,7 +6874,7 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
68746874
}
68756875
} else {
68766876
Arg = BB->createPhiArgument(Ty, OwnershipKind, /*decl*/ nullptr,
6877-
foundReborrow, foundEscaping);
6877+
foundReborrow, hasPointerEscape);
68786878
}
68796879
setLocalValue(Arg, Name, NameLoc);
68806880
} while (P.consumeIf(tok::comma));

lib/SILOptimizer/Utils/LoopUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static SILBasicBlock *insertBackedgeBlock(SILLoop *L, DominanceInfo *DT,
129129
for (auto *BBArg : Header->getArguments()) {
130130
BBArgs.push_back(BEBlock->createPhiArgument(
131131
BBArg->getType(), BBArg->getOwnershipKind(), /* decl */ nullptr,
132-
BBArg->isReborrow(), BBArg->isEscaping()));
132+
BBArg->isReborrow(), BBArg->hasPointerEscape()));
133133
}
134134

135135
// Arbitrarily pick one of the predecessor's branch locations.

lib/Serialization/DeserializeSIL.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ SILBasicBlock *SILDeserializer::readSILBasicBlock(SILFunction *Fn,
973973
SILType SILArgTy = getSILType(ArgTy, ValueCategory, Fn);
974974
auto OwnershipKind = ValueOwnershipKind((Args[I + 1] >> 8) & 0x7);
975975
auto reborrow = (Args[I + 1] >> 11) & 0x1;
976-
auto escaping = (Args[I + 1] >> 12) & 0x1;
976+
auto pointerEscape = (Args[I + 1] >> 12) & 0x1;
977977
if (IsEntry) {
978978
auto *fArg = CurrentBB->createFunctionArgument(SILArgTy);
979979
bool isNoImplicitCopy = (Args[I + 1] >> 13) & 0x1;
@@ -987,7 +987,8 @@ SILBasicBlock *SILDeserializer::readSILBasicBlock(SILFunction *Fn,
987987
Arg = fArg;
988988
} else {
989989
Arg = CurrentBB->createPhiArgument(SILArgTy, OwnershipKind,
990-
/*decl*/ nullptr, reborrow, escaping);
990+
/*decl*/ nullptr, reborrow,
991+
pointerEscape);
991992
}
992993
LastValueID = LastValueID + 1;
993994
setLocalValue(Arg, LastValueID);

lib/Serialization/SerializeSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ void SILSerializer::writeSILBasicBlock(const SILBasicBlock &BB) {
644644
packedMetadata |= unsigned(SA->getType().getCategory()); // 8 bits
645645
packedMetadata |= unsigned(SA->getOwnershipKind()) << 8; // 3 bits
646646
packedMetadata |= unsigned(SA->isReborrow()) << 11; // 1 bit
647-
packedMetadata |= unsigned(SA->isEscaping()) << 12; // 1 bit
647+
packedMetadata |= unsigned(SA->hasPointerEscape()) << 12; // 1 bit
648648
if (auto *SFA = dyn_cast<SILFunctionArgument>(SA)) {
649649
packedMetadata |= unsigned(SFA->isNoImplicitCopy()) << 13; // 1 bit
650650
packedMetadata |= unsigned(SFA->getLifetimeAnnotation()) << 14; // 2 bits

0 commit comments

Comments
 (0)