Skip to content

Commit 3c84b6f

Browse files
authored
Corrected errors in Fastalloc doc (#199)
1 parent f2b9533 commit 3c84b6f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

doc/FASTALLOC.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Every register class (int, float, and vector) has its own LRU and they
3232
are stored together in an array: `lrus`. An LRU is represented similarly
3333
to a `VRegSet`: it's a circular, doubly-linked list based on a vector.
3434

35-
The last PReg in an LRU is the least-recently allocated PReg:
35+
The last PReg in an LRU is the least recently allocated PReg:
3636

3737
most recently used PReg (head) -> 2nd MRU PReg -> ... -> LRU PReg
3838

@@ -103,11 +103,11 @@ Some invariants that remain true throughout execution:
103103

104104
1. During processing, the allocation of a VReg at any point in time
105105
as indicated in `vreg_allocs` changes exactly twice or thrice.
106-
Initially it is set to none. When it's allocated, it is
106+
Initially, it is set to none. When it's allocated, it is
107107
changed to that allocation. After this, it doesn't change unless
108108
it's evicted or spilled across a block boundary;
109109
if it is, then its current allocation will change to its dedicated
110-
spillslot. After this, it doesn't change again until it's definition
110+
spillslot. After this, it doesn't change again until its definition
111111
is reached and it's deallocated, during which its `vreg_allocs`
112112
entry is set to none. The only exception is block parameters that
113113
are never used: these are never allocated.
@@ -125,7 +125,7 @@ virtual registers will be in their dedicated spillslots.
125125
# Instruction Allocation
126126

127127
To allocate a single instruction, the first step is to reset the
128-
`available_pregs` sets to all allocated PRegs.
128+
`available_pregs` sets to all allocatable PRegs.
129129

130130
Next, the selection phase is carried out for all operands with
131131
fixed register constraints: the registers they are constrained to use are
@@ -188,22 +188,22 @@ On the other hand, if the VReg's current allocation is not within
188188
constraints, the selection and eviction phases are carried out for
189189
non-fixed operands. First, a set of PRegs that can be drawn from is
190190
created from `available_pregs`. For early uses and late defs,
191-
this draw-from set is the early set or late set respectively.
191+
this draw-from set is the early set or late set, respectively.
192192
For late uses and early defs, the draw-from set is an intersection
193193
of the available early and late sets (because a PReg used for a late
194194
use can't be reassigned to another operand in the early phase;
195195
likewise, a PReg used for an early def can't be reassigned to another
196196
operand in the late phase).
197197
The LRU for the VReg's regclass is then traversed from the end to find
198-
the least-recently used PReg in the draw-from set. Once a PReg is found,
198+
the least recently used PReg in the draw-from set. Once a PReg is found,
199199
it is marked as the most recently used in the LRU, unavailable in the
200200
`available_pregs` sets, and whatever VReg was in it before is evicted.
201201

202-
The assignment phase is carried out next: the final allocation for the
202+
The assignment phase is carried out next. The final allocation for the
203203
operand is set to the selected register.
204204

205205
If the newly allocated operand has not been allocated before, that is,
206-
this is the first use/def of the VReg encountered, the VReg is
206+
this is the first use/def of the VReg encountered; the VReg is
207207
inserted into `live_vregs` and marked as the value in the allocated
208208
PReg in `vreg_in_preg`.
209209

@@ -230,7 +230,7 @@ Reused inputs are handled by creating a new operand with a fixed register
230230
constraint to use whatever register was assigned to the reuse def.
231231

232232
Because of the way reuse operands and reused inputs are handled, when
233-
selecting a register for an early use operand with a fixed constraint,
233+
selecting a register for an early-use operand with a fixed constraint,
234234
the PReg is also marked as unavailable in the `available_pregs` late
235235
set if the operand is a reused input. And when selecting a register
236236
for reuse def operands, the selected register is marked as unavailable

0 commit comments

Comments
 (0)