Commit 418abb9
committed
[cc] aarch64 regalloc fix
Fixed bug in cc/arch/aarch64/regalloc.rs:
The aarch64 register allocator was calculating stack offsets independently for int and FP overflow arguments:
// Before (wrong):
// FP overflow: offset = 16 + (fp_arg_idx - 8) * 8
// Int overflow: offset = 16 + (int_arg_idx - 8) * 8
// Both start at 16 → collision when both overflow!
Per AAPCS64, stack arguments must be placed in parameter order (not separated by type). Fixed by using a single shared stack_arg_offset counter.
Verified with clang cross-compilation:
- q (int #9) should be at stack offset 0
- r (double #9) should be at stack offset 81 parent 9823bd9 commit 418abb9
1 file changed
+16
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
656 | 661 | | |
657 | 662 | | |
658 | 663 | | |
659 | 664 | | |
660 | 665 | | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
661 | 669 | | |
662 | 670 | | |
663 | 671 | | |
| |||
684 | 692 | | |
685 | 693 | | |
686 | 694 | | |
687 | | - | |
688 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
689 | 698 | | |
| 699 | + | |
690 | 700 | | |
691 | 701 | | |
692 | 702 | | |
| |||
695 | 705 | | |
696 | 706 | | |
697 | 707 | | |
698 | | - | |
699 | | - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
700 | 712 | | |
701 | 713 | | |
702 | 714 | | |
| |||
0 commit comments