aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Air.zig14
-rw-r--r--src/Liveness.zig2
-rw-r--r--src/arch/aarch64/CodeGen.zig16
-rw-r--r--src/codegen.zig20
-rw-r--r--src/codegen/c.zig2
-rw-r--r--src/codegen/llvm.zig33
-rw-r--r--src/print_air.zig2
7 files changed, 0 insertions, 89 deletions
diff --git a/src/Air.zig b/src/Air.zig
index 91b496a8e4..ee93f51096 100644
--- a/src/Air.zig
+++ b/src/Air.zig
@@ -384,10 +384,6 @@ pub const Inst = struct {
/// Result type is the element type of the slice operand.
/// Uses the `bin_op` field.
slice_elem_val,
- /// Given a pointer to a slice, and element index, return the element value at that index.
- /// Result type is the element type of the slice operand (2 element type operations).
- /// Uses the `bin_op` field.
- ptr_slice_elem_val,
/// Given a pointer value, and element index, return the element value at that index.
/// Result type is the element type of the pointer operand.
/// Uses the `bin_op` field.
@@ -396,11 +392,6 @@ pub const Inst = struct {
/// Result type is pointer to the element type of the pointer operand.
/// Uses the `ty_pl` field with payload `Bin`.
ptr_elem_ptr,
- /// Given a pointer to a pointer, and element index, return the element value of the inner
- /// pointer at that index.
- /// Result type is the element type of the inner pointer operand.
- /// Uses the `bin_op` field.
- ptr_ptr_elem_val,
/// Given a pointer to an array, return a slice.
/// Uses the `ty_op` field.
array_to_slice,
@@ -772,11 +763,6 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index) Type {
const ptr_ty = air.typeOf(datas[inst].bin_op.lhs);
return ptr_ty.elemType();
},
- .ptr_slice_elem_val, .ptr_ptr_elem_val => {
- const outer_ptr_ty = air.typeOf(datas[inst].bin_op.lhs);
- const inner_ptr_ty = outer_ptr_ty.elemType();
- return inner_ptr_ty.elemType();
- },
.atomic_load => {
const ptr_ty = air.typeOf(datas[inst].atomic_load.ptr);
return ptr_ty.elemType();
diff --git a/src/Liveness.zig b/src/Liveness.zig
index 5d5bb64196..1b29b46ad8 100644
--- a/src/Liveness.zig
+++ b/src/Liveness.zig
@@ -252,9 +252,7 @@ fn analyzeInst(
.store,
.array_elem_val,
.slice_elem_val,
- .ptr_slice_elem_val,
.ptr_elem_val,
- .ptr_ptr_elem_val,
.shl,
.shl_exact,
.shl_sat,
diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig
index bb2fc471cf..5d1856b2fa 100644
--- a/src/arch/aarch64/CodeGen.zig
+++ b/src/arch/aarch64/CodeGen.zig
@@ -500,10 +500,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
.array_elem_val => try self.airArrayElemVal(inst),
.slice_elem_val => try self.airSliceElemVal(inst),
- .ptr_slice_elem_val => try self.airPtrSliceElemVal(inst),
.ptr_elem_val => try self.airPtrElemVal(inst),
.ptr_elem_ptr => try self.airPtrElemPtr(inst),
- .ptr_ptr_elem_val => try self.airPtrPtrElemVal(inst),
.constant => unreachable, // excluded from function bodies
.const_ty => unreachable, // excluded from function bodies
@@ -1092,13 +1090,6 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void {
return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
}
-fn airPtrSliceElemVal(self: *Self, inst: Air.Inst.Index) !void {
- const is_volatile = false; // TODO
- const bin_op = self.air.instructions.items(.data)[inst].bin_op;
- const result: MCValue = if (!is_volatile and self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement ptr_slice_elem_val for {}", .{self.target.cpu.arch});
- return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
-}
-
fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
const is_volatile = false; // TODO
const bin_op = self.air.instructions.items(.data)[inst].bin_op;
@@ -1113,13 +1104,6 @@ fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void {
return self.finishAir(inst, result, .{ extra.lhs, extra.rhs, .none });
}
-fn airPtrPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
- const is_volatile = false; // TODO
- const bin_op = self.air.instructions.items(.data)[inst].bin_op;
- const result: MCValue = if (!is_volatile and self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement ptr_ptr_elem_val for {}", .{self.target.cpu.arch});
- return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
-}
-
fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void {
const bin_op = self.air.instructions.items(.data)[inst].bin_op;
_ = bin_op;
diff --git a/src/codegen.zig b/src/codegen.zig
index 13169db1fd..873260329c 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -848,10 +848,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
.array_elem_val => try self.airArrayElemVal(inst),
.slice_elem_val => try self.airSliceElemVal(inst),
- .ptr_slice_elem_val => try self.airPtrSliceElemVal(inst),
.ptr_elem_val => try self.airPtrElemVal(inst),
.ptr_elem_ptr => try self.airPtrElemPtr(inst),
- .ptr_ptr_elem_val => try self.airPtrPtrElemVal(inst),
.constant => unreachable, // excluded from function bodies
.const_ty => unreachable, // excluded from function bodies
@@ -1543,15 +1541,6 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
}
- fn airPtrSliceElemVal(self: *Self, inst: Air.Inst.Index) !void {
- const is_volatile = false; // TODO
- const bin_op = self.air.instructions.items(.data)[inst].bin_op;
- const result: MCValue = if (!is_volatile and self.liveness.isUnused(inst)) .dead else switch (arch) {
- else => return self.fail("TODO implement ptr_slice_elem_val for {}", .{self.target.cpu.arch}),
- };
- return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
- }
-
fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
const is_volatile = false; // TODO
const bin_op = self.air.instructions.items(.data)[inst].bin_op;
@@ -1570,15 +1559,6 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
return self.finishAir(inst, result, .{ extra.lhs, extra.rhs, .none });
}
- fn airPtrPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
- const is_volatile = false; // TODO
- const bin_op = self.air.instructions.items(.data)[inst].bin_op;
- const result: MCValue = if (!is_volatile and self.liveness.isUnused(inst)) .dead else switch (arch) {
- else => return self.fail("TODO implement ptr_ptr_elem_val for {}", .{self.target.cpu.arch}),
- };
- return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
- }
-
fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void {
const bin_op = self.air.instructions.items(.data)[inst].bin_op;
const result: MCValue = switch (arch) {
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 6e03de1cca..f09bb574af 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -1081,10 +1081,8 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO
.ptr_slice_ptr_ptr => try airPtrSliceFieldPtr(f, inst, ".ptr;\n"),
.ptr_elem_val => try airPtrElemVal(f, inst, "["),
- .ptr_ptr_elem_val => try airPtrElemVal(f, inst, "[0]["),
.ptr_elem_ptr => try airPtrElemPtr(f, inst),
.slice_elem_val => try airSliceElemVal(f, inst, "["),
- .ptr_slice_elem_val => try airSliceElemVal(f, inst, "[0]["),
.array_elem_val => try airArrayElemVal(f, inst),
.unwrap_errunion_payload => try airUnwrapErrUnionPay(f, inst),
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index f924c0afc4..e5356582e2 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -1760,10 +1760,8 @@ pub const FuncGen = struct {
.array_elem_val => try self.airArrayElemVal(inst),
.slice_elem_val => try self.airSliceElemVal(inst),
- .ptr_slice_elem_val => try self.airPtrSliceElemVal(inst),
.ptr_elem_val => try self.airPtrElemVal(inst),
.ptr_elem_ptr => try self.airPtrElemPtr(inst),
- .ptr_ptr_elem_val => try self.airPtrPtrElemVal(inst),
.optional_payload => try self.airOptionalPayload(inst, false),
.optional_payload_ptr => try self.airOptionalPayload(inst, true),
@@ -2165,24 +2163,6 @@ pub const FuncGen = struct {
return self.load(ptr, slice_ty);
}
- fn airPtrSliceElemVal(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value {
- const bin_op = self.air.instructions.items(.data)[inst].bin_op;
- const slice_ty = self.air.typeOf(bin_op.lhs).childType();
- if (!slice_ty.isVolatilePtr() and self.liveness.isUnused(inst)) return null;
-
- const lhs = try self.resolveInst(bin_op.lhs);
- const rhs = try self.resolveInst(bin_op.rhs);
-
- const base_ptr = ptr: {
- const ptr_field_ptr = self.builder.buildStructGEP(lhs, 0, "");
- break :ptr self.builder.buildLoad(ptr_field_ptr, "");
- };
-
- const indices: [1]*const llvm.Value = .{rhs};
- const ptr = self.builder.buildInBoundsGEP(base_ptr, &indices, indices.len, "");
- return self.load(ptr, slice_ty);
- }
-
fn airArrayElemVal(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value {
if (self.liveness.isUnused(inst)) return null;
@@ -2240,19 +2220,6 @@ pub const FuncGen = struct {
}
}
- fn airPtrPtrElemVal(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value {
- const bin_op = self.air.instructions.items(.data)[inst].bin_op;
- const ptr_ty = self.air.typeOf(bin_op.lhs).childType();
- if (!ptr_ty.isVolatilePtr() and self.liveness.isUnused(inst)) return null;
-
- const lhs = try self.resolveInst(bin_op.lhs);
- const rhs = try self.resolveInst(bin_op.rhs);
- const base_ptr = self.builder.buildLoad(lhs, "");
- const indices: [1]*const llvm.Value = .{rhs};
- const ptr = self.builder.buildInBoundsGEP(base_ptr, &indices, indices.len, "");
- return self.load(ptr, ptr_ty);
- }
-
fn airStructFieldPtr(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value {
if (self.liveness.isUnused(inst))
return null;
diff --git a/src/print_air.zig b/src/print_air.zig
index a9485a57f9..5231bf0055 100644
--- a/src/print_air.zig
+++ b/src/print_air.zig
@@ -130,9 +130,7 @@ const Writer = struct {
.store,
.array_elem_val,
.slice_elem_val,
- .ptr_slice_elem_val,
.ptr_elem_val,
- .ptr_ptr_elem_val,
.shl,
.shl_exact,
.shl_sat,