-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vm] Improve same-as-first constraint handling
All other moves generated by the register allocator to satisfy constraints were using `PrefersRegister` for the source, but `SameAsFirstInput` was using `Any`. This lead to situations where hot code inside a loop would repeatedly reload a constant. To avoid these situations switch `SameAsFirstInput` to use `PrefersRegister` when the use occurs inside a loop. Additionally introduce an extension of `SameAsFirstInput`: `SameAsFirstOrSecondInput`. This new constraint allows register allocator to reorder first and second inputs if the second one is no longer alive after the instruction. This allows register allocator to avoid unnecessary move. `SameAsFirstOrSecondInput` can be used as an output constraint for commutative binary operations on X64 Additionally this CL adds a nascent infrastructure for writing unit tests against register allocator. See `linearscan_test.cc`. This CL improves code quality for tight loops with binary double operations written with constants on the left, for example: loop { doubleA = C * doubleB } Before this CL `C` would be reloaded into a register immediately before multiplication, but after this CL it will be kept in register (if register pressure allows). Issue #56705 TEST=LinearScan_TestSameAsFirstOrSecond* Change-Id: Id8e8242a8d1c1d1b8958076f10257e21e4a00aae Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385001 Reviewed-by: Alexander Markov <[email protected]> Commit-Queue: Slava Egorov <[email protected]>
- Loading branch information
Showing
11 changed files
with
328 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.