mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: add an API to replace all entries of a VTable
* add `ModulePassContext.replaceVTableEntries()` * add `ModulePassContext.notifyFunctionTablesChanged()`
This commit is contained in:
@@ -1516,6 +1516,7 @@ void SwiftPassInvocation::finishedModulePassRun() {
|
||||
endPass();
|
||||
assert(!function && transform && "not running a pass");
|
||||
assert(changeNotifications == SILAnalysis::InvalidationKind::Nothing
|
||||
&& !functionTablesChanged
|
||||
&& "unhandled change notifications at end of module pass");
|
||||
transform = nullptr;
|
||||
}
|
||||
@@ -1551,6 +1552,7 @@ void SwiftPassInvocation::endPass() {
|
||||
void SwiftPassInvocation::beginTransformFunction(SILFunction *function) {
|
||||
assert(!this->function && transform && "not running a pass");
|
||||
assert(changeNotifications == SILAnalysis::InvalidationKind::Nothing
|
||||
&& !functionTablesChanged
|
||||
&& "change notifications not cleared");
|
||||
this->function = function;
|
||||
}
|
||||
@@ -1561,6 +1563,10 @@ void SwiftPassInvocation::endTransformFunction() {
|
||||
passManager->invalidateAnalysis(function, changeNotifications);
|
||||
changeNotifications = SILAnalysis::InvalidationKind::Nothing;
|
||||
}
|
||||
if (functionTablesChanged) {
|
||||
passManager->invalidateFunctionTables();
|
||||
functionTablesChanged = false;
|
||||
}
|
||||
function = nullptr;
|
||||
assert(numBlockSetsAllocated == 0 && "Not all BasicBlockSets deallocated");
|
||||
assert(numNodeSetsAllocated == 0 && "Not all NodeSets deallocated");
|
||||
@@ -1580,6 +1586,7 @@ void SwiftPassInvocation::endVerifyFunction() {
|
||||
assert(function);
|
||||
if (!transform) {
|
||||
assert(changeNotifications == SILAnalysis::InvalidationKind::Nothing &&
|
||||
!functionTablesChanged &&
|
||||
"verifyication must not change the SIL of a function");
|
||||
assert(numBlockSetsAllocated == 0 && "Not all BasicBlockSets deallocated");
|
||||
assert(numNodeSetsAllocated == 0 && "Not all NodeSets deallocated");
|
||||
@@ -1634,6 +1641,9 @@ void BridgedChangeNotificationHandler::notifyChanges(Kind changeKind) const {
|
||||
case Kind::effectsChanged:
|
||||
invocation->notifyChanges(SILAnalysis::InvalidationKind::Effects);
|
||||
break;
|
||||
case Kind::functionTablesChanged:
|
||||
invocation->notifyFunctionTablesChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user