authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-05-28 09:06:25+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-06-06 20:34:53+07:00
log89b4195c69c53e8b1fdd3f5ddd2c9658a61daaac
tree534573f28c7950b16506f08a51a1f5a6c27a201a
parent3220e0b61c127b60188a040b5f4679765e8f6f40

stage2: sparc64: Account for delay slot in airBlock


1 files changed, 7 insertions(+), 2 deletions(-)

src/arch/sparc64/CodeGen.zig+7-2
......@@ -991,9 +991,14 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void {
991991 const relocs = &self.blocks.getPtr(inst).?.relocs;
992992 if (relocs.items.len > 0 and relocs.items[relocs.items.len - 1] == self.mir_instructions.len - 1) {
993993 // If the last Mir instruction is the last relocation (which
994 // would just jump one instruction further), it can be safely
994 // would just jump two instruction further), it can be safely
995995 // removed
996 self.mir_instructions.orderedRemove(relocs.pop());
996 const index = relocs.pop();
997
998 // First, remove the delay slot, then remove
999 // the branch instruction itself.
1000 self.mir_instructions.orderedRemove(index + 1);
1001 self.mir_instructions.orderedRemove(index);
9971002 }
9981003 for (relocs.items) |reloc| {
9991004 try self.performReloc(reloc);