Cleanup and document SIL memory behavior APIs.

This is code that I am fairly familiar with but it still took a day of
investigation to figure out how it is supposed to be used now in the
presence of bridging.

This primarily involved ruling out the possibity that the mid-level
Swift APIs could at some point call into the lower-level C++ APIs.

The biggest problem was that AliasAnalysis::getMemoryBehaviorOfInst()
was declared as a public interface, and it's name indicates that it
computes the memory behavior. But it is just a wrapper around a Swift
API and never actually calls into any of the C++ logic that is
responsible for computing memory behavior!
This commit is contained in:
Andrew Trick
2023-07-07 20:54:31 -07:00
parent b426c1507d
commit 5bae8551ff
4 changed files with 59 additions and 23 deletions

View File

@@ -711,7 +711,7 @@ void BridgedAliasAnalysis::registerAnalysis(GetMemEffectFn getMemEffectsFn,
canReferenceSameFieldFunction = canReferenceSameFieldFn;
}
MemoryBehavior AliasAnalysis::getMemoryBehaviorOfInst(
MemoryBehavior AliasAnalysis::getMemoryEffectOnEscapedAddress(
SILValue addr, SILInstruction *toInst) {
if (getMemEffectsFunction) {
return (MemoryBehavior)getMemEffectsFunction({PM->getSwiftPassInvocation()}, {addr},