Skip to content

Commit e852284

Browse files
committed
Rename AccessedStorage to AccessStorage
to be consistent with AccessPath and AccessBase. Otherwise, the arbitrary name difference adds constant friction.
1 parent 354b5c4 commit e852284

34 files changed

+565
-565
lines changed

docs/SILMemoryAccess.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# SIL utilities for modeling memory access
22

3-
The `AccessBase`, `AccessedStorage` and `AccessPath` types formalize
3+
The `AccessBase`, `AccessStorage` and `AccessPath` types formalize
44
memory access in SIL. Given an address-typed SIL value, it is possible
55
to reliably identify the storage location of the accessed
6-
memory. `AccessedStorage` identifies an accessed storage
6+
memory. `AccessStorage` identifies an accessed storage
77
location. `AccessPath` contains both a storage location and the
88
"access path" within that memory object. The relevant API details are
99
documented in MemAccessUtils.h
@@ -30,17 +30,17 @@ address is immutable for the duration of its access scope
3030

3131
## Access path def-use relationship
3232

33-
Computing `AccessedStorage` and `AccessPath` for any given SIL address
33+
Computing `AccessStorage` and `AccessPath` for any given SIL address
3434
involves a use-def traversal to determine the origin of the
3535
address. It may traverse operations on values of type address,
3636
Builtin.RawPointer, box, and reference. The logic that
3737
formalizes which SIL operations may be involved in the def-use chain
3838
is encapsulated with the `AccessUseDefChainVisitor`. The traversal can
3939
be customized by implementing this visitor. Customization is not
40-
expected to change the meaning of AccessedStorage or
40+
expected to change the meaning of AccessStorage or
4141
AccessPath. Rather, it is intended for additional pass-specific
4242
book-keeping or for higher-level convenience APIs that operate on the
43-
use-def chain bypassing AccessedStorage completely.
43+
use-def chain bypassing AccessStorage completely.
4444

4545
Access def-use chains are divided by four points: the object "root", the
4646
access "base", the outer-most "access" scope, and the "address" of a
@@ -114,13 +114,13 @@ bb3(%a : $A):
114114

115115
Each object property and its tail storage is considered a separate
116116
formal access base. The reference root is only one component of an
117-
`AccessedStorage` location. AccessedStorage also identifies the class
117+
`AccessStorage` location. AccessStorage also identifies the class
118118
property being accessed within that object.
119119

120120
A reference root may be borrowed, so the use-def path from the base to
121121
the root may cross a borrow scope. This means that uses of one base
122122
may not be replaced with a different base even if it has the same
123-
AccessedStorage because they may not be contained within the same
123+
AccessStorage because they may not be contained within the same
124124
borrow scope. However, this is the only part of the access path that
125125
may be borrowed. Address uses with the same base can be substituted
126126
without checking the borrow scope.
@@ -132,7 +132,7 @@ produced by an instruction that directly identifies the kind of
132132
storage being accessed without further use-def traversal. Common
133133
access bases are `alloc_stack`, `global_addr`,
134134
`ref_element_addr`, `project_box`, and function arguments (see
135-
`AccessedStorage::Kind`).
135+
`AccessStorage::Kind`).
136136

137137
The access base is the same as the "root" SILValue for all storage
138138
kinds except global and reference storage. Reference storage includes
@@ -155,7 +155,7 @@ and the memory operation cannot cross an access scope.
155155
Typically, the base is the address-type source operand of a
156156
`begin_access`. However, the path from the access base to the
157157
`begin_access` may include *storage casts* (see
158-
`isAccessedStorageCast`). It may involve address an pointer
158+
`isAccessStorageCast`). It may involve address an pointer
159159
types, and may traverse phis. For some kinds of storage, the base may
160160
itself even be a non-address pointer. For phis that cannot be uniquely
161161
resolved, the base may even be a box type.
@@ -186,14 +186,14 @@ allows for a class of storage optimizations, such as bitfields, in
186186
which address storage is always uniquely determined. Currently, if a
187187
(non-address) phi on the access path from `base` to `access` does not
188188
have a common base, then it is considered an invalid access (the
189-
AccessedStorage object is not valid). SIL verification ensures that a
190-
formal access always has valid AccessedStorage (WIP). In other words,
189+
AccessStorage object is not valid). SIL verification ensures that a
190+
formal access always has valid AccessStorage (WIP). In other words,
191191
the source of a `begin_access` marker must be a single, non-phi
192192
base. In the future, for further simplicity, we may also disallow
193193
pointer phis unless they have a common base.
194194

195195
Not all SIL memory access is part of a formal access, but the
196-
`AccessedStorage` and `AccessPath` abstractions are universally
196+
`AccessStorage` and `AccessPath` abstractions are universally
197197
applicable. Non-formal access still has an access base, even though
198198
the use-def search does not begin at a `begin_access` marker. For
199199
non-formal access, SIL verification is not as strict. An invalid
@@ -264,7 +264,7 @@ end_access %outerAccess : $*Int
264264

265265
For most purposes, the inner access scopes are irrelevant. When we ask
266266
for the "accessed storage" for `%innerAccess`, we get an
267-
`AccessedStorage` value of "Stack" kind with base `%var =
267+
`AccessStorage` value of "Stack" kind with base `%var =
268268
alloc_stack`. If instead of finding the original accessed storage, we
269269
want to identify the enclosing formal access scope, we need to use a
270270
different API that supports the special `Nested` storage kind. This is
@@ -371,9 +371,9 @@ bb3(%p3 : $Builtin.RawPointer):
371371
load %field : $*Int64
372372
```
373373

374-
## AccessedStorage
374+
## AccessStorage
375375

376-
`AccessedStorage` identifies an accessed storage location, be it a
376+
`AccessStorage` identifies an accessed storage location, be it a
377377
box, stack location, class property, global variable, or argument. It
378378
is implemented as a value object that requires no compile-time memory
379379
allocation and can be used as the hash key for that location. Extra
@@ -383,9 +383,9 @@ accessed and information about the location's uniqueness or whether it
383383
is distinct from other storage.
384384

385385
Two __uniquely identified__ storage locations may only alias if their
386-
AccessedStorage objects are identical.
386+
AccessStorage objects are identical.
387387

388-
`AccessedStorage` records the "root" SILValue of the access. The root is
388+
`AccessStorage` records the "root" SILValue of the access. The root is
389389
the same as the access base for all storage kinds except global and
390390
class storage. For class properties, the storage root is the reference
391391
root of the object, not the base of the property. Multiple
@@ -396,11 +396,11 @@ instructions may reference the same variable. To find all global uses,
396396
the client must independently find all global variable references
397397
within the function. Clients that need to know which SILValue base was
398398
discovered during use-def traversal in all cases can make use of
399-
`AccessedStorageWithBase` or `AccessPathWithBase`.
399+
`AccessStorageWithBase` or `AccessPathWithBase`.
400400

401401
### AccessPath
402402

403-
`AccessPath` extends `AccessedStorage` to include the path components
403+
`AccessPath` extends `AccessStorage` to include the path components
404404
that determine the address of a subobject within the access base. The
405405
access path is a string of index offsets and subobject projection
406406
indices.

0 commit comments

Comments
 (0)