| author | |
| committer | |
| log | 0aee40bd13fa72ac4ca41e133440917c0ed94ffb |
| tree | d3f46db09ea597780d4bb4471249ec2e803dd99f |
| parent | 528c43233f0f566930efc7fc53c4f001dea4dfda |
2 files changed, 29 insertions(+), 2 deletions(-)
src/arch/riscv64/CodeGen.zig+14-1| ... | @@ -2338,7 +2338,20 @@ fn airPtrToInt(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2338,7 +2338,20 @@ fn airPtrToInt(self: *Self, inst: Air.Inst.Index) !void { |
| 2338 | 2338 | ||
| 2339 | fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { | 2339 | fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { |
| 2340 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 2340 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 2341 | const result = try self.resolveInst(ty_op.operand); | 2341 | const result = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2342 | const operand = try self.resolveInst(ty_op.operand); | ||
| 2343 | if (self.reuseOperand(inst, ty_op.operand, 0, operand)) break :result operand; | ||
| 2344 | |||
| 2345 | const operand_lock = switch (operand) { | ||
| 2346 | .register => |reg| self.register_manager.lockReg(reg), | ||
| 2347 | else => null, | ||
| 2348 | }; | ||
| 2349 | defer if (operand_lock) |lock| self.register_manager.unlockReg(lock); | ||
| 2350 | |||
| 2351 | const dest = try self.allocRegOrMem(inst, true); | ||
| 2352 | try self.setRegOrMem(self.air.typeOfIndex(inst), dest, operand); | ||
| 2353 | break :result dest; | ||
| 2354 | }; | ||
| 2342 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 2355 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2343 | } | 2356 | } |
| 2344 | 2357 |
src/arch/sparc64/CodeGen.zig+15-1| ... | @@ -1091,7 +1091,21 @@ fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void | ... | @@ -1091,7 +1091,21 @@ fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void |
| 1091 | 1091 | ||
| 1092 | fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { | 1092 | fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1093 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 1093 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 1094 | const result = try self.resolveInst(ty_op.operand); | 1094 | const result = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1095 | const operand = try self.resolveInst(ty_op.operand); | ||
| 1096 | if (self.reuseOperand(inst, ty_op.operand, 0, operand)) break :result operand; | ||
| 1097 | |||
| 1098 | const operand_lock = switch (operand) { | ||
| 1099 | .register => |reg| self.register_manager.lockReg(reg), | ||
| 1100 | .register_with_overflow => |rwo| self.register_manager.lockReg(rwo.reg), | ||
| 1101 | else => null, | ||
| 1102 | }; | ||
| 1103 | defer if (operand_lock) |lock| self.register_manager.unlockReg(lock); | ||
| 1104 | |||
| 1105 | const dest = try self.allocRegOrMem(inst, true); | ||
| 1106 | try self.setRegOrMem(self.air.typeOfIndex(inst), dest, operand); | ||
| 1107 | break :result dest; | ||
| 1108 | }; | ||
| 1095 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 1109 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1096 | } | 1110 | } |
| 1097 | 1111 |