authorgravatar for miguel.p.paradinha@gmail.commparadinha <miguel.p.paradinha@gmail.com> 2022-01-23 22:04:50+00:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-01-24 23:19:53+01:00
log2e9ce6facd47189c4bbcd90a2a6ba1a689bfbde3
tree259e9fc054687e0fddc8f491c0ad416c5ad63132
parent76654015009038a07f14b9eb8500bb84e9e28099

stage2: x64: fix printing of callee preserved regs instructions


1 files changed, 4 insertions(+), 1 deletions(-)

src/arch/x86_64/PrintMir.zig+4-1
...@@ -186,8 +186,11 @@ fn mirPushPopRegsFromCalleePreservedRegs(print: *const Print, tag: Mir.Inst.Tag,...@@ -186,8 +186,11 @@ fn mirPushPopRegsFromCalleePreservedRegs(print: *const Print, tag: Mir.Inst.Tag,
186 const regs = data.regs;186 const regs = data.regs;
187 var disp: u32 = data.disp + 8;187 var disp: u32 = data.disp + 8;
188 if (regs == 0) return w.writeAll("no regs from callee_preserved_regs\n");188 if (regs == 0) return w.writeAll("no regs from callee_preserved_regs\n");
189 var printed_first_reg = false;
189 for (bits.callee_preserved_regs) |reg, i| {190 for (bits.callee_preserved_regs) |reg, i| {
190 if ((regs >> @intCast(u5, i)) & 1 == 0) continue;191 if ((regs >> @intCast(u5, i)) & 1 == 0) continue;
192 if (printed_first_reg) try w.writeAll(" ");
193 printed_first_reg = true;
191 if (tag == .push) {194 if (tag == .push) {
192 try w.print("mov qword ptr [{s} + {d}], {s}", .{195 try w.print("mov qword ptr [{s} + {d}], {s}", .{
193 @tagName(ops.reg1),196 @tagName(ops.reg1),
...@@ -202,8 +205,8 @@ fn mirPushPopRegsFromCalleePreservedRegs(print: *const Print, tag: Mir.Inst.Tag,...@@ -202,8 +205,8 @@ fn mirPushPopRegsFromCalleePreservedRegs(print: *const Print, tag: Mir.Inst.Tag,
202 });205 });
203 }206 }
204 disp += 8;207 disp += 8;
208 try w.writeByte('\n');
205 }209 }
206 try w.writeByte('\n');
207}210}
208211
209fn mirJmpCall(print: *const Print, tag: Mir.Inst.Tag, inst: Mir.Inst.Index, w: anytype) !void {212fn mirJmpCall(print: *const Print, tag: Mir.Inst.Tag, inst: Mir.Inst.Index, w: anytype) !void {