| ... | @@ -207,10 +207,12 @@ pub const MCValue = union(enum) { | ... | @@ -207,10 +207,12 @@ pub const MCValue = union(enum) { |
| 207 | /// The value is a pointer to a value referenced indirectly via GOT. | 207 | /// The value is a pointer to a value referenced indirectly via GOT. |
| 208 | /// Payload is a symbol index. | 208 | /// Payload is a symbol index. |
| 209 | lea_got: u32, | 209 | lea_got: u32, |
| 210 | /// TODO indirection via actual .got table | 210 | /// The value is an extern variable referenced via GOT. |
| 211 | /// LOL Jakub, the king of naming... | 211 | /// Payload is a symbol index. |
| 212 | load_actual_got: u32, | 212 | load_extern_got: u32, |
| 213 | lea_actual_got: u32, | 213 | /// The value is a pointer to an extern variable referenced via GOT. |
| | 214 | /// Payload is a symbol index. |
| | 215 | lea_extern_got: u32, |
| 214 | /// The value is a threadlocal variable. | 216 | /// The value is a threadlocal variable. |
| 215 | /// Payload is a symbol index. | 217 | /// Payload is a symbol index. |
| 216 | load_tlv: u32, | 218 | load_tlv: u32, |
| ... | @@ -299,7 +301,7 @@ pub const MCValue = union(enum) { | ... | @@ -299,7 +301,7 @@ pub const MCValue = union(enum) { |
| 299 | .register_overflow, | 301 | .register_overflow, |
| 300 | .lea_direct, | 302 | .lea_direct, |
| 301 | .lea_got, | 303 | .lea_got, |
| 302 | .lea_actual_got, | 304 | .lea_extern_got, |
| 303 | .lea_tlv, | 305 | .lea_tlv, |
| 304 | .lea_frame, | 306 | .lea_frame, |
| 305 | .reserved_frame, | 307 | .reserved_frame, |
| ... | @@ -313,7 +315,7 @@ pub const MCValue = union(enum) { | ... | @@ -313,7 +315,7 @@ pub const MCValue = union(enum) { |
| 313 | .load_direct => |sym_index| .{ .lea_direct = sym_index }, | 315 | .load_direct => |sym_index| .{ .lea_direct = sym_index }, |
| 314 | .load_got => |sym_index| .{ .lea_got = sym_index }, | 316 | .load_got => |sym_index| .{ .lea_got = sym_index }, |
| 315 | .load_tlv => |sym_index| .{ .lea_tlv = sym_index }, | 317 | .load_tlv => |sym_index| .{ .lea_tlv = sym_index }, |
| 316 | .load_actual_got => |sym_index| .{ .lea_actual_got = sym_index }, | 318 | .load_extern_got => |sym_index| .{ .lea_extern_got = sym_index }, |
| 317 | .load_frame => |frame_addr| .{ .lea_frame = frame_addr }, | 319 | .load_frame => |frame_addr| .{ .lea_frame = frame_addr }, |
| 318 | }; | 320 | }; |
| 319 | } | 321 | } |
| ... | @@ -331,7 +333,7 @@ pub const MCValue = union(enum) { | ... | @@ -331,7 +333,7 @@ pub const MCValue = union(enum) { |
| 331 | .indirect, | 333 | .indirect, |
| 332 | .load_direct, | 334 | .load_direct, |
| 333 | .load_got, | 335 | .load_got, |
| 334 | .load_actual_got, | 336 | .load_extern_got, |
| 335 | .load_tlv, | 337 | .load_tlv, |
| 336 | .load_frame, | 338 | .load_frame, |
| 337 | .reserved_frame, | 339 | .reserved_frame, |
| ... | @@ -342,7 +344,7 @@ pub const MCValue = union(enum) { | ... | @@ -342,7 +344,7 @@ pub const MCValue = union(enum) { |
| 342 | .register_offset => |reg_off| .{ .indirect = reg_off }, | 344 | .register_offset => |reg_off| .{ .indirect = reg_off }, |
| 343 | .lea_direct => |sym_index| .{ .load_direct = sym_index }, | 345 | .lea_direct => |sym_index| .{ .load_direct = sym_index }, |
| 344 | .lea_got => |sym_index| .{ .load_got = sym_index }, | 346 | .lea_got => |sym_index| .{ .load_got = sym_index }, |
| 345 | .lea_actual_got => |sym_index| .{ .load_actual_got = sym_index }, | 347 | .lea_extern_got => |sym_index| .{ .load_extern_got = sym_index }, |
| 346 | .lea_tlv => |sym_index| .{ .load_tlv = sym_index }, | 348 | .lea_tlv => |sym_index| .{ .load_tlv = sym_index }, |
| 347 | .lea_frame => |frame_addr| .{ .load_frame = frame_addr }, | 349 | .lea_frame => |frame_addr| .{ .load_frame = frame_addr }, |
| 348 | }; | 350 | }; |
| ... | @@ -366,8 +368,8 @@ pub const MCValue = union(enum) { | ... | @@ -366,8 +368,8 @@ pub const MCValue = union(enum) { |
| 366 | .lea_direct, | 368 | .lea_direct, |
| 367 | .load_got, | 369 | .load_got, |
| 368 | .lea_got, | 370 | .lea_got, |
| 369 | .load_actual_got, | 371 | .load_extern_got, |
| 370 | .lea_actual_got, | 372 | .lea_extern_got, |
| 371 | .load_tlv, | 373 | .load_tlv, |
| 372 | .lea_tlv, | 374 | .lea_tlv, |
| 373 | .load_frame, | 375 | .load_frame, |
| ... | @@ -402,8 +404,8 @@ pub const MCValue = union(enum) { | ... | @@ -402,8 +404,8 @@ pub const MCValue = union(enum) { |
| 402 | .lea_direct, | 404 | .lea_direct, |
| 403 | .load_got, | 405 | .load_got, |
| 404 | .lea_got, | 406 | .lea_got, |
| 405 | .load_actual_got, | 407 | .load_extern_got, |
| 406 | .lea_actual_got, | 408 | .lea_extern_got, |
| 407 | .load_tlv, | 409 | .load_tlv, |
| 408 | .lea_tlv, | 410 | .lea_tlv, |
| 409 | .lea_frame, | 411 | .lea_frame, |
| ... | @@ -446,8 +448,8 @@ pub const MCValue = union(enum) { | ... | @@ -446,8 +448,8 @@ pub const MCValue = union(enum) { |
| 446 | .lea_direct => |pl| try writer.print("direct:{d}", .{pl}), | 448 | .lea_direct => |pl| try writer.print("direct:{d}", .{pl}), |
| 447 | .load_got => |pl| try writer.print("[got:{d}]", .{pl}), | 449 | .load_got => |pl| try writer.print("[got:{d}]", .{pl}), |
| 448 | .lea_got => |pl| try writer.print("got:{d}", .{pl}), | 450 | .lea_got => |pl| try writer.print("got:{d}", .{pl}), |
| 449 | .load_actual_got => |pl| try writer.print("[actual_got:{d}]", .{pl}), | 451 | .load_extern_got => |pl| try writer.print("[extern_got:{d}]", .{pl}), |
| 450 | .lea_actual_got => |pl| try writer.print("actual_got:{d}", .{pl}), | 452 | .lea_extern_got => |pl| try writer.print("extern_got:{d}", .{pl}), |
| 451 | .load_tlv => |pl| try writer.print("[tlv:{d}]", .{pl}), | 453 | .load_tlv => |pl| try writer.print("[tlv:{d}]", .{pl}), |
| 452 | .lea_tlv => |pl| try writer.print("tlv:{d}", .{pl}), | 454 | .lea_tlv => |pl| try writer.print("tlv:{d}", .{pl}), |
| 453 | .load_frame => |pl| try writer.print("[{} + 0x{x}]", .{ pl.index, pl.off }), | 455 | .load_frame => |pl| try writer.print("[{} + 0x{x}]", .{ pl.index, pl.off }), |
| ... | @@ -475,8 +477,8 @@ const InstTracking = struct { | ... | @@ -475,8 +477,8 @@ const InstTracking = struct { |
| 475 | .lea_direct, | 477 | .lea_direct, |
| 476 | .load_got, | 478 | .load_got, |
| 477 | .lea_got, | 479 | .lea_got, |
| 478 | .load_actual_got, | 480 | .load_extern_got, |
| 479 | .lea_actual_got, | 481 | .lea_extern_got, |
| 480 | .load_tlv, | 482 | .load_tlv, |
| 481 | .lea_tlv, | 483 | .lea_tlv, |
| 482 | .load_frame, | 484 | .load_frame, |
| ... | @@ -536,8 +538,8 @@ const InstTracking = struct { | ... | @@ -536,8 +538,8 @@ const InstTracking = struct { |
| 536 | .lea_direct, | 538 | .lea_direct, |
| 537 | .load_got, | 539 | .load_got, |
| 538 | .lea_got, | 540 | .lea_got, |
| 539 | .load_actual_got, | 541 | .load_extern_got, |
| 540 | .lea_actual_got, | 542 | .lea_extern_got, |
| 541 | .load_tlv, | 543 | .load_tlv, |
| 542 | .lea_tlv, | 544 | .lea_tlv, |
| 543 | .load_frame, | 545 | .load_frame, |
| ... | @@ -573,8 +575,8 @@ const InstTracking = struct { | ... | @@ -573,8 +575,8 @@ const InstTracking = struct { |
| 573 | .lea_direct, | 575 | .lea_direct, |
| 574 | .load_got, | 576 | .load_got, |
| 575 | .lea_got, | 577 | .lea_got, |
| 576 | .load_actual_got, | 578 | .load_extern_got, |
| 577 | .lea_actual_got, | 579 | .lea_extern_got, |
| 578 | .load_tlv, | 580 | .load_tlv, |
| 579 | .lea_tlv, | 581 | .lea_tlv, |
| 580 | .lea_frame, | 582 | .lea_frame, |
| ... | @@ -4391,7 +4393,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4391,7 +4393,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 4391 | .memory, | 4393 | .memory, |
| 4392 | .load_direct, | 4394 | .load_direct, |
| 4393 | .load_got, | 4395 | .load_got, |
| 4394 | .load_actual_got, | 4396 | .load_extern_got, |
| 4395 | .load_tlv, | 4397 | .load_tlv, |
| 4396 | => try self.genSetReg(addr_reg, Type.usize, array.address()), | 4398 | => try self.genSetReg(addr_reg, Type.usize, array.address()), |
| 4397 | .lea_direct, .lea_tlv => unreachable, | 4399 | .lea_direct, .lea_tlv => unreachable, |
| ... | @@ -5872,7 +5874,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerErro | ... | @@ -5872,7 +5874,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerErro |
| 5872 | .register_offset, | 5874 | .register_offset, |
| 5873 | .lea_direct, | 5875 | .lea_direct, |
| 5874 | .lea_got, | 5876 | .lea_got, |
| 5875 | .lea_actual_got, | 5877 | .lea_extern_got, |
| 5876 | .lea_tlv, | 5878 | .lea_tlv, |
| 5877 | .lea_frame, | 5879 | .lea_frame, |
| 5878 | => try self.genCopy(dst_ty, dst_mcv, ptr_mcv.deref()), | 5880 | => try self.genCopy(dst_ty, dst_mcv, ptr_mcv.deref()), |
| ... | @@ -5880,7 +5882,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerErro | ... | @@ -5880,7 +5882,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerErro |
| 5880 | .indirect, | 5882 | .indirect, |
| 5881 | .load_direct, | 5883 | .load_direct, |
| 5882 | .load_got, | 5884 | .load_got, |
| 5883 | .load_actual_got, | 5885 | .load_extern_got, |
| 5884 | .load_tlv, | 5886 | .load_tlv, |
| 5885 | .load_frame, | 5887 | .load_frame, |
| 5886 | => { | 5888 | => { |
| ... | @@ -6019,7 +6021,7 @@ fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerErr | ... | @@ -6019,7 +6021,7 @@ fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerErr |
| 6019 | .register_offset, | 6021 | .register_offset, |
| 6020 | .lea_direct, | 6022 | .lea_direct, |
| 6021 | .lea_got, | 6023 | .lea_got, |
| 6022 | .lea_actual_got, | 6024 | .lea_extern_got, |
| 6023 | .lea_tlv, | 6025 | .lea_tlv, |
| 6024 | .lea_frame, | 6026 | .lea_frame, |
| 6025 | => try self.genCopy(src_ty, ptr_mcv.deref(), src_mcv), | 6027 | => try self.genCopy(src_ty, ptr_mcv.deref(), src_mcv), |
| ... | @@ -6027,7 +6029,7 @@ fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerErr | ... | @@ -6027,7 +6029,7 @@ fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerErr |
| 6027 | .indirect, | 6029 | .indirect, |
| 6028 | .load_direct, | 6030 | .load_direct, |
| 6029 | .load_got, | 6031 | .load_got, |
| 6030 | .load_actual_got, | 6032 | .load_extern_got, |
| 6031 | .load_tlv, | 6033 | .load_tlv, |
| 6032 | .load_frame, | 6034 | .load_frame, |
| 6033 | => { | 6035 | => { |
| ... | @@ -6449,7 +6451,7 @@ fn genUnOpMir(self: *Self, mir_tag: Mir.Inst.FixedTag, dst_ty: Type, dst_mcv: MC | ... | @@ -6449,7 +6451,7 @@ fn genUnOpMir(self: *Self, mir_tag: Mir.Inst.FixedTag, dst_ty: Type, dst_mcv: MC |
| 6449 | .register_overflow, | 6451 | .register_overflow, |
| 6450 | .lea_direct, | 6452 | .lea_direct, |
| 6451 | .lea_got, | 6453 | .lea_got, |
| 6452 | .lea_actual_got, | 6454 | .lea_extern_got, |
| 6453 | .lea_tlv, | 6455 | .lea_tlv, |
| 6454 | .lea_frame, | 6456 | .lea_frame, |
| 6455 | .reserved_frame, | 6457 | .reserved_frame, |
| ... | @@ -6457,7 +6459,7 @@ fn genUnOpMir(self: *Self, mir_tag: Mir.Inst.FixedTag, dst_ty: Type, dst_mcv: MC | ... | @@ -6457,7 +6459,7 @@ fn genUnOpMir(self: *Self, mir_tag: Mir.Inst.FixedTag, dst_ty: Type, dst_mcv: MC |
| 6457 | => unreachable, // unmodifiable destination | 6459 | => unreachable, // unmodifiable destination |
| 6458 | .register => |dst_reg| try self.asmRegister(mir_tag, registerAlias(dst_reg, abi_size)), | 6460 | .register => |dst_reg| try self.asmRegister(mir_tag, registerAlias(dst_reg, abi_size)), |
| 6459 | .register_pair => unreachable, // unimplemented | 6461 | .register_pair => unreachable, // unimplemented |
| 6460 | .memory, .load_got, .load_actual_got, .load_direct, .load_tlv => { | 6462 | .memory, .load_got, .load_extern_got, .load_direct, .load_tlv => { |
| 6461 | const addr_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp); | 6463 | const addr_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp); |
| 6462 | const addr_reg_lock = self.register_manager.lockRegAssumeUnused(addr_reg); | 6464 | const addr_reg_lock = self.register_manager.lockRegAssumeUnused(addr_reg); |
| 6463 | defer self.register_manager.unlockReg(addr_reg_lock); | 6465 | defer self.register_manager.unlockReg(addr_reg_lock); |
| ... | @@ -7415,8 +7417,8 @@ fn genBinOp( | ... | @@ -7415,8 +7417,8 @@ fn genBinOp( |
| 7415 | .lea_direct, | 7417 | .lea_direct, |
| 7416 | .load_got, | 7418 | .load_got, |
| 7417 | .lea_got, | 7419 | .lea_got, |
| 7418 | .load_actual_got, | 7420 | .load_extern_got, |
| 7419 | .lea_actual_got, | 7421 | .lea_extern_got, |
| 7420 | .load_tlv, | 7422 | .load_tlv, |
| 7421 | .lea_tlv, | 7423 | .lea_tlv, |
| 7422 | .lea_frame, | 7424 | .lea_frame, |
| ... | @@ -7473,8 +7475,8 @@ fn genBinOp( | ... | @@ -7473,8 +7475,8 @@ fn genBinOp( |
| 7473 | .lea_direct, | 7475 | .lea_direct, |
| 7474 | .load_got, | 7476 | .load_got, |
| 7475 | .lea_got, | 7477 | .lea_got, |
| 7476 | .load_actual_got, | 7478 | .load_extern_got, |
| 7477 | .lea_actual_got, | 7479 | .lea_extern_got, |
| 7478 | .load_tlv, | 7480 | .load_tlv, |
| 7479 | .lea_tlv, | 7481 | .lea_tlv, |
| 7480 | .lea_frame, | 7482 | .lea_frame, |
| ... | @@ -8427,7 +8429,7 @@ fn genBinOpMir( | ... | @@ -8427,7 +8429,7 @@ fn genBinOpMir( |
| 8427 | .register_overflow, | 8429 | .register_overflow, |
| 8428 | .lea_direct, | 8430 | .lea_direct, |
| 8429 | .lea_got, | 8431 | .lea_got, |
| 8430 | .lea_actual_got, | 8432 | .lea_extern_got, |
| 8431 | .lea_tlv, | 8433 | .lea_tlv, |
| 8432 | .lea_frame, | 8434 | .lea_frame, |
| 8433 | .reserved_frame, | 8435 | .reserved_frame, |
| ... | @@ -8516,8 +8518,8 @@ fn genBinOpMir( | ... | @@ -8516,8 +8518,8 @@ fn genBinOpMir( |
| 8516 | .lea_direct, | 8518 | .lea_direct, |
| 8517 | .load_got, | 8519 | .load_got, |
| 8518 | .lea_got, | 8520 | .lea_got, |
| 8519 | .load_actual_got, | 8521 | .load_extern_got, |
| 8520 | .lea_actual_got, | 8522 | .lea_extern_got, |
| 8521 | .load_tlv, | 8523 | .load_tlv, |
| 8522 | .lea_tlv, | 8524 | .lea_tlv, |
| 8523 | .load_frame, | 8525 | .load_frame, |
| ... | @@ -8550,7 +8552,7 @@ fn genBinOpMir( | ... | @@ -8550,7 +8552,7 @@ fn genBinOpMir( |
| 8550 | .register_offset, | 8552 | .register_offset, |
| 8551 | .lea_direct, | 8553 | .lea_direct, |
| 8552 | .lea_got, | 8554 | .lea_got, |
| 8553 | .lea_actual_got, | 8555 | .lea_extern_got, |
| 8554 | .lea_tlv, | 8556 | .lea_tlv, |
| 8555 | .lea_frame, | 8557 | .lea_frame, |
| 8556 | => { | 8558 | => { |
| ... | @@ -8566,7 +8568,7 @@ fn genBinOpMir( | ... | @@ -8566,7 +8568,7 @@ fn genBinOpMir( |
| 8566 | .memory, | 8568 | .memory, |
| 8567 | .load_direct, | 8569 | .load_direct, |
| 8568 | .load_got, | 8570 | .load_got, |
| 8569 | .load_actual_got, | 8571 | .load_extern_got, |
| 8570 | .load_tlv, | 8572 | .load_tlv, |
| 8571 | => { | 8573 | => { |
| 8572 | const ptr_ty = try mod.singleConstPtrType(ty); | 8574 | const ptr_ty = try mod.singleConstPtrType(ty); |
| ... | @@ -8587,13 +8589,13 @@ fn genBinOpMir( | ... | @@ -8587,13 +8589,13 @@ fn genBinOpMir( |
| 8587 | } | 8589 | } |
| 8588 | } | 8590 | } |
| 8589 | }, | 8591 | }, |
| 8590 | .memory, .indirect, .load_got, .load_actual_got, .load_direct, .load_tlv, .load_frame => { | 8592 | .memory, .indirect, .load_got, .load_extern_got, .load_direct, .load_tlv, .load_frame => { |
| 8591 | const OpInfo = ?struct { addr_reg: Register, addr_lock: RegisterLock }; | 8593 | const OpInfo = ?struct { addr_reg: Register, addr_lock: RegisterLock }; |
| 8592 | const limb_abi_size: u32 = @min(abi_size, 8); | 8594 | const limb_abi_size: u32 = @min(abi_size, 8); |
| 8593 | | 8595 | |
| 8594 | const dst_info: OpInfo = switch (dst_mcv) { | 8596 | const dst_info: OpInfo = switch (dst_mcv) { |
| 8595 | else => unreachable, | 8597 | else => unreachable, |
| 8596 | .memory, .load_got, .load_actual_got, .load_direct, .load_tlv => dst: { | 8598 | .memory, .load_got, .load_extern_got, .load_direct, .load_tlv => dst: { |
| 8597 | const dst_addr_reg = | 8599 | const dst_addr_reg = |
| 8598 | (try self.register_manager.allocReg(null, abi.RegisterClass.gp)).to64(); | 8600 | (try self.register_manager.allocReg(null, abi.RegisterClass.gp)).to64(); |
| 8599 | const dst_addr_lock = self.register_manager.lockRegAssumeUnused(dst_addr_reg); | 8601 | const dst_addr_lock = self.register_manager.lockRegAssumeUnused(dst_addr_reg); |
| ... | @@ -8627,17 +8629,17 @@ fn genBinOpMir( | ... | @@ -8627,17 +8629,17 @@ fn genBinOpMir( |
| 8627 | .indirect, | 8629 | .indirect, |
| 8628 | .lea_direct, | 8630 | .lea_direct, |
| 8629 | .lea_got, | 8631 | .lea_got, |
| 8630 | .lea_actual_got, | 8632 | .lea_extern_got, |
| 8631 | .lea_tlv, | 8633 | .lea_tlv, |
| 8632 | .load_frame, | 8634 | .load_frame, |
| 8633 | .lea_frame, | 8635 | .lea_frame, |
| 8634 | => null, | 8636 | => null, |
| 8635 | .memory, .load_got, .load_actual_got, .load_direct, .load_tlv => src: { | 8637 | .memory, .load_got, .load_extern_got, .load_direct, .load_tlv => src: { |
| 8636 | switch (resolved_src_mcv) { | 8638 | switch (resolved_src_mcv) { |
| 8637 | .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr))) != null and | 8639 | .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr))) != null and |
| 8638 | math.cast(i32, @as(i64, @bitCast(addr)) + abi_size - limb_abi_size) != null) | 8640 | math.cast(i32, @as(i64, @bitCast(addr)) + abi_size - limb_abi_size) != null) |
| 8639 | break :src null, | 8641 | break :src null, |
| 8640 | .load_got, .load_actual_got, .load_direct, .load_tlv => {}, | 8642 | .load_got, .load_extern_got, .load_direct, .load_tlv => {}, |
| 8641 | else => unreachable, | 8643 | else => unreachable, |
| 8642 | } | 8644 | } |
| 8643 | | 8645 | |
| ... | @@ -8680,7 +8682,7 @@ fn genBinOpMir( | ... | @@ -8680,7 +8682,7 @@ fn genBinOpMir( |
| 8680 | switch (dst_mcv) { | 8682 | switch (dst_mcv) { |
| 8681 | .memory, | 8683 | .memory, |
| 8682 | .load_got, | 8684 | .load_got, |
| 8683 | .load_actual_got, | 8685 | .load_extern_got, |
| 8684 | .load_direct, | 8686 | .load_direct, |
| 8685 | .load_tlv, | 8687 | .load_tlv, |
| 8686 | => .{ .base = .{ .reg = dst_info.?.addr_reg }, .disp = off }, | 8688 | => .{ .base = .{ .reg = dst_info.?.addr_reg }, .disp = off }, |
| ... | @@ -8765,8 +8767,8 @@ fn genBinOpMir( | ... | @@ -8765,8 +8767,8 @@ fn genBinOpMir( |
| 8765 | .lea_direct, | 8767 | .lea_direct, |
| 8766 | .load_got, | 8768 | .load_got, |
| 8767 | .lea_got, | 8769 | .lea_got, |
| 8768 | .load_actual_got, | 8770 | .load_extern_got, |
| 8769 | .lea_actual_got, | 8771 | .lea_extern_got, |
| 8770 | .load_tlv, | 8772 | .load_tlv, |
| 8771 | .lea_tlv, | 8773 | .lea_tlv, |
| 8772 | .load_frame, | 8774 | .load_frame, |
| ... | @@ -8782,7 +8784,7 @@ fn genBinOpMir( | ... | @@ -8782,7 +8784,7 @@ fn genBinOpMir( |
| 8782 | .register_offset, | 8784 | .register_offset, |
| 8783 | .lea_direct, | 8785 | .lea_direct, |
| 8784 | .lea_got, | 8786 | .lea_got, |
| 8785 | .lea_actual_got, | 8787 | .lea_extern_got, |
| 8786 | .lea_tlv, | 8788 | .lea_tlv, |
| 8787 | .lea_frame, | 8789 | .lea_frame, |
| 8788 | => switch (limb_i) { | 8790 | => switch (limb_i) { |
| ... | @@ -8832,7 +8834,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M | ... | @@ -8832,7 +8834,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M |
| 8832 | .register_overflow, | 8834 | .register_overflow, |
| 8833 | .lea_direct, | 8835 | .lea_direct, |
| 8834 | .lea_got, | 8836 | .lea_got, |
| 8835 | .lea_actual_got, | 8837 | .lea_extern_got, |
| 8836 | .lea_tlv, | 8838 | .lea_tlv, |
| 8837 | .lea_frame, | 8839 | .lea_frame, |
| 8838 | .reserved_frame, | 8840 | .reserved_frame, |
| ... | @@ -8881,8 +8883,8 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M | ... | @@ -8881,8 +8883,8 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M |
| 8881 | .lea_direct, | 8883 | .lea_direct, |
| 8882 | .load_got, | 8884 | .load_got, |
| 8883 | .lea_got, | 8885 | .lea_got, |
| 8884 | .load_actual_got, | 8886 | .load_extern_got, |
| 8885 | .lea_actual_got, | 8887 | .lea_extern_got, |
| 8886 | .load_tlv, | 8888 | .load_tlv, |
| 8887 | .lea_tlv, | 8889 | .lea_tlv, |
| 8888 | .lea_frame, | 8890 | .lea_frame, |
| ... | @@ -8921,7 +8923,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M | ... | @@ -8921,7 +8923,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M |
| 8921 | } | 8923 | } |
| 8922 | }, | 8924 | }, |
| 8923 | .register_pair => unreachable, // unimplemented | 8925 | .register_pair => unreachable, // unimplemented |
| 8924 | .memory, .indirect, .load_direct, .load_got, .load_actual_got, .load_tlv, .load_frame => { | 8926 | .memory, .indirect, .load_direct, .load_got, .load_extern_got, .load_tlv, .load_frame => { |
| 8925 | const tmp_reg = try self.copyToTmpRegister(dst_ty, dst_mcv); | 8927 | const tmp_reg = try self.copyToTmpRegister(dst_ty, dst_mcv); |
| 8926 | const tmp_mcv = MCValue{ .register = tmp_reg }; | 8928 | const tmp_mcv = MCValue{ .register = tmp_reg }; |
| 8927 | const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg); | 8929 | const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg); |
| ... | @@ -9014,7 +9016,7 @@ fn genVarDbgInfo( | ... | @@ -9014,7 +9016,7 @@ fn genVarDbgInfo( |
| 9014 | //} }, | 9016 | //} }, |
| 9015 | .memory => |address| .{ .memory = address }, | 9017 | .memory => |address| .{ .memory = address }, |
| 9016 | .load_got => |sym_index| .{ .linker_load = .{ .type = .got, .sym_index = sym_index } }, | 9018 | .load_got => |sym_index| .{ .linker_load = .{ .type = .got, .sym_index = sym_index } }, |
| 9017 | .load_actual_got => |sym_index| .{ .linker_load = .{ .type = .actual_got, .sym_index = sym_index } }, | 9019 | .load_extern_got => |sym_index| .{ .linker_load = .{ .type = .extern_got, .sym_index = sym_index } }, |
| 9018 | .load_direct => |sym_index| .{ .linker_load = .{ .type = .direct, .sym_index = sym_index } }, | 9020 | .load_direct => |sym_index| .{ .linker_load = .{ .type = .direct, .sym_index = sym_index } }, |
| 9019 | .immediate => |x| .{ .immediate = x }, | 9021 | .immediate => |x| .{ .immediate = x }, |
| 9020 | .undef => .undef, | 9022 | .undef => .undef, |
| ... | @@ -9454,14 +9456,14 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { | ... | @@ -9454,14 +9456,14 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 9454 | .indirect, | 9456 | .indirect, |
| 9455 | .lea_direct, | 9457 | .lea_direct, |
| 9456 | .lea_got, | 9458 | .lea_got, |
| 9457 | .lea_actual_got, | 9459 | .lea_extern_got, |
| 9458 | .lea_tlv, | 9460 | .lea_tlv, |
| 9459 | .lea_frame, | 9461 | .lea_frame, |
| 9460 | .reserved_frame, | 9462 | .reserved_frame, |
| 9461 | .air_ref, | 9463 | .air_ref, |
| 9462 | => unreachable, | 9464 | => unreachable, |
| 9463 | .register_pair, .load_frame => null, | 9465 | .register_pair, .load_frame => null, |
| 9464 | .memory, .load_got, .load_actual_got, .load_direct, .load_tlv => dst: { | 9466 | .memory, .load_got, .load_extern_got, .load_direct, .load_tlv => dst: { |
| 9465 | switch (resolved_dst_mcv) { | 9467 | switch (resolved_dst_mcv) { |
| 9466 | .memory => |addr| if (math.cast( | 9468 | .memory => |addr| if (math.cast( |
| 9467 | i32, | 9469 | i32, |
| ... | @@ -9470,7 +9472,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { | ... | @@ -9470,7 +9472,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 9470 | i32, | 9472 | i32, |
| 9471 | @as(i64, @bitCast(addr)) + abi_size - 8, | 9473 | @as(i64, @bitCast(addr)) + abi_size - 8, |
| 9472 | ) != null) break :dst null, | 9474 | ) != null) break :dst null, |
| 9473 | .load_got, .load_actual_got, .load_direct, .load_tlv => {}, | 9475 | .load_got, .load_extern_got, .load_direct, .load_tlv => {}, |
| 9474 | else => unreachable, | 9476 | else => unreachable, |
| 9475 | } | 9477 | } |
| 9476 | | 9478 | |
| ... | @@ -9513,14 +9515,14 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { | ... | @@ -9513,14 +9515,14 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 9513 | .indirect, | 9515 | .indirect, |
| 9514 | .lea_direct, | 9516 | .lea_direct, |
| 9515 | .lea_got, | 9517 | .lea_got, |
| 9516 | .lea_actual_got, | 9518 | .lea_extern_got, |
| 9517 | .lea_tlv, | 9519 | .lea_tlv, |
| 9518 | .lea_frame, | 9520 | .lea_frame, |
| 9519 | .reserved_frame, | 9521 | .reserved_frame, |
| 9520 | .air_ref, | 9522 | .air_ref, |
| 9521 | => unreachable, | 9523 | => unreachable, |
| 9522 | .register_pair, .load_frame => null, | 9524 | .register_pair, .load_frame => null, |
| 9523 | .memory, .load_got, .load_actual_got, .load_direct, .load_tlv => src: { | 9525 | .memory, .load_got, .load_extern_got, .load_direct, .load_tlv => src: { |
| 9524 | switch (resolved_src_mcv) { | 9526 | switch (resolved_src_mcv) { |
| 9525 | .memory => |addr| if (math.cast( | 9527 | .memory => |addr| if (math.cast( |
| 9526 | i32, | 9528 | i32, |
| ... | @@ -9529,7 +9531,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { | ... | @@ -9529,7 +9531,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 9529 | i32, | 9531 | i32, |
| 9530 | @as(i64, @bitCast(addr)) + abi_size - 8, | 9532 | @as(i64, @bitCast(addr)) + abi_size - 8, |
| 9531 | ) != null) break :src null, | 9533 | ) != null) break :src null, |
| 9532 | .load_got, .load_actual_got, .load_direct, .load_tlv => {}, | 9534 | .load_got, .load_extern_got, .load_direct, .load_tlv => {}, |
| 9533 | else => unreachable, | 9535 | else => unreachable, |
| 9534 | } | 9536 | } |
| 9535 | | 9537 | |
| ... | @@ -9948,7 +9950,7 @@ fn isNull(self: *Self, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MC | ... | @@ -9948,7 +9950,7 @@ fn isNull(self: *Self, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MC |
| 9948 | .register_overflow, | 9950 | .register_overflow, |
| 9949 | .lea_direct, | 9951 | .lea_direct, |
| 9950 | .lea_got, | 9952 | .lea_got, |
| 9951 | .lea_actual_got, | 9953 | .lea_extern_got, |
| 9952 | .lea_tlv, | 9954 | .lea_tlv, |
| 9953 | .lea_frame, | 9955 | .lea_frame, |
| 9954 | .reserved_frame, | 9956 | .reserved_frame, |
| ... | @@ -9975,7 +9977,7 @@ fn isNull(self: *Self, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MC | ... | @@ -9975,7 +9977,7 @@ fn isNull(self: *Self, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MC |
| 9975 | | 9977 | |
| 9976 | .memory, | 9978 | .memory, |
| 9977 | .load_got, | 9979 | .load_got, |
| 9978 | .load_actual_got, | 9980 | .load_extern_got, |
| 9979 | .load_direct, | 9981 | .load_direct, |
| 9980 | .load_tlv, | 9982 | .load_tlv, |
| 9981 | => { | 9983 | => { |
| ... | @@ -10533,7 +10535,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -10533,7 +10535,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 10533 | .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_| | 10535 | .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_| |
| 10534 | break :arg input_mcv, | 10536 | break :arg input_mcv, |
| 10535 | .indirect, .load_frame => break :arg input_mcv, | 10537 | .indirect, .load_frame => break :arg input_mcv, |
| 10536 | .load_direct, .load_got, .load_actual_got, .load_tlv => {}, | 10538 | .load_direct, .load_got, .load_extern_got, .load_tlv => {}, |
| 10537 | else => { | 10539 | else => { |
| 10538 | const temp_mcv = try self.allocTempRegOrMem(ty, false); | 10540 | const temp_mcv = try self.allocTempRegOrMem(ty, false); |
| 10539 | try self.genCopy(ty, temp_mcv, input_mcv); | 10541 | try self.genCopy(ty, temp_mcv, input_mcv); |
| ... | @@ -11194,7 +11196,7 @@ fn genCopy(self: *Self, ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError | ... | @@ -11194,7 +11196,7 @@ fn genCopy(self: *Self, ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError |
| 11194 | .register_overflow, | 11196 | .register_overflow, |
| 11195 | .lea_direct, | 11197 | .lea_direct, |
| 11196 | .lea_got, | 11198 | .lea_got, |
| 11197 | .lea_actual_got, | 11199 | .lea_extern_got, |
| 11198 | .lea_tlv, | 11200 | .lea_tlv, |
| 11199 | .lea_frame, | 11201 | .lea_frame, |
| 11200 | .reserved_frame, | 11202 | .reserved_frame, |
| ... | @@ -11246,11 +11248,11 @@ fn genCopy(self: *Self, ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError | ... | @@ -11246,11 +11248,11 @@ fn genCopy(self: *Self, ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError |
| 11246 | } | 11248 | } |
| 11247 | }, | 11249 | }, |
| 11248 | .indirect => |reg_off| try self.genSetMem(.{ .reg = reg_off.reg }, reg_off.off, ty, src_mcv), | 11250 | .indirect => |reg_off| try self.genSetMem(.{ .reg = reg_off.reg }, reg_off.off, ty, src_mcv), |
| 11249 | .memory, .load_direct, .load_got, .load_actual_got, .load_tlv => { | 11251 | .memory, .load_direct, .load_got, .load_extern_got, .load_tlv => { |
| 11250 | switch (dst_mcv) { | 11252 | switch (dst_mcv) { |
| 11251 | .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |small_addr| | 11253 | .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |small_addr| |
| 11252 | return self.genSetMem(.{ .reg = .ds }, small_addr, ty, src_mcv), | 11254 | return self.genSetMem(.{ .reg = .ds }, small_addr, ty, src_mcv), |
| 11253 | .load_direct, .load_got, .load_actual_got, .load_tlv => {}, | 11255 | .load_direct, .load_got, .load_extern_got, .load_tlv => {}, |
| 11254 | else => unreachable, | 11256 | else => unreachable, |
| 11255 | } | 11257 | } |
| 11256 | | 11258 | |
| ... | @@ -11412,7 +11414,7 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr | ... | @@ -11412,7 +11414,7 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr |
| 11412 | else => unreachable, | 11414 | else => unreachable, |
| 11413 | }, | 11415 | }, |
| 11414 | )), | 11416 | )), |
| 11415 | .memory, .load_direct, .load_got, .load_actual_got, .load_tlv => { | 11417 | .memory, .load_direct, .load_got, .load_extern_got, .load_tlv => { |
| 11416 | switch (src_mcv) { | 11418 | switch (src_mcv) { |
| 11417 | .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |small_addr| | 11419 | .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |small_addr| |
| 11418 | return (try self.moveStrategy( | 11420 | return (try self.moveStrategy( |
| ... | @@ -11440,7 +11442,7 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr | ... | @@ -11440,7 +11442,7 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr |
| 11440 | }, | 11442 | }, |
| 11441 | .Float, .Vector => {}, | 11443 | .Float, .Vector => {}, |
| 11442 | }, | 11444 | }, |
| 11443 | .load_got, .load_actual_got, .load_tlv => {}, | 11445 | .load_got, .load_extern_got, .load_tlv => {}, |
| 11444 | else => unreachable, | 11446 | else => unreachable, |
| 11445 | } | 11447 | } |
| 11446 | | 11448 | |
| ... | @@ -11454,18 +11456,18 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr | ... | @@ -11454,18 +11456,18 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr |
| 11454 | Memory.sib(Memory.PtrSize.fromSize(abi_size), .{ .base = .{ .reg = addr_reg } }), | 11456 | Memory.sib(Memory.PtrSize.fromSize(abi_size), .{ .base = .{ .reg = addr_reg } }), |
| 11455 | ); | 11457 | ); |
| 11456 | }, | 11458 | }, |
| 11457 | .lea_direct, .lea_got, .lea_actual_got => |sym_index| { | 11459 | .lea_direct, .lea_got, .lea_extern_got => |sym_index| { |
| 11458 | const atom_index = try self.owner.getSymbolIndex(self); | 11460 | const atom_index = try self.owner.getSymbolIndex(self); |
| 11459 | _ = try self.addInst(.{ | 11461 | _ = try self.addInst(.{ |
| 11460 | .tag = switch (src_mcv) { | 11462 | .tag = switch (src_mcv) { |
| 11461 | .lea_direct => .lea, | 11463 | .lea_direct => .lea, |
| 11462 | .lea_got, .lea_actual_got => .mov, | 11464 | .lea_got, .lea_extern_got => .mov, |
| 11463 | else => unreachable, | 11465 | else => unreachable, |
| 11464 | }, | 11466 | }, |
| 11465 | .ops = switch (src_mcv) { | 11467 | .ops = switch (src_mcv) { |
| 11466 | .lea_direct => .direct_reloc, | 11468 | .lea_direct => .direct_reloc, |
| 11467 | .lea_got => .got_reloc, | 11469 | .lea_got => .got_reloc, |
| 11468 | .lea_actual_got => .actual_got_reloc, | 11470 | .lea_extern_got => .extern_got_reloc, |
| 11469 | else => unreachable, | 11471 | else => unreachable, |
| 11470 | }, | 11472 | }, |
| 11471 | .data = .{ .rx = .{ | 11473 | .data = .{ .rx = .{ |
| ... | @@ -11601,8 +11603,8 @@ fn genSetMem(self: *Self, base: Memory.Base, disp: i32, ty: Type, src_mcv: MCVal | ... | @@ -11601,8 +11603,8 @@ fn genSetMem(self: *Self, base: Memory.Base, disp: i32, ty: Type, src_mcv: MCVal |
| 11601 | .lea_direct, | 11603 | .lea_direct, |
| 11602 | .load_got, | 11604 | .load_got, |
| 11603 | .lea_got, | 11605 | .lea_got, |
| 11604 | .load_actual_got, | 11606 | .load_extern_got, |
| 11605 | .lea_actual_got, | 11607 | .lea_extern_got, |
| 11606 | .load_tlv, | 11608 | .load_tlv, |
| 11607 | .lea_tlv, | 11609 | .lea_tlv, |
| 11608 | .load_frame, | 11610 | .load_frame, |
| ... | @@ -13608,7 +13610,7 @@ fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue { | ... | @@ -13608,7 +13610,7 @@ fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue { |
| 13608 | .memory => |addr| .{ .memory = addr }, | 13610 | .memory => |addr| .{ .memory = addr }, |
| 13609 | .load_direct => |sym_index| .{ .load_direct = sym_index }, | 13611 | .load_direct => |sym_index| .{ .load_direct = sym_index }, |
| 13610 | .load_got => |sym_index| .{ .lea_got = sym_index }, | 13612 | .load_got => |sym_index| .{ .lea_got = sym_index }, |
| 13611 | .load_actual_got => |sym_index| .{ .lea_actual_got = sym_index }, | 13613 | .load_extern_got => |sym_index| .{ .lea_extern_got = sym_index }, |
| 13612 | .load_tlv => |sym_index| .{ .lea_tlv = sym_index }, | 13614 | .load_tlv => |sym_index| .{ .lea_tlv = sym_index }, |
| 13613 | }, | 13615 | }, |
| 13614 | .fail => |msg| { | 13616 | .fail => |msg| { |