mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Introduces a set of protocols useful to perform def-use and use-def traversals to find uses and definitions of values. This logic was originally baked into `EscapeInfo` directly. Here we extract it into general utilities, namely: - `ValueDefUseWalker`: visit uses of a value walking down value-value projections/constructions. - `AddressDefUseWalker`: visit uses of an address walking down addr-addr projections/constructions. - `ValueUseDefWalker`: visit definitions of a value walking up value-value projections/constructions. - `AddressUseDefWalker`: visit definitions of an address walking up addr-addr projections/constructions. These utilities can then be used in other passes or to create new utilities by composing them. For example to find a definition passing through both address projections and value extractions, it's enough to implement a visitor conforming to both `AddressUseDefWalker` and `ValueUseDefWalker`.
26 KiB
26 KiB