| author | |
| committer | |
| log | 84876fec582e13707a809c8136bb1eaf92b5da09 |
| tree | 31a7024410c73a01ffbf59da136b6eb9ea01d837 |
| parent | 1d3382202029cde2e00d7747ec0ea53a5df68047 |
7 files changed, 0 insertions(+), 89 deletions(-)
src/Air.zig-14| ... | ... | @@ -384,10 +384,6 @@ pub const Inst = struct { |
| 384 | 384 | /// Result type is the element type of the slice operand. |
| 385 | 385 | /// Uses the `bin_op` field. |
| 386 | 386 | slice_elem_val, |
| 387 | /// Given a pointer to a slice, and element index, return the element value at that index. | |
| 388 | /// Result type is the element type of the slice operand (2 element type operations). | |
| 389 | /// Uses the `bin_op` field. | |
| 390 | ptr_slice_elem_val, | |
| 391 | 387 | /// Given a pointer value, and element index, return the element value at that index. |
| 392 | 388 | /// Result type is the element type of the pointer operand. |
| 393 | 389 | /// Uses the `bin_op` field. |
| ... | ... | @@ -396,11 +392,6 @@ pub const Inst = struct { |
| 396 | 392 | /// Result type is pointer to the element type of the pointer operand. |
| 397 | 393 | /// Uses the `ty_pl` field with payload `Bin`. |
| 398 | 394 | ptr_elem_ptr, |
| 399 | /// Given a pointer to a pointer, and element index, return the element value of the inner | |
| 400 | /// pointer at that index. | |
| 401 | /// Result type is the element type of the inner pointer operand. | |
| 402 | /// Uses the `bin_op` field. | |
| 403 | ptr_ptr_elem_val, | |
| 404 | 395 | /// Given a pointer to an array, return a slice. |
| 405 | 396 | /// Uses the `ty_op` field. |
| 406 | 397 | array_to_slice, |
| ... | ... | @@ -772,11 +763,6 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index) Type { |
| 772 | 763 | const ptr_ty = air.typeOf(datas[inst].bin_op.lhs); |
| 773 | 764 | return ptr_ty.elemType(); |
| 774 | 765 | }, |
| 775 | .ptr_slice_elem_val, .ptr_ptr_elem_val => { | |
| 776 | const outer_ptr_ty = air.typeOf(datas[inst].bin_op.lhs); | |
| 777 | const inner_ptr_ty = outer_ptr_ty.elemType(); | |
| 778 | return inner_ptr_ty.elemType(); | |
| 779 | }, | |
| 780 | 766 | .atomic_load => { |
| 781 | 767 | const ptr_ty = air.typeOf(datas[inst].atomic_load.ptr); |
| 782 | 768 | return ptr_ty.elemType(); |
src/Liveness.zig-2| ... | ... | @@ -252,9 +252,7 @@ fn analyzeInst( |
| 252 | 252 | .store, |
| 253 | 253 | .array_elem_val, |
| 254 | 254 | .slice_elem_val, |
| 255 | .ptr_slice_elem_val, | |
| 256 | 255 | .ptr_elem_val, |
| 257 | .ptr_ptr_elem_val, | |
| 258 | 256 | .shl, |
| 259 | 257 | .shl_exact, |
| 260 | 258 | .shl_sat, |
src/arch/aarch64/CodeGen.zig-16| ... | ... | @@ -500,10 +500,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 500 | 500 | |
| 501 | 501 | .array_elem_val => try self.airArrayElemVal(inst), |
| 502 | 502 | .slice_elem_val => try self.airSliceElemVal(inst), |
| 503 | .ptr_slice_elem_val => try self.airPtrSliceElemVal(inst), | |
| 504 | 503 | .ptr_elem_val => try self.airPtrElemVal(inst), |
| 505 | 504 | .ptr_elem_ptr => try self.airPtrElemPtr(inst), |
| 506 | .ptr_ptr_elem_val => try self.airPtrPtrElemVal(inst), | |
| 507 | 505 | |
| 508 | 506 | .constant => unreachable, // excluded from function bodies |
| 509 | 507 | .const_ty => unreachable, // excluded from function bodies |
| ... | ... | @@ -1092,13 +1090,6 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 1092 | 1090 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 1093 | 1091 | } |
| 1094 | 1092 | |
| 1095 | fn airPtrSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { | |
| 1096 | const is_volatile = false; // TODO | |
| 1097 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 1098 | 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}); | |
| 1099 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | |
| 1100 | } | |
| 1101 | ||
| 1102 | 1093 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 1103 | 1094 | const is_volatile = false; // TODO |
| 1104 | 1095 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | ... | @@ -1113,13 +1104,6 @@ fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 1113 | 1104 | return self.finishAir(inst, result, .{ extra.lhs, extra.rhs, .none }); |
| 1114 | 1105 | } |
| 1115 | 1106 | |
| 1116 | fn airPtrPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { | |
| 1117 | const is_volatile = false; // TODO | |
| 1118 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 1119 | 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}); | |
| 1120 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | |
| 1121 | } | |
| 1122 | ||
| 1123 | 1107 | fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void { |
| 1124 | 1108 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 1125 | 1109 | _ = bin_op; |
src/codegen.zig-20| ... | ... | @@ -848,10 +848,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 848 | 848 | |
| 849 | 849 | .array_elem_val => try self.airArrayElemVal(inst), |
| 850 | 850 | .slice_elem_val => try self.airSliceElemVal(inst), |
| 851 | .ptr_slice_elem_val => try self.airPtrSliceElemVal(inst), | |
| 852 | 851 | .ptr_elem_val => try self.airPtrElemVal(inst), |
| 853 | 852 | .ptr_elem_ptr => try self.airPtrElemPtr(inst), |
| 854 | .ptr_ptr_elem_val => try self.airPtrPtrElemVal(inst), | |
| 855 | 853 | |
| 856 | 854 | .constant => unreachable, // excluded from function bodies |
| 857 | 855 | .const_ty => unreachable, // excluded from function bodies |
| ... | ... | @@ -1543,15 +1541,6 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1543 | 1541 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 1544 | 1542 | } |
| 1545 | 1543 | |
| 1546 | fn airPtrSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { | |
| 1547 | const is_volatile = false; // TODO | |
| 1548 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 1549 | const result: MCValue = if (!is_volatile and self.liveness.isUnused(inst)) .dead else switch (arch) { | |
| 1550 | else => return self.fail("TODO implement ptr_slice_elem_val for {}", .{self.target.cpu.arch}), | |
| 1551 | }; | |
| 1552 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | |
| 1553 | } | |
| 1554 | ||
| 1555 | 1544 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 1556 | 1545 | const is_volatile = false; // TODO |
| 1557 | 1546 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | ... | @@ -1570,15 +1559,6 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1570 | 1559 | return self.finishAir(inst, result, .{ extra.lhs, extra.rhs, .none }); |
| 1571 | 1560 | } |
| 1572 | 1561 | |
| 1573 | fn airPtrPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { | |
| 1574 | const is_volatile = false; // TODO | |
| 1575 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 1576 | const result: MCValue = if (!is_volatile and self.liveness.isUnused(inst)) .dead else switch (arch) { | |
| 1577 | else => return self.fail("TODO implement ptr_ptr_elem_val for {}", .{self.target.cpu.arch}), | |
| 1578 | }; | |
| 1579 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | |
| 1580 | } | |
| 1581 | ||
| 1582 | 1562 | fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void { |
| 1583 | 1563 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 1584 | 1564 | const result: MCValue = switch (arch) { |
src/codegen/c.zig-2| ... | ... | @@ -1081,10 +1081,8 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO |
| 1081 | 1081 | .ptr_slice_ptr_ptr => try airPtrSliceFieldPtr(f, inst, ".ptr;\n"), |
| 1082 | 1082 | |
| 1083 | 1083 | .ptr_elem_val => try airPtrElemVal(f, inst, "["), |
| 1084 | .ptr_ptr_elem_val => try airPtrElemVal(f, inst, "[0]["), | |
| 1085 | 1084 | .ptr_elem_ptr => try airPtrElemPtr(f, inst), |
| 1086 | 1085 | .slice_elem_val => try airSliceElemVal(f, inst, "["), |
| 1087 | .ptr_slice_elem_val => try airSliceElemVal(f, inst, "[0]["), | |
| 1088 | 1086 | .array_elem_val => try airArrayElemVal(f, inst), |
| 1089 | 1087 | |
| 1090 | 1088 | .unwrap_errunion_payload => try airUnwrapErrUnionPay(f, inst), |
src/codegen/llvm.zig-33| ... | ... | @@ -1760,10 +1760,8 @@ pub const FuncGen = struct { |
| 1760 | 1760 | |
| 1761 | 1761 | .array_elem_val => try self.airArrayElemVal(inst), |
| 1762 | 1762 | .slice_elem_val => try self.airSliceElemVal(inst), |
| 1763 | .ptr_slice_elem_val => try self.airPtrSliceElemVal(inst), | |
| 1764 | 1763 | .ptr_elem_val => try self.airPtrElemVal(inst), |
| 1765 | 1764 | .ptr_elem_ptr => try self.airPtrElemPtr(inst), |
| 1766 | .ptr_ptr_elem_val => try self.airPtrPtrElemVal(inst), | |
| 1767 | 1765 | |
| 1768 | 1766 | .optional_payload => try self.airOptionalPayload(inst, false), |
| 1769 | 1767 | .optional_payload_ptr => try self.airOptionalPayload(inst, true), |
| ... | ... | @@ -2165,24 +2163,6 @@ pub const FuncGen = struct { |
| 2165 | 2163 | return self.load(ptr, slice_ty); |
| 2166 | 2164 | } |
| 2167 | 2165 | |
| 2168 | fn airPtrSliceElemVal(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { | |
| 2169 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 2170 | const slice_ty = self.air.typeOf(bin_op.lhs).childType(); | |
| 2171 | if (!slice_ty.isVolatilePtr() and self.liveness.isUnused(inst)) return null; | |
| 2172 | ||
| 2173 | const lhs = try self.resolveInst(bin_op.lhs); | |
| 2174 | const rhs = try self.resolveInst(bin_op.rhs); | |
| 2175 | ||
| 2176 | const base_ptr = ptr: { | |
| 2177 | const ptr_field_ptr = self.builder.buildStructGEP(lhs, 0, ""); | |
| 2178 | break :ptr self.builder.buildLoad(ptr_field_ptr, ""); | |
| 2179 | }; | |
| 2180 | ||
| 2181 | const indices: [1]*const llvm.Value = .{rhs}; | |
| 2182 | const ptr = self.builder.buildInBoundsGEP(base_ptr, &indices, indices.len, ""); | |
| 2183 | return self.load(ptr, slice_ty); | |
| 2184 | } | |
| 2185 | ||
| 2186 | 2166 | fn airArrayElemVal(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { |
| 2187 | 2167 | if (self.liveness.isUnused(inst)) return null; |
| 2188 | 2168 | |
| ... | ... | @@ -2240,19 +2220,6 @@ pub const FuncGen = struct { |
| 2240 | 2220 | } |
| 2241 | 2221 | } |
| 2242 | 2222 | |
| 2243 | fn airPtrPtrElemVal(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { | |
| 2244 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 2245 | const ptr_ty = self.air.typeOf(bin_op.lhs).childType(); | |
| 2246 | if (!ptr_ty.isVolatilePtr() and self.liveness.isUnused(inst)) return null; | |
| 2247 | ||
| 2248 | const lhs = try self.resolveInst(bin_op.lhs); | |
| 2249 | const rhs = try self.resolveInst(bin_op.rhs); | |
| 2250 | const base_ptr = self.builder.buildLoad(lhs, ""); | |
| 2251 | const indices: [1]*const llvm.Value = .{rhs}; | |
| 2252 | const ptr = self.builder.buildInBoundsGEP(base_ptr, &indices, indices.len, ""); | |
| 2253 | return self.load(ptr, ptr_ty); | |
| 2254 | } | |
| 2255 | ||
| 2256 | 2223 | fn airStructFieldPtr(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { |
| 2257 | 2224 | if (self.liveness.isUnused(inst)) |
| 2258 | 2225 | return null; |
src/print_air.zig-2| ... | ... | @@ -130,9 +130,7 @@ const Writer = struct { |
| 130 | 130 | .store, |
| 131 | 131 | .array_elem_val, |
| 132 | 132 | .slice_elem_val, |
| 133 | .ptr_slice_elem_val, | |
| 134 | 133 | .ptr_elem_val, |
| 135 | .ptr_ptr_elem_val, | |
| 136 | 134 | .shl, |
| 137 | 135 | .shl_exact, |
| 138 | 136 | .shl_sat, |