Add mark_dependence [nonescaping] flag.

The dependent 'value' may be marked 'nonescaping', which guarantees that the
lifetime dependence is statically enforceable. In this case, the compiler
must be able to follow all values forwarded from the dependent 'value', and
recognize all final (non-forwarded, non-escaping) use points. This implies
that `findPointerEscape` is false. A diagnostic pass checks that the
incoming SIL to verify that these use points are all initially within the
'base' lifetime. Regular 'mark_dependence' semantics ensure that
optimizations cannot violate the lifetime dependence after diagnostics.
This commit is contained in:
Andrew Trick
2023-10-17 23:34:23 -07:00
parent 47cab70ee3
commit 264cbaea42
28 changed files with 152 additions and 47 deletions

View File

@@ -375,4 +375,9 @@ public struct Builder {
let endMutation = bridged.createEndCOWMutation(instance.bridged, keepUnique)
return notifyNew(endMutation.getAs(EndCOWMutationInst.self))
}
public func createMarkDependence(value: Value, base: Value, isNonEscaping: Bool) -> MarkDependenceInst {
let markDependence = bridged.createMarkDependence(value.bridged, base.bridged, isNonEscaping)
return notifyNew(markDependence.getAs(MarkDependenceInst.self))
}
}