Commit 5f25684
committed
Handle up to 2^16 - 1 operands per inst, and error properly on more.
This PR addresses an underlying limitation that became a problem for
Cranelift recently, after folding return-value loads into call
pseudoinsts (thus producing single instructions with many operands): we
only supported 255 operands per instruction.
It appears that `Use` was using a `u8` for the "slot index" for an
operand as a result of earlier optimization/packing efforts. However,
the current shape of the struct leaves a padding byte free, so we should
be able to expand to a `u16` with no loss in performance.
Furthermore, previously we weren't catching the overflow, but rather
were silently wrapping around (eek). This properly returns a
`RegAllocError::TooManyOperands` now if an instruction has too many
operands (more than `u16::MAX`).1 parent b2bb25d commit 5f25684
4 files changed
+39
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
319 | | - | |
| 318 | + | |
| 319 | + | |
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| |||
713 | 713 | | |
714 | 714 | | |
715 | 715 | | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
| 716 | + | |
721 | 717 | | |
722 | 718 | | |
723 | 719 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
97 | 102 | | |
98 | 103 | | |
99 | 104 | | |
| |||
221 | 226 | | |
222 | 227 | | |
223 | 228 | | |
224 | | - | |
225 | | - | |
226 | | - | |
| 229 | + | |
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
| |||
362 | 365 | | |
363 | 366 | | |
364 | 367 | | |
365 | | - | |
| 368 | + | |
366 | 369 | | |
367 | 370 | | |
368 | 371 | | |
| |||
456 | 459 | | |
457 | 460 | | |
458 | 461 | | |
459 | | - | |
460 | | - | |
461 | | - | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
462 | 467 | | |
463 | 468 | | |
464 | 469 | | |
| |||
527 | 532 | | |
528 | 533 | | |
529 | 534 | | |
530 | | - | |
531 | | - | |
| 535 | + | |
532 | 536 | | |
533 | 537 | | |
534 | 538 | | |
535 | 539 | | |
536 | | - | |
537 | | - | |
| 540 | + | |
| 541 | + | |
538 | 542 | | |
539 | 543 | | |
540 | 544 | | |
| |||
638 | 642 | | |
639 | 643 | | |
640 | 644 | | |
641 | | - | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
642 | 649 | | |
643 | 650 | | |
644 | 651 | | |
| |||
681 | 688 | | |
682 | 689 | | |
683 | 690 | | |
684 | | - | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
685 | 695 | | |
686 | 696 | | |
687 | 697 | | |
| |||
756 | 766 | | |
757 | 767 | | |
758 | 768 | | |
| 769 | + | |
| 770 | + | |
759 | 771 | | |
760 | 772 | | |
761 | 773 | | |
| |||
837 | 849 | | |
838 | 850 | | |
839 | 851 | | |
840 | | - | |
841 | | - | |
842 | | - | |
| 852 | + | |
843 | 853 | | |
844 | 854 | | |
845 | 855 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1577 | 1577 | | |
1578 | 1578 | | |
1579 | 1579 | | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
1580 | 1583 | | |
1581 | 1584 | | |
1582 | 1585 | | |
| |||
0 commit comments