Skip to content

Commit 0fb3cb9

Browse files
committed
[NFC] Add AccessBase.address
LifetimeDependence uses the address of the AccessBase to compute liveness. It is more convenient to switch over all AccessBase kinds here rather than force all clients to do it.
1 parent ec0026f commit 0fb3cb9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

SwiftCompilerSources/Sources/SIL/Utilities/AccessUtils.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,22 @@ public enum AccessBase : CustomStringConvertible, Hashable {
114114
}
115115
}
116116

117+
/// Return 'nil' for global varabiables and unidentified addresses.
118+
public var address: Value? {
119+
switch self {
120+
case .global, .unidentified: return nil
121+
case .box(let pbi): return pbi
122+
case .stack(let asi): return asi
123+
case .class(let rea): return rea
124+
case .tail(let rta): return rta
125+
case .argument(let arg): return arg
126+
case .yield(let result): return result
127+
case .storeBorrow(let sb): return sb
128+
case .pointer(let p): return p
129+
case .index(let ia): return ia
130+
}
131+
}
132+
117133
public var description: String {
118134
switch self {
119135
case .unidentified: return "?"

0 commit comments

Comments
 (0)