Commit Graph

1 Commits

Author SHA1 Message Date
Alyssa Rosenzweig 04a2c6efb1 util: Add a generic worklist implementation
Models a double-ended queue of elements from an a list. Based on NIR's worklist
data structure. This is useful in most backend compilers for data flow analysis.

Using this data structure has several advantages for backends:

* Simplicity, avoids open-coding a worklist data structure.
* Performance, the data structure is lighter weight than e.g sets
* Correctness, e.g. sets are nondeterministic and can cause random bugs.

Using a worklist approach at all is good for performance of liveness analysis
to avoid performing excess walks over the IR.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16046>
2022-04-25 23:50:57 +00:00