@@ -93,6 +93,11 @@ class InstructionDeleter {
93
93
94
94
// / If the instruction \p inst is dead, delete it immediately and record
95
95
// / its operands so that they can be cleaned up later.
96
+ // /
97
+ // / \p callback is called on each deleted instruction before deleting any
98
+ // / instructions. This way, the SIL is valid in the callback. However, the
99
+ // / callback cannot be used to update instruction iterators since other
100
+ // / instructions to be deleted remain in the instruction list.
96
101
void deleteIfDead (
97
102
SILInstruction *inst,
98
103
llvm::function_ref<void (SILInstruction *)> callback =
@@ -110,8 +115,10 @@ class InstructionDeleter {
110
115
// / \pre the instruction to be deleted must not have any use other than
111
116
// / incidental uses.
112
117
// /
113
- // / \param callback a callback called whenever an instruction
114
- // / is deleted.
118
+ // / \p callback is called on each deleted instruction before deleting any
119
+ // / instructions. This way, the SIL is valid in the callback. However, the
120
+ // / callback cannot be used to update instruction iterators since other
121
+ // / instructions to be deleted remain in the instruction list.
115
122
void forceDeleteAndFixLifetimes (
116
123
SILInstruction *inst,
117
124
llvm::function_ref<void (SILInstruction *)> callback =
@@ -130,8 +137,10 @@ class InstructionDeleter {
130
137
// / \pre the instruction to be deleted must not have any use other than
131
138
// / incidental uses.
132
139
// /
133
- // / \param callback a callback called whenever an instruction
134
- // / is deleted.
140
+ // / \p callback is called on each deleted instruction before deleting any
141
+ // / instructions. This way, the SIL is valid in the callback. However, the
142
+ // / callback cannot be used to update instruction iterators since other
143
+ // / instructions to be deleted remain in the instruction list.
135
144
void forceDelete (
136
145
SILInstruction *inst,
137
146
llvm::function_ref<void (SILInstruction *)> callback =
@@ -145,7 +154,10 @@ class InstructionDeleter {
145
154
// / function body in an inconsistent state, it needs to be made consistent
146
155
// / before this method is invoked.
147
156
// /
148
- // / \param callback a callback called whenever an instruction is deleted.
157
+ // / \p callback is called on each deleted instruction before deleting any
158
+ // / instructions. This way, the SIL is valid in the callback. However, the
159
+ // / callback cannot be used to update instruction iterators since other
160
+ // / instructions to be deleted remain in the instruction list.
149
161
void
150
162
cleanUpDeadInstructions (llvm::function_ref<void (SILInstruction *)> callback =
151
163
[](SILInstruction *) {});
@@ -178,7 +190,10 @@ class InstructionDeleter {
178
190
// / \pre the SIL function containing the instruction is assumed to be
179
191
// / consistent, i.e., does not have under or over releases.
180
192
// /
181
- // / \param callback a callback called whenever an instruction is deleted.
193
+ // / \p callback is called on each deleted instruction before deleting any
194
+ // / instructions. This way, the SIL is valid in the callback. However, the
195
+ // / callback cannot be used to update instruction iterators since other
196
+ // / instructions to be deleted remain in the instruction list.
182
197
void eliminateDeadInstruction (
183
198
SILInstruction *inst, llvm::function_ref<void (SILInstruction *)> callback =
184
199
[](SILInstruction *) {});
0 commit comments