Conventional SSA (also called CSSA) requires phi nodes be isolated by
parallel copies such that there is no interference between SSA values.
This is required for many out-of-SSA algorithms and, in our case, a
prerequisite for spilling.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
For spilling, we want to be able to treat TLS as if it were a register
file. It unifies and makes everything easier. Also add support to
OpCopy to for copying between GPR and Mem. We cannot, however copy
directly from Mem to Mem.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
Instead of using OpMov or OpParCopy, use OpCopy directly. This reserves
OpParCopy for RA type things and OpMOv for actual codegen. We can also
drop OpMov from copy propagation now.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This increases the size of RegRef to 32 bits but that's fine given that
it's usually in a union with SSARef which is 128 bits. The real
advantage is that it allows us to start treating memory as a register
type which will come in really useful for spilling.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This gets rid of most of the per-block hash maps and replaces them all
with vectors. This is both simpler and should be quite a bit more
efficient (though block lookup isn't common).
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This renames CFG to CFG2 and moves to storing the blocks in a CFG
instead of a Vec. This should let us make a bunch of other data
structures drop to a vec instead of a hash map now that we can rely on
the CFG instead of BasicBlock::id.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This is a pair of vectors but it acts a bit like a vector of a pair.
Everything is inserted, removed, iterated, etc. in tandem to ensure that
we never mismatch between the two vectors. However, because they're two
separate vectors, we ensure that it can be used to store Src and Dst and
keep everything contiguous.
Of particular interest is the new retain() method which is equivalent to
Vec::retain() which allows filtering a VecPair. This tricky operation
is performed three different times by DCE and will be needed in spilling
as well.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This one is much faster to compute because we can use bitops for the
fixed-point data-flow algorithm rather than the clumsy walking of hash
sets. The faster version is sufficient for RA and checking for register
pressure. We only need to fall back to the slower version for spilling.
Thanks to traits, we can get some of the same behavior with both.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
One could argue that this should go in the function and not be an
on-demand analysis pass but we can do that later. For now, we just
break it out into a separate data structure.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>