[sil-optimizer] Get rid of the InstModCallback constructors in favor of onDelete/onCreatedNewInst/etc.

Without this when constructing an InstModCallback it is hard to distinguish
which closure is meant for which operation when passed to the constructor of
InstModCallback (if this was in Swift, we could use argument labels, but we do
not have such things in c++).

This new value type sort of formulation makes it unambiguous which callback is
used for what when constructing one of these.
This commit is contained in:
Michael Gottesman
2021-04-26 17:56:34 -07:00
parent e5d0a489d4
commit b6bfea1f39
7 changed files with 47 additions and 54 deletions

View File

@@ -783,7 +783,7 @@ void TempRValueOptPass::run() {
}
}
InstModCallbacks callbacks(
auto callbacks = InstModCallbacks().onDelete(
[](SILInstruction *instToKill) {
// SimplifyInstruction is not in the business of removing
// copy_addr. If it were, then we would need to update deadCopies.