Skip to content

Commit 1baf38c

Browse files
committed
[sil] Split operand ownership classification from SILOwnershipVerifier.cpp into OperandOwnership.cpp.
Last week I split out operand ownership classification from the SILOwnershipVerifier into the OperandOwnershipKindClassifier. Now move that classifier code to another file so that SILOwnershipVerifier.cpp just consists of the actual checker code. This makes sense since this type of classifier is describing a separate structural aspect of SIL rather than something intrinsic to the ownership verifier. Keep in mind that this is not the final form of this classifier. Just an incremental step forward.
1 parent 2d1e976 commit 1baf38c

File tree

5 files changed

+1275
-1220
lines changed

5 files changed

+1275
-1220
lines changed

include/swift/SIL/OwnershipUtils.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define SWIFT_SIL_OWNERSHIPUTILS_H
1515

1616
#include "swift/Basic/LLVM.h"
17+
#include "swift/SIL/SILValue.h"
1718
#include "llvm/ADT/SmallPtrSet.h"
1819
#include "llvm/ADT/SmallVector.h"
1920

@@ -101,6 +102,22 @@ bool valueHasLinearLifetime(SILValue value,
101102
DeadEndBlocks &deadEndBlocks,
102103
ownership::ErrorBehaviorKind errorBehavior);
103104

105+
/// Returns true if v is an address or trivial.
106+
bool isValueAddressOrTrivial(SILValue v, SILModule &m);
107+
108+
/// These operations forward both owned and guaranteed ownership.
109+
bool isOwnershipForwardingValueKind(SILNodeKind kind);
110+
111+
/// These operations forward guaranteed ownership, but don't necessarily forward
112+
/// owned values.
113+
bool isGuaranteedForwardingValueKind(SILNodeKind kind);
114+
115+
bool isGuaranteedForwardingValue(SILValue value);
116+
117+
bool isGuaranteedForwardingInst(SILInstruction *i);
118+
119+
bool isOwnershipForwardingInst(SILInstruction *i);
120+
104121
} // namespace swift
105122

106123
#endif

lib/SIL/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ add_swift_library(swiftSIL STATIC
1111
LinearLifetimeChecker.cpp
1212
LoopInfo.cpp
1313
Notifications.cpp
14+
OperandOwnership.cpp
1415
OptimizationRemark.cpp
16+
OwnershipUtils.cpp
1517
PrettyStackTrace.cpp
1618
Projection.cpp
1719
SIL.cpp

0 commit comments

Comments
 (0)