| ... | @@ -83,7 +83,6 @@ end_di_column: u32, | ... | @@ -83,7 +83,6 @@ end_di_column: u32, |
| 83 | epilogue_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, | 83 | epilogue_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, |
| 84 | | 84 | |
| 85 | reused_operands: std.StaticBitSet(Liveness.bpi - 1) = undefined, | 85 | reused_operands: std.StaticBitSet(Liveness.bpi - 1) = undefined, |
| 86 | const_tracking: ConstTrackingMap = .empty, | | |
| 87 | inst_tracking: InstTrackingMap = .empty, | 86 | inst_tracking: InstTrackingMap = .empty, |
| 88 | | 87 | |
| 89 | // Key is the block instruction | 88 | // Key is the block instruction |
| ... | @@ -926,7 +925,6 @@ pub fn generate( | ... | @@ -926,7 +925,6 @@ pub fn generate( |
| 926 | while (block_it.next()) |block| block.deinit(gpa); | 925 | while (block_it.next()) |block| block.deinit(gpa); |
| 927 | function.blocks.deinit(gpa); | 926 | function.blocks.deinit(gpa); |
| 928 | function.inst_tracking.deinit(gpa); | 927 | function.inst_tracking.deinit(gpa); |
| 929 | function.const_tracking.deinit(gpa); | | |
| 930 | function.epilogue_relocs.deinit(gpa); | 928 | function.epilogue_relocs.deinit(gpa); |
| 931 | function.mir_instructions.deinit(gpa); | 929 | function.mir_instructions.deinit(gpa); |
| 932 | function.mir_extra.deinit(gpa); | 930 | function.mir_extra.deinit(gpa); |
| ... | @@ -108991,40 +108989,35 @@ fn resolveInst(self: *CodeGen, ref: Air.Inst.Ref) InnerError!MCValue { | ... | @@ -108991,40 +108989,35 @@ fn resolveInst(self: *CodeGen, ref: Air.Inst.Ref) InnerError!MCValue { |
| 108991 | // If the type has no codegen bits, no need to store it. | 108989 | // If the type has no codegen bits, no need to store it. |
| 108992 | if (!ty.hasRuntimeBitsIgnoreComptime(zcu)) return .none; | 108990 | if (!ty.hasRuntimeBitsIgnoreComptime(zcu)) return .none; |
| 108993 | | 108991 | |
| 108994 | const mcv = if (ref.toIndex()) |inst| mcv: { | 108992 | const mcv: MCValue = if (ref.toIndex()) |inst| mcv: { |
| 108995 | break :mcv self.inst_tracking.getPtr(inst).?.short; | 108993 | break :mcv self.inst_tracking.getPtr(inst).?.short; |
| 108996 | } else mcv: { | 108994 | } else mcv: { |
| 108997 | const ip_index = ref.toInterned().?; | 108995 | const const_mcv = try self.genTypedValue(.fromInterned(ref.toInterned().?)); |
| 108998 | const gop = try self.const_tracking.getOrPut(self.gpa, ip_index); | 108996 | switch (const_mcv) { |
| 108999 | if (!gop.found_existing) gop.value_ptr.* = .init(init: { | 108997 | .lea_tlv => |tlv_sym| switch (self.bin_file.tag) { |
| 109000 | const const_mcv = try self.genTypedValue(.fromInterned(ip_index)); | 108998 | .elf, .macho => { |
| 109001 | switch (const_mcv) { | 108999 | if (self.mod.pic) { |
| 109002 | .lea_tlv => |tlv_sym| switch (self.bin_file.tag) { | 109000 | try self.spillRegisters(&.{ .rdi, .rax }); |
| 109003 | .elf, .macho => { | 109001 | } else { |
| 109004 | if (self.mod.pic) { | 109002 | try self.spillRegisters(&.{.rax}); |
| 109005 | try self.spillRegisters(&.{ .rdi, .rax }); | 109003 | } |
| 109006 | } else { | 109004 | const frame_index = try self.allocFrameIndex(.init(.{ |
| 109007 | try self.spillRegisters(&.{.rax}); | 109005 | .size = 8, |
| 109008 | } | 109006 | .alignment = .@"8", |
| 109009 | const frame_index = try self.allocFrameIndex(.init(.{ | 109007 | })); |
| 109010 | .size = 8, | 109008 | try self.genSetMem( |
| 109011 | .alignment = .@"8", | 109009 | .{ .frame = frame_index }, |
| 109012 | })); | 109010 | 0, |
| 109013 | try self.genSetMem( | 109011 | .usize, |
| 109014 | .{ .frame = frame_index }, | 109012 | .{ .lea_symbol = .{ .sym_index = tlv_sym } }, |
| 109015 | 0, | 109013 | .{}, |
| 109016 | .usize, | 109014 | ); |
| 109017 | .{ .lea_symbol = .{ .sym_index = tlv_sym } }, | 109015 | break :mcv .{ .load_frame = .{ .index = frame_index } }; |
| 109018 | .{}, | | |
| 109019 | ); | | |
| 109020 | break :init .{ .load_frame = .{ .index = frame_index } }; | | |
| 109021 | }, | | |
| 109022 | else => break :init const_mcv, | | |
| 109023 | }, | 109016 | }, |
| 109024 | else => break :init const_mcv, | 109017 | else => break :mcv const_mcv, |
| 109025 | } | 109018 | }, |
| 109026 | }); | 109019 | else => break :mcv const_mcv, |
| 109027 | break :mcv gop.value_ptr.short; | 109020 | } |
| 109028 | }; | 109021 | }; |
| 109029 | | 109022 | |
| 109030 | switch (mcv) { | 109023 | switch (mcv) { |
| ... | @@ -115260,8 +115253,7 @@ fn tempFromOperand(cg: *CodeGen, op_ref: Air.Inst.Ref, op_dies: bool) InnerError | ... | @@ -115260,8 +115253,7 @@ fn tempFromOperand(cg: *CodeGen, op_ref: Air.Inst.Ref, op_dies: bool) InnerError |
| 115260 | | 115253 | |
| 115261 | if (op_ref.toIndex()) |op_inst| return .{ .index = op_inst }; | 115254 | if (op_ref.toIndex()) |op_inst| return .{ .index = op_inst }; |
| 115262 | const val = op_ref.toInterned().?; | 115255 | const val = op_ref.toInterned().?; |
| 115263 | const gop = try cg.const_tracking.getOrPut(cg.gpa, val); | 115256 | return cg.tempInit(.fromInterned(ip.typeOf(val)), init: { |
| 115264 | if (!gop.found_existing) gop.value_ptr.* = .init(init: { | | |
| 115265 | const const_mcv = try cg.genTypedValue(.fromInterned(val)); | 115257 | const const_mcv = try cg.genTypedValue(.fromInterned(val)); |
| 115266 | switch (const_mcv) { | 115258 | switch (const_mcv) { |
| 115267 | .lea_tlv => |tlv_sym| switch (cg.bin_file.tag) { | 115259 | .lea_tlv => |tlv_sym| switch (cg.bin_file.tag) { |
| ... | @@ -115289,7 +115281,6 @@ fn tempFromOperand(cg: *CodeGen, op_ref: Air.Inst.Ref, op_dies: bool) InnerError | ... | @@ -115289,7 +115281,6 @@ fn tempFromOperand(cg: *CodeGen, op_ref: Air.Inst.Ref, op_dies: bool) InnerError |
| 115289 | else => break :init const_mcv, | 115281 | else => break :init const_mcv, |
| 115290 | } | 115282 | } |
| 115291 | }); | 115283 | }); |
| 115292 | return cg.tempInit(.fromInterned(ip.typeOf(val)), gop.value_ptr.short); | | |
| 115293 | } | 115284 | } |
| 115294 | | 115285 | |
| 115295 | fn tempsFromOperandsInner( | 115286 | fn tempsFromOperandsInner( |