authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-11-04 12:39:29+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-11-05 10:14:59+01:00
log1fe0b58942b45832981e700ba8eb7ae23dc2190f
tree798a114f18d528d282f58215d212e2b2b58ccad3
parentdf0212bf47974b4e676a5bb97aac5ab381d6cbf3

aarch64: extract atom index for both COFF and MachO


1 files changed, 28 insertions(+), 4 deletions(-)

src/arch/aarch64/CodeGen.zig+28-4
......@@ -3719,12 +3719,18 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type
37193719 .direct => .load_memory_ptr_direct,
37203720 };
37213721 const mod = self.bin_file.options.module.?;
3722 const owner_decl = mod.declPtr(self.mod_fn.owner_decl);
3723 const atom_index = switch (self.bin_file.tag) {
3724 .macho => owner_decl.link.macho.sym_index,
3725 .coff => owner_decl.link.coff.sym_index,
3726 else => unreachable, // unsupported target format
3727 };
37223728 _ = try self.addInst(.{
37233729 .tag = tag,
37243730 .data = .{
37253731 .payload = try self.addExtra(Mir.LoadMemoryPie{
37263732 .register = @enumToInt(src_reg),
3727 .atom_index = mod.declPtr(self.mod_fn.owner_decl).link.macho.sym_index,
3733 .atom_index = atom_index,
37283734 .sym_index = load_struct.sym_index,
37293735 }),
37303736 },
......@@ -5161,12 +5167,18 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro
51615167 .direct => .load_memory_ptr_direct,
51625168 };
51635169 const mod = self.bin_file.options.module.?;
5170 const owner_decl = mod.declPtr(self.mod_fn.owner_decl);
5171 const atom_index = switch (self.bin_file.tag) {
5172 .macho => owner_decl.link.macho.sym_index,
5173 .coff => owner_decl.link.coff.sym_index,
5174 else => unreachable, // unsupported target format
5175 };
51645176 _ = try self.addInst(.{
51655177 .tag = tag,
51665178 .data = .{
51675179 .payload = try self.addExtra(Mir.LoadMemoryPie{
51685180 .register = @enumToInt(src_reg),
5169 .atom_index = mod.declPtr(self.mod_fn.owner_decl).link.macho.sym_index,
5181 .atom_index = atom_index,
51705182 .sym_index = load_struct.sym_index,
51715183 }),
51725184 },
......@@ -5268,12 +5280,18 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void
52685280 .direct => .load_memory_direct,
52695281 };
52705282 const mod = self.bin_file.options.module.?;
5283 const owner_decl = mod.declPtr(self.mod_fn.owner_decl);
5284 const atom_index = switch (self.bin_file.tag) {
5285 .macho => owner_decl.link.macho.sym_index,
5286 .coff => owner_decl.link.coff.sym_index,
5287 else => unreachable, // unsupported target format
5288 };
52715289 _ = try self.addInst(.{
52725290 .tag = tag,
52735291 .data = .{
52745292 .payload = try self.addExtra(Mir.LoadMemoryPie{
52755293 .register = @enumToInt(reg),
5276 .atom_index = mod.declPtr(self.mod_fn.owner_decl).link.macho.sym_index,
5294 .atom_index = atom_index,
52775295 .sym_index = load_struct.sym_index,
52785296 }),
52795297 },
......@@ -5455,12 +5473,18 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I
54555473 .direct => .load_memory_ptr_direct,
54565474 };
54575475 const mod = self.bin_file.options.module.?;
5476 const owner_decl = mod.declPtr(self.mod_fn.owner_decl);
5477 const atom_index = switch (self.bin_file.tag) {
5478 .macho => owner_decl.link.macho.sym_index,
5479 .coff => owner_decl.link.coff.sym_index,
5480 else => unreachable, // unsupported target format
5481 };
54585482 _ = try self.addInst(.{
54595483 .tag = tag,
54605484 .data = .{
54615485 .payload = try self.addExtra(Mir.LoadMemoryPie{
54625486 .register = @enumToInt(src_reg),
5463 .atom_index = mod.declPtr(self.mod_fn.owner_decl).link.macho.sym_index,
5487 .atom_index = atom_index,
54645488 .sym_index = load_struct.sym_index,
54655489 }),
54665490 },