File tree Expand file tree Collapse file tree 3 files changed +18
-24
lines changed
lib/SILOptimizer/SemanticARC Expand file tree Collapse file tree 3 files changed +18
-24
lines changed Original file line number Diff line number Diff line change @@ -670,6 +670,10 @@ class SILInstruction : public llvm::ilist_node<SILInstruction> {
670
670
using TransformedOperandValueRange =
671
671
OptionalTransformRange<ArrayRef<Operand>, OperandToTransformedValue>;
672
672
673
+ // / Functor for Operand::getUser()
674
+ struct OperandToUser ;
675
+ using OperandUserRange = TransformRange<ArrayRef<Operand *>, OperandToUser>;
676
+
673
677
static OperandValueRange getOperandValues (ArrayRef<Operand*> operands);
674
678
675
679
OperandRefValueRange getOperandValues () const ;
@@ -1021,6 +1025,12 @@ struct SILInstruction::OperandRefToValue {
1021
1025
}
1022
1026
};
1023
1027
1028
+ struct SILInstruction ::OperandToUser {
1029
+ SILInstruction *operator ()(const Operand *use) const {
1030
+ return const_cast <Operand *>(use)->getUser ();
1031
+ }
1032
+ };
1033
+
1024
1034
struct SILInstruction ::FilterOperandToRealOperand {
1025
1035
const SILInstruction &i;
1026
1036
Original file line number Diff line number Diff line change @@ -363,12 +363,14 @@ OwnershipLiveRange::hasUnknownConsumingUse(bool assumingAtFixPoint) const {
363
363
return HasConsumingUse_t::YesButAllPhiArgs;
364
364
}
365
365
366
- OwnershipLiveRange::DestroyingInstsRange
366
+ SILInstruction::OperandUserRange
367
367
OwnershipLiveRange::getDestroyingInsts () const {
368
- return DestroyingInstsRange (getDestroyingUses (), OperandToUser ());
368
+ return SILInstruction::OperandUserRange (getDestroyingUses (),
369
+ SILInstruction::OperandToUser ());
369
370
}
370
371
371
- OwnershipLiveRange::ConsumingInstsRange
372
+ SILInstruction::OperandUserRange
372
373
OwnershipLiveRange::getAllConsumingInsts () const {
373
- return ConsumingInstsRange (consumingUses, OperandToUser ());
374
+ return SILInstruction::OperandUserRange (consumingUses,
375
+ SILInstruction::OperandToUser ());
374
376
}
Original file line number Diff line number Diff line change @@ -113,17 +113,9 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
113
113
return unknownConsumingUses;
114
114
}
115
115
116
- private:
117
- struct OperandToUser ;
116
+ SILInstruction::OperandUserRange getDestroyingInsts () const ;
118
117
119
- public:
120
- using DestroyingInstsRange =
121
- TransformRange<ArrayRef<Operand *>, OperandToUser>;
122
- DestroyingInstsRange getDestroyingInsts () const ;
123
-
124
- using ConsumingInstsRange =
125
- TransformRange<ArrayRef<Operand *>, OperandToUser>;
126
- ConsumingInstsRange getAllConsumingInsts () const ;
118
+ SILInstruction::OperandUserRange getAllConsumingInsts () const ;
127
119
128
120
// / If this LiveRange has a single destroying use, return that use. Otherwise,
129
121
// / return nullptr.
@@ -198,16 +190,6 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
198
190
DeadEndBlocks &deadEndBlocks,
199
191
ValueLifetimeAnalysis::Frontier &scratch);
200
192
};
201
-
202
- struct OwnershipLiveRange ::OperandToUser {
203
- OperandToUser () {}
204
-
205
- SILInstruction *operator ()(const Operand *use) const {
206
- auto *nonConstUse = const_cast <Operand *>(use);
207
- return nonConstUse->getUser ();
208
- }
209
- };
210
-
211
193
} // namespace semanticarc
212
194
} // namespace swift
213
195
You can’t perform that action at this time.
0 commit comments