@@ -171,7 +171,7 @@ class SILInstructionResultArray {
171
171
reverse_range getReversedValues () const ;
172
172
173
173
using type_range = llvm::iterator_range<
174
- llvm::mapped_iterator<iterator, std::function< SILType(SILValue)> , SILType>>;
174
+ llvm::mapped_iterator<iterator, SILType(*)( SILValue), SILType>>;
175
175
type_range getTypes () const ;
176
176
177
177
bool operator ==(const SILInstructionResultArray &rhs);
@@ -197,18 +197,6 @@ class SILInstructionResultArray {
197
197
// / Please do not use this outside of this class. It is only meant to speedup
198
198
// / MultipleValueInstruction::getIndexOfResult(SILValue).
199
199
const ValueBase *back () const ;
200
-
201
- // / Return the offset 1 past the end of the array or None if we are not
202
- // / actually storing anything.
203
- Optional<unsigned > getStartOffset () const {
204
- return empty () ? None : Optional<unsigned >(0 );
205
- }
206
-
207
- // / Return the offset 1 past the end of the array or None if we are not
208
- // / actually storing anything.
209
- Optional<unsigned > getEndOffset () const {
210
- return empty () ? None : Optional<unsigned >(size ());
211
- }
212
200
};
213
201
214
202
class SILInstructionResultArray ::iterator {
@@ -220,7 +208,7 @@ class SILInstructionResultArray::iterator {
220
208
SILInstructionResultArray Parent;
221
209
222
210
// / The index into the parent array.
223
- Optional< unsigned > Index;
211
+ unsigned Index;
224
212
225
213
public:
226
214
using difference_type = int ;
@@ -230,34 +218,31 @@ class SILInstructionResultArray::iterator {
230
218
using iterator_category = std::bidirectional_iterator_tag;
231
219
232
220
iterator () = default ;
233
- iterator (const SILInstructionResultArray &Parent,
234
- Optional<unsigned > Index = 0 )
221
+ iterator (const SILInstructionResultArray &Parent, unsigned Index = 0 )
235
222
: Parent(Parent), Index(Index) {}
236
223
237
- SILValue operator *() const { return Parent[Index.getValue ()]; }
238
- SILValue operator *() { return Parent[Index.getValue ()]; }
224
+ SILValue operator *() const { return Parent[Index]; }
239
225
SILValue operator ->() const { return operator *(); }
240
- SILValue operator ->() { return operator *(); }
241
226
242
227
iterator &operator ++() {
243
- ++Index. getValue () ;
228
+ ++Index;
244
229
return *this ;
245
230
}
246
231
247
232
iterator operator ++(int ) {
248
233
iterator copy = *this ;
249
- ++Index. getValue () ;
234
+ ++Index;
250
235
return copy;
251
236
}
252
237
253
238
iterator &operator --() {
254
- --Index. getValue () ;
239
+ --Index;
255
240
return *this ;
256
241
}
257
242
258
243
iterator operator --(int ) {
259
244
iterator copy = *this ;
260
- --Index. getValue () ;
245
+ --Index;
261
246
return copy;
262
247
}
263
248
@@ -6646,29 +6631,35 @@ class TermInst : public NonValueInstruction {
6646
6631
6647
6632
using succblock_iterator =
6648
6633
TransformIterator<SILSuccessor *,
6649
- std::function< SILBasicBlock *(const SILSuccessor &)> >;
6634
+ SILBasicBlock *(*)( const SILSuccessor &)>;
6650
6635
using const_succblock_iterator = TransformIterator<
6651
6636
const SILSuccessor *,
6652
- std::function< const SILBasicBlock *(const SILSuccessor &)> >;
6637
+ const SILBasicBlock *(*)( const SILSuccessor &)>;
6653
6638
succblock_iterator succblock_begin () {
6654
- using FuncTy = std::function<SILBasicBlock *(const SILSuccessor &)>;
6655
- FuncTy F (&SILSuccessor::getBB);
6656
- return makeTransformIterator (getSuccessors ().begin (), F);
6639
+ return succblock_iterator (getSuccessors ().begin (),
6640
+ [](const SILSuccessor &succ) -> SILBasicBlock * {
6641
+ return succ.getBB ();
6642
+ });
6657
6643
}
6658
6644
succblock_iterator succblock_end () {
6659
- using FuncTy = std::function<SILBasicBlock *(const SILSuccessor &)>;
6660
- FuncTy F (&SILSuccessor::getBB);
6661
- return makeTransformIterator (getSuccessors ().end (), F);
6645
+ return succblock_iterator (getSuccessors ().end (),
6646
+ [](const SILSuccessor &succ) -> SILBasicBlock * {
6647
+ return succ.getBB ();
6648
+ });
6662
6649
}
6663
6650
const_succblock_iterator succblock_begin () const {
6664
- using FuncTy = std::function<const SILBasicBlock *(const SILSuccessor &)>;
6665
- FuncTy F (&SILSuccessor::getBB);
6666
- return makeTransformIterator (getSuccessors ().begin (), F);
6651
+ return const_succblock_iterator (
6652
+ getSuccessors ().begin (),
6653
+ [](const SILSuccessor &succ) -> const SILBasicBlock * {
6654
+ return succ.getBB ();
6655
+ });
6667
6656
}
6668
6657
const_succblock_iterator succblock_end () const {
6669
- using FuncTy = std::function<const SILBasicBlock *(const SILSuccessor &)>;
6670
- FuncTy F (&SILSuccessor::getBB);
6671
- return makeTransformIterator (getSuccessors ().end (), F);
6658
+ return const_succblock_iterator (
6659
+ getSuccessors ().end (),
6660
+ [](const SILSuccessor &succ) -> const SILBasicBlock * {
6661
+ return succ.getBB ();
6662
+ });
6672
6663
}
6673
6664
6674
6665
SILBasicBlock *getSingleSuccessorBlock () {
@@ -6691,23 +6682,26 @@ class TermInst : public NonValueInstruction {
6691
6682
6692
6683
using SuccessorBlockListTy =
6693
6684
TransformRange<SuccessorListTy,
6694
- std::function< SILBasicBlock *(const SILSuccessor &)> >;
6685
+ SILBasicBlock *(*)( const SILSuccessor &)>;
6695
6686
using ConstSuccessorBlockListTy =
6696
- TransformRange<ConstSuccessorListTy, std::function< const SILBasicBlock *(
6697
- const SILSuccessor &)> >;
6687
+ TransformRange<ConstSuccessorListTy,
6688
+ const SILBasicBlock *(*)( const SILSuccessor &)>;
6698
6689
6699
6690
// / Return the range of SILBasicBlocks that are successors of this block.
6700
6691
SuccessorBlockListTy getSuccessorBlocks () {
6701
- using FuncTy = std::function<SILBasicBlock *(const SILSuccessor &)>;
6702
- FuncTy F (&SILSuccessor::getBB);
6703
- return makeTransformRange (getSuccessors (), F);
6692
+ return SuccessorBlockListTy (getSuccessors (),
6693
+ [](const SILSuccessor &succ) -> SILBasicBlock* {
6694
+ return succ.getBB ();
6695
+ });
6704
6696
}
6705
6697
6706
6698
// / Return the range of SILBasicBlocks that are successors of this block.
6707
6699
ConstSuccessorBlockListTy getSuccessorBlocks () const {
6708
- using FuncTy = std::function<const SILBasicBlock *(const SILSuccessor &)>;
6709
- FuncTy F (&SILSuccessor::getBB);
6710
- return makeTransformRange (getSuccessors (), F);
6700
+ return ConstSuccessorBlockListTy (
6701
+ getSuccessors (),
6702
+ [](const SILSuccessor &succ) -> const SILBasicBlock * {
6703
+ return succ.getBB ();
6704
+ });
6711
6705
}
6712
6706
6713
6707
DEFINE_ABSTRACT_NON_VALUE_INST_BOILERPLATE (TermInst)
0 commit comments