mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use ValueBase instead of SILInstructions for delete notifications.
This enables e.g. notifications about the removal of SILArguments.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace swift {
|
||||
|
||||
class SILInstruction;
|
||||
class ValueBase;
|
||||
|
||||
/// A protocol (or inferface) for handling instruction deletion notifications.
|
||||
///
|
||||
@@ -29,7 +29,7 @@ struct DeleteNotificationHandler {
|
||||
virtual ~DeleteNotificationHandler() {}
|
||||
|
||||
/// Handle the invalidation message for the value \p Value.
|
||||
virtual void handleDeleteNotification(swift::SILInstruction *Instr) { }
|
||||
virtual void handleDeleteNotification(swift::ValueBase *Value) { }
|
||||
};
|
||||
|
||||
} // end swift namespace
|
||||
|
||||
@@ -204,9 +204,9 @@ public:
|
||||
/// Remove the delete notification handler \p Handler from the module context.
|
||||
void removeDeleteNotificationHandler(DeleteNotificationHandler* Handler);
|
||||
|
||||
/// Send the invalidation message that \p Inst is being deleted to all
|
||||
/// Send the invalidation message that \p V is being deleted to all
|
||||
/// registered handlers. The order of handlers is deterministic but arbitrary.
|
||||
void notifyDeleteHandlers(SILInstruction *Inst);
|
||||
void notifyDeleteHandlers(ValueBase *V);
|
||||
|
||||
/// \brief Get a uniqued pointer to a SIL type list.
|
||||
SILTypeList *getSILTypeList(ArrayRef<SILType> Types) const;
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace swift {
|
||||
|
||||
class SILValue;
|
||||
class SILInstruction;
|
||||
class ValueBase;
|
||||
class SideEffectAnalysis;
|
||||
|
||||
/// This class is a simple wrapper around an alias analysis cache. This is
|
||||
@@ -82,7 +83,7 @@ private:
|
||||
bool typesMayAlias(SILType T1, SILType T2);
|
||||
|
||||
|
||||
virtual void handleDeleteNotification(SILInstruction *I) override {
|
||||
virtual void handleDeleteNotification(ValueBase *I) override {
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -676,7 +676,7 @@ removeDeleteNotificationHandler(DeleteNotificationHandler* Handler) {
|
||||
NotificationHandlers.remove(Handler);
|
||||
}
|
||||
|
||||
void SILModule::notifyDeleteHandlers(SILInstruction *Item) {
|
||||
void SILModule::notifyDeleteHandlers(ValueBase *Item) {
|
||||
for (auto *Handler : NotificationHandlers) {
|
||||
Handler->handleDeleteNotification(Item);
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ class SILCombine : public SILFunctionTransform {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void handleDeleteNotification(SILInstruction *I) override {
|
||||
virtual void handleDeleteNotification(ValueBase *I) override {
|
||||
}
|
||||
|
||||
StringRef getName() override { return "SIL Combine"; }
|
||||
|
||||
Reference in New Issue
Block a user