|
18 | 18 | #include <iterator>
|
19 | 19 |
|
20 | 20 | namespace swift {
|
| 21 | + |
21 | 22 | class SILBasicBlock;
|
22 | 23 | class TermInst;
|
23 | 24 |
|
24 |
| -/// SILSuccessor - This represents a reference to a SILBasicBlock in a |
25 |
| -/// terminator instruction, forming a list of TermInst references to |
26 |
| -/// BasicBlocks. This forms the predecessor list, ensuring that it is always |
27 |
| -/// kept up to date. |
| 25 | +/// \brief An edge in the control flow graph. |
| 26 | +/// |
| 27 | +/// A SILSuccessor is stored in the terminator instruction of the tail block of |
| 28 | +/// the CFG edge. Internally it has a back reference to the terminator that |
| 29 | +/// contains it (ContainingInst). It also contains the SuccessorBlock that is |
| 30 | +/// the "head" of the CFG edge. This makes it very simple to iterate over the |
| 31 | +/// successors of a specific block. |
| 32 | +/// |
| 33 | +/// SILSuccessor also enables given a "head" edge the ability to iterate over |
| 34 | +/// predecessors. This is done by using an ilist that is embedded into |
| 35 | +/// SILSuccessors. |
28 | 36 | class SILSuccessor {
|
29 | 37 | friend class SILSuccessorIterator;
|
30 |
| - /// ContainingInst - This is the Terminator instruction that contains this |
31 |
| - /// successor. |
| 38 | + |
| 39 | + /// The terminator instruction that contains this SILSuccessor. |
32 | 40 | TermInst *ContainingInst = nullptr;
|
33 | 41 |
|
34 |
| - /// SuccessorBlock - If non-null, this is the BasicBlock that the terminator |
35 |
| - /// branches to. |
| 42 | + /// If non-null, this is the BasicBlock that the terminator branches to. |
36 | 43 | SILBasicBlock *SuccessorBlock = nullptr;
|
37 |
| - |
38 |
| - /// This is the prev and next terminator reference to SuccessorBlock, or |
39 |
| - /// null if SuccessorBlock is null. |
40 |
| - SILSuccessor **Prev = nullptr, *Next = nullptr; |
| 44 | + |
| 45 | + /// A pointer to the SILSuccessor that represents the previous SILSuccessor in the |
| 46 | + /// predecessor list for SuccessorBlock. |
| 47 | + /// |
| 48 | + /// Must be nullptr if SuccessorBlock is. |
| 49 | + SILSuccessor **Prev = nullptr; |
| 50 | + |
| 51 | + /// A pointer to the SILSuccessor that represents the next SILSuccessor in the |
| 52 | + /// predecessor list for SuccessorBlock. |
| 53 | + /// |
| 54 | + /// Must be nullptr if SuccessorBlock is. |
| 55 | + SILSuccessor *Next = nullptr; |
| 56 | + |
41 | 57 | public:
|
42 | 58 | SILSuccessor() {}
|
43 | 59 |
|
|
0 commit comments