authorgravatar for mathieusuen@yahoo.frMathieu Suen <mathieusuen@yahoo.fr> 2026-08-18 14:20:51+02:00
committergravatar for mathk@noreply.codeberg.orgmathk <mathk@noreply.codeberg.org> 2026-08-19 08:02:13+02:00
logba0cfda93dabd07ded441ecf475fc28a90bd495e
tree19993ee4737823bcee9792b1f049c75f7a664cf1
parentfff5e675bb0493914acb4a6e929fb090867cc9c3

chore: Air, Unify type of ty for Data payload


17 files changed, 298 insertions(+), 314 deletions(-)

src/Air.zig+13-13
......@@ -1297,15 +1297,15 @@ pub const Inst = struct {
12971297 },
12981298 ty: Type,
12991299 arg: struct {
1300 ty: Ref,
1300 ty: Type,
13011301 zir_param_index: u32,
13021302 },
13031303 ty_op: struct {
1304 ty: Ref,
1304 ty: Type,
13051305 operand: Ref,
13061306 },
13071307 ty_pl: struct {
1308 ty: Ref,
1308 ty: Type,
13091309 // Index into a different array.
13101310 payload: u32,
13111311 },
......@@ -1339,7 +1339,7 @@ pub const Inst = struct {
13391339 operation: std.lang.ReduceOp,
13401340 },
13411341 ty_nav: struct {
1342 ty: InternPool.Index,
1342 ty: Type,
13431343 nav: InternPool.Nav.Index,
13441344 },
13451345 legalize_compiler_rt_call: struct {
......@@ -1700,7 +1700,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
17001700 .c_va_start,
17011701 => return datas[@backingInt(inst)].ty,
17021702
1703 .arg => return datas[@backingInt(inst)].arg.ty.toType(),
1703 .arg => return datas[@backingInt(inst)].arg.ty,
17041704
17051705 .assembly,
17061706 .block,
......@@ -1727,7 +1727,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
17271727 .try_ptr_cold,
17281728 .shuffle_one,
17291729 .shuffle_two,
1730 => return datas[@backingInt(inst)].ty_pl.ty.toType(),
1730 => return datas[@backingInt(inst)].ty_pl.ty,
17311731
17321732 .not,
17331733 .bit_cast,
......@@ -1781,7 +1781,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
17811781 .c_va_arg,
17821782 .c_va_copy,
17831783 .abs,
1784 => return datas[@backingInt(inst)].ty_op.ty.toType(),
1784 => return datas[@backingInt(inst)].ty_op.ty,
17851785
17861786 .loop,
17871787 .repeat,
......@@ -1865,7 +1865,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
18651865 return .fromInterned(ip.indexToKey(err_union_ty.ip_index).error_union_type.payload_type);
18661866 },
18671867
1868 .runtime_nav_ptr => return .fromInterned(datas[@backingInt(inst)].ty_nav.ty),
1868 .runtime_nav_ptr => return datas[@backingInt(inst)].ty_nav.ty,
18691869
18701870 .work_item_id,
18711871 .work_group_size,
......@@ -2268,7 +2268,7 @@ pub fn unwrapDbgBlock(air: *const Air, inst_index: Inst.Index) UnwrappedDbgInlin
22682268 const extra = air.extraData(Air.DbgInlineBlock, payload);
22692269 return .{
22702270 .func = extra.data.func,
2271 .ty = data.ty_pl.ty.toType(),
2271 .ty = data.ty_pl.ty,
22722272 .body = @ptrCast(air.extra.items[extra.end..][0..extra.data.body_len]),
22732273 };
22742274}
......@@ -2287,7 +2287,7 @@ pub fn unwrapBlock(air: *const Air, inst_index: Inst.Index) UnwrappedBlock {
22872287 };
22882288 const extra = air.extraData(Air.Block, payload);
22892289 return .{
2290 .ty = data.ty_pl.ty.toType(),
2290 .ty = data.ty_pl.ty,
22912291 .body = @ptrCast(air.extra.items[extra.end..][0..extra.data.body_len]),
22922292 };
22932293}
......@@ -2367,7 +2367,7 @@ pub fn unwrapTry(air: *const Air, inst_index: Inst.Index) UnwrappedTry {
23672367}
23682368
23692369pub const UnwrappedTryPtr = struct {
2370 error_union_payload_ptr_ty: Inst.Ref,
2370 error_union_payload_ptr_ty: Type,
23712371 error_union_ptr: Inst.Ref,
23722372 else_body: []const Inst.Index,
23732373};
......@@ -2482,7 +2482,7 @@ pub fn unwrapShuffleOne(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index
24822482 .shuffle_one => {},
24832483 else => unreachable, // assertion failure
24842484 }
2485 const result_ty: Type = .fromInterned(inst.data.ty_pl.ty.toInterned().?);
2485 const result_ty: Type = inst.data.ty_pl.ty;
24862486 const mask_len: u32 = result_ty.vectorLen(zcu);
24872487 const extra_idx = inst.data.ty_pl.payload;
24882488 return .{
......@@ -2505,7 +2505,7 @@ pub fn unwrapShuffleTwo(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index
25052505 .shuffle_two => {},
25062506 else => unreachable, // assertion failure
25072507 }
2508 const result_ty: Type = .fromInterned(inst.data.ty_pl.ty.toInterned().?);
2508 const result_ty: Type = inst.data.ty_pl.ty;
25092509 const mask_len: u32 = result_ty.vectorLen(zcu);
25102510 const extra_idx = inst.data.ty_pl.payload;
25112511 return .{
src/Air/Legalize.zig+77-77
......@@ -470,7 +470,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
470470 .shl_with_overflow,
471471 => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) {
472472 const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl;
473 if (ty_pl.ty.toType().fieldType(0, zcu).isVector(zcu)) {
473 if (ty_pl.ty.fieldType(0, zcu).isVector(zcu)) {
474474 continue :inst l.replaceInst(inst, .block, try l.scalarizeOverflowBlockPayload(inst));
475475 }
476476 },
......@@ -527,27 +527,27 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
527527 .trunc,
528528 => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) {
529529 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;
530 if (ty_op.ty.toType().isVector(zcu)) {
530 if (ty_op.ty.isVector(zcu)) {
531531 continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op));
532532 }
533533 },
534534 .abs => {
535535 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;
536 switch (l.wantScalarizeOrSoftFloat(.abs, ty_op.ty.toType())) {
536 switch (l.wantScalarizeOrSoftFloat(.abs, ty_op.ty)) {
537537 .none => {},
538538 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)),
539539 .soft_float => continue :inst try l.compilerRtCall(
540540 inst,
541 softFloatFunc(.abs, ty_op.ty.toType(), zcu),
541 softFloatFunc(.abs, ty_op.ty, zcu),
542542 &.{ty_op.operand},
543 ty_op.ty.toType(),
543 ty_op.ty,
544544 ),
545545 }
546546 },
547547 .fptrunc => {
548548 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;
549549 const src_ty = l.typeOf(ty_op.operand);
550 const dest_ty = ty_op.ty.toType();
550 const dest_ty = ty_op.ty;
551551 if (src_ty.zigTypeTag(zcu) == .vector) {
552552 if (l.features.has(.scalarize_fptrunc) or
553553 l.wantSoftFloatScalar(src_ty.childType(zcu)) or
......@@ -562,7 +562,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
562562 .fpext => {
563563 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;
564564 const src_ty = l.typeOf(ty_op.operand);
565 const dest_ty = ty_op.ty.toType();
565 const dest_ty = ty_op.ty;
566566 if (src_ty.zigTypeTag(zcu) == .vector) {
567567 if (l.features.has(.scalarize_fpext) or
568568 l.wantSoftFloatScalar(src_ty.childType(zcu)) or
......@@ -580,14 +580,14 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
580580 .none => {},
581581 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)),
582582 .soft_float => switch (try l.softIntFromFloat(inst)) {
583 .call => |func| continue :inst try l.compilerRtCall(inst, func, &.{ty_op.operand}, ty_op.ty.toType()),
583 .call => |func| continue :inst try l.compilerRtCall(inst, func, &.{ty_op.operand}, ty_op.ty),
584584 .block_payload => |data| continue :inst l.replaceInst(inst, .block, data),
585585 },
586586 }
587587 },
588588 .float_from_int => {
589589 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;
590 const dest_ty = ty_op.ty.toType();
590 const dest_ty = ty_op.ty;
591591 switch (l.wantScalarizeOrSoftFloat(.float_from_int, dest_ty)) {
592592 .none => {},
593593 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)),
......@@ -630,7 +630,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
630630 continue :inst l.replaceInst(inst, .int_cast, .{ .ty_op = ty_op });
631631 } else if (l.features.has(.scalarize_int_cast_safe)) {
632632 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;
633 if (ty_op.ty.toType().isVector(zcu)) {
633 if (ty_op.ty.isVector(zcu)) {
634634 continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op));
635635 }
636636 },
......@@ -875,7 +875,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
875875 switch (vector_ty.vectorLen(zcu)) {
876876 0 => unreachable,
877877 1 => continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{
878 .ty = .fromType(vector_ty.childType(zcu)),
878 .ty = vector_ty.childType(zcu),
879879 .operand = reduce.operand,
880880 } }),
881881 else => {},
......@@ -893,7 +893,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
893893 },
894894 .splat => if (l.features.has(.splat_one_elem_to_bit_cast)) {
895895 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;
896 switch (ty_op.ty.toType().vectorLen(zcu)) {
896 switch (ty_op.ty.vectorLen(zcu)) {
897897 0 => unreachable,
898898 1 => continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{
899899 .ty = ty_op.ty,
......@@ -904,7 +904,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
904904 },
905905 .shuffle_one => {
906906 const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl;
907 switch (l.wantScalarizeOrSoftFloat(.shuffle_one, ty_pl.ty.toType())) {
907 switch (l.wantScalarizeOrSoftFloat(.shuffle_one, ty_pl.ty)) {
908908 .none => {},
909909 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleOneBlockPayload(inst)),
910910 .soft_float => unreachable, // the operand is not a scalar
......@@ -912,7 +912,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
912912 },
913913 .shuffle_two => {
914914 const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl;
915 switch (l.wantScalarizeOrSoftFloat(.shuffle_two, ty_pl.ty.toType())) {
915 switch (l.wantScalarizeOrSoftFloat(.shuffle_two, ty_pl.ty)) {
916916 .none => {},
917917 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleTwoBlockPayload(inst)),
918918 .soft_float => unreachable, // the operand is not a scalar
......@@ -946,7 +946,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
946946 => {},
947947 .aggregate_init => if (l.features.has(.expand_packed_aggregate_init)) {
948948 const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl;
949 const agg_ty = ty_pl.ty.toType();
949 const agg_ty = ty_pl.ty;
950950 switch (agg_ty.zigTypeTag(zcu)) {
951951 else => {},
952952 .@"union" => unreachable,
......@@ -962,7 +962,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
962962 if (field_bits == struct_bits) {
963963 // Just bitcast this field.
964964 continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{
965 .ty = .fromType(agg_ty),
965 .ty = agg_ty,
966966 .operand = @fromBackingInt(@intCast(l.air_extra.items[ty_pl.payload + field_index])),
967967 } });
968968 }
......@@ -1152,7 +1152,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz
11521152 const elem_block_inst = loop.block.add(l, .{
11531153 .tag = .block,
11541154 .data = .{ .ty_pl = .{
1155 .ty = .fromType(res_elem_ty),
1155 .ty = res_elem_ty,
11561156 .payload = undefined,
11571157 } },
11581158 });
......@@ -1182,7 +1182,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz
11821182 const elem_ptr = loop.block.add(l, .{
11831183 .tag = .ptr_elem_ptr,
11841184 .data = .{ .ty_pl = .{
1185 .ty = .fromType(try pt.singleMutPtrType(res_elem_ty)),
1185 .ty = try pt.singleMutPtrType(res_elem_ty),
11861186 .payload = try l.addExtra(Air.Bin, .{
11871187 .lhs = result_ptr,
11881188 .rhs = index_val,
......@@ -1223,7 +1223,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz
12231223 try loop.finish(l);
12241224
12251225 return .{ .ty_pl = .{
1226 .ty = .fromType(res_ty),
1226 .ty = res_ty,
12271227 .payload = try l.addBlockBody(main_block.body()),
12281228 } };
12291229}
......@@ -1303,7 +1303,7 @@ fn scalarizeShuffleOneBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro
13031303 main_block.addBr(l, orig_inst, result_val);
13041304
13051305 return .{ .ty_pl = .{
1306 .ty = .fromType(shuffle.result_ty),
1306 .ty = shuffle.result_ty,
13071307 .payload = try l.addBlockBody(main_block.body()),
13081308 } };
13091309}
......@@ -1409,7 +1409,7 @@ fn scalarizeShuffleTwoBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro
14091409 main_block.addBr(l, orig_inst, result_val);
14101410
14111411 return .{ .ty_pl = .{
1412 .ty = .fromType(shuffle.result_ty),
1412 .ty = shuffle.result_ty,
14131413 .payload = try l.addBlockBody(main_block.body()),
14141414 } };
14151415}
......@@ -1478,7 +1478,7 @@ fn addScalarizedShuffle(
14781478 const main_block_inst = parent_block.add(l, .{
14791479 .tag = .block,
14801480 .data = .{ .ty_pl = .{
1481 .ty = .void_type,
1481 .ty = .void,
14821482 .payload = undefined,
14831483 } },
14841484 });
......@@ -1532,7 +1532,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
15321532
15331533 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;
15341534
1535 const dest_ty = ty_op.ty.toType();
1535 const dest_ty = ty_op.ty;
15361536 const operand_ty = l.typeOf(ty_op.operand);
15371537
15381538 // We exit this block only if the scalarization is actually necessary. Otherwise we will return
......@@ -1677,7 +1677,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
16771677 const uint_block_inst = main_block.add(l, .{
16781678 .tag = .block,
16791679 .data = .{ .ty_pl = .{
1680 .ty = .fromType(uint_ty),
1680 .ty = uint_ty,
16811681 .payload = undefined,
16821682 } },
16831683 });
......@@ -1746,7 +1746,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
17461746 .bit_cast_safe => main_block.add(l, .{
17471747 .tag = .bit_cast_safe,
17481748 .data = .{ .ty_op = .{
1749 .ty = .fromType(dest_ty),
1749 .ty = dest_ty,
17501750 .operand = uint_val,
17511751 } },
17521752 }).toRef(),
......@@ -1761,7 +1761,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
17611761 const result = main_block.add(l, .{
17621762 .tag = .aggregate_init,
17631763 .data = .{ .ty_pl = .{
1764 .ty = .fromType(dest_ty),
1764 .ty = dest_ty,
17651765 .payload = @intCast(aggregate_init_payload_start),
17661766 } },
17671767 }).toRef();
......@@ -1814,7 +1814,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
18141814 const elem_ptr = loop.block.add(l, .{
18151815 .tag = .ptr_elem_ptr,
18161816 .data = .{ .ty_pl = .{
1817 .ty = .fromType(try pt.singleMutPtrType(elem_ty)),
1817 .ty = try pt.singleMutPtrType(elem_ty),
18181818 .payload = try l.addExtra(Air.Bin, .{
18191819 .lhs = result_ptr,
18201820 .rhs = index_val,
......@@ -1860,7 +1860,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
18601860 }
18611861
18621862 return .{ .ty_pl = .{
1863 .ty = .fromType(dest_ty),
1863 .ty = dest_ty,
18641864 .payload = try l.addBlockBody(main_block.body()),
18651865 } };
18661866}
......@@ -1942,14 +1942,14 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!
19421942 const elem_result = loop.block.add(l, .{
19431943 .tag = orig.tag,
19441944 .data = .{ .ty_pl = .{
1945 .ty = .fromType(scalar_tuple_ty),
1945 .ty = scalar_tuple_ty,
19461946 .payload = try l.addExtra(Air.Bin, .{ .lhs = lhs, .rhs = rhs }),
19471947 } },
19481948 }).toRef();
19491949 const int_elem = loop.block.add(l, .{
19501950 .tag = .agg_field_val,
19511951 .data = .{ .ty_pl = .{
1952 .ty = .fromType(scalar_int_ty),
1952 .ty = scalar_int_ty,
19531953 .payload = try l.addExtra(Air.StructField, .{
19541954 .struct_operand = elem_result,
19551955 .field_index = 0,
......@@ -1959,7 +1959,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!
19591959 const overflow_elem = loop.block.add(l, .{
19601960 .tag = .agg_field_val,
19611961 .data = .{ .ty_pl = .{
1962 .ty = .u1_type,
1962 .ty = .u1,
19631963 .payload = try l.addExtra(Air.StructField, .{
19641964 .struct_operand = elem_result,
19651965 .field_index = 1,
......@@ -2006,7 +2006,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!
20062006 try loop.finish(l);
20072007
20082008 return .{ .ty_pl = .{
2009 .ty = .fromType(vec_tuple_ty),
2009 .ty = vec_tuple_ty,
20102010 .payload = try l.addBlockBody(main_block.body()),
20112011 } };
20122012}
......@@ -2133,7 +2133,7 @@ fn scalarizeReduceBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimize
21332133 try loop.finish(l);
21342134
21352135 return .{ .ty_pl = .{
2136 .ty = .fromType(scalar_ty),
2136 .ty = scalar_ty,
21372137 .payload = try l.addBlockBody(main_block.body()),
21382138 } };
21392139}
......@@ -2144,7 +2144,7 @@ fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
21442144 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;
21452145
21462146 const operand_ref = ty_op.operand;
2147 const dest_ty = ty_op.ty.toType();
2147 const dest_ty = ty_op.ty;
21482148
21492149 if (dest_ty.zigTypeTag(zcu) != .@"enum" or
21502150 dest_ty.isNonexhaustiveEnum(zcu) or
......@@ -2188,7 +2188,7 @@ fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
21882188 try condbr.finish(l);
21892189
21902190 return .{ .ty_pl = .{
2191 .ty = .fromType(dest_ty),
2191 .ty = dest_ty,
21922192 .payload = try l.addBlockBody(block.body()),
21932193 } };
21942194}
......@@ -2200,7 +2200,7 @@ fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
22002200
22012201 const operand_ref = ty_op.operand;
22022202 const operand_ty = l.typeOf(operand_ref);
2203 const dest_ty = ty_op.ty.toType();
2203 const dest_ty = ty_op.ty;
22042204
22052205 const is_vector = operand_ty.zigTypeTag(zcu) == .vector;
22062206 const operand_scalar_ty = operand_ty.scalarType(zcu);
......@@ -2324,7 +2324,7 @@ fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
23242324 const cast_inst = cur_block.add(l, .{
23252325 .tag = .int_cast,
23262326 .data = .{ .ty_op = .{
2327 .ty = Air.internedToRef(dest_ty.toIntern()),
2327 .ty = dest_ty,
23282328 .operand = operand_ref,
23292329 } },
23302330 });
......@@ -2359,7 +2359,7 @@ fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
23592359 assert(condbr_idx != 0); // should have already returned `null`
23602360 for (condbr_buf[0..condbr_idx]) |*condbr| try condbr.finish(l);
23612361 return .{ .ty_pl = .{
2362 .ty = Air.internedToRef(dest_ty.toIntern()),
2362 .ty = dest_ty,
23632363 .payload = try l.addBlockBody(main_block.body()),
23642364 } };
23652365}
......@@ -2371,7 +2371,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz
23712371
23722372 const operand_ref = ty_op.operand;
23732373 const operand_ty = l.typeOf(operand_ref);
2374 const dest_ty = ty_op.ty.toType();
2374 const dest_ty = ty_op.ty;
23752375
23762376 const is_vector = operand_ty.zigTypeTag(zcu) == .vector;
23772377 const dest_scalar_ty = dest_ty.scalarType(zcu);
......@@ -2453,7 +2453,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz
24532453 const cast_inst = condbr.else_block.add(l, .{
24542454 .tag = if (optimized) .int_from_float_optimized else .int_from_float,
24552455 .data = .{ .ty_op = .{
2456 .ty = Air.internedToRef(dest_ty.toIntern()),
2456 .ty = dest_ty,
24572457 .operand = operand_ref,
24582458 } },
24592459 });
......@@ -2468,7 +2468,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz
24682468 try condbr.finish(l);
24692469
24702470 return .{ .ty_pl = .{
2471 .ty = Air.internedToRef(dest_ty.toIntern()),
2471 .ty = dest_ty,
24722472 .payload = try l.addBlockBody(main_block.body()),
24732473 } };
24742474}
......@@ -2505,7 +2505,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
25052505 const overflow_op_inst = main_block.add(l, .{
25062506 .tag = overflow_op_tag,
25072507 .data = .{ .ty_pl = .{
2508 .ty = Air.internedToRef(overflow_tuple_ty.toIntern()),
2508 .ty = overflow_tuple_ty,
25092509 .payload = try l.addExtra(Air.Bin, .{
25102510 .lhs = bin_op.lhs,
25112511 .rhs = bin_op.rhs,
......@@ -2515,7 +2515,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
25152515 const overflow_bits_inst = main_block.add(l, .{
25162516 .tag = .agg_field_val,
25172517 .data = .{ .ty_pl = .{
2518 .ty = Air.internedToRef(overflow_bits_ty.toIntern()),
2518 .ty = overflow_bits_ty,
25192519 .payload = try l.addExtra(Air.StructField, .{
25202520 .struct_operand = overflow_op_inst.toRef(),
25212521 .field_index = 1,
......@@ -2539,7 +2539,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
25392539 const result_inst = condbr.else_block.add(l, .{
25402540 .tag = .agg_field_val,
25412541 .data = .{ .ty_pl = .{
2542 .ty = Air.internedToRef(operand_ty.toIntern()),
2542 .ty = operand_ty,
25432543 .payload = try l.addExtra(Air.StructField, .{
25442544 .struct_operand = overflow_op_inst.toRef(),
25452545 .field_index = 0,
......@@ -2558,7 +2558,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
25582558
25592559 try condbr.finish(l);
25602560 return .{ .ty_pl = .{
2561 .ty = Air.internedToRef(operand_ty.toIntern()),
2561 .ty = operand_ty,
25622562 .payload = try l.addBlockBody(main_block.body()),
25632563 } };
25642564}
......@@ -2608,7 +2608,7 @@ fn divCeilBlockPayload(
26082608
26092609 _ = main_block.stealRemainingCapacity();
26102610 return .{ .ty_pl = .{
2611 .ty = .fromType(operand_ty),
2611 .ty = operand_ty,
26122612 .payload = try l.addBlockBody(main_block.body()),
26132613 } };
26142614 },
......@@ -2707,7 +2707,7 @@ fn divCeilBlockPayload(
27072707
27082708 _ = main_block.stealRemainingCapacity();
27092709 return .{ .ty_pl = .{
2710 .ty = .fromType(operand_ty),
2710 .ty = operand_ty,
27112711 .payload = try l.addBlockBody(main_block.body()),
27122712 } };
27132713 },
......@@ -2721,7 +2721,7 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins
27212721 const zcu = pt.zcu;
27222722
27232723 const orig_ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;
2724 const res_ty = orig_ty_op.ty.toType();
2724 const res_ty = orig_ty_op.ty;
27252725 const res_int_ty = try pt.intType(.unsigned, @intCast(res_ty.bitSize(zcu)));
27262726 const ptr_ty = l.typeOf(orig_ty_op.operand);
27272727 const ptr_info = ptr_ty.ptrInfo(zcu);
......@@ -2740,14 +2740,14 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins
27402740 .operand = res_block.addBitCast(l, res_ty, res_block.add(l, .{
27412741 .tag = .trunc,
27422742 .data = .{ .ty_op = .{
2743 .ty = Air.internedToRef(res_int_ty.toIntern()),
2743 .ty = res_int_ty,
27442744 .operand = res_block.add(l, .{
27452745 .tag = .shr,
27462746 .data = .{ .bin_op = .{
27472747 .lhs = res_block.add(l, .{
27482748 .tag = .load,
27492749 .data = .{ .ty_op = .{
2750 .ty = Air.internedToRef(load_ty.toIntern()),
2750 .ty = load_ty,
27512751 .operand = res_block.addPtrCast(l, load_ptr_ty: {
27522752 var load_ptr_info = ptr_info;
27532753 load_ptr_info.child = load_ty.toIntern();
......@@ -2768,7 +2768,7 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins
27682768 } },
27692769 });
27702770 return .{ .ty_pl = .{
2771 .ty = Air.internedToRef(res_ty.toIntern()),
2771 .ty = res_ty,
27722772 .payload = try l.addBlockBody(res_block.body()),
27732773 } };
27742774}
......@@ -2811,7 +2811,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In
28112811 .lhs = res_block.add(l, .{
28122812 .tag = .load,
28132813 .data = .{ .ty_op = .{
2814 .ty = Air.internedToRef(load_store_ty.toIntern()),
2814 .ty = load_store_ty,
28152815 .operand = backing_ptr,
28162816 } },
28172817 }).toRef(),
......@@ -2843,7 +2843,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In
28432843 .lhs = res_block.add(l, .{
28442844 .tag = .int_cast,
28452845 .data = .{ .ty_op = .{
2846 .ty = Air.internedToRef(load_store_ty.toIntern()),
2846 .ty = load_store_ty,
28472847 .operand = res_block.addBitCast(l, operand_int_ty, orig_bin_op.rhs),
28482848 } },
28492849 }).toRef(),
......@@ -2866,7 +2866,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In
28662866 });
28672867 }
28682868 return .{ .ty_pl = .{
2869 .ty = .void_type,
2869 .ty = .void,
28702870 .payload = try l.addBlockBody(res_block.body()),
28712871 } };
28722872}
......@@ -2876,7 +2876,7 @@ fn packedStructFieldValBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Err
28762876
28772877 const orig_ty_pl = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_pl;
28782878 const orig_extra = l.extraData(Air.StructField, orig_ty_pl.payload).data;
2879 const field_ty = orig_ty_pl.ty.toType();
2879 const field_ty = orig_ty_pl.ty;
28802880 const agg_ty = l.typeOf(orig_extra.struct_operand);
28812881
28822882 const agg_bits: u16 = @intCast(agg_ty.bitSize(zcu));
......@@ -2899,7 +2899,7 @@ fn packedStructFieldValBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Err
28992899 main_block.addBr(l, orig_inst, field_val);
29002900
29012901 return .{ .ty_pl = .{
2902 .ty = .fromType(field_ty),
2902 .ty = field_ty,
29032903 .payload = try l.addBlockBody(main_block.body()),
29042904 } };
29052905}
......@@ -2909,7 +2909,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro
29092909 const gpa = zcu.gpa;
29102910
29112911 const orig_ty_pl = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_pl;
2912 const agg_ty = orig_ty_pl.ty.toType();
2912 const agg_ty = orig_ty_pl.ty;
29132913 const agg_field_count = agg_ty.structFieldCount(zcu);
29142914 var opv_field_count: u32 = 0;
29152915 for (0..agg_field_count) |field_idx| {
......@@ -2954,7 +2954,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro
29542954 main_block.addBr(l, orig_inst, result);
29552955
29562956 return .{ .ty_pl = .{
2957 .ty = .fromType(agg_ty),
2957 .ty = agg_ty,
29582958 .payload = try l.addBlockBody(main_block.body()),
29592959 } };
29602960}
......@@ -2965,7 +2965,7 @@ fn arrayToVectorBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.
29652965 const gpa = zcu.gpa;
29662966
29672967 const orig_ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;
2968 const vec_ty = orig_ty_op.ty.toType();
2968 const vec_ty = orig_ty_op.ty;
29692969 const len: usize = @intCast(vec_ty.vectorLen(zcu));
29702970
29712971 var bfa_buf: [64 + 2]Air.Inst.Index = undefined;
......@@ -2989,14 +2989,14 @@ fn arrayToVectorBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.
29892989 const result = main_block.add(l, .{
29902990 .tag = .aggregate_init,
29912991 .data = .{ .ty_pl = .{
2992 .ty = .fromType(vec_ty),
2992 .ty = vec_ty,
29932993 .payload = elems_start,
29942994 } },
29952995 }).toRef();
29962996 main_block.addBr(l, orig_inst, result);
29972997
29982998 return .{ .ty_pl = .{
2999 .ty = .fromType(vec_ty),
2999 .ty = vec_ty,
30003000 .payload = try l.addBlockBody(main_block.body()),
30013001 } };
30023002}
......@@ -3080,7 +3080,7 @@ const Block = struct {
30803080 return b.add(l, .{
30813081 .tag = tag,
30823082 .data = .{ .ty_op = .{
3083 .ty = .fromType(ty),
3083 .ty = ty,
30843084 .operand = operand,
30853085 } },
30863086 });
......@@ -3146,7 +3146,7 @@ const Block = struct {
31463146 return b.add(l, .{
31473147 .tag = if (opts.optimized) .cmp_vector_optimized else .cmp_vector,
31483148 .data = .{ .ty_pl = .{
3149 .ty = Air.internedToRef(bool_vec_ty.toIntern()),
3149 .ty = bool_vec_ty,
31503150 .payload = try l.addExtra(Air.VectorCmp, .{
31513151 .lhs = lhs,
31523152 .rhs = rhs,
......@@ -3194,7 +3194,7 @@ const Block = struct {
31943194 if (result_ty.toIntern() != operand_ty.toIntern()) return b.add(l, .{
31953195 .tag = .bit_cast,
31963196 .data = .{ .ty_op = .{
3197 .ty = .fromType(result_ty),
3197 .ty = result_ty,
31983198 .operand = operand,
31993199 } },
32003200 }).toRef();
......@@ -3221,7 +3221,7 @@ const Block = struct {
32213221 if (result_ty.toIntern() != operand_ty.toIntern()) return b.add(l, .{
32223222 .tag = .ptr_cast,
32233223 .data = .{ .ty_op = .{
3224 .ty = .fromType(result_ty),
3224 .ty = result_ty,
32253225 .operand = operand,
32263226 } },
32273227 }).toRef();
......@@ -3343,7 +3343,7 @@ const Loop = struct {
33433343 .inst = parent_block.add(l, .{
33443344 .tag = .loop,
33453345 .data = .{ .ty_pl = .{
3346 .ty = .noreturn_type,
3346 .ty = .noreturn,
33473347 .payload = undefined,
33483348 } },
33493349 }),
......@@ -3466,7 +3466,7 @@ fn compilerRtCall(
34663466 main_block.addBr(l, orig_inst, casted_result);
34673467
34683468 return l.replaceInst(orig_inst, .block, .{ .ty_pl = .{
3469 .ty = .fromType(result_ty),
3469 .ty = result_ty,
34703470 .payload = try l.addBlockBody(main_block.body()),
34713471 } });
34723472}
......@@ -3522,7 +3522,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
35223522 const target = zcu.getTarget();
35233523
35243524 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;
3525 const dest_ty = ty_op.ty.toType();
3525 const dest_ty = ty_op.ty;
35263526 const src_ty = l.typeOf(ty_op.operand);
35273527
35283528 const src_info = src_ty.intInfo(zcu);
......@@ -3568,7 +3568,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
35683568 main_block.addBr(l, orig_inst, casted_result);
35693569
35703570 return .{ .block_payload = .{ .ty_pl = .{
3571 .ty = .fromType(dest_ty),
3571 .ty = dest_ty,
35723572 .payload = try l.addBlockBody(main_block.body()),
35733573 } } };
35743574 }
......@@ -3602,7 +3602,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
36023602 main_block.addBr(l, orig_inst, casted_result);
36033603
36043604 return .{ .block_payload = .{ .ty_pl = .{
3605 .ty = .fromType(dest_ty),
3605 .ty = dest_ty,
36063606 .payload = try l.addBlockBody(main_block.body()),
36073607 } } };
36083608}
......@@ -3616,7 +3616,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
36163616
36173617 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;
36183618 const src_ty = l.typeOf(ty_op.operand);
3619 const dest_ty = ty_op.ty.toType();
3619 const dest_ty = ty_op.ty;
36203620
36213621 const dest_info = dest_ty.intInfo(zcu);
36223622 const float_off: u32 = switch (src_ty.floatBits(target)) {
......@@ -3658,7 +3658,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
36583658 main_block.addBr(l, orig_inst, casted_val);
36593659
36603660 return .{ .block_payload = .{ .ty_pl = .{
3661 .ty = .fromType(dest_ty),
3661 .ty = dest_ty,
36623662 .payload = try l.addBlockBody(main_block.body()),
36633663 } } };
36643664 }
......@@ -3682,7 +3682,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
36823682 main_block.addBr(l, orig_inst, result_val);
36833683
36843684 return .{ .block_payload = .{ .ty_pl = .{
3685 .ty = .fromType(dest_ty),
3685 .ty = dest_ty,
36863686 .payload = try l.addBlockBody(main_block.body()),
36873687 } } };
36883688}
......@@ -3767,7 +3767,7 @@ fn softFloatNegBlockPayload(
37673767 main_block.addBr(l, orig_inst, result);
37683768
37693769 return .{ .ty_pl = .{
3770 .ty = .fromType(float_ty),
3770 .ty = float_ty,
37713771 .payload = try l.addBlockBody(main_block.body()),
37723772 } };
37733773}
......@@ -3801,7 +3801,7 @@ fn softFloatDivTruncFloorCeilBlockPayload(
38013801 main_block.addBr(l, orig_inst, casted_result);
38023802
38033803 return .{ .ty_pl = .{
3804 .ty = .fromType(float_ty),
3804 .ty = float_ty,
38053805 .payload = try l.addBlockBody(main_block.body()),
38063806 } };
38073807}
......@@ -3841,7 +3841,7 @@ fn softFloatModBlockPayload(
38413841 try condbr.finish(l);
38423842
38433843 return .{ .ty_pl = .{
3844 .ty = .fromType(float_ty),
3844 .ty = float_ty,
38453845 .payload = try l.addBlockBody(main_block.body()),
38463846 } };
38473847}
......@@ -3864,7 +3864,7 @@ fn softFloatCmpBlockPayload(
38643864 main_block.addBr(l, orig_inst, result);
38653865
38663866 return .{ .ty_pl = .{
3867 .ty = .bool_type,
3867 .ty = .bool,
38683868 .payload = try l.addBlockBody(main_block.body()),
38693869 } };
38703870}
src/Air/Liveness.zig+1-1
......@@ -661,7 +661,7 @@ fn analyzeInst(
661661 },
662662 .aggregate_init => {
663663 const ty_pl = inst_datas[@backingInt(inst)].ty_pl;
664 const aggregate_ty = ty_pl.ty.toType();
664 const aggregate_ty = ty_pl.ty;
665665 const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip)));
666666 const elements = @as([]const Air.Inst.Ref, @ptrCast(a.air.extra.items[ty_pl.payload..][0..len]));
667667
src/Air/Liveness/Verify.zig+2-2
......@@ -343,7 +343,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void {
343343 // big tombs
344344 .aggregate_init => {
345345 const ty_pl = data[@backingInt(inst)].ty_pl;
346 const aggregate_ty = ty_pl.ty.toType();
346 const aggregate_ty = ty_pl.ty;
347347 const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip)));
348348 const elements = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]));
349349
......@@ -453,7 +453,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void {
453453 },
454454 .block, .dbg_inline_block => |tag| {
455455 const ty_pl = data[@backingInt(inst)].ty_pl;
456 const block_ty = ty_pl.ty.toType();
456 const block_ty = ty_pl.ty;
457457 const block_body = switch (tag) {
458458 .block => self.air.unwrapBlock(inst).body,
459459 .dbg_inline_block => self.air.unwrapDbgBlock(inst).body,
src/Air/Verify.zig+9-9
......@@ -121,7 +121,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
121121 .bit_cast, .bit_cast_safe => {
122122 const ty_op = data[@backingInt(inst)].ty_op;
123123 const operand_ty = air.typeOf(ty_op.operand, ip);
124 const result_ty = ty_op.ty.toType();
124 const result_ty = ty_op.ty;
125125 // Enums are allowed here even if their backing type is implicit.
126126 if (!operand_ty.hasBitRepresentation(zcu) and operand_ty.zigTypeTag(zcu) != .@"enum") {
127127 return verify.fail("bad operand type");
......@@ -136,7 +136,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
136136 .ptr_cast => {
137137 const ty_op = data[@backingInt(inst)].ty_op;
138138 const operand_ty = air.typeOf(ty_op.operand, ip);
139 const result_ty = ty_op.ty.toType();
139 const result_ty = ty_op.ty;
140140 const operand_scalar_ty = operand_ty.scalarType(zcu);
141141 const result_scalar_ty = result_ty.scalarType(zcu);
142142 if (operand_ty.isSliceAtRuntime(zcu)) {
......@@ -154,7 +154,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
154154 .ptr_from_int => {
155155 const ty_op = data[@backingInt(inst)].ty_op;
156156 const operand_ty = air.typeOf(ty_op.operand, ip);
157 const result_ty = ty_op.ty.toType();
157 const result_ty = ty_op.ty;
158158 const operand_scalar_ty = operand_ty.scalarType(zcu);
159159 const result_scalar_ty = result_ty.scalarType(zcu);
160160 if (operand_scalar_ty.toIntern() != .usize_type) return verify.fail("bad operand type");
......@@ -165,7 +165,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
165165 .int_from_ptr => {
166166 const ty_op = data[@backingInt(inst)].ty_op;
167167 const operand_ty = air.typeOf(ty_op.operand, ip);
168 const result_ty = ty_op.ty.toType();
168 const result_ty = ty_op.ty;
169169 const operand_scalar_ty = operand_ty.scalarType(zcu);
170170 const result_scalar_ty = result_ty.scalarType(zcu);
171171 if (!operand_scalar_ty.isPtrAtRuntime(zcu)) return verify.fail("bad operand type");
......@@ -176,7 +176,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
176176 .error_cast => {
177177 const ty_op = data[@backingInt(inst)].ty_op;
178178 const operand_ty = air.typeOf(ty_op.operand, ip);
179 const result_ty = ty_op.ty.toType();
179 const result_ty = ty_op.ty;
180180 switch (operand_ty.zigTypeTag(zcu)) {
181181 else => return verify.fail("bad operand type"),
182182 .error_union => {
......@@ -195,7 +195,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
195195 .error_from_int => {
196196 const ty_op = data[@backingInt(inst)].ty_op;
197197 const operand_ty = air.typeOf(ty_op.operand, ip);
198 const result_ty = ty_op.ty.toType();
198 const result_ty = ty_op.ty;
199199 if (!operand_ty.isUnsignedInt(zcu)) return verify.fail("bad operand type");
200200 if (operand_ty.bitSize(zcu) != zcu.errorSetBits()) return verify.fail("bad operand bit size");
201201 if (result_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad result type");
......@@ -203,7 +203,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
203203 .int_from_error => {
204204 const ty_op = data[@backingInt(inst)].ty_op;
205205 const operand_ty = air.typeOf(ty_op.operand, ip);
206 const result_ty = ty_op.ty.toType();
206 const result_ty = ty_op.ty;
207207 if (operand_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad operand type");
208208 if (!result_ty.isUnsignedInt(zcu)) return verify.fail("bad result type");
209209 if (result_ty.bitSize(zcu) != zcu.errorSetBits()) return verify.fail("bad result bit size");
......@@ -211,7 +211,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
211211 .union_from_enum => {
212212 const ty_op = data[@backingInt(inst)].ty_op;
213213 const operand_ty = air.typeOf(ty_op.operand, ip);
214 const result_ty = ty_op.ty.toType();
214 const result_ty = ty_op.ty;
215215 if (operand_ty.zigTypeTag(zcu) != .@"enum") return verify.fail("bad operand type");
216216 if (result_ty.zigTypeTag(zcu) != .@"union") return verify.fail("bad result type");
217217 const union_tag_ty = result_ty.unionTagType(zcu) orelse return verify.fail("union type is not tagged");
......@@ -222,7 +222,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
222222 const ty_pl = data[@backingInt(inst)].ty_pl;
223223 const bin_op = air.extraData(Air.Bin, ty_pl.payload).data;
224224 const ptr_ty = air.typeOf(bin_op.lhs, ip);
225 const result_ty = ty_pl.ty.toType();
225 const result_ty = ty_pl.ty;
226226 if (ptr_ty.zigTypeTag(zcu) != .pointer) return verify.fail("bad pointer type");
227227 if (result_ty.zigTypeTag(zcu) != .pointer) return verify.fail("bad result type");
228228 const ptr_info = ptr_ty.ptrInfo(zcu);
src/Air/print.zig+7-7
......@@ -387,20 +387,20 @@ const Writer = struct {
387387
388388 fn writeArg(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {
389389 const arg = w.air.instructions.items(.data)[@backingInt(inst)].arg;
390 try w.writeType(s, arg.ty.toType());
390 try w.writeType(s, arg.ty);
391391 try s.print(", {d}", .{arg.zir_param_index});
392392 }
393393
394394 fn writeTyOp(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {
395395 const ty_op = w.air.instructions.items(.data)[@backingInt(inst)].ty_op;
396 try w.writeType(s, ty_op.ty.toType());
396 try w.writeType(s, ty_op.ty);
397397 try s.writeAll(", ");
398398 try w.writeOperand(s, inst, 0, ty_op.operand);
399399 }
400400
401401 fn writeBlock(w: *Writer, s: *std.Io.Writer, tag: Air.Inst.Tag, inst: Air.Inst.Index) Error!void {
402402 const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl;
403 try w.writeType(s, ty_pl.ty.toType());
403 try w.writeType(s, ty_pl.ty);
404404
405405 const body = switch (tag) {
406406 .block => w.air.unwrapBlock(inst).body,
......@@ -448,7 +448,7 @@ const Writer = struct {
448448 fn writeAggregateInit(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {
449449 const zcu = w.pt.zcu;
450450 const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl;
451 const vector_ty = ty_pl.ty.toType();
451 const vector_ty = ty_pl.ty;
452452 const len = @as(usize, @intCast(vector_ty.arrayLen(zcu)));
453453 const elements = @as([]const Air.Inst.Ref, @ptrCast(w.air.extra.items[ty_pl.payload..][0..len]));
454454
......@@ -482,7 +482,7 @@ const Writer = struct {
482482 const ty_pl = data[@backingInt(inst)].ty_pl;
483483 const extra = w.air.extraData(Air.Bin, ty_pl.payload).data;
484484
485 const inst_ty = data[@backingInt(inst)].ty_pl.ty.toType();
485 const inst_ty = data[@backingInt(inst)].ty_pl.ty;
486486 try w.writeType(s, inst_ty);
487487 try s.writeAll(", ");
488488 try w.writeOperand(s, inst, 0, extra.lhs);
......@@ -608,7 +608,7 @@ const Writer = struct {
608608 fn writeRuntimeNavPtr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {
609609 const ip = &w.pt.zcu.intern_pool;
610610 const ty_nav = w.air.instructions.items(.data)[@backingInt(inst)].ty_nav;
611 try w.writeType(s, .fromInterned(ty_nav.ty));
611 try w.writeType(s, ty_nav.ty);
612612 try s.print(", '{f}'", .{ip.getNav(ty_nav.nav).fqn.fmt(ip)});
613613 }
614614
......@@ -799,7 +799,7 @@ const Writer = struct {
799799 try w.writeOperand(s, inst, 0, unwrapped_try.error_union_ptr);
800800
801801 try s.writeAll(", ");
802 try w.writeType(s, unwrapped_try.error_union_payload_ptr_ty.toType());
802 try w.writeType(s, unwrapped_try.error_union_payload_ptr_ty);
803803 if (w.skip_body) return s.writeAll(", ...");
804804 try s.writeAll(", {\n");
805805 const old_indent = w.indent;
src/Sema.zig+51-67
......@@ -577,7 +577,7 @@ pub const Block = struct {
577577 return block.addInst(.{
578578 .tag = tag,
579579 .data = .{ .ty_op = .{
580 .ty = Air.internedToRef(ty.toIntern()),
580 .ty = ty,
581581 .operand = operand,
582582 } },
583583 });
......@@ -636,7 +636,6 @@ pub const Block = struct {
636636 field_index: u32,
637637 ptr_field_ty: Type,
638638 ) !Air.Inst.Ref {
639 const ty = Air.internedToRef(ptr_field_ty.toIntern());
640639 const tag: Air.Inst.Tag = switch (field_index) {
641640 0 => .struct_field_ptr_index_0,
642641 1 => .struct_field_ptr_index_1,
......@@ -646,7 +645,7 @@ pub const Block = struct {
646645 return block.addInst(.{
647646 .tag = .struct_field_ptr,
648647 .data = .{ .ty_pl = .{
649 .ty = ty,
648 .ty = ptr_field_ty,
650649 .payload = try block.sema.addExtra(Air.StructField{
651650 .struct_operand = struct_ptr,
652651 .field_index = field_index,
......@@ -658,7 +657,7 @@ pub const Block = struct {
658657 return block.addInst(.{
659658 .tag = tag,
660659 .data = .{ .ty_op = .{
661 .ty = ty,
660 .ty = ptr_field_ty,
662661 .operand = struct_ptr,
663662 } },
664663 });
......@@ -673,7 +672,7 @@ pub const Block = struct {
673672 return block.addInst(.{
674673 .tag = .agg_field_val,
675674 .data = .{ .ty_pl = .{
676 .ty = Air.internedToRef(field_ty.toIntern()),
675 .ty = field_ty,
677676 .payload = try block.sema.addExtra(Air.StructField{
678677 .struct_operand = struct_val,
679678 .field_index = field_index,
......@@ -691,7 +690,7 @@ pub const Block = struct {
691690 return block.addInst(.{
692691 .tag = .slice_elem_ptr,
693692 .data = .{ .ty_pl = .{
694 .ty = Air.internedToRef(elem_ptr_ty.toIntern()),
693 .ty = elem_ptr_ty,
695694 .payload = try block.sema.addExtra(Air.Bin{
696695 .lhs = slice,
697696 .rhs = elem_index,
......@@ -705,16 +704,6 @@ pub const Block = struct {
705704 array_ptr: Air.Inst.Ref,
706705 elem_index: Air.Inst.Ref,
707706 elem_ptr_ty: Type,
708 ) !Air.Inst.Ref {
709 const ty_ref = Air.internedToRef(elem_ptr_ty.toIntern());
710 return block.addPtrElemPtrTypeRef(array_ptr, elem_index, ty_ref);
711 }
712
713 fn addPtrElemPtrTypeRef(
714 block: *Block,
715 array_ptr: Air.Inst.Ref,
716 elem_index: Air.Inst.Ref,
717 elem_ptr_ty: Air.Inst.Ref,
718707 ) !Air.Inst.Ref {
719708 return block.addInst(.{
720709 .tag = .ptr_elem_ptr,
......@@ -735,10 +724,10 @@ pub const Block = struct {
735724 return block.addInst(.{
736725 .tag = if (block.float_mode == .optimized) .cmp_vector_optimized else .cmp_vector,
737726 .data = .{ .ty_pl = .{
738 .ty = Air.internedToRef((try pt.vectorType(.{
727 .ty = (try pt.vectorType(.{
739728 .len = sema.typeOf(lhs).vectorLen(zcu),
740729 .child = .bool_type,
741 })).toIntern()),
730 })),
742731 .payload = try sema.addExtra(Air.VectorCmp{
743732 .lhs = lhs,
744733 .rhs = rhs,
......@@ -771,7 +760,6 @@ pub const Block = struct {
771760 elements: []const Air.Inst.Ref,
772761 ) !Air.Inst.Ref {
773762 const sema = block.sema;
774 const ty_ref = Air.internedToRef(aggregate_ty.toIntern());
775763 try sema.air_extra.ensureUnusedCapacity(sema.gpa, elements.len);
776764 const extra_index: u32 = @intCast(sema.air_extra.items.len);
777765 sema.appendRefsAssumeCapacity(elements);
......@@ -779,7 +767,7 @@ pub const Block = struct {
779767 return block.addInst(.{
780768 .tag = .aggregate_init,
781769 .data = .{ .ty_pl = .{
782 .ty = ty_ref,
770 .ty = aggregate_ty,
783771 .payload = extra_index,
784772 } },
785773 });
......@@ -794,7 +782,7 @@ pub const Block = struct {
794782 return block.addInst(.{
795783 .tag = .union_init,
796784 .data = .{ .ty_pl = .{
797 .ty = Air.internedToRef(union_ty.toIntern()),
785 .ty = union_ty,
798786 .payload = try block.sema.addExtra(Air.UnionInit{
799787 .field_index = field_index,
800788 .init = init,
......@@ -3761,7 +3749,7 @@ fn finishResolveComptimeKnownAllocPtr(
37613749 // this one to drop the side effect. We also need to rewrite the stores; we'll turn them to this
37623750 // too because it doesn't really matter what they become.
37633751 const nop_inst: Air.Inst = .{ .tag = .ptr_from_int, .data = .{ .ty_op = .{
3764 .ty = .fromIntern(alloc_ty.toIntern()),
3752 .ty = alloc_ty,
37653753 .operand = .zero_usize,
37663754 } } };
37673755
......@@ -4037,7 +4025,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
40374025 sema.air_instructions.set(@backingInt(placeholder_inst), .{
40384026 .tag = .block,
40394027 .data = .{ .ty_pl = .{
4040 .ty = .void_type,
4028 .ty = .void,
40414029 .payload = sema.addExtraAssumeCapacity(Air.Block{
40424030 .body_len = @intCast(replacement_block.instructions.items.len),
40434031 }),
......@@ -5191,7 +5179,7 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError
51915179 sema.air_instructions.appendAssumeCapacity(.{
51925180 .tag = .loop,
51935181 .data = .{ .ty_pl = .{
5194 .ty = .noreturn_type,
5182 .ty = .noreturn,
51955183 .payload = undefined,
51965184 } },
51975185 });
......@@ -5349,7 +5337,7 @@ fn resolveBlockBody(
53495337 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).@"struct".field_names.len +
53505338 child_block.instructions.items.len);
53515339 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5352 .ty = Air.internedToRef(operand_ty.toIntern()),
5340 .ty = operand_ty,
53535341 .payload = sema.addExtraAssumeCapacity(Air.Block{
53545342 .body_len = @intCast(child_block.instructions.items.len),
53555343 }),
......@@ -5431,7 +5419,7 @@ fn resolveAnalyzedBlock(
54315419 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len +
54325420 child_block.instructions.items.len);
54335421 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5434 .ty = .noreturn_type,
5422 .ty = .noreturn,
54355423 .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{
54365424 .func = child_block.inlining.?.func,
54375425 .body_len = @intCast(child_block.instructions.items.len),
......@@ -5469,7 +5457,7 @@ fn resolveAnalyzedBlock(
54695457 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len +
54705458 child_block.instructions.items.len);
54715459 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5472 .ty = .void_type,
5460 .ty = .void,
54735461 .payload = sema.addExtraAssumeCapacity(Air.Block{
54745462 .body_len = @intCast(child_block.instructions.items.len),
54755463 }),
......@@ -5479,7 +5467,7 @@ fn resolveAnalyzedBlock(
54795467 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len +
54805468 child_block.instructions.items.len);
54815469 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5482 .ty = .void_type,
5470 .ty = .void,
54835471 .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{
54845472 .func = child_block.inlining.?.func,
54855473 .body_len = @intCast(child_block.instructions.items.len),
......@@ -5528,13 +5516,12 @@ fn resolveAnalyzedBlock(
55285516
55295517 try sema.checkMergeAllowed(child_block, type_src, resolved_ty);
55305518
5531 const ty_inst = Air.internedToRef(resolved_ty.toIntern());
55325519 switch (block_tag) {
55335520 .block => {
55345521 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len +
55355522 child_block.instructions.items.len);
55365523 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5537 .ty = ty_inst,
5524 .ty = resolved_ty,
55385525 .payload = sema.addExtraAssumeCapacity(Air.Block{
55395526 .body_len = @intCast(child_block.instructions.items.len),
55405527 }),
......@@ -5544,7 +5531,7 @@ fn resolveAnalyzedBlock(
55445531 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len +
55455532 child_block.instructions.items.len);
55465533 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5547 .ty = ty_inst,
5534 .ty = resolved_ty,
55485535 .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{
55495536 .func = child_block.inlining.?.func,
55505537 .body_len = @intCast(child_block.instructions.items.len),
......@@ -5585,7 +5572,7 @@ fn resolveAnalyzedBlock(
55855572
55865573 sema.air_instructions.items(.tag)[@backingInt(br)] = .block;
55875574 sema.air_instructions.items(.data)[@backingInt(br)] = .{ .ty_pl = .{
5588 .ty = .noreturn_type,
5575 .ty = .noreturn,
55895576 .payload = sema.addExtraAssumeCapacity(Air.Block{
55905577 .body_len = sub_block_len,
55915578 }),
......@@ -6093,7 +6080,7 @@ pub fn analyzeSaveErrRetIndex(sema: *Sema, block: *Block) SemaError!Air.Inst.Ref
60936080 return try block.addInst(.{
60946081 .tag = .save_err_return_trace_index,
60956082 .data = .{ .ty_pl = .{
6096 .ty = Air.internedToRef(stack_trace_ty.toIntern()),
6083 .ty = stack_trace_ty,
60976084 .payload = @intCast(field_index),
60986085 } },
60996086 });
......@@ -6140,7 +6127,7 @@ fn popErrorReturnTrace(
61406127 .tag = .block,
61416128 .data = .{
61426129 .ty_pl = .{
6143 .ty = .void_type,
6130 .ty = .void,
61446131 .payload = undefined, // updated below
61456132 },
61466133 },
......@@ -6294,7 +6281,7 @@ fn zirCall(
62946281 const save_inst = try block.insertInst(block_index, .{
62956282 .tag = .save_err_return_trace_index,
62966283 .data = .{ .ty_pl = .{
6297 .ty = Air.internedToRef(stack_trace_ty.toIntern()),
6284 .ty = stack_trace_ty,
62986285 .payload = @intCast(field_index),
62996286 } },
63006287 });
......@@ -10364,7 +10351,7 @@ fn analyzeSwitchBlock(
1036410351 const air_ref = try child_block.addInst(.{
1036510352 .tag = air_tag,
1036610353 .data = .{ .ty_pl = .{
10367 .ty = .noreturn_type,
10354 .ty = .noreturn,
1036810355 .payload = payload_index,
1036910356 } },
1037010357 });
......@@ -10446,7 +10433,7 @@ fn analyzeSwitchBlock(
1044610433 sema.air_instructions.set(@backingInt(placeholder_inst), .{
1044710434 .tag = .block,
1044810435 .data = .{ .ty_pl = .{
10449 .ty = .noreturn_type,
10436 .ty = .noreturn,
1045010437 .payload = sema.addExtraAssumeCapacity(Air.Block{
1045110438 .body_len = @intCast(replacement_block.instructions.items.len),
1045210439 }),
......@@ -12401,7 +12388,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion(
1240112388 .tag = .block,
1240212389 .data = .{
1240312390 .ty_pl = .{
12404 .ty = .fromType(capture_ty),
12391 .ty = capture_ty,
1240512392 .payload = undefined, // updated below
1240612393 },
1240712394 },
......@@ -12492,7 +12479,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion(
1249212479 try sema.air_instructions.append(sema.gpa, .{
1249312480 .tag = .get_union_tag,
1249412481 .data = .{ .ty_op = .{
12495 .ty = .fromIntern(union_obj.enum_tag_type),
12482 .ty = .fromInterned(union_obj.enum_tag_type),
1249612483 .operand = loaded_operand,
1249712484 } },
1249812485 });
......@@ -13140,7 +13127,7 @@ fn zirShl(
1314013127 const op_ov = try block.addInst(.{
1314113128 .tag = .shl_with_overflow,
1314213129 .data = .{ .ty_pl = .{
13143 .ty = .fromIntern(op_ov_tuple_ty.toIntern()),
13130 .ty = op_ov_tuple_ty,
1314413131 .payload = try sema.addExtra(Air.Bin{
1314513132 .lhs = lhs,
1314613133 .rhs = rhs,
......@@ -13673,7 +13660,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1367313660 const lhs_dest_slice = try block.addInst(.{
1367413661 .tag = .slice,
1367513662 .data = .{ .ty_pl = .{
13676 .ty = .fromType(slice_ty),
13663 .ty = slice_ty,
1367713664 .payload = try sema.addExtra(Air.Bin{
1367813665 .lhs = many_alloc,
1367913666 .rhs = try pt.intRef(.usize, lhs_len),
......@@ -13688,7 +13675,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1368813675 const rhs_dest_offset = try block.addInst(.{
1368913676 .tag = .ptr_add,
1369013677 .data = .{ .ty_pl = .{
13691 .ty = Air.internedToRef(many_ty.toIntern()),
13678 .ty = many_ty,
1369213679 .payload = try sema.addExtra(Air.Bin{
1369313680 .lhs = many_alloc,
1369413681 .rhs = try pt.intRef(.usize, lhs_len),
......@@ -13698,7 +13685,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1369813685 const rhs_dest_slice = try block.addInst(.{
1369913686 .tag = .slice,
1370013687 .data = .{ .ty_pl = .{
13701 .ty = .fromType(slice_ty),
13688 .ty = slice_ty,
1370213689 .payload = try sema.addExtra(Air.Bin{
1370313690 .lhs = rhs_dest_offset,
1370413691 .rhs = try pt.intRef(.usize, rhs_len),
......@@ -14970,7 +14957,7 @@ fn zirOverflowArithmetic(
1497014957 return block.addInst(.{
1497114958 .tag = air_tag,
1497214959 .data = .{ .ty_pl = .{
14973 .ty = Air.internedToRef(tuple_ty.toIntern()),
14960 .ty = tuple_ty,
1497414961 .payload = try block.sema.addExtra(Air.Bin{
1497514962 .lhs = lhs,
1497614963 .rhs = rhs,
......@@ -15267,7 +15254,7 @@ fn analyzePtrArithmetic(
1526715254 return block.addInst(.{
1526815255 .tag = air_tag,
1526915256 .data = .{ .ty_pl = .{
15270 .ty = .fromType(new_ptr_ty),
15257 .ty = new_ptr_ty,
1527115258 .payload = try sema.addExtra(Air.Bin{
1527215259 .lhs = ptr,
1527315260 .rhs = offset,
......@@ -15330,7 +15317,7 @@ fn zirAsm(
1533015317 const ConstraintName = struct { c: []const u8, n: []const u8 };
1533115318 const out_args = try sema.arena.alloc(Air.Inst.Ref, outputs_len);
1533215319 const outputs = try sema.arena.alloc(ConstraintName, outputs_len);
15333 var expr_ty = Air.Inst.Ref.void_type;
15320 var expr_ty: Type = .void;
1533415321
1533515322 for (out_args, 0..) |*arg, out_i| {
1533615323 const output = sema.code.extraData(Zir.Inst.Asm.Output, extra_i);
......@@ -15352,7 +15339,7 @@ fn zirAsm(
1535215339
1535315340 const out_ty = try sema.resolveType(block, ret_ty_src, output.data.operand);
1535415341 try sema.ensureLayoutResolved(out_ty, ret_ty_src, .asm_out_type);
15355 expr_ty = .fromType(out_ty);
15342 expr_ty = out_ty;
1535615343 break :out_ty out_ty;
1535715344 } else {
1535815345 const inst = sema.resolveInst(output.data.operand);
......@@ -15547,7 +15534,7 @@ fn zirAsm(
1554715534 buffer[input.c.len + 1 + input.n.len] = 0;
1554815535 sema.air_extra.items.len += (input.c.len + input.n.len + (2 + 3)) / 4;
1554915536 }
15550 if (try expr_ty.toType().onePossibleValue(pt)) |opv| return .fromValue(opv);
15537 if (try expr_ty.onePossibleValue(pt)) |opv| return .fromValue(opv);
1555115538 return asm_air;
1555215539}
1555315540
......@@ -17459,7 +17446,7 @@ fn zirBoolBr(
1745917446 try sema.air_instructions.append(gpa, .{
1746017447 .tag = .block,
1746117448 .data = .{ .ty_pl = .{
17462 .ty = .bool_type,
17449 .ty = .bool,
1746317450 .payload = undefined,
1746417451 } },
1746517452 });
......@@ -17879,13 +17866,12 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr
1787917866 new.child = err_union_ty.errorUnionPayload(zcu).toIntern();
1788017867 break :info new;
1788117868 });
17882 const res_ty_ref = Air.internedToRef(res_ty.toIntern());
1788317869 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.TryPtr).@"struct".field_names.len +
1788417870 sub_block.instructions.items.len);
1788517871 const try_inst = try parent_block.addInst(.{
1788617872 .tag = if (is_cold) .try_ptr_cold else .try_ptr,
1788717873 .data = .{ .ty_pl = .{
17888 .ty = res_ty_ref,
17874 .ty = res_ty,
1788917875 .payload = sema.addExtraAssumeCapacity(Air.TryPtr{
1789017876 .ptr = operand,
1789117877 .body_len = @intCast(sub_block.instructions.items.len),
......@@ -18137,7 +18123,7 @@ fn maybePushErrorTrace(
1813718123 sema.air_instructions.appendAssumeCapacity(.{
1813818124 .tag = .block,
1813918125 .data = .{ .ty_pl = .{
18140 .ty = .void_type,
18126 .ty = .void,
1814118127 .payload = block_payload,
1814218128 } },
1814318129 });
......@@ -19333,10 +19319,9 @@ fn zirArrayInit(
1933319319 .child = array_ty.fieldType(i, zcu).toIntern(),
1933419320 .flags = .{ .address_space = target_util.defaultAddressSpace(target, .local) },
1933519321 });
19336 const elem_ptr_ty_ref = Air.internedToRef(elem_ptr_ty.toIntern());
1933719322
1933819323 const index = try pt.intRef(.usize, i);
19339 const elem_ptr = try block.addPtrElemPtrTypeRef(base_ptr, index, elem_ptr_ty_ref);
19324 const elem_ptr = try block.addPtrElemPtr(base_ptr, index, elem_ptr_ty);
1934019325 _ = try block.addBinOp(.store, elem_ptr, arg);
1934119326 }
1934219327 return sema.makePtrConst(block, alloc);
......@@ -19346,11 +19331,10 @@ fn zirArrayInit(
1934619331 .child = array_ty.childType(zcu).toIntern(),
1934719332 .flags = .{ .address_space = target_util.defaultAddressSpace(target, .local) },
1934819333 });
19349 const elem_ptr_ty_ref = Air.internedToRef(elem_ptr_ty.toIntern());
1935019334
1935119335 for (resolved_args, 0..) |arg, i| {
1935219336 const index = try pt.intRef(.usize, i);
19353 const elem_ptr = try block.addPtrElemPtrTypeRef(base_ptr, index, elem_ptr_ty_ref);
19337 const elem_ptr = try block.addPtrElemPtr(base_ptr, index, elem_ptr_ty);
1935419338 _ = try block.addBinOp(.store, elem_ptr, arg);
1935519339 }
1935619340 return sema.makePtrConst(block, alloc);
......@@ -22239,7 +22223,7 @@ fn ptrCastFull(
2223922223 break :ptr try block.addInst(.{
2224022224 .tag = .addrspace_cast,
2224122225 .data = .{ .ty_op = .{
22242 .ty = Air.internedToRef(intermediate_ty.toIntern()),
22226 .ty = intermediate_ty,
2224322227 .operand = pre_addrspace_cast,
2224422228 } },
2224522229 });
......@@ -22364,7 +22348,7 @@ fn ptrCastFull(
2236422348 return block.addInst(.{
2236522349 .tag = .slice,
2236622350 .data = .{ .ty_pl = .{
22367 .ty = Air.internedToRef(dest_ty.toIntern()),
22351 .ty = dest_ty,
2236822352 .payload = try sema.addExtra(Air.Bin{
2236922353 .lhs = coerced_ptr,
2237022354 .rhs = result_len,
......@@ -23233,7 +23217,7 @@ fn zirCmpxchg(
2323323217 return block.addInst(.{
2323423218 .tag = air_tag,
2323523219 .data = .{ .ty_pl = .{
23236 .ty = Air.internedToRef(result_ty.toIntern()),
23220 .ty = result_ty,
2323723221 .payload = try sema.addExtra(Air.Cmpxchg{
2323823222 .ptr = ptr,
2323923223 .expected_value = expected_value,
......@@ -23498,7 +23482,7 @@ fn analyzeShuffle(
2349823482 return block.addInst(.{
2349923483 .tag = .shuffle_two,
2350023484 .data = .{ .ty_pl = .{
23501 .ty = Air.internedToRef(result_ty.toIntern()),
23485 .ty = result_ty,
2350223486 .payload = air_extra_idx,
2350323487 } },
2350423488 });
......@@ -23517,7 +23501,7 @@ fn analyzeShuffle(
2351723501 return block.addInst(.{
2351823502 .tag = .shuffle_one,
2351923503 .data = .{ .ty_pl = .{
23520 .ty = Air.internedToRef(result_ty.toIntern()),
23504 .ty = result_ty,
2352123505 .payload = air_extra_idx,
2352223506 } },
2352323507 });
......@@ -23536,7 +23520,7 @@ fn analyzeShuffle(
2353623520 return block.addInst(.{
2353723521 .tag = .shuffle_one,
2353823522 .data = .{ .ty_pl = .{
23539 .ty = Air.internedToRef(result_ty.toIntern()),
23523 .ty = result_ty,
2354023524 .payload = air_extra_idx,
2354123525 } },
2354223526 });
......@@ -24083,7 +24067,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
2408324067 break :result try block.addInst(.{
2408424068 .tag = .field_parent_ptr,
2408524069 .data = .{ .ty_pl = .{
24086 .ty = .fromType(unaligned_parent_ptr_ty),
24070 .ty = unaligned_parent_ptr_ty,
2408724071 .payload = try block.sema.addExtra(Air.FieldParentPtr{
2408824072 .field_ptr = casted_field_ptr,
2408924073 .field_index = @intCast(field_index),
......@@ -25939,7 +25923,7 @@ fn addSafetyCheckExtra(
2593925923 sema.air_instructions.appendAssumeCapacity(.{
2594025924 .tag = .block,
2594125925 .data = .{ .ty_pl = .{
25942 .ty = .void_type,
25926 .ty = .void,
2594325927 .payload = sema.addExtraAssumeCapacity(Air.Block{
2594425928 .body_len = 1,
2594525929 }),
......@@ -26485,7 +26469,7 @@ fn analyzeSpirvRuntimeArrayLen(
2648526469 return block.addInst(.{
2648626470 .tag = .spirv_runtime_array_len,
2648726471 .data = .{ .ty_pl = .{
26488 .ty = .u32_type,
26472 .ty = .u32,
2648926473 .payload = try sema.addExtra(Air.StructField{
2649026474 .struct_operand = struct_operand,
2649126475 .field_index = field_index,
......@@ -30935,7 +30919,7 @@ fn analyzeNavRefInner(sema: *Sema, block: *Block, src: LazySrcLoc, orig_nav_inde
3093530919 return block.addInst(.{
3093630920 .tag = .runtime_nav_ptr,
3093730921 .data = .{ .ty_nav = .{
30938 .ty = ptr_ty.toIntern(),
30922 .ty = ptr_ty,
3093930923 .nav = nav_index,
3094030924 } },
3094130925 });
......@@ -31898,7 +31882,7 @@ fn analyzeSlice(
3189831882 const result = try block.addInst(.{
3189931883 .tag = .slice,
3190031884 .data = .{ .ty_pl = .{
31901 .ty = Air.internedToRef(return_ty.toIntern()),
31885 .ty = return_ty,
3190231886 .payload = try sema.addExtra(Air.Bin{
3190331887 .lhs = new_ptr,
3190431888 .rhs = new_len,
src/Zcu/PerThread.zig+1-1
......@@ -3378,7 +3378,7 @@ fn analyzeFuncBodyInner(
33783378 sema.air_instructions.appendAssumeCapacity(.{
33793379 .tag = .arg,
33803380 .data = .{ .arg = .{
3381 .ty = .fromIntern(param_ty.toIntern()),
3381 .ty = param_ty,
33823382 .zir_param_index = @intCast(zir_param_index),
33833383 } },
33843384 });
src/codegen/aarch64.zig+1-1
......@@ -75,7 +75,7 @@ pub fn generate(
7575 const air_args = for (air_main_body, 0..) |air_inst_index, body_index| {
7676 if (air.instructions.items(.tag)[@backingInt(air_inst_index)] != .arg) break air_main_body[0..body_index];
7777 const arg = air.instructions.items(.data)[@backingInt(air_inst_index)].arg;
78 const param_ty = arg.ty.toType();
78 const param_ty = arg.ty;
7979 const param_vi = param_vi: {
8080 if (arg.zir_param_index >= named_params_len) {
8181 assert(func_type.is_var_args);
src/codegen/aarch64/Select.zig+55-55
......@@ -279,7 +279,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
279279 const unwrapped_asm = isel.air.unwrapAsm(air_inst_index);
280280
281281 for (unwrapped_asm.outputs) |operand| if (operand != .none) try isel.analyzeUse(operand);
282 if (ty_pl.ty != .void_type) try isel.def_order.putNoClobber(gpa, air_inst_index, {});
282 if (ty_pl.ty.ip_index != .void_type) try isel.def_order.putNoClobber(gpa, air_inst_index, {});
283283
284284 air_body_index += 1;
285285 air_inst_index = air_body[air_body_index];
......@@ -348,7 +348,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
348348 => {
349349 const ty_op = air_data[@backingInt(air_inst_index)].ty_op;
350350 maybe_noop: {
351 if (ty_op.ty.toInterned().? != isel.air.typeOf(ty_op.operand, ip).toIntern()) break :maybe_noop;
351 if (ty_op.ty.ip_index != isel.air.typeOf(ty_op.operand, ip).toIntern()) break :maybe_noop;
352352 if (true) break :maybe_noop;
353353 if (ty_op.operand.toIndex()) |src_air_inst_index| {
354354 if (isel.hints.get(src_air_inst_index)) |hint_vpsi| {
......@@ -792,7 +792,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
792792 },
793793 .aggregate_init => {
794794 const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl;
795 const elements: []const Air.Inst.Ref = @ptrCast(isel.air.extra.items[ty_pl.payload..][0..@intCast(ty_pl.ty.toType().arrayLen(zcu))]);
795 const elements: []const Air.Inst.Ref = @ptrCast(isel.air.extra.items[ty_pl.payload..][0..@intCast(ty_pl.ty.arrayLen(zcu))]);
796796
797797 for (elements) |element| try isel.analyzeUse(element);
798798 try isel.def_order.putNoClobber(gpa, air_inst_index, {});
......@@ -2475,10 +2475,10 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
24752475
24762476 const ty_pl = air.data(air.inst_index).ty_pl;
24772477 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;
2478 const elem_size = ty_pl.ty.toType().childType(zcu).abiSize(zcu);
2478 const elem_size = ty_pl.ty.childType(zcu).abiSize(zcu);
24792479
24802480 const base_vi = try isel.use(bin_op.lhs);
2481 var base_part_it = base_vi.field(ty_pl.ty.toType(), 0, 8);
2481 var base_part_it = base_vi.field(ty_pl.ty, 0, 8);
24822482 const base_part_vi = try base_part_it.only(isel);
24832483 const base_part_mat = try base_part_vi.?.matReg(isel);
24842484 const index_vi = try isel.use(bin_op.rhs);
......@@ -2656,9 +2656,9 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
26562656 const lhs_vi = try isel.use(bin_op.lhs);
26572657 const rhs_vi = try isel.use(bin_op.rhs);
26582658 const ty_size = lhs_vi.size(isel);
2659 var overflow_it = res_vi.value.field(ty_pl.ty.toType(), ty_size, 1);
2659 var overflow_it = res_vi.value.field(ty_pl.ty, ty_size, 1);
26602660 const overflow_vi = try overflow_it.only(isel);
2661 var wrapped_it = res_vi.value.field(ty_pl.ty.toType(), 0, ty_size);
2661 var wrapped_it = res_vi.value.field(ty_pl.ty, 0, ty_size);
26622662 const wrapped_vi = try wrapped_it.only(isel);
26632663 try wrapped_vi.?.addOrSubtract(isel, ty, lhs_vi, switch (air_tag) {
26642664 else => unreachable,
......@@ -2731,11 +2731,11 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
27312731 if (!std.mem.eql(u8, name, "_")) {
27322732 const operand_gop = try as.operands.getOrPut(gpa, name);
27332733 if (operand_gop.found_existing) return isel.fail("duplicate output name: '{s}'", .{name});
2734 operand_gop.value_ptr.* = .{ .register = switch (ty_pl.ty.toType().abiSize(zcu)) {
2734 operand_gop.value_ptr.* = .{ .register = switch (ty_pl.ty.abiSize(zcu)) {
27352735 0 => unreachable,
27362736 1...4 => output_ra.w(),
27372737 5...8 => output_ra.x(),
2738 else => return isel.fail("too big output type: '{f}'", .{isel.fmtType(ty_pl.ty.toType())}),
2738 else => return isel.fail("too big output type: '{f}'", .{isel.fmtType(ty_pl.ty)}),
27392739 } };
27402740 }
27412741 } else if (std.mem.eql(u8, constraint, "=r")) {
......@@ -2746,11 +2746,11 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
27462746 if (!std.mem.eql(u8, name, "_")) {
27472747 const operand_gop = try as.operands.getOrPut(gpa, name);
27482748 if (operand_gop.found_existing) return isel.fail("duplicate output name: '{s}'", .{name});
2749 operand_gop.value_ptr.* = .{ .register = switch (ty_pl.ty.toType().abiSize(zcu)) {
2749 operand_gop.value_ptr.* = .{ .register = switch (ty_pl.ty.abiSize(zcu)) {
27502750 0 => unreachable,
27512751 1...4 => output_ra.w(),
27522752 5...8 => output_ra.x(),
2753 else => return isel.fail("too big output type: '{f}'", .{isel.fmtType(ty_pl.ty.toType())}),
2753 else => return isel.fail("too big output type: '{f}'", .{isel.fmtType(ty_pl.ty)}),
27542754 } };
27552755 }
27562756 } else return isel.fail("invalid constraint: '{s}'", .{constraint}),
......@@ -3156,9 +3156,9 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
31563156 defer res_vi.value.deref(isel);
31573157
31583158 const ty_op = air.data(air.inst_index).ty_op;
3159 const ty = ty_op.ty.toType();
3159 const ty = ty_op.ty;
31603160 const int_info: std.lang.Type.Int = int_info: {
3161 if (ty_op.ty == .bool_type) break :int_info .{ .signedness = .unsigned, .bits = 1 };
3161 if (ty_op.ty.ip_index == .bool_type) break :int_info .{ .signedness = .unsigned, .bits = 1 };
31623162 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });
31633163 break :int_info ty.intInfo(zcu);
31643164 };
......@@ -3215,7 +3215,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
32153215 if (isel.live_values.fetchRemove(air.inst_index)) |dst_vi| unused: {
32163216 defer dst_vi.value.deref(isel);
32173217 const ty_op = air.data(air.inst_index).ty_op;
3218 const dst_ty = ty_op.ty.toType();
3218 const dst_ty = ty_op.ty;
32193219 const dst_tag = dst_ty.zigTypeTag(zcu);
32203220 const src_ty = isel.air.typeOf(ty_op.operand, ip);
32213221 const src_tag = src_ty.zigTypeTag(zcu);
......@@ -3869,7 +3869,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
38693869 defer res_vi.value.deref(isel);
38703870
38713871 const ty_op = air.data(air.inst_index).ty_op;
3872 const ty = ty_op.ty.toType();
3872 const ty = ty_op.ty;
38733873 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });
38743874 const int_info = ty.intInfo(zcu);
38753875 if (int_info.bits > 64) return isel.fail("too big {t} {f}", .{ air_tag, isel.fmtType(ty) });
......@@ -3933,7 +3933,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
39333933 defer res_vi.value.deref(isel);
39343934
39353935 const ty_op = air.data(air.inst_index).ty_op;
3936 const ty = ty_op.ty.toType();
3936 const ty = ty_op.ty;
39373937 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });
39383938 const int_info = ty.intInfo(zcu);
39393939 if (int_info.bits > 64) return isel.fail("too big {t} {f}", .{ air_tag, isel.fmtType(ty) });
......@@ -4235,7 +4235,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
42354235 defer res_vi.value.deref(isel);
42364236
42374237 const ty_op = air.data(air.inst_index).ty_op;
4238 const ty = ty_op.ty.toType();
4238 const ty = ty_op.ty;
42394239 if (!ty.isRuntimeFloat()) {
42404240 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });
42414241 switch (ty.intInfo(zcu).bits) {
......@@ -4860,7 +4860,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
48604860 const error_union_ptr_mat = try error_union_ptr_vi.matReg(isel);
48614861 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {
48624862 defer payload_ptr_vi.value.deref(isel);
4863 switch (codegen.errUnionPayloadOffset(unwrapped_try.error_union_payload_ptr_ty.toType().childType(zcu), zcu)) {
4863 switch (codegen.errUnionPayloadOffset(unwrapped_try.error_union_payload_ptr_ty.childType(zcu), zcu)) {
48644864 0 => try payload_ptr_vi.value.move(isel, unwrapped_try.error_union_ptr),
48654865 else => |payload_offset| {
48664866 const payload_ptr_ra = try payload_ptr_vi.value.defReg(isel) orelse break :unused;
......@@ -4989,7 +4989,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
49894989 if (size <= Value.max_parts and ip.zigTypeTag(ptr_info.child) != .@"union") {
49904990 const ptr_vi = try isel.use(ty_op.operand);
49914991 const ptr_mat = try ptr_vi.matReg(isel);
4992 _ = try dst_vi.value.load(isel, ty_op.ty.toType(), ptr_mat.ra, .{
4992 _ = try dst_vi.value.load(isel, ty_op.ty, ptr_mat.ra, .{
49934993 .@"volatile" = ptr_info.flags.is_volatile,
49944994 });
49954995 try ptr_mat.finish(isel);
......@@ -5137,7 +5137,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
51375137 defer dst_vi.value.deref(isel);
51385138
51395139 const ty_op = air.data(air.inst_index).ty_op;
5140 const dst_ty = ty_op.ty.toType();
5140 const dst_ty = ty_op.ty;
51415141 const dst_bits = dst_ty.floatBits(isel.target);
51425142 const src_ty = isel.air.typeOf(ty_op.operand, ip);
51435143 const src_bits = src_ty.floatBits(isel.target);
......@@ -5247,7 +5247,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
52475247 defer dst_vi.value.deref(isel);
52485248
52495249 const ty_op = air.data(air.inst_index).ty_op;
5250 const dst_ty = ty_op.ty.toType();
5250 const dst_ty = ty_op.ty;
52515251 const dst_int_info = dst_ty.intInfo(zcu);
52525252 const src_ty = isel.air.typeOf(ty_op.operand, ip);
52535253 const src_int_info = src_ty.intInfo(zcu);
......@@ -5338,7 +5338,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
53385338 defer dst_vi.value.deref(isel);
53395339
53405340 const ty_op = air.data(air.inst_index).ty_op;
5341 const dst_ty = ty_op.ty.toType();
5341 const dst_ty = ty_op.ty;
53425342 const dst_int_info = dst_ty.intInfo(zcu);
53435343 const src_ty = isel.air.typeOf(ty_op.operand, ip);
53445344 const src_int_info = src_ty.intInfo(zcu);
......@@ -5440,7 +5440,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
54405440 defer dst_vi.value.deref(isel);
54415441
54425442 const ty_op = air.data(air.inst_index).ty_op;
5443 const dst_ty = ty_op.ty.toType();
5443 const dst_ty = ty_op.ty;
54445444 const src_ty = isel.air.typeOf(ty_op.operand, ip);
54455445 if (!dst_ty.isAbiInt(zcu) or !src_ty.isAbiInt(zcu)) return isel.fail("bad {t} {f} {f}", .{ air_tag, isel.fmtType(dst_ty), isel.fmtType(src_ty) });
54465446 const dst_int_info = dst_ty.intInfo(zcu);
......@@ -5536,7 +5536,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
55365536 const opt_vi = try isel.use(ty_op.operand);
55375537 var payload_part_it = opt_vi.field(opt_ty, 0, payload_vi.value.size(isel));
55385538 const payload_part_vi = try payload_part_it.only(isel);
5539 try payload_vi.value.copy(isel, ty_op.ty.toType(), payload_part_vi.?);
5539 try payload_vi.value.copy(isel, ty_op.ty, payload_part_vi.?);
55405540 }
55415541 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
55425542 },
......@@ -5576,16 +5576,16 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
55765576 defer opt_vi.value.deref(isel);
55775577
55785578 const ty_op = air.data(air.inst_index).ty_op;
5579 if (ty_op.ty.toType().optionalReprIsPayload(zcu)) {
5579 if (ty_op.ty.optionalReprIsPayload(zcu)) {
55805580 try opt_vi.value.move(isel, ty_op.operand);
55815581 break :unused;
55825582 }
55835583
55845584 const payload_size = isel.air.typeOf(ty_op.operand, ip).abiSize(zcu);
5585 var payload_part_it = opt_vi.value.field(ty_op.ty.toType(), 0, payload_size);
5585 var payload_part_it = opt_vi.value.field(ty_op.ty, 0, payload_size);
55865586 const payload_part_vi = try payload_part_it.only(isel);
55875587 try payload_part_vi.?.move(isel, ty_op.operand);
5588 var has_value_part_it = opt_vi.value.field(ty_op.ty.toType(), payload_size, 1);
5588 var has_value_part_it = opt_vi.value.field(ty_op.ty, payload_size, 1);
55895589 const has_value_part_vi = try has_value_part_it.only(isel);
55905590 const has_value_part_ra = try has_value_part_vi.?.defReg(isel) orelse break :unused;
55915591 try isel.emit(.movz(has_value_part_ra.w(), 1, .{ .lsl = .@"0" }));
......@@ -5602,11 +5602,11 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
56025602 const error_union_vi = try isel.use(ty_op.operand);
56035603 var payload_part_it = error_union_vi.field(
56045604 error_union_ty,
5605 codegen.errUnionPayloadOffset(ty_op.ty.toType(), zcu),
5605 codegen.errUnionPayloadOffset(ty_op.ty, zcu),
56065606 payload_vi.value.size(isel),
56075607 );
56085608 const payload_part_vi = try payload_part_it.only(isel);
5609 try payload_vi.value.copy(isel, ty_op.ty.toType(), payload_part_vi.?);
5609 try payload_vi.value.copy(isel, ty_op.ty, payload_part_vi.?);
56105610 }
56115611 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
56125612 },
......@@ -5624,7 +5624,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
56245624 error_set_vi.value.size(isel),
56255625 );
56265626 const error_set_part_vi = try error_set_part_it.only(isel);
5627 try error_set_vi.value.copy(isel, ty_op.ty.toType(), error_set_part_vi.?);
5627 try error_set_vi.value.copy(isel, ty_op.ty, error_set_part_vi.?);
56285628 }
56295629 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
56305630 },
......@@ -5632,7 +5632,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
56325632 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {
56335633 defer payload_ptr_vi.value.deref(isel);
56345634 const ty_op = air.data(air.inst_index).ty_op;
5635 switch (codegen.errUnionPayloadOffset(ty_op.ty.toType().childType(zcu), zcu)) {
5635 switch (codegen.errUnionPayloadOffset(ty_op.ty.childType(zcu), zcu)) {
56365636 0 => try payload_ptr_vi.value.move(isel, ty_op.operand),
56375637 else => |payload_offset| {
56385638 const payload_ptr_ra = try payload_ptr_vi.value.defReg(isel) orelse break :unused;
......@@ -5660,7 +5660,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
56605660 const error_union_ptr_info = error_union_ptr_ty.ptrInfo(zcu);
56615661 const error_union_ptr_vi = try isel.use(ty_op.operand);
56625662 const error_union_ptr_mat = try error_union_ptr_vi.matReg(isel);
5663 _ = try error_vi.value.load(isel, ty_op.ty.toType(), error_union_ptr_mat.ra, .{
5663 _ = try error_vi.value.load(isel, ty_op.ty, error_union_ptr_mat.ra, .{
56645664 .offset = codegen.errUnionErrorOffset(
56655665 ZigType.fromInterned(error_union_ptr_info.child).errorUnionPayload(zcu),
56665666 zcu,
......@@ -5675,7 +5675,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
56755675 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {
56765676 defer payload_ptr_vi.value.deref(isel);
56775677 const ty_op = air.data(air.inst_index).ty_op;
5678 const payload_ty = ty_op.ty.toType().childType(zcu);
5678 const payload_ty = ty_op.ty.childType(zcu);
56795679 const error_union_ty = isel.air.typeOf(ty_op.operand, ip).childType(zcu);
56805680 const error_set_size = error_union_ty.errorUnionSet(zcu).abiSize(zcu);
56815681 const error_union_ptr_vi = try isel.use(ty_op.operand);
......@@ -5712,7 +5712,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
57125712 defer error_union_vi.value.deref(isel);
57135713
57145714 const ty_op = air.data(air.inst_index).ty_op;
5715 const error_union_ty = ty_op.ty.toType();
5715 const error_union_ty = ty_op.ty;
57165716 const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type;
57175717 const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type);
57185718 const payload_ty: ZigType = .fromInterned(error_union_info.payload_type);
......@@ -5739,7 +5739,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
57395739 defer error_union_vi.value.deref(isel);
57405740
57415741 const ty_op = air.data(air.inst_index).ty_op;
5742 const error_union_ty = ty_op.ty.toType();
5742 const error_union_ty = ty_op.ty;
57435743 const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type;
57445744 const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type);
57455745 const payload_ty: ZigType = .fromInterned(error_union_info.payload_type);
......@@ -5766,7 +5766,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
57665766 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;
57675767 switch (codegen.fieldOffset(
57685768 isel.air.typeOf(extra.struct_operand, ip),
5769 ty_pl.ty.toType(),
5769 ty_pl.ty,
57705770 extra.field_index,
57715771 zcu,
57725772 )) {
......@@ -5799,7 +5799,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
57995799 const ty_op = air.data(air.inst_index).ty_op;
58005800 switch (codegen.fieldOffset(
58015801 isel.air.typeOf(ty_op.operand, ip),
5802 ty_op.ty.toType(),
5802 ty_op.ty,
58035803 switch (air_tag) {
58045804 else => unreachable,
58055805 .struct_field_ptr_index_0 => 0,
......@@ -5835,7 +5835,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
58355835 const ty_pl = air.data(air.inst_index).ty_pl;
58365836 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;
58375837 const agg_ty = isel.air.typeOf(extra.struct_operand, ip);
5838 const field_ty = ty_pl.ty.toType();
5838 const field_ty = ty_pl.ty;
58395839 const field_bit_offset, const field_bit_size, const is_packed = switch (agg_ty.containerLayout(zcu)) {
58405840 .auto, .@"extern" => .{
58415841 8 * agg_ty.structFieldOffset(extra.field_index, zcu),
......@@ -5861,7 +5861,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
58615861 .@"struct" => {
58625862 var agg_part_it = agg_vi.field(agg_ty, @divExact(field_bit_offset, 8), @divExact(field_bit_size, 8));
58635863 while (try agg_part_it.next(isel)) |agg_part| {
5864 var field_part_it = field_vi.value.field(ty_pl.ty.toType(), agg_part.offset, agg_part.vi.size(isel));
5864 var field_part_it = field_vi.value.field(ty_pl.ty, agg_part.offset, agg_part.vi.size(isel));
58655865 const field_part_vi = try field_part_it.only(isel);
58665866 if (field_part_vi.? == agg_part.vi) continue;
58675867 var field_subpart_it = field_part_vi.?.parts(isel);
......@@ -5931,7 +5931,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
59315931 const union_vi = try isel.use(ty_op.operand);
59325932 var tag_part_it = union_vi.field(union_ty, union_layout.tagOffset(), union_layout.tag_size);
59335933 const tag_part_vi = try tag_part_it.only(isel);
5934 try tag_vi.value.copy(isel, ty_op.ty.toType(), tag_part_vi.?);
5934 try tag_vi.value.copy(isel, ty_op.ty, tag_part_vi.?);
59355935 }
59365936 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
59375937 },
......@@ -5940,10 +5940,10 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
59405940 defer slice_vi.value.deref(isel);
59415941 const ty_pl = air.data(air.inst_index).ty_pl;
59425942 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;
5943 var ptr_part_it = slice_vi.value.field(ty_pl.ty.toType(), 0, 8);
5943 var ptr_part_it = slice_vi.value.field(ty_pl.ty, 0, 8);
59445944 const ptr_part_vi = try ptr_part_it.only(isel);
59455945 try ptr_part_vi.?.move(isel, bin_op.lhs);
5946 var len_part_it = slice_vi.value.field(ty_pl.ty.toType(), 8, 8);
5946 var len_part_it = slice_vi.value.field(ty_pl.ty, 8, 8);
59475947 const len_part_vi = try len_part_it.only(isel);
59485948 try len_part_vi.?.move(isel, bin_op.rhs);
59495949 }
......@@ -5956,7 +5956,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
59565956 const slice_vi = try isel.use(ty_op.operand);
59575957 var len_part_it = slice_vi.field(isel.air.typeOf(ty_op.operand, ip), 8, 8);
59585958 const len_part_vi = try len_part_it.only(isel);
5959 try len_vi.value.copy(isel, ty_op.ty.toType(), len_part_vi.?);
5959 try len_vi.value.copy(isel, ty_op.ty, len_part_vi.?);
59605960 }
59615961 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
59625962 },
......@@ -5967,7 +5967,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
59675967 const slice_vi = try isel.use(ty_op.operand);
59685968 var ptr_part_it = slice_vi.field(isel.air.typeOf(ty_op.operand, ip), 0, 8);
59695969 const ptr_part_vi = try ptr_part_it.only(isel);
5970 try ptr_vi.value.copy(isel, ty_op.ty.toType(), ptr_part_vi.?);
5970 try ptr_vi.value.copy(isel, ty_op.ty, ptr_part_vi.?);
59715971 }
59725972 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
59735973 },
......@@ -6180,7 +6180,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
61806180
61816181 const ty_pl = air.data(air.inst_index).ty_pl;
61826182 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;
6183 const elem_size = ty_pl.ty.toType().childType(zcu).abiSize(zcu);
6183 const elem_size = ty_pl.ty.childType(zcu).abiSize(zcu);
61846184
61856185 const slice_vi = try isel.use(bin_op.lhs);
61866186 var ptr_part_it = slice_vi.field(isel.air.typeOf(bin_op.lhs, ip), 0, 8);
......@@ -6286,7 +6286,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
62866286
62876287 const ty_pl = air.data(air.inst_index).ty_pl;
62886288 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;
6289 const elem_size = ty_pl.ty.toType().childType(zcu).abiSize(zcu);
6289 const elem_size = ty_pl.ty.childType(zcu).abiSize(zcu);
62906290
62916291 const base_vi = try isel.use(bin_op.lhs);
62926292 const base_mat = try base_vi.matReg(isel);
......@@ -6301,10 +6301,10 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
63016301 if (isel.live_values.fetchRemove(air.inst_index)) |slice_vi| {
63026302 defer slice_vi.value.deref(isel);
63036303 const ty_op = air.data(air.inst_index).ty_op;
6304 var ptr_part_it = slice_vi.value.field(ty_op.ty.toType(), 0, 8);
6304 var ptr_part_it = slice_vi.value.field(ty_op.ty, 0, 8);
63056305 const ptr_part_vi = try ptr_part_it.only(isel);
63066306 try ptr_part_vi.?.move(isel, ty_op.operand);
6307 var len_part_it = slice_vi.value.field(ty_op.ty.toType(), 8, 8);
6307 var len_part_it = slice_vi.value.field(ty_op.ty, 8, 8);
63086308 const len_part_vi = try len_part_it.only(isel);
63096309 if (try len_part_vi.?.defReg(isel)) |len_ra| try isel.movImmediate(
63106310 len_ra.x(),
......@@ -6318,7 +6318,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
63186318 defer dst_vi.value.deref(isel);
63196319
63206320 const ty_op = air.data(air.inst_index).ty_op;
6321 const dst_ty = ty_op.ty.toType();
6321 const dst_ty = ty_op.ty;
63226322 const src_ty = isel.air.typeOf(ty_op.operand, ip);
63236323 if (!dst_ty.isAbiInt(zcu)) return isel.fail("bad {t} {f} {f}", .{ air_tag, isel.fmtType(dst_ty), isel.fmtType(src_ty) });
63246324 const dst_int_info = dst_ty.intInfo(zcu);
......@@ -6460,7 +6460,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
64606460 defer dst_vi.value.deref(isel);
64616461
64626462 const ty_op = air.data(air.inst_index).ty_op;
6463 const dst_ty = ty_op.ty.toType();
6463 const dst_ty = ty_op.ty;
64646464 const src_ty = isel.air.typeOf(ty_op.operand, ip);
64656465 const dst_bits = dst_ty.floatBits(isel.target);
64666466 if (!src_ty.isAbiInt(zcu)) return isel.fail("bad {t} {f} {f}", .{ air_tag, isel.fmtType(dst_ty), isel.fmtType(src_ty) });
......@@ -6884,7 +6884,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
68846884 defer agg_vi.value.deref(isel);
68856885
68866886 const ty_pl = air.data(air.inst_index).ty_pl;
6887 const agg_ty = ty_pl.ty.toType();
6887 const agg_ty = ty_pl.ty;
68886888 switch (ip.indexToKey(agg_ty.toIntern())) {
68896889 .array_type => |array_type| {
68906890 const elems: []const Air.Inst.Ref =
......@@ -6959,7 +6959,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
69596959
69606960 const ty_pl = air.data(air.inst_index).ty_pl;
69616961 const extra = isel.air.extraData(Air.UnionInit, ty_pl.payload).data;
6962 const union_ty = ty_pl.ty.toType();
6962 const union_ty = ty_pl.ty;
69636963 const loaded_union = ip.loadUnionType(union_ty.toIntern());
69646964 const union_layout = ZigType.getUnionLayout(loaded_union, zcu);
69656965
......@@ -7171,7 +7171,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
71717171 const ty_pl = air.data(air.inst_index).ty_pl;
71727172 const extra = isel.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
71737173 switch (codegen.fieldOffset(
7174 ty_pl.ty.toType(),
7174 ty_pl.ty,
71757175 isel.air.typeOf(extra.field_ptr, ip),
71767176 extra.field_index,
71777177 zcu,
......@@ -7259,7 +7259,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
72597259 const maybe_arg_vi = isel.live_values.fetchRemove(air.inst_index);
72607260 defer if (maybe_arg_vi) |arg_vi| arg_vi.value.deref(isel);
72617261 const ty_op = air.data(air.inst_index).ty_op;
7262 const ty = ty_op.ty.toType();
7262 const ty = ty_op.ty;
72637263 var param_it: CallAbiIterator = .init;
72647264 const param_vi = try param_it.param(isel, ty);
72657265 defer param_vi.?.deref(isel);
......@@ -7459,7 +7459,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
74597459 const ty_op = air.data(air.inst_index).ty_op;
74607460 const va_list_ptr_vi = try isel.use(ty_op.operand);
74617461 const va_list_ptr_mat = try va_list_ptr_vi.matReg(isel);
7462 _ = try va_list_vi.value.load(isel, ty_op.ty.toType(), va_list_ptr_mat.ra, .{});
7462 _ = try va_list_vi.value.load(isel, ty_op.ty, va_list_ptr_mat.ra, .{});
74637463 try va_list_ptr_mat.finish(isel);
74647464 }
74657465 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
src/codegen/c.zig+3-3
......@@ -3413,7 +3413,7 @@ fn airIntCast(f: *Function, inst: Air.Inst.Index, operation: []const u8, info: B
34133413 const zcu = pt.zcu;
34143414 const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op;
34153415
3416 const inst_ty = ty_op.ty.toType();
3416 const inst_ty = ty_op.ty;
34173417 const inst_scalar_ty = inst_ty.scalarType(zcu);
34183418 const operand_ty = f.typeOf(ty_op.operand);
34193419 const operand_scalar_ty = operand_ty.scalarType(zcu);
......@@ -7219,7 +7219,7 @@ fn airMulAdd(f: *Function, inst: Air.Inst.Index) !CValue {
72197219fn airRuntimeNavPtr(f: *Function, inst: Air.Inst.Index) !CValue {
72207220 const ty_nav = f.air.instructions.items(.data)[@backingInt(inst)].ty_nav;
72217221 const w = &f.code.writer;
7222 const local = try f.allocLocal(inst, .fromInterned(ty_nav.ty));
7222 const local = try f.allocLocal(inst, ty_nav.ty);
72237223 try f.writeCValue(w, local, .other);
72247224 try w.writeAll(" = ");
72257225 try f.dg.renderNav(w, ty_nav.nav, .other);
......@@ -7261,7 +7261,7 @@ fn airCVaArg(f: *Function, inst: Air.Inst.Index) !CValue {
72617261 try w.writeAll(" = va_arg(*(va_list *)");
72627262 try f.writeCValue(w, va_list, .other);
72637263 try w.writeAll(", ");
7264 try f.renderType(w, ty_op.ty.toType());
7264 try f.renderType(w, ty_op.ty);
72657265 try w.writeAll(");");
72667266 try f.newline();
72677267 return local;
src/codegen/llvm/FuncGen.zig+6-6
......@@ -1164,7 +1164,7 @@ fn airRetLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void {
11641164fn airCVaArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {
11651165 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;
11661166 const list = try self.resolveInst(ty_op.operand);
1167 const arg_ty = ty_op.ty.toType();
1167 const arg_ty = ty_op.ty;
11681168 const llvm_arg_ty = try self.object.lowerType(arg_ty, .as_value);
11691169
11701170 return self.wip.vaArg(list, llvm_arg_ty, "");
......@@ -1175,7 +1175,7 @@ fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu
11751175 const zcu = o.zcu;
11761176 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;
11771177 const src_list = try self.resolveInst(ty_op.operand);
1178 const va_list_ty = ty_op.ty.toType();
1178 const va_list_ty = ty_op.ty;
11791179
11801180 const dest_list = try self.buildZigAlloca(va_list_ty, .none);
11811181
......@@ -2393,11 +2393,11 @@ fn airFieldParentPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Build
23932393
23942394 const field_ptr = try self.resolveInst(extra.field_ptr);
23952395
2396 const parent_ty = ty_pl.ty.toType().childType(zcu);
2396 const parent_ty = ty_pl.ty.childType(zcu);
23972397 const field_offset = parent_ty.structFieldOffset(extra.field_index, zcu);
23982398 if (field_offset == 0) return field_ptr;
23992399
2400 const res_ty = try o.lowerType(ty_pl.ty.toType(), .as_value);
2400 const res_ty = try o.lowerType(ty_pl.ty, .as_value);
24012401 const llvm_usize = try o.lowerType(.usize, .as_value);
24022402
24032403 const field_ptr_int = try self.wip.cast(.ptrtoint, field_ptr, llvm_usize, "");
......@@ -3191,7 +3191,7 @@ fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) Allocator.Er
31913191 const zcu = self.object.zcu;
31923192
31933193 const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl;
3194 const struct_ty = ty_pl.ty.toType();
3194 const struct_ty = ty_pl.ty;
31953195 const field_index = ty_pl.payload;
31963196
31973197 assert(self.err_ret_trace != .none);
......@@ -5902,7 +5902,7 @@ fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui
59025902 const ip = &zcu.intern_pool;
59035903 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;
59045904 const operand = try self.resolveInst(ty_op.operand);
5905 const error_set_ty = ty_op.ty.toType();
5905 const error_set_ty = ty_op.ty;
59065906
59075907 const names = error_set_ty.errorSetNames(zcu);
59085908 const valid_block = try self.wip.block(@intCast(names.len), "Valid");
src/codegen/riscv64/CodeGen.zig+5-5
......@@ -3536,7 +3536,7 @@ fn airWrapErrUnionPayload(func: *Func, inst: Air.Inst.Index) !void {
35363536 const zcu = pt.zcu;
35373537 const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op;
35383538
3539 const eu_ty = ty_op.ty.toType();
3539 const eu_ty = ty_op.ty;
35403540 const pl_ty = eu_ty.errorUnionPayload(zcu);
35413541 const err_ty = eu_ty.errorUnionSet(zcu);
35423542 const operand = try func.resolveInst(ty_op.operand);
......@@ -3561,7 +3561,7 @@ fn airWrapErrUnionErr(func: *Func, inst: Air.Inst.Index) !void {
35613561 const zcu = pt.zcu;
35623562 const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op;
35633563
3564 const eu_ty = ty_op.ty.toType();
3564 const eu_ty = ty_op.ty;
35653565 const pl_ty = eu_ty.errorUnionPayload(zcu);
35663566 const err_ty = eu_ty.errorUnionSet(zcu);
35673567
......@@ -3583,7 +3583,7 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void {
35833583 const zcu = func.pt.zcu;
35843584 const ip = &zcu.intern_pool;
35853585 const ty_nav = func.air.instructions.items(.data)[@backingInt(inst)].ty_nav;
3586 const ptr_ty: Type = .fromInterned(ty_nav.ty);
3586 const ptr_ty: Type = ty_nav.ty;
35873587
35883588 const nav = ip.getNav(ty_nav.nav);
35893589 const tlv_sym_index = if (func.bin_file.cast(.elf)) |elf_file| sym: {
......@@ -7295,7 +7295,7 @@ fn airFloatFromInt(func: *Func, inst: Air.Inst.Index) !void {
72957295 const operand = try func.resolveInst(ty_op.operand);
72967296
72977297 const src_ty = func.typeOf(ty_op.operand);
7298 const dst_ty = ty_op.ty.toType();
7298 const dst_ty = ty_op.ty;
72997299
73007300 const src_reg, const src_lock = try func.promoteReg(src_ty, operand);
73017301 defer if (src_lock) |lock| func.register_manager.unlockReg(lock);
......@@ -7358,7 +7358,7 @@ fn airIntFromFloat(func: *Func, inst: Air.Inst.Index) !void {
73587358
73597359 const operand = try func.resolveInst(ty_op.operand);
73607360 const src_ty = func.typeOf(ty_op.operand);
7361 const dst_ty = ty_op.ty.toType();
7361 const dst_ty = ty_op.ty;
73627362
73637363 const is_unsigned = dst_ty.isUnsignedInt(zcu);
73647364 const src_bits = src_ty.bitSize(zcu);
src/codegen/sparc64/CodeGen.zig+1-1
......@@ -2650,7 +2650,7 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void {
26502650 const zcu = pt.zcu;
26512651 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;
26522652 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
2653 const error_union_ty = ty_op.ty.toType();
2653 const error_union_ty = ty_op.ty;
26542654 const payload_ty = error_union_ty.errorUnionPayload(zcu);
26552655 const mcv = try self.resolveInst(ty_op.operand);
26562656 if (!payload_ty.hasRuntimeBits(zcu)) break :result mcv;
src/codegen/spirv/CodeGen.zig+1-1
......@@ -7064,7 +7064,7 @@ fn airFieldParentPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
70647064 const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl;
70657065 const extra = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
70667066
7067 const parent_ptr_ty = ty_pl.ty.toType();
7067 const parent_ptr_ty = ty_pl.ty;
70687068 const parent_ty = parent_ptr_ty.childType(zcu);
70697069 const result_ty_id = try cg.resolveType(parent_ptr_ty, .indirect);
70707070
src/codegen/wasm/CodeGen.zig+8-8
......@@ -1591,7 +1591,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
15911591 .int_cast => {
15921592 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;
15931593
1594 const dest_ty = ty_op.ty.toType();
1594 const dest_ty = ty_op.ty;
15951595 const operand = try cg.resolveInst(ty_op.operand);
15961596 const src_ty = cg.typeOf(ty_op.operand);
15971597
......@@ -1620,7 +1620,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
16201620 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;
16211621
16221622 const operand = try cg.resolveInst(ty_op.operand);
1623 const dest_ty = ty_op.ty.toType();
1623 const dest_ty = ty_op.ty;
16241624 const src_ty = cg.typeOf(ty_op.operand);
16251625
16261626 if (dest_ty.zigTypeTag(zcu) == .vector or src_ty.zigTypeTag(zcu) == .vector) {
......@@ -2385,7 +2385,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
23852385 const zcu = pt.zcu;
23862386 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;
23872387 const operand = try cg.resolveInst(ty_op.operand);
2388 const elem_ty = ty_op.ty.toType();
2388 const elem_ty = ty_op.ty;
23892389 const ptr_ty = cg.typeOf(ty_op.operand);
23902390 const ptr_info = ptr_ty.ptrInfo(zcu);
23912391
......@@ -6176,7 +6176,7 @@ fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
61766176 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;
61776177
61786178 const operand = try cg.resolveInst(ty_op.operand);
6179 const err_ty = ty_op.ty.toType();
6179 const err_ty = ty_op.ty;
61806180 const pl_ty = err_ty.errorUnionPayload(zcu);
61816181
61826182 const result = result: {
......@@ -6402,7 +6402,7 @@ fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
64026402 const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl;
64036403 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
64046404
6405 const elem_ty = ty_pl.ty.toType().childType(zcu);
6405 const elem_ty = ty_pl.ty.childType(zcu);
64066406 const elem_size = elem_ty.abiSize(zcu);
64076407
64086408 const slice = try cg.resolveInst(bin_op.lhs);
......@@ -6441,7 +6441,7 @@ fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
64416441
64426442 const operand = try cg.resolveInst(ty_op.operand);
64436443 const array_ty = cg.typeOf(ty_op.operand).childType(zcu);
6444 const slice_ty = ty_op.ty.toType();
6444 const slice_ty = ty_op.ty;
64456445
64466446 // create a slice on the stack
64476447 const slice_local = try cg.allocStack(slice_ty);
......@@ -6489,7 +6489,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
64896489 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
64906490
64916491 const ptr_ty = cg.typeOf(bin_op.lhs);
6492 const elem_ty = ty_pl.ty.toType().childType(zcu);
6492 const elem_ty = ty_pl.ty.childType(zcu);
64936493 const elem_size = elem_ty.abiSize(zcu);
64946494
64956495 const ptr = try cg.resolveInst(bin_op.lhs);
......@@ -7499,7 +7499,7 @@ fn airErrorSetHasValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
74997499 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;
75007500
75017501 const operand = try cg.resolveInst(ty_op.operand);
7502 const error_set_ty = ty_op.ty.toType();
7502 const error_set_ty = ty_op.ty;
75037503 const result = try cg.allocLocal(Type.bool);
75047504
75057505 const names = error_set_ty.errorSetNames(zcu);
src/codegen/x86_64/CodeGen.zig+57-57
......@@ -43354,7 +43354,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4335443354 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
4335543355 try ops[0].toSlicePtr(cg);
4335643356 var res: [1]Temp = undefined;
43357 if (!hack_around_sema_opv_bugs or ty_pl.ty.toType().childType(zcu).hasRuntimeBits(zcu)) cg.select(&res, &.{ty_pl.ty.toType()}, &ops, comptime &.{ .{
43357 if (!hack_around_sema_opv_bugs or ty_pl.ty.childType(zcu).hasRuntimeBits(zcu)) cg.select(&res, &.{ty_pl.ty}, &ops, comptime &.{ .{
4335843358 .patterns = &.{
4335943359 .{ .src = .{ .to_gpr, .simm32, .none } },
4336043360 },
......@@ -43468,7 +43468,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4346843468 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
4346943469 try ops[0].toSlicePtr(cg);
4347043470 var res: [1]Temp = undefined;
43471 if (!hack_around_sema_opv_bugs or ty_pl.ty.toType().childType(zcu).hasRuntimeBits(zcu)) cg.select(&res, &.{ty_pl.ty.toType()}, &ops, comptime &.{ .{
43471 if (!hack_around_sema_opv_bugs or ty_pl.ty.childType(zcu).hasRuntimeBits(zcu)) cg.select(&res, &.{ty_pl.ty}, &ops, comptime &.{ .{
4347243472 .patterns = &.{
4347343473 .{ .src = .{ .to_gpr, .simm32, .none } },
4347443474 },
......@@ -52208,7 +52208,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5220852208 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
5220952209 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
5221052210 var res: [2]Temp = undefined;
52211 cg.select(&res, &.{ ty_pl.ty.toType(), .u1 }, &ops, comptime &.{ .{
52211 cg.select(&res, &.{ ty_pl.ty, .u1 }, &ops, comptime &.{ .{
5221252212 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .exact_signed_int = 8 }, .any },
5221352213 .patterns = &.{
5221452214 .{ .src = .{ .to_mut_gpr, .imm8, .none } },
......@@ -53044,7 +53044,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5304453044 } }) catch |err| switch (err) {
5304553045 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
5304653046 @tagName(air_tag),
53047 ty_pl.ty.toType().fmt(pt),
53047 ty_pl.ty.fmt(pt),
5304853048 ops[0].tracking(cg),
5304953049 ops[1].tracking(cg),
5305053050 }),
......@@ -53058,7 +53058,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5305853058 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
5305953059 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
5306053060 var res: [2]Temp = undefined;
53061 cg.select(&res, &.{ ty_pl.ty.toType(), .u1 }, &ops, comptime &.{ .{
53061 cg.select(&res, &.{ ty_pl.ty, .u1 }, &ops, comptime &.{ .{
5306253062 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .exact_signed_int = 8 }, .any },
5306353063 .patterns = &.{
5306453064 .{ .src = .{ .to_mut_gpr, .imm8, .none } },
......@@ -53949,7 +53949,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5394953949 } }) catch |err| switch (err) {
5395053950 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
5395153951 @tagName(air_tag),
53952 ty_pl.ty.toType().fmt(pt),
53952 ty_pl.ty.fmt(pt),
5395353953 ops[0].tracking(cg),
5395453954 ops[1].tracking(cg),
5395553955 }),
......@@ -53963,7 +53963,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5396353963 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
5396453964 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
5396553965 var res: [2]Temp = undefined;
53966 cg.select(&res, &.{ ty_pl.ty.toType(), .u1 }, &ops, comptime &.{ .{
53966 cg.select(&res, &.{ ty_pl.ty, .u1 }, &ops, comptime &.{ .{
5396753967 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .exact_signed_int = 8 }, .any },
5396853968 .patterns = &.{
5396953969 .{ .src = .{ .{ .to_reg = .al }, .mem, .none } },
......@@ -57546,7 +57546,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5754657546 } }) catch |err| switch (err) {
5754757547 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
5754857548 @tagName(air_tag),
57549 ty_pl.ty.toType().fmt(pt),
57549 ty_pl.ty.fmt(pt),
5755057550 ops[0].tracking(cg),
5755157551 ops[1].tracking(cg),
5755257552 }),
......@@ -57560,7 +57560,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5756057560 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
5756157561 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
5756257562 var res: [2]Temp = undefined;
57563 cg.select(&res, &.{ ty_pl.ty.toType(), .u1 }, &ops, comptime &.{ .{
57563 cg.select(&res, &.{ ty_pl.ty, .u1 }, &ops, comptime &.{ .{
5756457564 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .unsigned_int = .byte }, .any },
5756557565 .patterns = &.{
5756657566 .{ .src = .{ .mut_mem, .{ .imm = 1 }, .none } },
......@@ -60891,7 +60891,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6089160891 } }) catch |err| switch (err) {
6089260892 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
6089360893 @tagName(air_tag),
60894 ty_pl.ty.toType().fmt(pt),
60894 ty_pl.ty.fmt(pt),
6089560895 ops[0].tracking(cg),
6089660896 ops[1].tracking(cg),
6089760897 }),
......@@ -65659,7 +65659,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6565965659 const ty_op = air_datas[@backingInt(inst)].ty_op;
6566065660 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
6566165661 var res: [1]Temp = undefined;
65662 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
65662 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
6566365663 .src_constraints = .{ .{ .bool_vec = .byte }, .any, .any },
6566465664 .patterns = &.{
6566565665 .{ .src = .{ .mut_mem, .none, .none } },
......@@ -67432,7 +67432,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6743267432 } }) catch |err| switch (err) {
6743367433 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
6743467434 @tagName(air_tag),
67435 ty_op.ty.toType().fmt(pt),
67435 ty_op.ty.fmt(pt),
6743667436 ops[0].tracking(cg),
6743767437 }),
6743867438 else => |e| return e,
......@@ -67499,7 +67499,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6749967499 const ty_op = air_datas[@backingInt(inst)].ty_op;
6750067500 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
6750167501 var res: [1]Temp = undefined;
67502 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
67502 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
6750367503 .required_features = .{ .slow_incdec, null, null, null },
6750467504 .src_constraints = .{ .{ .exact_signed_int = 1 }, .any, .any },
6750567505 .patterns = &.{
......@@ -70604,7 +70604,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7060470604 const ty_op = air_datas[@backingInt(inst)].ty_op;
7060570605 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
7060670606 var res: [1]Temp = undefined;
70607 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
70607 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
7060870608 .required_features = .{ .slow_incdec, null, null, null },
7060970609 .src_constraints = .{ .{ .exact_signed_int = 1 }, .any, .any },
7061070610 .patterns = &.{
......@@ -71001,7 +71001,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7100171001 const ty_op = air_datas[@backingInt(inst)].ty_op;
7100271002 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
7100371003 var res: [1]Temp = undefined;
71004 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
71004 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
7100571005 .src_constraints = .{ .{ .exact_signed_int = 1 }, .any, .any },
7100671006 .patterns = &.{
7100771007 .{ .src = .{ .mut_mem, .none, .none } },
......@@ -71889,7 +71889,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7188971889 const ty_op = air_datas[@backingInt(inst)].ty_op;
7189071890 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
7189171891 var res: [1]Temp = undefined;
71892 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
71892 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
7189371893 .src_constraints = .{ .{ .exact_int = 8 }, .any, .any },
7189471894 .patterns = &.{
7189571895 .{ .src = .{ .mut_mem, .none, .none } },
......@@ -72527,7 +72527,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7252772527 } }) catch |err| switch (err) {
7252872528 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
7252972529 @tagName(air_tag),
72530 ty_op.ty.toType().fmt(pt),
72530 ty_op.ty.fmt(pt),
7253172531 ops[0].tracking(cg),
7253272532 }),
7253372533 else => |e| return e,
......@@ -72538,7 +72538,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7253872538 const ty_op = air_datas[@backingInt(inst)].ty_op;
7253972539 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
7254072540 var res: [1]Temp = undefined;
72541 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
72541 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
7254272542 .src_constraints = .{ .{ .exact_int = 1 }, .any, .any },
7254372543 .patterns = &.{
7254472544 .{ .src = .{ .mut_mem, .none, .none } },
......@@ -75629,7 +75629,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7562975629 } }) catch |err| switch (err) {
7563075630 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
7563175631 @tagName(air_tag),
75632 ty_op.ty.toType().fmt(pt),
75632 ty_op.ty.fmt(pt),
7563375633 ops[0].tracking(cg),
7563475634 }),
7563575635 else => |e| return e,
......@@ -77552,7 +77552,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7755277552 const ty_op = air_datas[@backingInt(inst)].ty_op;
7755377553 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
7755477554 var res: [1]Temp = undefined;
77555 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
77555 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
7755677556 .required_features = .{ .cmov, null, null, null },
7755777557 .src_constraints = .{ .{ .int = .byte }, .any, .any },
7755877558 .patterns = &.{
......@@ -82071,7 +82071,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8207182071 .lt, .lte => {},
8207282072 .gt, .gte => std.mem.swap(Temp, &ops[0], &ops[1]),
8207382073 }
82074 break :err cg.select(&res, &.{ty_pl.ty.toType()}, &ops, switch (@as(Condition, switch (cmp_op) {
82074 break :err cg.select(&res, &.{ty_pl.ty}, &ops, switch (@as(Condition, switch (cmp_op) {
8207582075 else => unreachable,
8207682076 .lt, .gt => .l,
8207782077 .lte, .gte => .le,
......@@ -84587,7 +84587,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8458784587 } },
8458884588 });
8458984589 },
84590 .eq, .neq => |cmp_op| cg.select(&res, &.{ty_pl.ty.toType()}, &ops, switch (@as(Condition, switch (cmp_op) {
84590 .eq, .neq => |cmp_op| cg.select(&res, &.{ty_pl.ty}, &ops, switch (@as(Condition, switch (cmp_op) {
8459184591 else => unreachable,
8459284592 .eq => .e,
8459384593 .neq => .ne,
......@@ -89364,7 +89364,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8936489364 },
8936589365 .load => {
8936689366 const ty_op = air_datas[@backingInt(inst)].ty_op;
89367 const val_ty = ty_op.ty.toType();
89367 const val_ty = ty_op.ty;
8936889368 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
8936989369 var res: [1]Temp = undefined;
8937089370 cg.select(&res, &.{val_ty}, &ops, comptime &.{ .{
......@@ -89693,7 +89693,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8969389693 const ty_op = air_datas[@backingInt(inst)].ty_op;
8969489694 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
8969589695 var res: [1]Temp = undefined;
89696 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
89696 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
8969789697 .required_features = .{ .f16c, null, null, null },
8969889698 .src_constraints = .{ .{ .scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
8969989699 .dst_constraints = .{ .{ .scalar_float = .{ .of = .word, .is = .word } }, .any },
......@@ -91706,7 +91706,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9170691706 } }) catch |err| switch (err) {
9170791707 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
9170891708 @tagName(air_tag),
91709 ty_op.ty.toType().fmt(pt),
91709 ty_op.ty.fmt(pt),
9171091710 cg.typeOf(ty_op.operand).fmt(pt),
9171191711 ops[0].tracking(cg),
9171291712 }),
......@@ -91718,7 +91718,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9171891718 const ty_op = air_datas[@backingInt(inst)].ty_op;
9171991719 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
9172091720 var res: [1]Temp = undefined;
91721 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
91721 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
9172291722 .required_features = .{ .f16c, null, null, null },
9172391723 .src_constraints = .{ .{ .scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
9172491724 .dst_constraints = .{ .{ .scalar_float = .{ .of = .dword, .is = .dword } }, .any },
......@@ -93381,7 +93381,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9338193381 } }) catch |err| switch (err) {
9338293382 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
9338393383 @tagName(air_tag),
93384 ty_op.ty.toType().fmt(pt),
93384 ty_op.ty.fmt(pt),
9338593385 cg.typeOf(ty_op.operand).fmt(pt),
9338693386 ops[0].tracking(cg),
9338793387 }),
......@@ -93391,7 +93391,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9339193391 },
9339293392 .int_cast => |air_tag| {
9339393393 const ty_op = air_datas[@backingInt(inst)].ty_op;
93394 const dst_ty = ty_op.ty.toType();
93394 const dst_ty = ty_op.ty;
9339593395 const src_ty = cg.typeOf(ty_op.operand);
9339693396 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
9339793397 var res: [1]Temp = undefined;
......@@ -98152,7 +98152,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9815298152 const ty_op = air_datas[@backingInt(inst)].ty_op;
9815398153 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
9815498154 var res: [1]Temp = undefined;
98155 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
98155 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
9815698156 .src_constraints = .{ .{ .signed_int = .gpr }, .any, .any },
9815798157 .dst_constraints = .{ .{ .exact_signed_int = 1 }, .any },
9815898158 .patterns = &.{
......@@ -103805,7 +103805,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103805103805 } }) catch |err| switch (err) {
103806103806 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
103807103807 @tagName(air_tag),
103808 ty_op.ty.toType().fmt(pt),
103808 ty_op.ty.fmt(pt),
103809103809 cg.typeOf(ty_op.operand).fmt(pt),
103810103810 ops[0].tracking(cg),
103811103811 }),
......@@ -103816,10 +103816,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103816103816 .optional_payload => {
103817103817 const ty_op = air_datas[@backingInt(inst)].ty_op;
103818103818 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
103819 const pl = if (!hack_around_sema_opv_bugs or ty_op.ty.toType().hasRuntimeBits(zcu))
103820 try ops[0].read(ty_op.ty.toType(), .{}, cg)
103819 const pl = if (!hack_around_sema_opv_bugs or ty_op.ty.hasRuntimeBits(zcu))
103820 try ops[0].read(ty_op.ty, .{}, cg)
103821103821 else
103822 try cg.tempInit(ty_op.ty.toType(), .none);
103822 try cg.tempInit(ty_op.ty, .none);
103823103823 try pl.finish(inst, &.{ty_op.operand}, &ops, cg);
103824103824 },
103825103825 .optional_payload_ptr => {
......@@ -103844,7 +103844,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103844103844 },
103845103845 .wrap_optional => {
103846103846 const ty_op = air_datas[@backingInt(inst)].ty_op;
103847 const opt_ty = ty_op.ty.toType();
103847 const opt_ty = ty_op.ty;
103848103848 const opt_pl_ty = cg.typeOf(ty_op.operand);
103849103849 const opt_pl_abi_size: u31 = @intCast(opt_pl_ty.abiSize(zcu));
103850103850 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
......@@ -103859,7 +103859,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103859103859 },
103860103860 .unwrap_errunion_payload => {
103861103861 const ty_op = air_datas[@backingInt(inst)].ty_op;
103862 const eu_pl_ty = ty_op.ty.toType();
103862 const eu_pl_ty = ty_op.ty;
103863103863 const eu_pl_off: i32 = @intCast(codegen.errUnionPayloadOffset(eu_pl_ty, zcu));
103864103864 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
103865103865 const pl = if (!hack_around_sema_opv_bugs or eu_pl_ty.hasRuntimeBits(zcu))
......@@ -103871,7 +103871,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103871103871 .unwrap_errunion_err => {
103872103872 const ty_op = air_datas[@backingInt(inst)].ty_op;
103873103873 const eu_ty = cg.typeOf(ty_op.operand);
103874 const eu_err_ty = ty_op.ty.toType();
103874 const eu_err_ty = ty_op.ty;
103875103875 const eu_pl_ty = eu_ty.errorUnionPayload(zcu);
103876103876 const eu_err_off: i32 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));
103877103877 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
......@@ -103890,7 +103890,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103890103890 .unwrap_errunion_err_ptr => {
103891103891 const ty_op = air_datas[@backingInt(inst)].ty_op;
103892103892 const eu_ty = cg.typeOf(ty_op.operand).childType(zcu);
103893 const eu_err_ty = ty_op.ty.toType();
103893 const eu_err_ty = ty_op.ty;
103894103894 const eu_pl_ty = eu_ty.errorUnionPayload(zcu);
103895103895 const eu_err_off: i32 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));
103896103896 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
......@@ -103915,7 +103915,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103915103915 },
103916103916 .wrap_errunion_payload => {
103917103917 const ty_op = air_datas[@backingInt(inst)].ty_op;
103918 const eu_ty = ty_op.ty.toType();
103918 const eu_ty = ty_op.ty;
103919103919 const eu_err_ty = eu_ty.errorUnionSet(zcu);
103920103920 const eu_pl_ty = cg.typeOf(ty_op.operand);
103921103921 const eu_err_off: u31 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));
......@@ -103930,7 +103930,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103930103930 },
103931103931 .wrap_errunion_err => {
103932103932 const ty_op = air_datas[@backingInt(inst)].ty_op;
103933 const eu_ty = ty_op.ty.toType();
103933 const eu_ty = ty_op.ty;
103934103934 const eu_pl_ty = eu_ty.errorUnionPayload(zcu);
103935103935 const eu_err_off: u31 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));
103936103936 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
......@@ -103944,7 +103944,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103944103944 var ops = try cg.tempsFromOperands(inst, .{struct_field.struct_operand});
103945103945 try ops[0].toOffset(@intCast(codegen.fieldOffset(
103946103946 cg.typeOf(struct_field.struct_operand),
103947 ty_pl.ty.toType(),
103947 ty_pl.ty,
103948103948 struct_field.field_index,
103949103949 zcu,
103950103950 )), cg);
......@@ -103959,7 +103959,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103959103959 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
103960103960 try ops[0].toOffset(@intCast(codegen.fieldOffset(
103961103961 cg.typeOf(ty_op.operand),
103962 ty_op.ty.toType(),
103962 ty_op.ty,
103963103963 switch (air_tag) {
103964103964 else => unreachable,
103965103965 .struct_field_ptr_index_0 => 0,
......@@ -103975,7 +103975,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103975103975 const ty_pl = air_datas[@backingInt(inst)].ty_pl;
103976103976 const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data;
103977103977 const agg_ty = cg.typeOf(struct_field.struct_operand);
103978 const field_ty = ty_pl.ty.toType();
103978 const field_ty = ty_pl.ty;
103979103979 const field_off: u31 = switch (agg_ty.containerLayout(zcu)) {
103980103980 .auto, .@"extern" => @intCast(agg_ty.structFieldOffset(struct_field.field_index, zcu)),
103981103981 .@"packed" => unreachable,
......@@ -104004,7 +104004,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104004104004 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
104005104005 const union_layout = union_ty.unionGetLayout(zcu);
104006104006 assert(union_layout.tag_size > 0);
104007 const res = try ops[0].read(ty_op.ty.toType(), .{
104007 const res = try ops[0].read(ty_op.ty, .{
104008104008 .disp = @intCast(union_layout.tagOffset()),
104009104009 }, cg);
104010104010 try res.finish(inst, &.{ty_op.operand}, &ops, cg);
......@@ -104364,7 +104364,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104364104364 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
104365104365 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
104366104366 try ops[0].toSlicePtr(cg);
104367 const dst_ty = ty_pl.ty.toType();
104367 const dst_ty = ty_pl.ty;
104368104368 zero_offset: {
104369104369 const elem_size = dst_ty.childType(zcu).abiSize(zcu);
104370104370 if (hack_around_sema_opv_bugs and elem_size == 0) break :zero_offset;
......@@ -104420,7 +104420,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104420104420 const ty_op = air_datas[@backingInt(inst)].ty_op;
104421104421 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
104422104422 var res: [1]Temp = undefined;
104423 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
104423 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
104424104424 .required_features = .{ .f16c, null, null, null },
104425104425 .src_constraints = .{ .{ .float = .word }, .any, .any },
104426104426 .dst_constraints = .{ .{ .int = .dword }, .any },
......@@ -115175,7 +115175,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
115175115175 } }) catch |err| switch (err) {
115176115176 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
115177115177 @tagName(air_tag),
115178 ty_op.ty.toType().fmt(pt),
115178 ty_op.ty.fmt(pt),
115179115179 cg.typeOf(ty_op.operand).fmt(pt),
115180115180 ops[0].tracking(cg),
115181115181 }),
......@@ -115189,7 +115189,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
115189115189 const ty_op = air_datas[@backingInt(inst)].ty_op;
115190115190 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
115191115191 var res: [1]Temp = undefined;
115192 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
115192 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
115193115193 .required_features = .{ .f16c, null, null, null },
115194115194 .src_constraints = .{ .{ .signed_int = .byte }, .any, .any },
115195115195 .dst_constraints = .{ .{ .float = .word }, .any },
......@@ -127066,7 +127066,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
127066127066 } }) catch |err| switch (err) {
127067127067 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
127068127068 @tagName(air_tag),
127069 ty_op.ty.toType().fmt(pt),
127069 ty_op.ty.fmt(pt),
127070127070 cg.typeOf(ty_op.operand).fmt(pt),
127071127071 ops[0].tracking(cg),
127072127072 }),
......@@ -168982,7 +168982,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
168982168982 const ty_op = air_datas[@backingInt(inst)].ty_op;
168983168983 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
168984168984 var res: [1]Temp = undefined;
168985 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{
168985 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
168986168986 .dst_constraints = .{ .{ .bool_vec = .qword }, .any },
168987168987 .src_constraints = .{ .bool, .any, .any },
168988168988 .patterns = &.{
......@@ -170811,7 +170811,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
170811170811 } }) catch |err| switch (err) {
170812170812 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
170813170813 @tagName(air_tag),
170814 ty_op.ty.toType().fmt(pt),
170814 ty_op.ty.fmt(pt),
170815170815 ops[0].tracking(cg),
170816170816 }),
170817170817 else => |e| return e,
......@@ -171333,7 +171333,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
171333171333 },
171334171334 .error_set_has_value => |air_tag| {
171335171335 const ty_op = air_datas[@backingInt(inst)].ty_op;
171336 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}) ++ .{try cg.tempInit(ty_op.ty.toType(), .none)};
171336 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}) ++ .{try cg.tempInit(ty_op.ty, .none)};
171337171337 var res: [1]Temp = undefined;
171338171338 cg.select(&res, &.{.bool}, &ops, comptime &.{ .{
171339171339 .required_features = .{ .avx, null, null, null },
......@@ -171415,7 +171415,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
171415171415 } }) catch |err| switch (err) {
171416171416 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
171417171417 @tagName(air_tag),
171418 ty_op.ty.toType().fmt(pt),
171418 ty_op.ty.fmt(pt),
171419171419 ops[0].tracking(cg),
171420171420 }),
171421171421 else => |e| return e,
......@@ -171425,7 +171425,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
171425171425 },
171426171426 .aggregate_init => |air_tag| fallback: {
171427171427 const ty_pl = air_datas[@backingInt(inst)].ty_pl;
171428 const agg_ty = ty_pl.ty.toType();
171428 const agg_ty = ty_pl.ty;
171429171429 if (agg_ty.isVector(zcu) and agg_ty.childType(zcu).toIntern() == .bool_type) {
171430171430 break :fallback try cg.airAggregateInitBoolVec(inst);
171431171431 }
......@@ -171496,7 +171496,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
171496171496 .union_init => {
171497171497 const ty_pl = air_datas[@backingInt(inst)].ty_pl;
171498171498 const union_init = cg.air.extraData(Air.UnionInit, ty_pl.payload).data;
171499 const union_ty = ty_pl.ty.toType();
171499 const union_ty = ty_pl.ty;
171500171500 var ops = try cg.tempsFromOperands(inst, .{union_init.init});
171501171501 var res = try cg.tempAllocMem(union_ty);
171502171502 const union_layout = union_ty.unionGetLayout(zcu);
......@@ -172948,7 +172948,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
172948172948 const field_parent_ptr = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
172949172949 var ops = try cg.tempsFromOperands(inst, .{field_parent_ptr.field_ptr});
172950172950 try ops[0].toOffset(-@as(i32, @intCast(codegen.fieldOffset(
172951 ty_pl.ty.toType(),
172951 ty_pl.ty,
172952172952 cg.typeOf(field_parent_ptr.field_ptr),
172953172953 field_parent_ptr.field_index,
172954172954 zcu,
......@@ -173071,7 +173071,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
173071173071 },
173072173072 .save_err_return_trace_index => {
173073173073 const ty_pl = air_datas[@backingInt(inst)].ty_pl;
173074 const agg_ty = ty_pl.ty.toType();
173074 const agg_ty = ty_pl.ty;
173075173075 assert(agg_ty.containerLayout(zcu) != .@"packed");
173076173076 var ert: Temp = .{ .index = err_ret_trace_index };
173077173077 var res = try ert.load(.usize, .{ .disp = @intCast(agg_ty.structFieldOffset(ty_pl.payload, zcu)) }, cg);
......@@ -173115,7 +173115,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
173115173115 else => unreachable,
173116173116 };
173117173117
173118 var res = try cg.tempInit(.fromInterned(ty_nav.ty), .{ .lea_nav = ty_nav.nav });
173118 var res = try cg.tempInit(ty_nav.ty, .{ .lea_nav = ty_nav.nav });
173119173119 if (is_threadlocal) while (try res.toRegClass(true, .general_purpose, cg)) {};
173120173120 try res.finish(inst, &.{}, &.{}, cg);
173121173121 },