You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -66,6 +70,7 @@ Useful to insert instructions after a (potential) terminator instruction.
66
70
67
71
#### Walk Utils
68
72
This consists of four protocols, which can be implemented to walk up or down the SSA graph:
73
+
69
74
*`ValueDefUseWalker`
70
75
*`AddressDefUseWalker`
71
76
*`ValueUseDefWalker`
@@ -78,6 +83,7 @@ This consists of four protocols, which can be implemented to walk up or down the
78
83
#### Escape Utilities
79
84
Escape analysis, which is used e.g. in stack promotion or alias analysis.
80
85
Escape analysis is usable through the following methods of `ProjectedValue` and `Value`:
86
+
81
87
*`isEscaping()`
82
88
*`isAddressEscaping()`
83
89
*`visit()`
@@ -89,6 +95,7 @@ Escape analysis is usable through the following methods of `ProjectedValue` and
89
95
90
96
#### Access Utils
91
97
A set of utilities for analyzing memory accesses. It defines the following concepts:
98
+
92
99
*`AccessBase`: represents the base address of a memory access.
93
100
*`AccessPath`: a pair of an `AccessBase` and `SmallProjectionPath` with the path describing the specific address (in terms of projections) of the access.
94
101
* Access storage path (which is of type `ProjectedValue`): identifies the reference - or a value which contains a reference - an address originates from.
@@ -97,6 +104,33 @@ A set of utilities for analyzing memory accesses. It defines the following conce
97
104
**Related C++ utilities:**`AccessPath` and other access utilities.
98
105
**Status:** done
99
106
107
+
### Ownership Utils
108
+
109
+
#### BorrowUtils.swift has utilities for traversing borrow scopes:
110
+
111
+
*`BorrowingInstruction`: find borrow scopes during def-use walks
112
+
*`BeginBorrowValue`: find borrow scopes during use-def walks
113
+
*`gatherBorrowIntroducers`: use-def walk finds the current scopes
114
+
*`gatherEnclosingValues`: use-def walk finds the outer lifetimes that enclose the current scope
115
+
116
+
#### OwnershipUtils.swift has utilities for traversing OSSA lifetimes:
117
+
118
+
*`computeLinearLiveness`: compute an InstructionRange from the immediate lifetime ending uses.
119
+
*`computeInteriorLiveness`: complete def-use walk to compute an InstructionRange from all transitive use points that must be within an OSSA lifetime.
120
+
*`InteriorUseWalker`: def-use walker for all transitive use points that must be within an OSSA lifetime.
121
+
*`AddressLifetimeDefUseWalker`: def-use address walker to categorize all legal address uses by ownership effect.
122
+
*`OwnershipUseVistor`: categorize all uses of an owned or guaranteed use by ownership effect. Use this within a recursive def-use walker to decide how to follow each use.
123
+
124
+
`AddressLifetimeDefUseWalker` currently differs from `AddressDefUseWalker`. It visits all uses regardless of whether they are projections, has callbacks for handling inner scopes, and automatically handles the lifetime effect of inner scopes and dependent values.
125
+
126
+
TODO: Define address projections in a single place rather than in both `AddressDefUseWalker` and `AddressUseVisitor`. This can be done with a simple `AddressProjection` protocol.
127
+
128
+
#### ForwardingUtils.swift has utilities for traversing forward-extended lifetimes:
129
+
130
+
A forward-extended lifetimes may include multiple OSSA lifetimes, joined by ForwardingInstructions. Forwarding walkers simply traverse the SSA graph of ForwardingInstructions:
0 commit comments