diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-04-12 10:36:28 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-04-13 11:47:51 +0200 |
| commit | cf9ba2965eb90de994dd648950ad81041f90b755 (patch) | |
| tree | 699496fad3f422d8310fa051f9939d1b9497b3e5 /src | |
| parent | e07120d704fe931dd8f6952d20739dc1e1b194aa (diff) | |
| download | zig-cf9ba2965eb90de994dd648950ad81041f90b755.tar.gz zig-cf9ba2965eb90de994dd648950ad81041f90b755.zip | |
x86_64: remove loadMemPtrIntoRegister() now redundant
Diffstat (limited to 'src')
| -rw-r--r-- | src/arch/x86_64/CodeGen.zig | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 1bf99c4e1f..491144283c 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -3677,41 +3677,6 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void { return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); } -fn loadMemPtrIntoRegister(self: *Self, reg: Register, ptr_ty: Type, ptr: MCValue) InnerError!void { - switch (ptr) { - .linker_load => |load_struct| { - const abi_size = @intCast(u32, ptr_ty.abiSize(self.target.*)); - const atom_index = if (self.bin_file.cast(link.File.MachO)) |macho_file| blk: { - const atom = try macho_file.getOrCreateAtomForDecl(self.mod_fn.owner_decl); - break :blk macho_file.getAtom(atom).getSymbolIndex().?; - } else if (self.bin_file.cast(link.File.Coff)) |coff_file| blk: { - const atom = try coff_file.getOrCreateAtomForDecl(self.mod_fn.owner_decl); - break :blk coff_file.getAtom(atom).getSymbolIndex().?; - } else unreachable; - const ops: Mir.Inst.Ops = switch (load_struct.type) { - .got => .got_reloc, - .direct => .direct_reloc, - .import => .import_reloc, - }; - _ = try self.addInst(.{ - .tag = .lea_linker, - .ops = ops, - .data = .{ .payload = try self.addExtra(Mir.LeaRegisterReloc{ - .reg = @enumToInt(registerAlias(reg, abi_size)), - .atom_index = atom_index, - .sym_index = load_struct.sym_index, - }) }, - }); - }, - .memory => |addr| { - // TODO: in case the address fits in an imm32 we can use [ds:imm32] - // instead of wasting an instruction copying the address to a register - try self.genSetReg(ptr_ty, reg, .{ .immediate = addr }); - }, - else => unreachable, - } -} - fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type) InnerError!void { const abi_size = @intCast(u32, value_ty.abiSize(self.target.*)); switch (ptr) { |
