@@ -85,6 +85,11 @@ class InstructionDeleter {
85
85
86
86
// / If the instruction \p inst is dead, delete it immediately and record
87
87
// / its operands so that they can be cleaned up later.
88
+ // /
89
+ // / \p callback is called on each deleted instruction before deleting any
90
+ // / instructions. This way, the SIL is valid in the callback. However, the
91
+ // / callback cannot be used to update instruction iterators since other
92
+ // / instructions to be deleted remain in the instruction list.
88
93
void deleteIfDead (
89
94
SILInstruction *inst,
90
95
llvm::function_ref<void (SILInstruction *)> callback =
@@ -102,8 +107,10 @@ class InstructionDeleter {
102
107
// / \pre the instruction to be deleted must not have any use other than
103
108
// / incidental uses.
104
109
// /
105
- // / \param callback a callback called whenever an instruction
106
- // / is deleted.
110
+ // / \p callback is called on each deleted instruction before deleting any
111
+ // / instructions. This way, the SIL is valid in the callback. However, the
112
+ // / callback cannot be used to update instruction iterators since other
113
+ // / instructions to be deleted remain in the instruction list.
107
114
void forceDeleteAndFixLifetimes (
108
115
SILInstruction *inst,
109
116
llvm::function_ref<void (SILInstruction *)> callback =
@@ -122,8 +129,10 @@ class InstructionDeleter {
122
129
// / \pre the instruction to be deleted must not have any use other than
123
130
// / incidental uses.
124
131
// /
125
- // / \param callback a callback called whenever an instruction
126
- // / is deleted.
132
+ // / \p callback is called on each deleted instruction before deleting any
133
+ // / instructions. This way, the SIL is valid in the callback. However, the
134
+ // / callback cannot be used to update instruction iterators since other
135
+ // / instructions to be deleted remain in the instruction list.
127
136
void forceDelete (
128
137
SILInstruction *inst,
129
138
llvm::function_ref<void (SILInstruction *)> callback =
@@ -137,7 +146,10 @@ class InstructionDeleter {
137
146
// / function body in an inconsistent state, it needs to be made consistent
138
147
// / before this method is invoked.
139
148
// /
140
- // / \param callback a callback called whenever an instruction is deleted.
149
+ // / \p callback is called on each deleted instruction before deleting any
150
+ // / instructions. This way, the SIL is valid in the callback. However, the
151
+ // / callback cannot be used to update instruction iterators since other
152
+ // / instructions to be deleted remain in the instruction list.
141
153
void
142
154
cleanUpDeadInstructions (llvm::function_ref<void (SILInstruction *)> callback =
143
155
[](SILInstruction *) {});
@@ -170,7 +182,10 @@ class InstructionDeleter {
170
182
// / \pre the SIL function containing the instruction is assumed to be
171
183
// / consistent, i.e., does not have under or over releases.
172
184
// /
173
- // / \param callback a callback called whenever an instruction is deleted.
185
+ // / \p callback is called on each deleted instruction before deleting any
186
+ // / instructions. This way, the SIL is valid in the callback. However, the
187
+ // / callback cannot be used to update instruction iterators since other
188
+ // / instructions to be deleted remain in the instruction list.
174
189
void eliminateDeadInstruction (
175
190
SILInstruction *inst, llvm::function_ref<void (SILInstruction *)> callback =
176
191
[](SILInstruction *) {});
0 commit comments