From 3145fa97c21704d8822db928e5f988f22497b1b8 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 17 Jan 2022 21:52:15 +0100 Subject: [PATCH] stage2: separate ptr and stack offset codepaths in genSetStack --- src/arch/x86_64/CodeGen.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 961bf365d6..2cf585fe4e 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -3252,9 +3252,11 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro } return self.fail("TODO implement memcpy for setting stack from {}", .{mcv}); }, - .ptr_stack_offset, - .stack_offset, - => |off| { + .ptr_stack_offset => { + const reg = try self.copyToTmpRegister(ty, mcv); + return self.genSetStack(ty, stack_offset, MCValue{ .register = reg }); + }, + .stack_offset => |off| { if (stack_offset == off) { // Copy stack variable to itself; nothing to do. return;