authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-01-23 00:31:37+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-01-23 00:31:37+01:00
log36f13f5911192440e51422b58e9275b7b7ed746a
treeb5e973a81056e36e1243e1e48278a202f98eff3b
parent081ce09575426086bca1164ae733e476b99a0253

stage2: remove asserts and comments which are Emit.zig responsibility


1 files changed, 0 insertions(+), 13 deletions(-)

src/arch/x86_64/CodeGen.zig-13
......@@ -3740,22 +3740,9 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void
37403740 .data = .{ .payload = payload },
37413741 });
37423742 } else {
3743 // This requires two instructions; a move imm as used above, followed by an indirect load using the register
3744 // as the address and the register as the destination.
3745 //
3746 // This cannot be used if the lower three bits of the id are equal to four or five, as there
3747 // is no way to possibly encode it. This means that RSP, RBP, R12, and R13 cannot be used with
3748 // this instruction.
3749 const id3 = @truncate(u3, reg.id());
3750 assert(id3 != 4 and id3 != 5);
3751
37523743 // Rather than duplicate the logic used for the move, we just use a self-call with a new MCValue.
37533744 try self.genSetReg(ty, reg, MCValue{ .immediate = x });
37543745
3755 // Now, the register contains the address of the value to load into it
3756 // Currently, we're only allowing 64-bit registers, so we need the `REX.W 8B /r` variant.
3757 // TODO: determine whether to allow other sized registers, and if so, handle them properly.
3758
37593746 // mov reg, [reg + 0x0]
37603747 _ = try self.addInst(.{
37613748 .tag = .mov,