309 Commits

Author SHA1 Message Date
Chris Fallin
7724dc6f5a Merge pull request #10 from cfallin/cargo-deny-config
Add cargo-deny config.
2021-09-06 20:01:12 -07:00
Chris Fallin
8191d6cbcf Add cargo-deny config.
This was excluded by mistake in #1; without a configuration, cargo-deny
runs with a default one, and rejects a lot of things (largely due to
open-source-but-not-allowlisted licenses).

This `deny.toml` comes from the regalloc.rs repo. It results in one
warning currently that will be resolved once #7 is.
2021-09-03 09:04:20 -07:00
Chris Fallin
57ccaefa04 Merge pull request #1 from cfallin/initial-regalloc
Initial implementation of regalloc2.
2021-08-31 18:19:59 -07:00
Chris Fallin
6f0893d69d Address review comments. 2021-08-31 17:56:06 -07:00
Chris Fallin
6389071e09 Address review comments. 2021-08-31 17:42:50 -07:00
Chris Fallin
b19fa4857f Rename operand positions to Early and Late, and make weights f16/f32 values. 2021-08-31 17:31:23 -07:00
Chris Fallin
3a18564e98 Addressed more review comments. 2021-08-30 17:51:55 -07:00
Chris Fallin
6d313f2b56 Address review comments: more doc comments and some minor refactorings. 2021-08-30 17:15:37 -07:00
Chris Fallin
e10bffbca8 Fix bug in refactored BitVec (found by @Amanieu). 2021-08-14 13:40:43 -07:00
Chris Fallin
69ad31f013 Replace remaining instances of use of debug feature with debug_assertions.
Also fix some code that did not build in debug mode anymore (d'oh!) in
`src/ion/merges.rs`, as exposed by this change.
2021-08-12 17:35:55 -07:00
Chris Fallin
8ed83e3a57 Fix BitVec::get_or_insert to scan only once. 2021-08-12 15:40:34 -07:00
Chris Fallin
f1a989f1b7 Add malloc/free optimization to TODO 2021-08-12 14:53:53 -07:00
Chris Fallin
ffc06b2099 Debug output for Operands: omit default/most common positions. 2021-08-12 14:49:42 -07:00
Chris Fallin
c071e44fc0 Derive PartialOrd/Ord/Hash for Operand. 2021-08-12 14:43:13 -07:00
Chris Fallin
eaf8647fdf BitVec: remove zero words to avoid expanding when unnecessary. 2021-08-12 14:40:18 -07:00
Chris Fallin
82b7e6ba7b Review feedback: bitvec: struct-like enum variants, and factor out one-item cache. 2021-08-12 14:33:35 -07:00
Chris Fallin
7652b4b109 Review feedback. 2021-08-12 14:27:20 -07:00
Chris Fallin
2f856435f4 Review feedback. 2021-08-12 14:08:10 -07:00
Chris Fallin
b76b7747d0 Fix comment in postorder.rs. 2021-08-12 14:00:20 -07:00
Chris Fallin
1f30958b5a Improve domtree as per @Amanieu's feedback. 2021-08-12 12:13:56 -07:00
Chris Fallin
3e1e0f39b6 Convert all log::debug to log::trace. 2021-08-12 12:05:19 -07:00
Chris Fallin
38323e0c27 Some more design-doc and TODO updates from @julian-seward1's feedback. 2021-08-12 11:39:38 -07:00
Chris Fallin
0c795842fd Add some more detail about spill bundles to design doc. 2021-08-12 11:26:45 -07:00
Chris Fallin
a591535fe9 Use "vector" or "sequence" in lieu of "list" in DESIGN.md, except when referring to linked lists.
From feedback from @julian-seward1. I had used "list" in a more generic
sense, meaning ordered sequence of elements, while in a Rust context it
can sometimes be confused with "linked list" specifically. These
alternative terms are more precise.
2021-08-12 11:23:47 -07:00
Chris Fallin
84285c26fb Rename OperandPolicy to OperandConstraint as per feedback from @julian-seward1. 2021-08-12 11:17:52 -07:00
Chris Fallin
c9e8a87cea Update TODO with new items from private feedback from @julian-seward1. 2021-08-12 11:17:37 -07:00
Chris Fallin
4c193a9499 Fix heuristic-cost function overflow with high loop depth (found by @Amanieu). 2021-07-28 12:37:32 -07:00
Chris Fallin
66d6821c7b Fix perf issue with many safepoints.
In wasmtime's `gc::many_live_refs` unit-test, approximately ~1K vregs
are live over ~1K safepoints (actually, each vreg is live over half the
safepoints on average, in a LIFO sort of arrangement).

This causes a huge slowdown with the current heuristics. Basically, each
vreg had a `Conflict` requirement because it had both stack uses
(safepoints) and register uses (the actual def and normal use). The
action in this case when processing the vreg's bundle is to split off
the first use -- a conservative-but-correct approach that will always
eventually split bundles far enough to get non-conflicting-requirement
pieces.

However, because each vreg had N stack uses followed by one register
use, this meant that each had to be split N times (!) -- so we had
O(n^2) splits and O(n^2) bundles by the end of the allocation.

This instead implements another simple heuristic that is much better:
when the requirements are conflicting, scan forward and find the exact
point at which the requirements become conflicting, such that the prefix
(first half prior to the split) still has no conflict, and split there.
This turns the above test-case into an O(n)-bundle / O(n)-split
situation.
2021-06-22 14:06:59 -07:00
Chris Fallin
f27abc9c48 Remove infinite-loop check: it is not a high enough bound in some pathological cases (e.g., gc::many_live_refs test in wasmtime), and it has served its purpose in testing. We can rely on more detailed assertions, e.g. that splits actually shrink bundles and that bundles evict only lower-priority bundles, instead. 2021-06-22 12:06:12 -07:00
Chris Fallin
245c212289 Revert "Add fixed-non-allocatable operand support."
This feature needs more thought; for now we will of course continue to
support pinned vregs, but perhaps we can do better for
"pass-through-and-forget" operands that are given non-allocatable
registers.

This reverts commit 736f636c36.
2021-06-20 23:03:44 -07:00
Chris Fallin
21fb233809 reduce nesting level in DESIGN.md to make pandoc-to-pdf happy 2021-06-19 13:41:26 -07:00
Chris Fallin
a58d36fd94 TODO update: make note on idea for large-input support 2021-06-19 13:20:11 -07:00
Chris Fallin
22eed0a6ae Make bitvec public; it is used by regalloc.rs shim too. 2021-06-19 12:47:02 -07:00
Chris Fallin
736f636c36 Add fixed-non-allocatable operand support. 2021-06-19 12:17:18 -07:00
Chris Fallin
50eb6fc42f Keep internal modules private, but re-export under fuzzing feature flag 2021-06-19 12:08:37 -07:00
Chris Fallin
caf7274efd Remove unused pred_pos 2021-06-19 11:48:54 -07:00
Chris Fallin
36975b8b6f Add doc-comment note on Edit that stack-to-stack moves are never generated. 2021-06-19 11:34:05 -07:00
Chris Fallin
b36a563d69 Cleanup: split allocator implemntation into 11 files of more reasonable size. 2021-06-18 16:51:41 -07:00
Chris Fallin
6944bc4735 Fix typo (thanks @bjorn3).
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-06-18 15:24:11 -07:00
Chris Fallin
6ec6207717 Add design document. 2021-06-18 13:59:12 -07:00
Chris Fallin
a686d5a513 Always recompute prio when recomputing bundle properties; otherwise is zero on new bundles and causes spill weight to be zeroed 2021-06-11 13:21:50 -07:00
Chris Fallin
ea814225a2 Update TODO list 2021-06-10 23:34:18 -07:00
Chris Fallin
1bd1248cb5 Avoid stack-to-stack moves by allocating an extra spillslot and re-using the scratch reg instead. 2021-06-10 22:36:02 -07:00
Chris Fallin
09b2dd4e73 TODO list update 2021-06-10 17:34:04 -07:00
Chris Fallin
fcbf384d74 Use hashset to avoid linear scan in conflict-bundle-set deduplication 2021-06-09 23:53:54 -07:00
Chris Fallin
4ba7b2f57e Improve redundant-move elimination: don't skip the case where we don't hvae vreg metadata within a BB. Instead, keep the checker happy by feeding more metadata to it on every move. 2021-06-09 23:29:48 -07:00
Chris Fallin
2851ac80c7 Working redundant-move elimination 2021-06-09 23:03:16 -07:00
Chris Fallin
f898b8dcbd Some fuzzbug fixes 2021-06-09 20:58:54 -07:00
Chris Fallin
e33790d8e7 do not remove redundant move if we don't have local (within-basic-block) vreg tags, as this might throw off the checker 2021-06-08 01:30:29 -07:00
Chris Fallin
0f270e5bcc WIP. 2021-06-08 01:14:10 -07:00