authorgravatar for seda18@rolmail.netDavid Senoner <seda18@rolmail.net> 2026-06-11 09:12:33+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-06-28 00:09:59+02:00
logb23a9579151b38e2b3539b9e4e8bbcd858cad2cb
tree64595ff8018ccfb4bad6b1e39f46d9d9daa9061f
parentefd6ded716a027f7d47fe5c38df17785c8e2a2e2

rename `struct_field_val` -> `agg_field_val`

Also rename corresponding `airStructFieldVal` functions -> `airAggFieldVal`

15 files changed, 41 insertions(+), 42 deletions(-)

src/Air.zig+3-4
...@@ -688,8 +688,7 @@ pub const Inst = struct {...@@ -688,8 +688,7 @@ pub const Inst = struct {
688 struct_field_ptr_index_3,688 struct_field_ptr_index_3,
689 /// Given a byval struct or union and a field index, returns the field byval.689 /// Given a byval struct or union and a field index, returns the field byval.
690 /// Uses the `ty_pl` field, payload is `StructField`.690 /// Uses the `ty_pl` field, payload is `StructField`.
691 /// TODO rename to `agg_field_val`691 agg_field_val,
692 struct_field_val,
693 /// Given a pointer to a tagged union, set its tag to the provided value.692 /// Given a pointer to a tagged union, set its tag to the provided value.
694 /// Result type is always void.693 /// Result type is always void.
695 /// Uses the `bin_op` field. LHS is union pointer, RHS is new tag value.694 /// Uses the `bin_op` field. LHS is union pointer, RHS is new tag value.
...@@ -1684,7 +1683,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)...@@ -1684,7 +1683,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
1684 .block,1683 .block,
1685 .dbg_inline_block,1684 .dbg_inline_block,
1686 .struct_field_ptr,1685 .struct_field_ptr,
1687 .struct_field_val,1686 .agg_field_val,
1688 .slice_elem_ptr,1687 .slice_elem_ptr,
1689 .ptr_elem_ptr,1688 .ptr_elem_ptr,
1690 .cmpxchg_weak,1689 .cmpxchg_weak,
...@@ -2079,7 +2078,7 @@ pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool {...@@ -2079,7 +2078,7 @@ pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool {
2079 .struct_field_ptr_index_1,2078 .struct_field_ptr_index_1,
2080 .struct_field_ptr_index_2,2079 .struct_field_ptr_index_2,
2081 .struct_field_ptr_index_3,2080 .struct_field_ptr_index_3,
2082 .struct_field_val,2081 .agg_field_val,
2083 .get_union_tag,2082 .get_union_tag,
2084 .slice,2083 .slice,
2085 .slice_len,2084 .slice_len,
src/Air/Legalize.zig+11-11
...@@ -181,8 +181,8 @@ pub const Feature = enum {...@@ -181,8 +181,8 @@ pub const Feature = enum {
181 /// Currently assumes little endian and a specific integer layout where the lsb of every integer is the lsb of the181 /// Currently assumes little endian and a specific integer layout where the lsb of every integer is the lsb of the
182 /// first byte of memory until bit pointers know their backing type.182 /// first byte of memory until bit pointers know their backing type.
183 expand_packed_store,183 expand_packed_store,
184 /// Replace `struct_field_val` of a packed field with a `bit_cast` to integer, `shr`, `trunc`, and `bit_cast` to field type.184 /// Replace `agg_field_val` of a packed field with a `bit_cast` to integer, `shr`, `trunc`, and `bit_cast` to field type.
185 expand_packed_struct_field_val,185 expand_packed_agg_field_val,
186 /// Replace `aggregate_init` of a packed struct with a sequence of `shl_exact`, `bit_cast`, `int_cast`, and `bit_or`.186 /// Replace `aggregate_init` of a packed struct with a sequence of `shl_exact`, `bit_cast`, `int_cast`, and `bit_or`.
187 expand_packed_aggregate_init,187 expand_packed_aggregate_init,
188188
...@@ -781,7 +781,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {...@@ -781,7 +781,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
781 .struct_field_ptr_index_2,781 .struct_field_ptr_index_2,
782 .struct_field_ptr_index_3,782 .struct_field_ptr_index_3,
783 => {},783 => {},
784 .struct_field_val => if (l.features.has(.expand_packed_struct_field_val)) {784 .agg_field_val => if (l.features.has(.expand_packed_agg_field_val)) {
785 const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl;785 const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl;
786 const extra = l.extraData(Air.StructField, ty_pl.payload).data;786 const extra = l.extraData(Air.StructField, ty_pl.payload).data;
787 switch (l.typeOf(extra.struct_operand).containerLayout(zcu)) {787 switch (l.typeOf(extra.struct_operand).containerLayout(zcu)) {
...@@ -1808,8 +1808,8 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!...@@ -1808,8 +1808,8 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!
1808 // %9 = legalize_vec_elem_val(orig_lhs, %8)1808 // %9 = legalize_vec_elem_val(orig_lhs, %8)
1809 // %10 = legalize_vec_elem_val(orig_rhs, %8)1809 // %10 = legalize_vec_elem_val(orig_rhs, %8)
1810 // %11 = ???_with_overflow(struct { Int, u1 }, %9, %10)1810 // %11 = ???_with_overflow(struct { Int, u1 }, %9, %10)
1811 // %12 = struct_field_val(%11, 0)1811 // %12 = agg_field_val(%11, 0)
1812 // %13 = struct_field_val(%11, 1)1812 // %13 = agg_field_val(%11, 1)
1813 // %14 = legalize_vec_store_elem(%4, %8, %12)1813 // %14 = legalize_vec_store_elem(%4, %8, %12)
1814 // %15 = legalize_vec_store_elem(%4, %8, %13)1814 // %15 = legalize_vec_store_elem(%4, %8, %13)
1815 // %16 = cmp_eq(%8, <usize, N-1>)1815 // %16 = cmp_eq(%8, <usize, N-1>)
...@@ -1861,7 +1861,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!...@@ -1861,7 +1861,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!
1861 } },1861 } },
1862 }).toRef();1862 }).toRef();
1863 const int_elem = loop.block.add(l, .{1863 const int_elem = loop.block.add(l, .{
1864 .tag = .struct_field_val,1864 .tag = .agg_field_val,
1865 .data = .{ .ty_pl = .{1865 .data = .{ .ty_pl = .{
1866 .ty = .fromType(scalar_int_ty),1866 .ty = .fromType(scalar_int_ty),
1867 .payload = try l.addExtra(Air.StructField, .{1867 .payload = try l.addExtra(Air.StructField, .{
...@@ -1871,7 +1871,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!...@@ -1871,7 +1871,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!
1871 } },1871 } },
1872 }).toRef();1872 }).toRef();
1873 const overflow_elem = loop.block.add(l, .{1873 const overflow_elem = loop.block.add(l, .{
1874 .tag = .struct_field_val,1874 .tag = .agg_field_val,
1875 .data = .{ .ty_pl = .{1875 .data = .{ .ty_pl = .{
1876 .ty = .u1_type,1876 .ty = .u1_type,
1877 .payload = try l.addExtra(Air.StructField, .{1877 .payload = try l.addExtra(Air.StructField, .{
...@@ -2343,14 +2343,14 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_...@@ -2343,14 +2343,14 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
2343 // The worst-case scenario is a vector operand:2343 // The worst-case scenario is a vector operand:
2344 //2344 //
2345 // %1 = add_with_overflow(%x, %y)2345 // %1 = add_with_overflow(%x, %y)
2346 // %2 = struct_field_val(%1, .@"1")2346 // %2 = agg_field_val(%1, .@"1")
2347 // %3 = reduce(%2, .@"or")2347 // %3 = reduce(%2, .@"or")
2348 // %4 = bit_cast(%3, @bool_type)2348 // %4 = bit_cast(%3, @bool_type)
2349 // %5 = cond_br(%4, {2349 // %5 = cond_br(%4, {
2350 // %6 = call(@panic.integerOverflow, [])2350 // %6 = call(@panic.integerOverflow, [])
2351 // %7 = unreach()2351 // %7 = unreach()
2352 // }, {2352 // }, {
2353 // %8 = struct_field_val(%1, .@"0")2353 // %8 = agg_field_val(%1, .@"0")
2354 // %9 = br(%z, %8)2354 // %9 = br(%z, %8)
2355 // })2355 // })
2356 var inst_buf: [9]Air.Inst.Index = undefined;2356 var inst_buf: [9]Air.Inst.Index = undefined;
...@@ -2369,7 +2369,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_...@@ -2369,7 +2369,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
2369 } },2369 } },
2370 });2370 });
2371 const overflow_bits_inst = main_block.add(l, .{2371 const overflow_bits_inst = main_block.add(l, .{
2372 .tag = .struct_field_val,2372 .tag = .agg_field_val,
2373 .data = .{ .ty_pl = .{2373 .data = .{ .ty_pl = .{
2374 .ty = Air.internedToRef(overflow_bits_ty.toIntern()),2374 .ty = Air.internedToRef(overflow_bits_ty.toIntern()),
2375 .payload = try l.addExtra(Air.StructField, .{2375 .payload = try l.addExtra(Air.StructField, .{
...@@ -2393,7 +2393,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_...@@ -2393,7 +2393,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
2393 condbr.else_block = .init(condbr.then_block.stealRemainingCapacity());2393 condbr.else_block = .init(condbr.then_block.stealRemainingCapacity());
23942394
2395 const result_inst = condbr.else_block.add(l, .{2395 const result_inst = condbr.else_block.add(l, .{
2396 .tag = .struct_field_val,2396 .tag = .agg_field_val,
2397 .data = .{ .ty_pl = .{2397 .data = .{ .ty_pl = .{
2398 .ty = Air.internedToRef(operand_ty.toIntern()),2398 .ty = Air.internedToRef(operand_ty.toIntern()),
2399 .payload = try l.addExtra(Air.StructField, .{2399 .payload = try l.addExtra(Air.StructField, .{
src/Air/Liveness.zig+1-1
...@@ -680,7 +680,7 @@ fn analyzeInst(...@@ -680,7 +680,7 @@ fn analyzeInst(
680 const extra = a.air.extraData(Air.UnionInit, inst_datas[@intFromEnum(inst)].ty_pl.payload).data;680 const extra = a.air.extraData(Air.UnionInit, inst_datas[@intFromEnum(inst)].ty_pl.payload).data;
681 return analyzeOperands(a, pass, data, inst, .{ extra.init, .none, .none });681 return analyzeOperands(a, pass, data, inst, .{ extra.init, .none, .none });
682 },682 },
683 .struct_field_ptr, .struct_field_val, .spirv_runtime_array_len => {683 .struct_field_ptr, .agg_field_val, .spirv_runtime_array_len => {
684 const extra = a.air.extraData(Air.StructField, inst_datas[@intFromEnum(inst)].ty_pl.payload).data;684 const extra = a.air.extraData(Air.StructField, inst_datas[@intFromEnum(inst)].ty_pl.payload).data;
685 return analyzeOperands(a, pass, data, inst, .{ extra.struct_operand, .none, .none });685 return analyzeOperands(a, pass, data, inst, .{ extra.struct_operand, .none, .none });
686 },686 },
src/Air/Liveness/Verify.zig+1-1
...@@ -198,7 +198,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void {...@@ -198,7 +198,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void {
198 const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data;198 const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data;
199 try self.verifyInstOperands(inst, .{ extra.init, .none, .none });199 try self.verifyInstOperands(inst, .{ extra.init, .none, .none });
200 },200 },
201 .struct_field_ptr, .struct_field_val, .spirv_runtime_array_len => {201 .struct_field_ptr, .agg_field_val, .spirv_runtime_array_len => {
202 const ty_pl = data[@intFromEnum(inst)].ty_pl;202 const ty_pl = data[@intFromEnum(inst)].ty_pl;
203 const extra = self.air.extraData(Air.StructField, ty_pl.payload).data;203 const extra = self.air.extraData(Air.StructField, ty_pl.payload).data;
204 try self.verifyInstOperands(inst, .{ extra.struct_operand, .none, .none });204 try self.verifyInstOperands(inst, .{ extra.struct_operand, .none, .none });
src/Air/Verify.zig+1-1
...@@ -365,7 +365,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {...@@ -365,7 +365,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
365 .struct_field_ptr_index_1,365 .struct_field_ptr_index_1,
366 .struct_field_ptr_index_2,366 .struct_field_ptr_index_2,
367 .struct_field_ptr_index_3,367 .struct_field_ptr_index_3,
368 .struct_field_val,368 .agg_field_val,
369 .set_union_tag,369 .set_union_tag,
370 .get_union_tag,370 .get_union_tag,
371 .slice,371 .slice,
src/Air/print.zig+1-1
...@@ -308,7 +308,7 @@ const Writer = struct {...@@ -308,7 +308,7 @@ const Writer = struct {
308 => try w.writeDbgVar(s, inst),308 => try w.writeDbgVar(s, inst),
309309
310 .struct_field_ptr => try w.writeStructField(s, inst),310 .struct_field_ptr => try w.writeStructField(s, inst),
311 .struct_field_val => try w.writeStructField(s, inst),311 .agg_field_val => try w.writeStructField(s, inst),
312 .spirv_runtime_array_len => try w.writeStructField(s, inst),312 .spirv_runtime_array_len => try w.writeStructField(s, inst),
313 .inferred_alloc => @panic("TODO"),313 .inferred_alloc => @panic("TODO"),
314 .inferred_alloc_comptime => @panic("TODO"),314 .inferred_alloc_comptime => @panic("TODO"),
src/Sema.zig+1-1
...@@ -671,7 +671,7 @@ pub const Block = struct {...@@ -671,7 +671,7 @@ pub const Block = struct {
671 field_ty: Type,671 field_ty: Type,
672 ) !Air.Inst.Ref {672 ) !Air.Inst.Ref {
673 return block.addInst(.{673 return block.addInst(.{
674 .tag = .struct_field_val,674 .tag = .agg_field_val,
675 .data = .{ .ty_pl = .{675 .data = .{ .ty_pl = .{
676 .ty = Air.internedToRef(field_ty.toIntern()),676 .ty = Air.internedToRef(field_ty.toIntern()),
677 .payload = try block.sema.addExtra(Air.StructField{677 .payload = try block.sema.addExtra(Air.StructField{
src/codegen/aarch64/Select.zig+2-2
...@@ -667,7 +667,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {...@@ -667,7 +667,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
667 air_inst_index = air_body[air_body_index];667 air_inst_index = air_body[air_body_index];
668 continue :air_tag air_tags[@intFromEnum(air_inst_index)];668 continue :air_tag air_tags[@intFromEnum(air_inst_index)];
669 },669 },
670 .struct_field_ptr, .struct_field_val => {670 .struct_field_ptr, .agg_field_val => {
671 const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl;671 const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl;
672 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;672 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;
673673
...@@ -5823,7 +5823,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5823,7 +5823,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5823 }5823 }
5824 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;5824 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
5825 },5825 },
5826 .struct_field_val => {5826 .agg_field_val => {
5827 if (isel.live_values.fetchRemove(air.inst_index)) |field_vi| unused: {5827 if (isel.live_values.fetchRemove(air.inst_index)) |field_vi| unused: {
5828 defer field_vi.value.deref(isel);5828 defer field_vi.value.deref(isel);
58295829
src/codegen/c.zig+4-4
...@@ -36,7 +36,7 @@ pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features {...@@ -36,7 +36,7 @@ pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features {
3636
37 .expand_packed_load = true,37 .expand_packed_load = true,
38 .expand_packed_store = true,38 .expand_packed_store = true,
39 .expand_packed_struct_field_val = true,39 .expand_packed_agg_field_val = true,
40 .expand_packed_aggregate_init = true,40 .expand_packed_aggregate_init = true,
4141
42 .scalarize_bit_cast_array = true,42 .scalarize_bit_cast_array = true,
...@@ -2823,7 +2823,7 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) Error!void {...@@ -2823,7 +2823,7 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) Error!void {
28232823
2824 .field_parent_ptr => try airFieldParentPtr(f, inst),2824 .field_parent_ptr => try airFieldParentPtr(f, inst),
28252825
2826 .struct_field_val => try airStructFieldVal(f, inst),2826 .agg_field_val => try airAggFieldVal(f, inst),
2827 .slice_ptr => try airSliceField(f, inst, false, "ptr"),2827 .slice_ptr => try airSliceField(f, inst, false, "ptr"),
2828 .slice_len => try airSliceField(f, inst, false, "len"),2828 .slice_len => try airSliceField(f, inst, false, "len"),
28292829
...@@ -5527,7 +5527,7 @@ fn fieldPtr(...@@ -5527,7 +5527,7 @@ fn fieldPtr(
5527 return local;5527 return local;
5528}5528}
55295529
5530fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue {5530fn airAggFieldVal(f: *Function, inst: Air.Inst.Index) !CValue {
5531 const pt = f.dg.pt;5531 const pt = f.dg.pt;
5532 const zcu = pt.zcu;5532 const zcu = pt.zcu;
5533 const ip = &zcu.intern_pool;5533 const ip = &zcu.intern_pool;
...@@ -5542,7 +5542,7 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -5542,7 +5542,7 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue {
5542 const struct_ty = f.typeOf(extra.struct_operand);5542 const struct_ty = f.typeOf(extra.struct_operand);
5543 const w = &f.code.writer;5543 const w = &f.code.writer;
55445544
5545 assert(struct_ty.containerLayout(zcu) != .@"packed"); // `Air.Legalize.Feature.expand_packed_struct_field_val` handles this case5545 assert(struct_ty.containerLayout(zcu) != .@"packed"); // `Air.Legalize.Feature.expand_packed_agg_field_val` handles this case
5546 const field_name: CValue = switch (ip.indexToKey(struct_ty.toIntern())) {5546 const field_name: CValue = switch (ip.indexToKey(struct_ty.toIntern())) {
5547 .struct_type => .{ .identifier = struct_ty.structFieldName(extra.field_index, zcu).unwrap().?.toSlice(ip) },5547 .struct_type => .{ .identifier = struct_ty.structFieldName(extra.field_index, zcu).unwrap().?.toSlice(ip) },
5548 .union_type => name: {5548 .union_type => name: {
src/codegen/llvm/FuncGen.zig+2-2
...@@ -539,7 +539,7 @@ fn genBody(self: *FuncGen, body: []const Air.Inst.Index, coverage_point: Air.Cov...@@ -539,7 +539,7 @@ fn genBody(self: *FuncGen, body: []const Air.Inst.Index, coverage_point: Air.Cov
539 .atomic_store_seq_cst => try self.airAtomicStore(inst, .seq_cst),539 .atomic_store_seq_cst => try self.airAtomicStore(inst, .seq_cst),
540540
541 .struct_field_ptr => try self.airStructFieldPtr(inst),541 .struct_field_ptr => try self.airStructFieldPtr(inst),
542 .struct_field_val => try self.airStructFieldVal(inst),542 .agg_field_val => try self.airAggFieldVal(inst),
543543
544 .struct_field_ptr_index_0 => try self.airStructFieldPtrIndex(inst, 0),544 .struct_field_ptr_index_0 => try self.airStructFieldPtrIndex(inst, 0),
545 .struct_field_ptr_index_1 => try self.airStructFieldPtrIndex(inst, 1),545 .struct_field_ptr_index_1 => try self.airStructFieldPtrIndex(inst, 1),
...@@ -2323,7 +2323,7 @@ fn airStructFieldPtrIndex(...@@ -2323,7 +2323,7 @@ fn airStructFieldPtrIndex(
2323 return self.fieldPtr(struct_ptr, struct_ptr_ty, field_index);2323 return self.fieldPtr(struct_ptr, struct_ptr_ty, field_index);
2324}2324}
23252325
2326fn airStructFieldVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {2326fn airAggFieldVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {
2327 const o = self.object;2327 const o = self.object;
2328 const zcu = o.zcu;2328 const zcu = o.zcu;
2329 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;2329 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
src/codegen/riscv64/CodeGen.zig+3-3
...@@ -1519,7 +1519,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void {...@@ -1519,7 +1519,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void {
1519 .store => try func.airStore(inst, false),1519 .store => try func.airStore(inst, false),
1520 .store_safe => try func.airStore(inst, true),1520 .store_safe => try func.airStore(inst, true),
1521 .struct_field_ptr=> try func.airStructFieldPtr(inst),1521 .struct_field_ptr=> try func.airStructFieldPtr(inst),
1522 .struct_field_val=> try func.airStructFieldVal(inst),1522 .agg_field_val => try func.airAggFieldVal(inst),
1523 .float_from_int => try func.airFloatFromInt(inst),1523 .float_from_int => try func.airFloatFromInt(inst),
1524 .int_from_float => try func.airIntFromFloat(inst),1524 .int_from_float => try func.airIntFromFloat(inst),
1525 .cmpxchg_strong => try func.airCmpxchg(inst, .strong),1525 .cmpxchg_strong => try func.airCmpxchg(inst, .strong),
...@@ -4591,7 +4591,7 @@ fn structFieldPtr(func: *Func, inst: Air.Inst.Index, operand: Air.Inst.Ref, inde...@@ -4591,7 +4591,7 @@ fn structFieldPtr(func: *Func, inst: Air.Inst.Index, operand: Air.Inst.Ref, inde
4591 return dst_mcv.offset(field_offset);4591 return dst_mcv.offset(field_offset);
4592}4592}
45934593
4594fn airStructFieldVal(func: *Func, inst: Air.Inst.Index) !void {4594fn airAggFieldVal(func: *Func, inst: Air.Inst.Index) !void {
4595 const pt = func.pt;4595 const pt = func.pt;
4596 const zcu = pt.zcu;4596 const zcu = pt.zcu;
45974597
...@@ -4688,7 +4688,7 @@ fn airStructFieldVal(func: *Func, inst: Air.Inst.Index) !void {...@@ -4688,7 +4688,7 @@ fn airStructFieldVal(func: *Func, inst: Air.Inst.Index) !void {
4688 break :result dst_mcv;4688 break :result dst_mcv;
4689 }4689 }
46904690
4691 return func.fail("TODO: airStructFieldVal load_frame field_off non multiple of 8", .{});4691 return func.fail("TODO: airAggFieldVal load_frame field_off non multiple of 8", .{});
4692 },4692 },
4693 else => return func.fail("TODO: airStructField {s}", .{@tagName(src_mcv)}),4693 else => return func.fail("TODO: airStructField {s}", .{@tagName(src_mcv)}),
4694 }4694 }
src/codegen/sparc64/CodeGen.zig+3-3
...@@ -576,7 +576,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {...@@ -576,7 +576,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
576 .store => try self.airStore(inst, false),576 .store => try self.airStore(inst, false),
577 .store_safe => try self.airStore(inst, true),577 .store_safe => try self.airStore(inst, true),
578 .struct_field_ptr=> try self.airStructFieldPtr(inst),578 .struct_field_ptr=> try self.airStructFieldPtr(inst),
579 .struct_field_val=> try self.airStructFieldVal(inst),579 .agg_field_val => try self.airAggFieldVal(inst),
580 .array_to_slice => try self.airArrayToSlice(inst),580 .array_to_slice => try self.airArrayToSlice(inst),
581 .float_from_int => try self.airFloatFromInt(inst),581 .float_from_int => try self.airFloatFromInt(inst),
582 .int_from_float => try self.airIntFromFloat(inst),582 .int_from_float => try self.airIntFromFloat(inst),
...@@ -2473,7 +2473,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void {...@@ -2473,7 +2473,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void {
2473 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });2473 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
2474}2474}
24752475
2476fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {2476fn airAggFieldVal(self: *Self, inst: Air.Inst.Index) !void {
2477 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;2477 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
2478 const extra = self.air.extraData(Air.StructField, ty_pl.payload).data;2478 const extra = self.air.extraData(Air.StructField, ty_pl.payload).data;
2479 const operand = extra.struct_operand;2479 const operand = extra.struct_operand;
...@@ -2536,7 +2536,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {...@@ -2536,7 +2536,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
2536 else => unreachable,2536 else => unreachable,
2537 }2537 }
2538 },2538 },
2539 else => return self.fail("TODO implement codegen struct_field_val for {}", .{mcv}),2539 else => return self.fail("TODO implement codegen agg_field_val for {}", .{mcv}),
2540 }2540 }
2541 };2541 };
25422542
src/codegen/spirv/CodeGen.zig+2-2
...@@ -4222,7 +4222,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) Error!void {...@@ -4222,7 +4222,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) Error!void {
4222 .get_union_tag => try cg.airGetUnionTag(inst),4222 .get_union_tag => try cg.airGetUnionTag(inst),
4223 .union_init => try cg.airUnionInit(inst),4223 .union_init => try cg.airUnionInit(inst),
42244224
4225 .struct_field_val => try cg.airStructFieldVal(inst),4225 .agg_field_val => try cg.airAggFieldVal(inst),
4226 .field_parent_ptr => try cg.airFieldParentPtr(inst),4226 .field_parent_ptr => try cg.airFieldParentPtr(inst),
42274227
4228 .struct_field_ptr => try cg.airStructFieldPtr(inst),4228 .struct_field_ptr => try cg.airStructFieldPtr(inst),
...@@ -6701,7 +6701,7 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id {...@@ -6701,7 +6701,7 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
6701 return try cg.unionInit(ty, extra.field_index, payload);6701 return try cg.unionInit(ty, extra.field_index, payload);
6702}6702}
67036703
6704fn airStructFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id {6704fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
6705 const pt = cg.pt;6705 const pt = cg.pt;
6706 const zcu = cg.zcu;6706 const zcu = cg.zcu;
6707 const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;6707 const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
src/codegen/wasm/CodeGen.zig+4-4
...@@ -41,7 +41,7 @@ pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features {...@@ -41,7 +41,7 @@ pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features {
4141
42 .expand_packed_load,42 .expand_packed_load,
43 .expand_packed_store,43 .expand_packed_store,
44 .expand_packed_struct_field_val,44 .expand_packed_agg_field_val,
45 .expand_packed_aggregate_init,45 .expand_packed_aggregate_init,
4646
47 .scalarize_add,47 .scalarize_add,
...@@ -1809,7 +1809,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -1809,7 +1809,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
1809 .struct_field_ptr_index_1 => cg.airStructFieldPtrIndex(inst, 1),1809 .struct_field_ptr_index_1 => cg.airStructFieldPtrIndex(inst, 1),
1810 .struct_field_ptr_index_2 => cg.airStructFieldPtrIndex(inst, 2),1810 .struct_field_ptr_index_2 => cg.airStructFieldPtrIndex(inst, 2),
1811 .struct_field_ptr_index_3 => cg.airStructFieldPtrIndex(inst, 3),1811 .struct_field_ptr_index_3 => cg.airStructFieldPtrIndex(inst, 3),
1812 .struct_field_val => cg.airStructFieldVal(inst),1812 .agg_field_val => cg.airAggFieldVal(inst),
1813 .field_parent_ptr => cg.airFieldParentPtr(inst),1813 .field_parent_ptr => cg.airFieldParentPtr(inst),
18141814
1815 .switch_br => cg.airSwitchBr(inst, false),1815 .switch_br => cg.airSwitchBr(inst, false),
...@@ -5470,7 +5470,7 @@ fn structFieldPtr(...@@ -5470,7 +5470,7 @@ fn structFieldPtr(
5470 }5470 }
5471}5471}
54725472
5473fn airStructFieldVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {5473fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5474 const pt = cg.pt;5474 const pt = cg.pt;
5475 const zcu = pt.zcu;5475 const zcu = pt.zcu;
5476 const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;5476 const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
...@@ -5483,7 +5483,7 @@ fn airStructFieldVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -5483,7 +5483,7 @@ fn airStructFieldVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5483 if (!field_ty.hasRuntimeBits(zcu)) return cg.finishAir(inst, .none, &.{struct_field.struct_operand});5483 if (!field_ty.hasRuntimeBits(zcu)) return cg.finishAir(inst, .none, &.{struct_field.struct_operand});
54845484
5485 const result: WValue = switch (struct_ty.containerLayout(zcu)) {5485 const result: WValue = switch (struct_ty.containerLayout(zcu)) {
5486 .@"packed" => unreachable, // legalize .expand_packed_struct_field_val5486 .@"packed" => unreachable, // legalize .expand_packed_agg_field_val
5487 else => result: {5487 else => result: {
5488 const offset = std.math.cast(u32, struct_ty.structFieldOffset(field_index, zcu)) orelse {5488 const offset = std.math.cast(u32, struct_ty.structFieldOffset(field_index, zcu)) orelse {
5489 return cg.fail("Field type '{f}' too big to fit into stack frame", .{field_ty.fmt(pt)});5489 return cg.fail("Field type '{f}' too big to fit into stack frame", .{field_ty.fmt(pt)});
src/codegen/x86_64/CodeGen.zig+2-2
...@@ -72,7 +72,7 @@ pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features {...@@ -72,7 +72,7 @@ pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features {
7272
73 .expand_packed_load,73 .expand_packed_load,
74 .expand_packed_store,74 .expand_packed_store,
75 .expand_packed_struct_field_val,75 .expand_packed_agg_field_val,
76 .expand_packed_aggregate_init,76 .expand_packed_aggregate_init,
77 });77 });
78}78}
...@@ -103965,7 +103965,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103965,7 +103965,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103965 )), cg);103965 )), cg);
103966 try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg);103966 try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg);
103967 },103967 },
103968 .struct_field_val => {103968 .agg_field_val => {
103969 const ty_pl = air_datas[@intFromEnum(inst)].ty_pl;103969 const ty_pl = air_datas[@intFromEnum(inst)].ty_pl;
103970 const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data;103970 const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data;
103971 const agg_ty = cg.typeOf(struct_field.struct_operand);103971 const agg_ty = cg.typeOf(struct_field.struct_operand);