stage2: sparcv9: Pad branch delay slots with nops

This commit is contained in:
Koakuma 2022-04-21 05:29:15 +07:00 committed by Jakub Konka
parent a00d69ea4a
commit e03ec51b4b

View File

@ -394,7 +394,11 @@ fn gen(self: *Self) !void {
},
});
// TODO Find a way to fill this slot
// Branches in SPARC have a delay slot, that is, the instruction
// following it will unconditionally be executed.
// See: Section 3.2.3 Control Transfer in SPARCv9 manual.
// See also: https://arcb.csc.ncsu.edu/~mueller/codeopt/codeopt00/notes/delaybra.html
// TODO Find a way to fill this delay slot
// nop
_ = try self.addInst(.{
.tag = .nop,
@ -895,6 +899,12 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.
},
},
});
// TODO Find a way to fill this delay slot
_ = try self.addInst(.{
.tag = .nop,
.data = .{ .nop = {} },
});
} else if (func_value.castTag(.extern_fn)) |_| {
return self.fail("TODO implement calling extern functions", .{});
} else {
@ -917,6 +927,12 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.
},
},
});
// TODO Find a way to fill this delay slot
_ = try self.addInst(.{
.tag = .nop,
.data = .{ .nop = {} },
});
}
const result = info.return_value;