| ... | ... | @@ -588,9 +588,9 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 588 | 588 | entry.value = .dead; |
| 589 | 589 | switch (prev_value) { |
| 590 | 590 | .register => |reg| { |
| 591 | | const reg64 = if (arch == .x86_64) reg.to64() else reg; |
| 592 | | _ = branch.registers.remove(reg64); |
| 593 | | branch.markRegFree(reg64); |
| 591 | const canon_reg = toCanonicalReg(reg); |
| 592 | _ = branch.registers.remove(canon_reg); |
| 593 | branch.markRegFree(canon_reg); |
| 594 | 594 | }, |
| 595 | 595 | else => {}, // TODO process stack allocation death |
| 596 | 596 | } |
| ... | ... | @@ -2097,5 +2097,14 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 2097 | 2097 | else => return reg, |
| 2098 | 2098 | } |
| 2099 | 2099 | } |
| 2100 | |
| 2101 | /// For most architectures this does nothing. For x86_64 it resolves any aliased registers |
| 2102 | /// to the 64-bit wide ones. |
| 2103 | fn toCanonicalReg(reg: Register) Register { |
| 2104 | return switch (arch) { |
| 2105 | .x86_64 => reg.to64(), |
| 2106 | else => reg, |
| 2107 | }; |
| 2108 | } |
| 2100 | 2109 | }; |
| 2101 | 2110 | } |