@@ -54,12 +54,18 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
54
54
// / order. This is why it is important not to mutate consumingUses after we
55
55
// / construct the LiveRange since going from small -> large could invalidate
56
56
// / the uses.
57
- SmallVector<Operand *, 6 > consumingUses;
57
+ // /
58
+ // / These UsePoints may be Operands or SILInstructions (terminators of blocks
59
+ // / in dead-end regions along the value's availability boundary).
60
+ SmallVector<UsePoint, 6 > consumingUses;
58
61
59
62
// / A list of destroy_values of the live range.
60
63
// /
61
- // / This is just a view into consuming uses.
62
- ArrayRef<Operand *> destroyingUses;
64
+ // / This is just a view into consumingUses.
65
+ // /
66
+ // / These UsePoints may be Operands or SILInstructions (terminators of blocks
67
+ // / in dead-end regions along the value's availability boundary).
68
+ ArrayRef<UsePoint> destroyingUses;
63
69
64
70
// / A list of forwarding instructions that forward owned ownership, but that
65
71
// / are also able to be converted to guaranteed ownership.
@@ -76,12 +82,16 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
76
82
// / "consumingUses" array the true lifetime of the OwnershipLiveRange.
77
83
// /
78
84
// / Corresponds to isOwnershipForwardingInst(...).
79
- ArrayRef<Operand *> ownershipForwardingUses;
85
+ // /
86
+ // / These UsePoints must all be Operands.
87
+ ArrayRef<UsePoint> ownershipForwardingUses;
80
88
81
89
// / Consuming uses that we were not able to understand as a forwarding
82
90
// / instruction or a destroy_value. These must be passed a strongly control
83
91
// / equivalent +1 value.
84
- ArrayRef<Operand *> unknownConsumingUses;
92
+ // /
93
+ // / These UsePoints must all be Operands.
94
+ ArrayRef<UsePoint> unknownConsumingUses;
85
95
86
96
public:
87
97
OwnershipLiveRange (SILValue value);
@@ -102,28 +112,17 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
102
112
HasConsumingUse_t
103
113
hasUnknownConsumingUse (bool assumingFixedPoint = false ) const ;
104
114
105
- // / Return an array ref to /all/ consuming uses. Will include all 3 sorts of
106
- // / consuming uses: destroying uses, forwarding consuming uses, and unknown
107
- // / forwarding instruction.
108
- ArrayRef<Operand *> getAllConsumingUses () const { return consumingUses; }
109
-
110
- ArrayRef<Operand *> getDestroyingUses () const { return destroyingUses; }
111
-
112
- ArrayRef<Operand *> getUnknownConsumingUses () const {
113
- return unknownConsumingUses;
115
+ UsePointInstructionRange getDestroyingInsts () const {
116
+ return UsePointInstructionRange (destroyingUses, UsePointToInstruction ());
114
117
}
115
118
116
- SILInstruction::OperandUserRange getDestroyingInsts () const ;
117
-
118
- SILInstruction::OperandUserRange getAllConsumingInsts () const ;
119
+ UsePointInstructionRange getUnknownConsumingInsts () const {
120
+ return UsePointInstructionRange (unknownConsumingUses,
121
+ UsePointToInstruction ());
122
+ }
119
123
120
- // / If this LiveRange has a single destroying use, return that use. Otherwise,
121
- // / return nullptr.
122
- Operand *getSingleDestroyingUse () const {
123
- if (destroyingUses.size () != 1 ) {
124
- return nullptr ;
125
- }
126
- return destroyingUses.front ();
124
+ UsePointInstructionRange getAllConsumingInsts () const {
125
+ return UsePointInstructionRange (consumingUses, UsePointToInstruction ());
127
126
}
128
127
129
128
// / If this LiveRange has a single unknown destroying use, return that
@@ -132,13 +131,14 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
132
131
if (unknownConsumingUses.size () != 1 ) {
133
132
return nullptr ;
134
133
}
135
- return unknownConsumingUses.front ();
134
+ auto point = unknownConsumingUses.front ();
135
+ return point.getOperand ();
136
136
}
137
137
138
138
OwnedValueIntroducer getIntroducer () const { return introducer; }
139
139
140
- ArrayRef<Operand *> getOwnershipForwardingUses () const {
141
- return ownershipForwardingUses;
140
+ PointOperandRange getOwnershipForwardingUses () const {
141
+ return PointOperandRange ( ownershipForwardingUses, PointToOperand ()) ;
142
142
}
143
143
144
144
void convertOwnedGeneralForwardingUsesToGuaranteed () &&;
0 commit comments