| ... | ... | @@ -2244,7 +2244,9 @@ fn genBinMathOpMir(self: *Self, mir_tag: Mir.Inst.Tag, dst_ty: Type, dst_mcv: MC |
| 2244 | 2244 | .none => unreachable, |
| 2245 | 2245 | .undef => try self.genSetReg(dst_ty, dst_reg, .undef), |
| 2246 | 2246 | .dead, .unreach => unreachable, |
| 2247 | | .ptr_stack_offset => unreachable, |
| 2247 | .ptr_stack_offset => |off| { |
| 2248 | return self.genBinMathOpMir(mir_tag, dst_ty, dst_mcv, .{ .immediate = @bitCast(u32, off) }); |
| 2249 | }, |
| 2248 | 2250 | .ptr_embedded_in_code => unreachable, |
| 2249 | 2251 | .register => |src_reg| { |
| 2250 | 2252 | _ = try self.addInst(.{ |
| ... | ... | @@ -2265,16 +2267,17 @@ fn genBinMathOpMir(self: *Self, mir_tag: Mir.Inst.Tag, dst_ty: Type, dst_mcv: MC |
| 2265 | 2267 | .data = .{ .imm = @truncate(u32, imm) }, |
| 2266 | 2268 | }); |
| 2267 | 2269 | }, |
| 2268 | | .embedded_in_code, .memory => { |
| 2270 | .embedded_in_code, |
| 2271 | .memory, |
| 2272 | .got_load, |
| 2273 | .direct_load, |
| 2274 | => { |
| 2269 | 2275 | assert(abi_size <= 8); |
| 2270 | 2276 | self.register_manager.freezeRegs(&.{dst_reg}); |
| 2271 | 2277 | defer self.register_manager.unfreezeRegs(&.{dst_reg}); |
| 2272 | 2278 | const reg = try self.copyToTmpRegister(dst_ty, src_mcv); |
| 2273 | 2279 | return self.genBinMathOpMir(mir_tag, dst_ty, dst_mcv, .{ .register = reg }); |
| 2274 | 2280 | }, |
| 2275 | | .got_load, .direct_load => { |
| 2276 | | return self.fail("TODO implement x86 ADD/SUB/CMP source symbol at index in linker", .{}); |
| 2277 | | }, |
| 2278 | 2281 | .stack_offset => |off| { |
| 2279 | 2282 | if (off > math.maxInt(i32)) { |
| 2280 | 2283 | return self.fail("stack offset too large", .{}); |
| ... | ... | @@ -4620,6 +4623,9 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { |
| 4620 | 4623 | } |
| 4621 | 4624 | |
| 4622 | 4625 | switch (typed_value.ty.zigTypeTag()) { |
| 4626 | .Array => { |
| 4627 | return self.lowerUnnamedConst(typed_value); |
| 4628 | }, |
| 4623 | 4629 | .Pointer => switch (typed_value.ty.ptrSize()) { |
| 4624 | 4630 | .Slice => { |
| 4625 | 4631 | return self.lowerUnnamedConst(typed_value); |