mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SIL] Add support for delete notification handlers.
This commit adds the basic support for delete notification handlers. The SIL Module is notified every time an instruction is deleted. The module will forward notification messages to users who ask to be notified. The motivation for this work is described in the upcoming commit to OptimizerDesign.md.
This commit is contained in:
@@ -37,6 +37,12 @@ SILBasicBlock::SILBasicBlock(SILFunction *parent, SILBasicBlock *afterBB)
|
||||
}
|
||||
}
|
||||
SILBasicBlock::~SILBasicBlock() {
|
||||
// Notify the delete handlers that the instructions in this block are
|
||||
// being deleted.
|
||||
for (auto I = begin(), E = end(); I != E; ++I) {
|
||||
getModule().notifyDeleteHandlers(&*I);
|
||||
}
|
||||
|
||||
// iplist's destructor is going to destroy the InstList.
|
||||
}
|
||||
|
||||
@@ -69,6 +75,8 @@ void SILBasicBlock::push_front(SILInstruction *I) {
|
||||
}
|
||||
|
||||
void SILBasicBlock::remove(SILInstruction *I) {
|
||||
// Notify the delete handlers that this instruction is going away.
|
||||
getModule().notifyDeleteHandlers(&*I);
|
||||
InstList.remove(I);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user