Skip to content

Commit db594b5

Browse files
authored
Merge pull request #34368 from atrick/comment-memutils
2 parents c0d664d + 9f83ced commit db594b5

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

include/swift/SIL/MemAccessUtils.h

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
///
5050
/// For better identification an access base, use
5151
/// AccessedStorage::compute(). It returns an AccessedStorage value
52-
/// that identifies the storage location of a memory access. It provides APIs
52+
/// that identifies the storage of a memory access. It provides APIs
5353
/// for inspecting type of accessed storage and allows for disambiguation
5454
/// between different types of storage and different properties within a class.
5555
///
@@ -64,7 +64,7 @@
6464
/// from an enforced begin_access or from any memory operation that is part of a
6565
/// formal access, then it returns a valid AccessedStorage value. If the memory
6666
/// operation is not part of a formal access, then it still identifies the
67-
/// accessed location as a best effort, but the result may be invalid storage.
67+
/// accessed storage as a best effort, but the result may be invalid storage.
6868
///
6969
/// An active goal is to require compute() to always return a
7070
/// valid AccessedStorage value even for operations that aren't part of a
@@ -77,13 +77,30 @@
7777
/// make incorrect assumptions about the absence of access to globals or class
7878
/// properties.
7979
///
80-
/// identifyFormalAccess() is similar to AccessedStorage::compute(), but returns
81-
/// the formally accessed storage of a begin_access instruction. This must
82-
/// return a valid AccessedStorage value unless the access has "Unsafe"
83-
/// enforcement. The formal access location may be nested within an outer
84-
/// begin_access. For the purpose of exclusivity, nested accesses are considered
85-
/// distinct formal accesses so they return distinct AccessedStorage values even
86-
/// though they may access the same memory.
80+
/// AccessedStorage::computeInScope() returns an AccessedStorage value for the
81+
/// immediately enclosing access scope. Within a formal access, it always
82+
/// returns a Nested storage kind, which provides the begin_access marker.
83+
///
84+
/// identifyFormalAccess() works like AccessedStorage::computeInScope(), but
85+
/// finds the storage corresponding to a begin_access marker, rather than an
86+
/// arbitrary address. This must return a valid AccessedStorage value unless the
87+
/// access has "Unsafe" enforcement. The given begin_access marker may be nested
88+
/// within another, outer access scope. For the purpose of exclusivity, nested
89+
/// accesses are considered distinct formal accesses so they return distinct
90+
/// AccessedStorage values even though they may access the same memory. This
91+
/// way, nested accesses do not appear to conflict.
92+
///
93+
/// AccessPath identifies both the accessed storage and the path to a specific
94+
/// storage location within that storage object. See ProgrammersGuide.md and the
95+
/// class comments below for details. AccessPath::compute() and
96+
/// AccessPath::computeInScope() mirror the AccessedStorage API.
97+
/// AccessPath::contains() and AccessPath::mayOverlap() provide efficient
98+
/// comparison of access paths.
99+
///
100+
/// AccessPath::collectUses() provides all reachable uses of the accessed
101+
/// storage, allowing the selection of Exact, Inner, or Overlapping uses.
102+
/// visitAccessedStorageUses() and visitAccessPathUses() generalize
103+
/// handling of all reachable uses for a given storage location.
87104
///
88105
//===----------------------------------------------------------------------===//
89106

0 commit comments

Comments
 (0)