mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[embedded] Compile-time (literal) KeyPaths for Embedded Swift
Enable KeyPath/AnyKeyPath/PartialKeyPath/WritableKeyPath in Embedded Swift, but for compile-time use only: - Add keypath optimizations into the mandatory optimizations pipeline - Allow keypath optimizations to look through begin_borrow, to make them work even in OSSA. - If a use of a KeyPath doesn't optimize away, diagnose in PerformanceDiagnostics - Make UnsafePointer.pointer(to:) transparent to allow the keypath optimization to happen in the callers of UnsafePointer.pointer(to:).
This commit is contained in:
@@ -599,6 +599,13 @@ bool specializeAppliesInFunction(SILFunction &F,
|
||||
SILTransform *transform,
|
||||
bool isMandatory);
|
||||
|
||||
bool tryOptimizeKeypath(ApplyInst *AI, SILBuilder Builder);
|
||||
bool tryOptimizeKeypathApplication(ApplyInst *AI, SILFunction *callee, SILBuilder Builder);
|
||||
bool tryOptimizeKeypathOffsetOf(ApplyInst *AI, FuncDecl *calleeFn,
|
||||
KeyPathInst *kp, SILBuilder Builder);
|
||||
bool tryOptimizeKeypathKVCString(ApplyInst *AI, FuncDecl *calleeFn,
|
||||
KeyPathInst *kp, SILBuilder Builder);
|
||||
|
||||
/// Instantiate the specified type by recursively tupling and structing the
|
||||
/// unique instances of the empty types and undef "instances" of the non-empty
|
||||
/// types aggregated together at each level.
|
||||
|
||||
Reference in New Issue
Block a user