Skip to content

Commit 3bc1bd9

Browse files
committed
Use ValueBase instead of SILInstructions for delete notifications.
This enables e.g. notifications about the removal of SILArguments.
1 parent ea84883 commit 3bc1bd9

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

include/swift/SIL/Notifications.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace swift {
1717

18-
class SILInstruction;
18+
class ValueBase;
1919

2020
/// A protocol (or inferface) for handling instruction deletion notifications.
2121
///
@@ -29,7 +29,7 @@ struct DeleteNotificationHandler {
2929
virtual ~DeleteNotificationHandler() {}
3030

3131
/// Handle the invalidation message for the value \p Value.
32-
virtual void handleDeleteNotification(swift::SILInstruction *Instr) { }
32+
virtual void handleDeleteNotification(swift::ValueBase *Value) { }
3333
};
3434

3535
} // end swift namespace

include/swift/SIL/SILModule.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ class SILModule {
204204
/// Remove the delete notification handler \p Handler from the module context.
205205
void removeDeleteNotificationHandler(DeleteNotificationHandler* Handler);
206206

207-
/// Send the invalidation message that \p Inst is being deleted to all
207+
/// Send the invalidation message that \p V is being deleted to all
208208
/// registered handlers. The order of handlers is deterministic but arbitrary.
209-
void notifyDeleteHandlers(SILInstruction *Inst);
209+
void notifyDeleteHandlers(ValueBase *V);
210210

211211
/// \brief Get a uniqued pointer to a SIL type list.
212212
SILTypeList *getSILTypeList(ArrayRef<SILType> Types) const;

include/swift/SILAnalysis/AliasAnalysis.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace swift {
2222

2323
class SILValue;
2424
class SILInstruction;
25+
class ValueBase;
2526
class SideEffectAnalysis;
2627

2728
/// This class is a simple wrapper around an alias analysis cache. This is
@@ -82,7 +83,7 @@ class AliasAnalysis : public SILAnalysis {
8283
bool typesMayAlias(SILType T1, SILType T2);
8384

8485

85-
virtual void handleDeleteNotification(SILInstruction *I) override {
86+
virtual void handleDeleteNotification(ValueBase *I) override {
8687
}
8788

8889
public:

lib/SIL/SILModule.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ removeDeleteNotificationHandler(DeleteNotificationHandler* Handler) {
676676
NotificationHandlers.remove(Handler);
677677
}
678678

679-
void SILModule::notifyDeleteHandlers(SILInstruction *Item) {
679+
void SILModule::notifyDeleteHandlers(ValueBase *Item) {
680680
for (auto *Handler : NotificationHandlers) {
681681
Handler->handleDeleteNotification(Item);
682682
}

lib/SILPasses/SILCombiner/SILCombine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ class SILCombine : public SILFunctionTransform {
355355
}
356356
}
357357

358-
virtual void handleDeleteNotification(SILInstruction *I) override {
358+
virtual void handleDeleteNotification(ValueBase *I) override {
359359
}
360360

361361
StringRef getName() override { return "SIL Combine"; }

0 commit comments

Comments
 (0)