mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:24:33 +01:00
x86_64: fix miscomp where in use register is marked as free
This commit is contained in:
parent
b36ea592b8
commit
4e581427d1
1 changed files with 7 additions and 7 deletions
|
|
@ -352,15 +352,15 @@ pub fn RegisterManager(
|
|||
) AllocateRegistersError!void {
|
||||
log.debug("getReg {} for inst {?}", .{ regAtTrackedIndex(tracked_index), inst });
|
||||
if (!self.isRegIndexFree(tracked_index)) {
|
||||
self.markRegIndexAllocated(tracked_index);
|
||||
|
||||
// Move the instruction that was previously there to a
|
||||
// stack allocation.
|
||||
const spilled_inst = self.registers[tracked_index];
|
||||
if (inst) |tracked_inst| self.registers[tracked_index] = tracked_inst;
|
||||
try self.getFunction().spillInstruction(regAtTrackedIndex(tracked_index), spilled_inst);
|
||||
if (inst == null) self.freeRegIndex(tracked_index);
|
||||
} else self.getRegIndexAssumeFree(tracked_index, inst);
|
||||
try self.getFunction().spillInstruction(
|
||||
regAtTrackedIndex(tracked_index),
|
||||
self.registers[tracked_index],
|
||||
);
|
||||
self.freeRegIndex(tracked_index);
|
||||
}
|
||||
self.getRegIndexAssumeFree(tracked_index, inst);
|
||||
}
|
||||
pub fn getReg(self: *Self, reg: Register, inst: ?Air.Inst.Index) AllocateRegistersError!void {
|
||||
log.debug("getting reg: {}", .{reg});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue