aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormparadinha <miguel.p.paradinha@gmail.com>2022-01-23 22:04:50 +0000
committerJakub Konka <kubkon@jakubkonka.com>2022-01-24 23:19:53 +0100
commit2e9ce6facd47189c4bbcd90a2a6ba1a689bfbde3 (patch)
tree259e9fc054687e0fddc8f491c0ad416c5ad63132 /src
parent76654015009038a07f14b9eb8500bb84e9e28099 (diff)
downloadzig-2e9ce6facd47189c4bbcd90a2a6ba1a689bfbde3.tar.gz
zig-2e9ce6facd47189c4bbcd90a2a6ba1a689bfbde3.zip
stage2: x64: fix printing of callee preserved regs instructions
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86_64/PrintMir.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/arch/x86_64/PrintMir.zig b/src/arch/x86_64/PrintMir.zig
index a7a4666f77..8f30802912 100644
--- a/src/arch/x86_64/PrintMir.zig
+++ b/src/arch/x86_64/PrintMir.zig
@@ -186,8 +186,11 @@ fn mirPushPopRegsFromCalleePreservedRegs(print: *const Print, tag: Mir.Inst.Tag,
const regs = data.regs;
var disp: u32 = data.disp + 8;
if (regs == 0) return w.writeAll("no regs from callee_preserved_regs\n");
+ var printed_first_reg = false;
for (bits.callee_preserved_regs) |reg, i| {
if ((regs >> @intCast(u5, i)) & 1 == 0) continue;
+ if (printed_first_reg) try w.writeAll(" ");
+ printed_first_reg = true;
if (tag == .push) {
try w.print("mov qword ptr [{s} + {d}], {s}", .{
@tagName(ops.reg1),
@@ -202,8 +205,8 @@ fn mirPushPopRegsFromCalleePreservedRegs(print: *const Print, tag: Mir.Inst.Tag,
});
}
disp += 8;
+ try w.writeByte('\n');
}
- try w.writeByte('\n');
}
fn mirJmpCall(print: *const Print, tag: Mir.Inst.Tag, inst: Mir.Inst.Index, w: anytype) !void {