Update regalloc document to reflect implementation.
This commit is contained in:
@@ -141,17 +141,18 @@ When all the EBBs in a function are laid out linearly, the live range of a
|
|||||||
value doesn't have to be a contiguous interval, although it will be in a
|
value doesn't have to be a contiguous interval, although it will be in a
|
||||||
majority of cases. There can be holes in the linear live range.
|
majority of cases. There can be holes in the linear live range.
|
||||||
|
|
||||||
The live range of an SSA value is represented as:
|
The part of a value's live range that falls inside a single EBB will always be
|
||||||
|
an interval without any holes. This follows from the dominance requirements of
|
||||||
|
SSA. A live range is represented as:
|
||||||
|
|
||||||
- The earliest program point where the value is live.
|
- The interval inside the EBB where the value is defined.
|
||||||
- The latest program point where the value is live.
|
- A set of intervals for EBBs where the value is live-in.
|
||||||
- A (often empty) list of holes, sorted in program order.
|
|
||||||
|
|
||||||
Any value that is only used inside a single EBB will have a live range without
|
Any value that is only used inside a single EBB will have an empty set of
|
||||||
holes. Some values are live across large parts of the function, and this can
|
live-in intervals. Some values are live across large parts of the function, and
|
||||||
often be represented with very few holes. It is important that the live range
|
this can often be represented with coalesced live-in intervals covering many
|
||||||
data structure doesn't have to grow linearly with the number of EBBs covered by
|
EBBs. It is important that the live range data structure doesn't have to grow
|
||||||
a live range.
|
linearly with the number of EBBs covered by a live range.
|
||||||
|
|
||||||
This representation is very similar to LLVM's ``LiveInterval`` data structure
|
This representation is very similar to LLVM's ``LiveInterval`` data structure
|
||||||
with a few important differences:
|
with a few important differences:
|
||||||
@@ -160,10 +161,16 @@ with a few important differences:
|
|||||||
``LiveInterval`` represents the union of multiple related SSA values in a
|
``LiveInterval`` represents the union of multiple related SSA values in a
|
||||||
virtual register. This makes Cretonne's representation smaller because
|
virtual register. This makes Cretonne's representation smaller because
|
||||||
individual segments don't have to annotated with a value number.
|
individual segments don't have to annotated with a value number.
|
||||||
- Cretonne stores the min and max program points separately from a list of
|
- Cretonne stores the def-interval separately from a list of coalesced live-in
|
||||||
holes, while LLVM stores an array of segments. The two representations are
|
intervals, while LLVM stores an array of segments. The two representations
|
||||||
equivalent, but Cretonne optimizes for the common case of a single contiguous
|
are equivalent, but Cretonne optimizes for the common case of a value that is
|
||||||
interval.
|
only used locally.
|
||||||
|
- It is simpler to check if two live ranges are overlapping. The dominance
|
||||||
|
properties of SSA form means that it is only necessary to check the
|
||||||
|
def-interval of each live range against the intervals of the other range. It
|
||||||
|
is not necessary to check for overlap between the two sets of live-in
|
||||||
|
intervals. This makes the overlap check logarithmic in the number of live-in
|
||||||
|
intervals instead of linear.
|
||||||
- LLVM represents a program point as ``SlotIndex`` which holds a pointer to a
|
- LLVM represents a program point as ``SlotIndex`` which holds a pointer to a
|
||||||
32-byte ``IndexListEntry`` struct. The entries are organized in a double
|
32-byte ``IndexListEntry`` struct. The entries are organized in a double
|
||||||
linked list that mirrors the ordering of instructions in a basic block. This
|
linked list that mirrors the ordering of instructions in a basic block. This
|
||||||
|
|||||||
Reference in New Issue
Block a user