mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
implement storing to MCValue.memory
This commit is contained in:
parent
5cf918143c
commit
cc16ac9314
@ -1762,8 +1762,19 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type
|
||||
},
|
||||
}
|
||||
},
|
||||
.memory => {
|
||||
return self.fail("TODO implement storing to MCValue.memory", .{});
|
||||
.memory => |addr| {
|
||||
const reg = try self.copyToTmpRegister(ptr_ty, .{ .memory = addr });
|
||||
// mov reg, [reg]
|
||||
_ = try self.addInst(.{
|
||||
.tag = .mov,
|
||||
.ops = (Mir.Ops{
|
||||
.reg1 = reg.to64(),
|
||||
.reg2 = reg.to64(),
|
||||
.flags = 0b10,
|
||||
}).encode(),
|
||||
.data = .{ .imm = 0 },
|
||||
});
|
||||
return self.store(.{ .register = reg }, value, ptr_ty, value_ty);
|
||||
},
|
||||
.stack_offset => {
|
||||
return self.fail("TODO implement storing to MCValue.stack_offset", .{});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user