Use ValueBase instead of SILInstructions for delete notifications.

This enables e.g. notifications about the removal of SILArguments.
This commit is contained in:
Roman Levenstein
2015-12-04 15:16:05 -08:00
parent ea848834f9
commit 3bc1bd93c8
5 changed files with 8 additions and 7 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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:

View File

@@ -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);
}

View File

@@ -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"; }