| ... | ... | @@ -16051,26 +16051,27 @@ fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue { |
| 16051 | 16051 | if (!gop.found_existing) gop.value_ptr.* = InstTracking.init(init: { |
| 16052 | 16052 | const const_mcv = try self.genTypedValue(.{ .ty = ty, .val = Value.fromInterned(ip_index) }); |
| 16053 | 16053 | switch (const_mcv) { |
| 16054 | | .lea_tlv => |tlv_sym| if (self.bin_file.cast(link.File.Elf)) |_| { |
| 16055 | | if (self.mod.pic) { |
| 16056 | | try self.spillRegisters(&.{ .rdi, .rax }); |
| 16057 | | } else { |
| 16058 | | try self.spillRegisters(&.{.rax}); |
| 16059 | | } |
| 16060 | | const frame_index = try self.allocFrameIndex(FrameAlloc.init(.{ |
| 16061 | | .size = 8, |
| 16062 | | .alignment = .@"8", |
| 16063 | | })); |
| 16064 | | try self.genSetMem( |
| 16065 | | .{ .frame = frame_index }, |
| 16066 | | 0, |
| 16067 | | Type.usize, |
| 16068 | | .{ .lea_symbol = .{ .sym = tlv_sym } }, |
| 16069 | | ); |
| 16070 | | break :init .{ .load_frame = .{ .index = frame_index } }; |
| 16071 | | } else if (self.bin_file.cast(link.File.MachO)) |_| { |
| 16072 | | return self.fail("TODO implement saving TLV variable to stack", .{}); |
| 16073 | | } else break :init const_mcv, |
| 16054 | .lea_tlv => |tlv_sym| switch (self.bin_file.tag) { |
| 16055 | .elf, .macho => { |
| 16056 | if (self.mod.pic) { |
| 16057 | try self.spillRegisters(&.{ .rdi, .rax }); |
| 16058 | } else { |
| 16059 | try self.spillRegisters(&.{.rax}); |
| 16060 | } |
| 16061 | const frame_index = try self.allocFrameIndex(FrameAlloc.init(.{ |
| 16062 | .size = 8, |
| 16063 | .alignment = .@"8", |
| 16064 | })); |
| 16065 | try self.genSetMem( |
| 16066 | .{ .frame = frame_index }, |
| 16067 | 0, |
| 16068 | Type.usize, |
| 16069 | .{ .lea_symbol = .{ .sym = tlv_sym } }, |
| 16070 | ); |
| 16071 | break :init .{ .load_frame = .{ .index = frame_index } }; |
| 16072 | }, |
| 16073 | else => break :init const_mcv, |
| 16074 | }, |
| 16074 | 16075 | else => break :init const_mcv, |
| 16075 | 16076 | } |
| 16076 | 16077 | }); |