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 {...@@ -1297,15 +1297,15 @@ pub const Inst = struct {
1297 },1297 },
1298 ty: Type,1298 ty: Type,
1299 arg: struct {1299 arg: struct {
1300 ty: Ref,1300 ty: Type,
1301 zir_param_index: u32,1301 zir_param_index: u32,
1302 },1302 },
1303 ty_op: struct {1303 ty_op: struct {
1304 ty: Ref,1304 ty: Type,
1305 operand: Ref,1305 operand: Ref,
1306 },1306 },
1307 ty_pl: struct {1307 ty_pl: struct {
1308 ty: Ref,1308 ty: Type,
1309 // Index into a different array.1309 // Index into a different array.
1310 payload: u32,1310 payload: u32,
1311 },1311 },
...@@ -1339,7 +1339,7 @@ pub const Inst = struct {...@@ -1339,7 +1339,7 @@ pub const Inst = struct {
1339 operation: std.lang.ReduceOp,1339 operation: std.lang.ReduceOp,
1340 },1340 },
1341 ty_nav: struct {1341 ty_nav: struct {
1342 ty: InternPool.Index,1342 ty: Type,
1343 nav: InternPool.Nav.Index,1343 nav: InternPool.Nav.Index,
1344 },1344 },
1345 legalize_compiler_rt_call: struct {1345 legalize_compiler_rt_call: struct {
...@@ -1700,7 +1700,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)...@@ -1700,7 +1700,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
1700 .c_va_start,1700 .c_va_start,
1701 => return datas[@backingInt(inst)].ty,1701 => return datas[@backingInt(inst)].ty,
17021702
1703 .arg => return datas[@backingInt(inst)].arg.ty.toType(),1703 .arg => return datas[@backingInt(inst)].arg.ty,
17041704
1705 .assembly,1705 .assembly,
1706 .block,1706 .block,
...@@ -1727,7 +1727,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)...@@ -1727,7 +1727,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
1727 .try_ptr_cold,1727 .try_ptr_cold,
1728 .shuffle_one,1728 .shuffle_one,
1729 .shuffle_two,1729 .shuffle_two,
1730 => return datas[@backingInt(inst)].ty_pl.ty.toType(),1730 => return datas[@backingInt(inst)].ty_pl.ty,
17311731
1732 .not,1732 .not,
1733 .bit_cast,1733 .bit_cast,
...@@ -1781,7 +1781,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)...@@ -1781,7 +1781,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
1781 .c_va_arg,1781 .c_va_arg,
1782 .c_va_copy,1782 .c_va_copy,
1783 .abs,1783 .abs,
1784 => return datas[@backingInt(inst)].ty_op.ty.toType(),1784 => return datas[@backingInt(inst)].ty_op.ty,
17851785
1786 .loop,1786 .loop,
1787 .repeat,1787 .repeat,
...@@ -1865,7 +1865,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)...@@ -1865,7 +1865,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
1865 return .fromInterned(ip.indexToKey(err_union_ty.ip_index).error_union_type.payload_type);1865 return .fromInterned(ip.indexToKey(err_union_ty.ip_index).error_union_type.payload_type);
1866 },1866 },
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
1870 .work_item_id,1870 .work_item_id,
1871 .work_group_size,1871 .work_group_size,
...@@ -2268,7 +2268,7 @@ pub fn unwrapDbgBlock(air: *const Air, inst_index: Inst.Index) UnwrappedDbgInlin...@@ -2268,7 +2268,7 @@ pub fn unwrapDbgBlock(air: *const Air, inst_index: Inst.Index) UnwrappedDbgInlin
2268 const extra = air.extraData(Air.DbgInlineBlock, payload);2268 const extra = air.extraData(Air.DbgInlineBlock, payload);
2269 return .{2269 return .{
2270 .func = extra.data.func,2270 .func = extra.data.func,
2271 .ty = data.ty_pl.ty.toType(),2271 .ty = data.ty_pl.ty,
2272 .body = @ptrCast(air.extra.items[extra.end..][0..extra.data.body_len]),2272 .body = @ptrCast(air.extra.items[extra.end..][0..extra.data.body_len]),
2273 };2273 };
2274}2274}
...@@ -2287,7 +2287,7 @@ pub fn unwrapBlock(air: *const Air, inst_index: Inst.Index) UnwrappedBlock {...@@ -2287,7 +2287,7 @@ pub fn unwrapBlock(air: *const Air, inst_index: Inst.Index) UnwrappedBlock {
2287 };2287 };
2288 const extra = air.extraData(Air.Block, payload);2288 const extra = air.extraData(Air.Block, payload);
2289 return .{2289 return .{
2290 .ty = data.ty_pl.ty.toType(),2290 .ty = data.ty_pl.ty,
2291 .body = @ptrCast(air.extra.items[extra.end..][0..extra.data.body_len]),2291 .body = @ptrCast(air.extra.items[extra.end..][0..extra.data.body_len]),
2292 };2292 };
2293}2293}
...@@ -2367,7 +2367,7 @@ pub fn unwrapTry(air: *const Air, inst_index: Inst.Index) UnwrappedTry {...@@ -2367,7 +2367,7 @@ pub fn unwrapTry(air: *const Air, inst_index: Inst.Index) UnwrappedTry {
2367}2367}
23682368
2369pub const UnwrappedTryPtr = struct {2369pub const UnwrappedTryPtr = struct {
2370 error_union_payload_ptr_ty: Inst.Ref,2370 error_union_payload_ptr_ty: Type,
2371 error_union_ptr: Inst.Ref,2371 error_union_ptr: Inst.Ref,
2372 else_body: []const Inst.Index,2372 else_body: []const Inst.Index,
2373};2373};
...@@ -2482,7 +2482,7 @@ pub fn unwrapShuffleOne(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index...@@ -2482,7 +2482,7 @@ pub fn unwrapShuffleOne(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index
2482 .shuffle_one => {},2482 .shuffle_one => {},
2483 else => unreachable, // assertion failure2483 else => unreachable, // assertion failure
2484 }2484 }
2485 const result_ty: Type = .fromInterned(inst.data.ty_pl.ty.toInterned().?);2485 const result_ty: Type = inst.data.ty_pl.ty;
2486 const mask_len: u32 = result_ty.vectorLen(zcu);2486 const mask_len: u32 = result_ty.vectorLen(zcu);
2487 const extra_idx = inst.data.ty_pl.payload;2487 const extra_idx = inst.data.ty_pl.payload;
2488 return .{2488 return .{
...@@ -2505,7 +2505,7 @@ pub fn unwrapShuffleTwo(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index...@@ -2505,7 +2505,7 @@ pub fn unwrapShuffleTwo(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index
2505 .shuffle_two => {},2505 .shuffle_two => {},
2506 else => unreachable, // assertion failure2506 else => unreachable, // assertion failure
2507 }2507 }
2508 const result_ty: Type = .fromInterned(inst.data.ty_pl.ty.toInterned().?);2508 const result_ty: Type = inst.data.ty_pl.ty;
2509 const mask_len: u32 = result_ty.vectorLen(zcu);2509 const mask_len: u32 = result_ty.vectorLen(zcu);
2510 const extra_idx = inst.data.ty_pl.payload;2510 const extra_idx = inst.data.ty_pl.payload;
2511 return .{2511 return .{
src/Air/Legalize.zig+77-77
...@@ -470,7 +470,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {...@@ -470,7 +470,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
470 .shl_with_overflow,470 .shl_with_overflow,
471 => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) {471 => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) {
472 const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl;472 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)) {
474 continue :inst l.replaceInst(inst, .block, try l.scalarizeOverflowBlockPayload(inst));474 continue :inst l.replaceInst(inst, .block, try l.scalarizeOverflowBlockPayload(inst));
475 }475 }
476 },476 },
...@@ -527,27 +527,27 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {...@@ -527,27 +527,27 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
527 .trunc,527 .trunc,
528 => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) {528 => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) {
529 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;529 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)) {
531 continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op));531 continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op));
532 }532 }
533 },533 },
534 .abs => {534 .abs => {
535 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;535 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)) {
537 .none => {},537 .none => {},
538 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)),538 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)),
539 .soft_float => continue :inst try l.compilerRtCall(539 .soft_float => continue :inst try l.compilerRtCall(
540 inst,540 inst,
541 softFloatFunc(.abs, ty_op.ty.toType(), zcu),541 softFloatFunc(.abs, ty_op.ty, zcu),
542 &.{ty_op.operand},542 &.{ty_op.operand},
543 ty_op.ty.toType(),543 ty_op.ty,
544 ),544 ),
545 }545 }
546 },546 },
547 .fptrunc => {547 .fptrunc => {
548 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;548 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;
549 const src_ty = l.typeOf(ty_op.operand);549 const src_ty = l.typeOf(ty_op.operand);
550 const dest_ty = ty_op.ty.toType();550 const dest_ty = ty_op.ty;
551 if (src_ty.zigTypeTag(zcu) == .vector) {551 if (src_ty.zigTypeTag(zcu) == .vector) {
552 if (l.features.has(.scalarize_fptrunc) or552 if (l.features.has(.scalarize_fptrunc) or
553 l.wantSoftFloatScalar(src_ty.childType(zcu)) or553 l.wantSoftFloatScalar(src_ty.childType(zcu)) or
...@@ -562,7 +562,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {...@@ -562,7 +562,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
562 .fpext => {562 .fpext => {
563 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;563 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;
564 const src_ty = l.typeOf(ty_op.operand);564 const src_ty = l.typeOf(ty_op.operand);
565 const dest_ty = ty_op.ty.toType();565 const dest_ty = ty_op.ty;
566 if (src_ty.zigTypeTag(zcu) == .vector) {566 if (src_ty.zigTypeTag(zcu) == .vector) {
567 if (l.features.has(.scalarize_fpext) or567 if (l.features.has(.scalarize_fpext) or
568 l.wantSoftFloatScalar(src_ty.childType(zcu)) or568 l.wantSoftFloatScalar(src_ty.childType(zcu)) or
...@@ -580,14 +580,14 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {...@@ -580,14 +580,14 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
580 .none => {},580 .none => {},
581 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)),581 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)),
582 .soft_float => switch (try l.softIntFromFloat(inst)) {582 .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),
584 .block_payload => |data| continue :inst l.replaceInst(inst, .block, data),584 .block_payload => |data| continue :inst l.replaceInst(inst, .block, data),
585 },585 },
586 }586 }
587 },587 },
588 .float_from_int => {588 .float_from_int => {
589 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;589 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;
591 switch (l.wantScalarizeOrSoftFloat(.float_from_int, dest_ty)) {591 switch (l.wantScalarizeOrSoftFloat(.float_from_int, dest_ty)) {
592 .none => {},592 .none => {},
593 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)),593 .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 {...@@ -630,7 +630,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
630 continue :inst l.replaceInst(inst, .int_cast, .{ .ty_op = ty_op });630 continue :inst l.replaceInst(inst, .int_cast, .{ .ty_op = ty_op });
631 } else if (l.features.has(.scalarize_int_cast_safe)) {631 } else if (l.features.has(.scalarize_int_cast_safe)) {
632 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;632 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)) {
634 continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op));634 continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op));
635 }635 }
636 },636 },
...@@ -875,7 +875,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {...@@ -875,7 +875,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
875 switch (vector_ty.vectorLen(zcu)) {875 switch (vector_ty.vectorLen(zcu)) {
876 0 => unreachable,876 0 => unreachable,
877 1 => continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{877 1 => continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{
878 .ty = .fromType(vector_ty.childType(zcu)),878 .ty = vector_ty.childType(zcu),
879 .operand = reduce.operand,879 .operand = reduce.operand,
880 } }),880 } }),
881 else => {},881 else => {},
...@@ -893,7 +893,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {...@@ -893,7 +893,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
893 },893 },
894 .splat => if (l.features.has(.splat_one_elem_to_bit_cast)) {894 .splat => if (l.features.has(.splat_one_elem_to_bit_cast)) {
895 const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op;895 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)) {
897 0 => unreachable,897 0 => unreachable,
898 1 => continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{898 1 => continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{
899 .ty = ty_op.ty,899 .ty = ty_op.ty,
...@@ -904,7 +904,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {...@@ -904,7 +904,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
904 },904 },
905 .shuffle_one => {905 .shuffle_one => {
906 const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl;906 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)) {
908 .none => {},908 .none => {},
909 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleOneBlockPayload(inst)),909 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleOneBlockPayload(inst)),
910 .soft_float => unreachable, // the operand is not a scalar910 .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 {...@@ -912,7 +912,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
912 },912 },
913 .shuffle_two => {913 .shuffle_two => {
914 const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl;914 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)) {
916 .none => {},916 .none => {},
917 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleTwoBlockPayload(inst)),917 .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleTwoBlockPayload(inst)),
918 .soft_float => unreachable, // the operand is not a scalar918 .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 {...@@ -946,7 +946,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
946 => {},946 => {},
947 .aggregate_init => if (l.features.has(.expand_packed_aggregate_init)) {947 .aggregate_init => if (l.features.has(.expand_packed_aggregate_init)) {
948 const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl;948 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;
950 switch (agg_ty.zigTypeTag(zcu)) {950 switch (agg_ty.zigTypeTag(zcu)) {
951 else => {},951 else => {},
952 .@"union" => unreachable,952 .@"union" => unreachable,
...@@ -962,7 +962,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {...@@ -962,7 +962,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void {
962 if (field_bits == struct_bits) {962 if (field_bits == struct_bits) {
963 // Just bitcast this field.963 // Just bitcast this field.
964 continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{964 continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{
965 .ty = .fromType(agg_ty),965 .ty = agg_ty,
966 .operand = @fromBackingInt(@intCast(l.air_extra.items[ty_pl.payload + field_index])),966 .operand = @fromBackingInt(@intCast(l.air_extra.items[ty_pl.payload + field_index])),
967 } });967 } });
968 }968 }
...@@ -1152,7 +1152,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz...@@ -1152,7 +1152,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz
1152 const elem_block_inst = loop.block.add(l, .{1152 const elem_block_inst = loop.block.add(l, .{
1153 .tag = .block,1153 .tag = .block,
1154 .data = .{ .ty_pl = .{1154 .data = .{ .ty_pl = .{
1155 .ty = .fromType(res_elem_ty),1155 .ty = res_elem_ty,
1156 .payload = undefined,1156 .payload = undefined,
1157 } },1157 } },
1158 });1158 });
...@@ -1182,7 +1182,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz...@@ -1182,7 +1182,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz
1182 const elem_ptr = loop.block.add(l, .{1182 const elem_ptr = loop.block.add(l, .{
1183 .tag = .ptr_elem_ptr,1183 .tag = .ptr_elem_ptr,
1184 .data = .{ .ty_pl = .{1184 .data = .{ .ty_pl = .{
1185 .ty = .fromType(try pt.singleMutPtrType(res_elem_ty)),1185 .ty = try pt.singleMutPtrType(res_elem_ty),
1186 .payload = try l.addExtra(Air.Bin, .{1186 .payload = try l.addExtra(Air.Bin, .{
1187 .lhs = result_ptr,1187 .lhs = result_ptr,
1188 .rhs = index_val,1188 .rhs = index_val,
...@@ -1223,7 +1223,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz...@@ -1223,7 +1223,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz
1223 try loop.finish(l);1223 try loop.finish(l);
12241224
1225 return .{ .ty_pl = .{1225 return .{ .ty_pl = .{
1226 .ty = .fromType(res_ty),1226 .ty = res_ty,
1227 .payload = try l.addBlockBody(main_block.body()),1227 .payload = try l.addBlockBody(main_block.body()),
1228 } };1228 } };
1229}1229}
...@@ -1303,7 +1303,7 @@ fn scalarizeShuffleOneBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro...@@ -1303,7 +1303,7 @@ fn scalarizeShuffleOneBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro
1303 main_block.addBr(l, orig_inst, result_val);1303 main_block.addBr(l, orig_inst, result_val);
13041304
1305 return .{ .ty_pl = .{1305 return .{ .ty_pl = .{
1306 .ty = .fromType(shuffle.result_ty),1306 .ty = shuffle.result_ty,
1307 .payload = try l.addBlockBody(main_block.body()),1307 .payload = try l.addBlockBody(main_block.body()),
1308 } };1308 } };
1309}1309}
...@@ -1409,7 +1409,7 @@ fn scalarizeShuffleTwoBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro...@@ -1409,7 +1409,7 @@ fn scalarizeShuffleTwoBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro
1409 main_block.addBr(l, orig_inst, result_val);1409 main_block.addBr(l, orig_inst, result_val);
14101410
1411 return .{ .ty_pl = .{1411 return .{ .ty_pl = .{
1412 .ty = .fromType(shuffle.result_ty),1412 .ty = shuffle.result_ty,
1413 .payload = try l.addBlockBody(main_block.body()),1413 .payload = try l.addBlockBody(main_block.body()),
1414 } };1414 } };
1415}1415}
...@@ -1478,7 +1478,7 @@ fn addScalarizedShuffle(...@@ -1478,7 +1478,7 @@ fn addScalarizedShuffle(
1478 const main_block_inst = parent_block.add(l, .{1478 const main_block_inst = parent_block.add(l, .{
1479 .tag = .block,1479 .tag = .block,
1480 .data = .{ .ty_pl = .{1480 .data = .{ .ty_pl = .{
1481 .ty = .void_type,1481 .ty = .void,
1482 .payload = undefined,1482 .payload = undefined,
1483 } },1483 } },
1484 });1484 });
...@@ -1532,7 +1532,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?...@@ -1532,7 +1532,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
15321532
1533 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;1533 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;
1536 const operand_ty = l.typeOf(ty_op.operand);1536 const operand_ty = l.typeOf(ty_op.operand);
15371537
1538 // We exit this block only if the scalarization is actually necessary. Otherwise we will return1538 // 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!?...@@ -1677,7 +1677,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
1677 const uint_block_inst = main_block.add(l, .{1677 const uint_block_inst = main_block.add(l, .{
1678 .tag = .block,1678 .tag = .block,
1679 .data = .{ .ty_pl = .{1679 .data = .{ .ty_pl = .{
1680 .ty = .fromType(uint_ty),1680 .ty = uint_ty,
1681 .payload = undefined,1681 .payload = undefined,
1682 } },1682 } },
1683 });1683 });
...@@ -1746,7 +1746,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?...@@ -1746,7 +1746,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
1746 .bit_cast_safe => main_block.add(l, .{1746 .bit_cast_safe => main_block.add(l, .{
1747 .tag = .bit_cast_safe,1747 .tag = .bit_cast_safe,
1748 .data = .{ .ty_op = .{1748 .data = .{ .ty_op = .{
1749 .ty = .fromType(dest_ty),1749 .ty = dest_ty,
1750 .operand = uint_val,1750 .operand = uint_val,
1751 } },1751 } },
1752 }).toRef(),1752 }).toRef(),
...@@ -1761,7 +1761,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?...@@ -1761,7 +1761,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
1761 const result = main_block.add(l, .{1761 const result = main_block.add(l, .{
1762 .tag = .aggregate_init,1762 .tag = .aggregate_init,
1763 .data = .{ .ty_pl = .{1763 .data = .{ .ty_pl = .{
1764 .ty = .fromType(dest_ty),1764 .ty = dest_ty,
1765 .payload = @intCast(aggregate_init_payload_start),1765 .payload = @intCast(aggregate_init_payload_start),
1766 } },1766 } },
1767 }).toRef();1767 }).toRef();
...@@ -1814,7 +1814,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?...@@ -1814,7 +1814,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
1814 const elem_ptr = loop.block.add(l, .{1814 const elem_ptr = loop.block.add(l, .{
1815 .tag = .ptr_elem_ptr,1815 .tag = .ptr_elem_ptr,
1816 .data = .{ .ty_pl = .{1816 .data = .{ .ty_pl = .{
1817 .ty = .fromType(try pt.singleMutPtrType(elem_ty)),1817 .ty = try pt.singleMutPtrType(elem_ty),
1818 .payload = try l.addExtra(Air.Bin, .{1818 .payload = try l.addExtra(Air.Bin, .{
1819 .lhs = result_ptr,1819 .lhs = result_ptr,
1820 .rhs = index_val,1820 .rhs = index_val,
...@@ -1860,7 +1860,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?...@@ -1860,7 +1860,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?
1860 }1860 }
18611861
1862 return .{ .ty_pl = .{1862 return .{ .ty_pl = .{
1863 .ty = .fromType(dest_ty),1863 .ty = dest_ty,
1864 .payload = try l.addBlockBody(main_block.body()),1864 .payload = try l.addBlockBody(main_block.body()),
1865 } };1865 } };
1866}1866}
...@@ -1942,14 +1942,14 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!...@@ -1942,14 +1942,14 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!
1942 const elem_result = loop.block.add(l, .{1942 const elem_result = loop.block.add(l, .{
1943 .tag = orig.tag,1943 .tag = orig.tag,
1944 .data = .{ .ty_pl = .{1944 .data = .{ .ty_pl = .{
1945 .ty = .fromType(scalar_tuple_ty),1945 .ty = scalar_tuple_ty,
1946 .payload = try l.addExtra(Air.Bin, .{ .lhs = lhs, .rhs = rhs }),1946 .payload = try l.addExtra(Air.Bin, .{ .lhs = lhs, .rhs = rhs }),
1947 } },1947 } },
1948 }).toRef();1948 }).toRef();
1949 const int_elem = loop.block.add(l, .{1949 const int_elem = loop.block.add(l, .{
1950 .tag = .agg_field_val,1950 .tag = .agg_field_val,
1951 .data = .{ .ty_pl = .{1951 .data = .{ .ty_pl = .{
1952 .ty = .fromType(scalar_int_ty),1952 .ty = scalar_int_ty,
1953 .payload = try l.addExtra(Air.StructField, .{1953 .payload = try l.addExtra(Air.StructField, .{
1954 .struct_operand = elem_result,1954 .struct_operand = elem_result,
1955 .field_index = 0,1955 .field_index = 0,
...@@ -1959,7 +1959,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!...@@ -1959,7 +1959,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!
1959 const overflow_elem = loop.block.add(l, .{1959 const overflow_elem = loop.block.add(l, .{
1960 .tag = .agg_field_val,1960 .tag = .agg_field_val,
1961 .data = .{ .ty_pl = .{1961 .data = .{ .ty_pl = .{
1962 .ty = .u1_type,1962 .ty = .u1,
1963 .payload = try l.addExtra(Air.StructField, .{1963 .payload = try l.addExtra(Air.StructField, .{
1964 .struct_operand = elem_result,1964 .struct_operand = elem_result,
1965 .field_index = 1,1965 .field_index = 1,
...@@ -2006,7 +2006,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!...@@ -2006,7 +2006,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!
2006 try loop.finish(l);2006 try loop.finish(l);
20072007
2008 return .{ .ty_pl = .{2008 return .{ .ty_pl = .{
2009 .ty = .fromType(vec_tuple_ty),2009 .ty = vec_tuple_ty,
2010 .payload = try l.addBlockBody(main_block.body()),2010 .payload = try l.addBlockBody(main_block.body()),
2011 } };2011 } };
2012}2012}
...@@ -2133,7 +2133,7 @@ fn scalarizeReduceBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimize...@@ -2133,7 +2133,7 @@ fn scalarizeReduceBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimize
2133 try loop.finish(l);2133 try loop.finish(l);
21342134
2135 return .{ .ty_pl = .{2135 return .{ .ty_pl = .{
2136 .ty = .fromType(scalar_ty),2136 .ty = scalar_ty,
2137 .payload = try l.addBlockBody(main_block.body()),2137 .payload = try l.addBlockBody(main_block.body()),
2138 } };2138 } };
2139}2139}
...@@ -2144,7 +2144,7 @@ fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I...@@ -2144,7 +2144,7 @@ fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
2144 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;2144 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;
21452145
2146 const operand_ref = ty_op.operand;2146 const operand_ref = ty_op.operand;
2147 const dest_ty = ty_op.ty.toType();2147 const dest_ty = ty_op.ty;
21482148
2149 if (dest_ty.zigTypeTag(zcu) != .@"enum" or2149 if (dest_ty.zigTypeTag(zcu) != .@"enum" or
2150 dest_ty.isNonexhaustiveEnum(zcu) or2150 dest_ty.isNonexhaustiveEnum(zcu) or
...@@ -2188,7 +2188,7 @@ fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I...@@ -2188,7 +2188,7 @@ fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
2188 try condbr.finish(l);2188 try condbr.finish(l);
21892189
2190 return .{ .ty_pl = .{2190 return .{ .ty_pl = .{
2191 .ty = .fromType(dest_ty),2191 .ty = dest_ty,
2192 .payload = try l.addBlockBody(block.body()),2192 .payload = try l.addBlockBody(block.body()),
2193 } };2193 } };
2194}2194}
...@@ -2200,7 +2200,7 @@ fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I...@@ -2200,7 +2200,7 @@ fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
22002200
2201 const operand_ref = ty_op.operand;2201 const operand_ref = ty_op.operand;
2202 const operand_ty = l.typeOf(operand_ref);2202 const operand_ty = l.typeOf(operand_ref);
2203 const dest_ty = ty_op.ty.toType();2203 const dest_ty = ty_op.ty;
22042204
2205 const is_vector = operand_ty.zigTypeTag(zcu) == .vector;2205 const is_vector = operand_ty.zigTypeTag(zcu) == .vector;
2206 const operand_scalar_ty = operand_ty.scalarType(zcu);2206 const operand_scalar_ty = operand_ty.scalarType(zcu);
...@@ -2324,7 +2324,7 @@ fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I...@@ -2324,7 +2324,7 @@ fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
2324 const cast_inst = cur_block.add(l, .{2324 const cast_inst = cur_block.add(l, .{
2325 .tag = .int_cast,2325 .tag = .int_cast,
2326 .data = .{ .ty_op = .{2326 .data = .{ .ty_op = .{
2327 .ty = Air.internedToRef(dest_ty.toIntern()),2327 .ty = dest_ty,
2328 .operand = operand_ref,2328 .operand = operand_ref,
2329 } },2329 } },
2330 });2330 });
...@@ -2359,7 +2359,7 @@ fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I...@@ -2359,7 +2359,7 @@ fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I
2359 assert(condbr_idx != 0); // should have already returned `null`2359 assert(condbr_idx != 0); // should have already returned `null`
2360 for (condbr_buf[0..condbr_idx]) |*condbr| try condbr.finish(l);2360 for (condbr_buf[0..condbr_idx]) |*condbr| try condbr.finish(l);
2361 return .{ .ty_pl = .{2361 return .{ .ty_pl = .{
2362 .ty = Air.internedToRef(dest_ty.toIntern()),2362 .ty = dest_ty,
2363 .payload = try l.addBlockBody(main_block.body()),2363 .payload = try l.addBlockBody(main_block.body()),
2364 } };2364 } };
2365}2365}
...@@ -2371,7 +2371,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz...@@ -2371,7 +2371,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz
23712371
2372 const operand_ref = ty_op.operand;2372 const operand_ref = ty_op.operand;
2373 const operand_ty = l.typeOf(operand_ref);2373 const operand_ty = l.typeOf(operand_ref);
2374 const dest_ty = ty_op.ty.toType();2374 const dest_ty = ty_op.ty;
23752375
2376 const is_vector = operand_ty.zigTypeTag(zcu) == .vector;2376 const is_vector = operand_ty.zigTypeTag(zcu) == .vector;
2377 const dest_scalar_ty = dest_ty.scalarType(zcu);2377 const dest_scalar_ty = dest_ty.scalarType(zcu);
...@@ -2453,7 +2453,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz...@@ -2453,7 +2453,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz
2453 const cast_inst = condbr.else_block.add(l, .{2453 const cast_inst = condbr.else_block.add(l, .{
2454 .tag = if (optimized) .int_from_float_optimized else .int_from_float,2454 .tag = if (optimized) .int_from_float_optimized else .int_from_float,
2455 .data = .{ .ty_op = .{2455 .data = .{ .ty_op = .{
2456 .ty = Air.internedToRef(dest_ty.toIntern()),2456 .ty = dest_ty,
2457 .operand = operand_ref,2457 .operand = operand_ref,
2458 } },2458 } },
2459 });2459 });
...@@ -2468,7 +2468,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz...@@ -2468,7 +2468,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz
2468 try condbr.finish(l);2468 try condbr.finish(l);
24692469
2470 return .{ .ty_pl = .{2470 return .{ .ty_pl = .{
2471 .ty = Air.internedToRef(dest_ty.toIntern()),2471 .ty = dest_ty,
2472 .payload = try l.addBlockBody(main_block.body()),2472 .payload = try l.addBlockBody(main_block.body()),
2473 } };2473 } };
2474}2474}
...@@ -2505,7 +2505,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_...@@ -2505,7 +2505,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
2505 const overflow_op_inst = main_block.add(l, .{2505 const overflow_op_inst = main_block.add(l, .{
2506 .tag = overflow_op_tag,2506 .tag = overflow_op_tag,
2507 .data = .{ .ty_pl = .{2507 .data = .{ .ty_pl = .{
2508 .ty = Air.internedToRef(overflow_tuple_ty.toIntern()),2508 .ty = overflow_tuple_ty,
2509 .payload = try l.addExtra(Air.Bin, .{2509 .payload = try l.addExtra(Air.Bin, .{
2510 .lhs = bin_op.lhs,2510 .lhs = bin_op.lhs,
2511 .rhs = bin_op.rhs,2511 .rhs = bin_op.rhs,
...@@ -2515,7 +2515,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_...@@ -2515,7 +2515,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
2515 const overflow_bits_inst = main_block.add(l, .{2515 const overflow_bits_inst = main_block.add(l, .{
2516 .tag = .agg_field_val,2516 .tag = .agg_field_val,
2517 .data = .{ .ty_pl = .{2517 .data = .{ .ty_pl = .{
2518 .ty = Air.internedToRef(overflow_bits_ty.toIntern()),2518 .ty = overflow_bits_ty,
2519 .payload = try l.addExtra(Air.StructField, .{2519 .payload = try l.addExtra(Air.StructField, .{
2520 .struct_operand = overflow_op_inst.toRef(),2520 .struct_operand = overflow_op_inst.toRef(),
2521 .field_index = 1,2521 .field_index = 1,
...@@ -2539,7 +2539,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_...@@ -2539,7 +2539,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
2539 const result_inst = condbr.else_block.add(l, .{2539 const result_inst = condbr.else_block.add(l, .{
2540 .tag = .agg_field_val,2540 .tag = .agg_field_val,
2541 .data = .{ .ty_pl = .{2541 .data = .{ .ty_pl = .{
2542 .ty = Air.internedToRef(operand_ty.toIntern()),2542 .ty = operand_ty,
2543 .payload = try l.addExtra(Air.StructField, .{2543 .payload = try l.addExtra(Air.StructField, .{
2544 .struct_operand = overflow_op_inst.toRef(),2544 .struct_operand = overflow_op_inst.toRef(),
2545 .field_index = 0,2545 .field_index = 0,
...@@ -2558,7 +2558,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_...@@ -2558,7 +2558,7 @@ fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_
25582558
2559 try condbr.finish(l);2559 try condbr.finish(l);
2560 return .{ .ty_pl = .{2560 return .{ .ty_pl = .{
2561 .ty = Air.internedToRef(operand_ty.toIntern()),2561 .ty = operand_ty,
2562 .payload = try l.addBlockBody(main_block.body()),2562 .payload = try l.addBlockBody(main_block.body()),
2563 } };2563 } };
2564}2564}
...@@ -2608,7 +2608,7 @@ fn divCeilBlockPayload(...@@ -2608,7 +2608,7 @@ fn divCeilBlockPayload(
26082608
2609 _ = main_block.stealRemainingCapacity();2609 _ = main_block.stealRemainingCapacity();
2610 return .{ .ty_pl = .{2610 return .{ .ty_pl = .{
2611 .ty = .fromType(operand_ty),2611 .ty = operand_ty,
2612 .payload = try l.addBlockBody(main_block.body()),2612 .payload = try l.addBlockBody(main_block.body()),
2613 } };2613 } };
2614 },2614 },
...@@ -2707,7 +2707,7 @@ fn divCeilBlockPayload(...@@ -2707,7 +2707,7 @@ fn divCeilBlockPayload(
27072707
2708 _ = main_block.stealRemainingCapacity();2708 _ = main_block.stealRemainingCapacity();
2709 return .{ .ty_pl = .{2709 return .{ .ty_pl = .{
2710 .ty = .fromType(operand_ty),2710 .ty = operand_ty,
2711 .payload = try l.addBlockBody(main_block.body()),2711 .payload = try l.addBlockBody(main_block.body()),
2712 } };2712 } };
2713 },2713 },
...@@ -2721,7 +2721,7 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins...@@ -2721,7 +2721,7 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins
2721 const zcu = pt.zcu;2721 const zcu = pt.zcu;
27222722
2723 const orig_ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;2723 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;
2725 const res_int_ty = try pt.intType(.unsigned, @intCast(res_ty.bitSize(zcu)));2725 const res_int_ty = try pt.intType(.unsigned, @intCast(res_ty.bitSize(zcu)));
2726 const ptr_ty = l.typeOf(orig_ty_op.operand);2726 const ptr_ty = l.typeOf(orig_ty_op.operand);
2727 const ptr_info = ptr_ty.ptrInfo(zcu);2727 const ptr_info = ptr_ty.ptrInfo(zcu);
...@@ -2740,14 +2740,14 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins...@@ -2740,14 +2740,14 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins
2740 .operand = res_block.addBitCast(l, res_ty, res_block.add(l, .{2740 .operand = res_block.addBitCast(l, res_ty, res_block.add(l, .{
2741 .tag = .trunc,2741 .tag = .trunc,
2742 .data = .{ .ty_op = .{2742 .data = .{ .ty_op = .{
2743 .ty = Air.internedToRef(res_int_ty.toIntern()),2743 .ty = res_int_ty,
2744 .operand = res_block.add(l, .{2744 .operand = res_block.add(l, .{
2745 .tag = .shr,2745 .tag = .shr,
2746 .data = .{ .bin_op = .{2746 .data = .{ .bin_op = .{
2747 .lhs = res_block.add(l, .{2747 .lhs = res_block.add(l, .{
2748 .tag = .load,2748 .tag = .load,
2749 .data = .{ .ty_op = .{2749 .data = .{ .ty_op = .{
2750 .ty = Air.internedToRef(load_ty.toIntern()),2750 .ty = load_ty,
2751 .operand = res_block.addPtrCast(l, load_ptr_ty: {2751 .operand = res_block.addPtrCast(l, load_ptr_ty: {
2752 var load_ptr_info = ptr_info;2752 var load_ptr_info = ptr_info;
2753 load_ptr_info.child = load_ty.toIntern();2753 load_ptr_info.child = load_ty.toIntern();
...@@ -2768,7 +2768,7 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins...@@ -2768,7 +2768,7 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins
2768 } },2768 } },
2769 });2769 });
2770 return .{ .ty_pl = .{2770 return .{ .ty_pl = .{
2771 .ty = Air.internedToRef(res_ty.toIntern()),2771 .ty = res_ty,
2772 .payload = try l.addBlockBody(res_block.body()),2772 .payload = try l.addBlockBody(res_block.body()),
2773 } };2773 } };
2774}2774}
...@@ -2811,7 +2811,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In...@@ -2811,7 +2811,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In
2811 .lhs = res_block.add(l, .{2811 .lhs = res_block.add(l, .{
2812 .tag = .load,2812 .tag = .load,
2813 .data = .{ .ty_op = .{2813 .data = .{ .ty_op = .{
2814 .ty = Air.internedToRef(load_store_ty.toIntern()),2814 .ty = load_store_ty,
2815 .operand = backing_ptr,2815 .operand = backing_ptr,
2816 } },2816 } },
2817 }).toRef(),2817 }).toRef(),
...@@ -2843,7 +2843,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In...@@ -2843,7 +2843,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In
2843 .lhs = res_block.add(l, .{2843 .lhs = res_block.add(l, .{
2844 .tag = .int_cast,2844 .tag = .int_cast,
2845 .data = .{ .ty_op = .{2845 .data = .{ .ty_op = .{
2846 .ty = Air.internedToRef(load_store_ty.toIntern()),2846 .ty = load_store_ty,
2847 .operand = res_block.addBitCast(l, operand_int_ty, orig_bin_op.rhs),2847 .operand = res_block.addBitCast(l, operand_int_ty, orig_bin_op.rhs),
2848 } },2848 } },
2849 }).toRef(),2849 }).toRef(),
...@@ -2866,7 +2866,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In...@@ -2866,7 +2866,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In
2866 });2866 });
2867 }2867 }
2868 return .{ .ty_pl = .{2868 return .{ .ty_pl = .{
2869 .ty = .void_type,2869 .ty = .void,
2870 .payload = try l.addBlockBody(res_block.body()),2870 .payload = try l.addBlockBody(res_block.body()),
2871 } };2871 } };
2872}2872}
...@@ -2876,7 +2876,7 @@ fn packedStructFieldValBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Err...@@ -2876,7 +2876,7 @@ fn packedStructFieldValBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Err
28762876
2877 const orig_ty_pl = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_pl;2877 const orig_ty_pl = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_pl;
2878 const orig_extra = l.extraData(Air.StructField, orig_ty_pl.payload).data;2878 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;
2880 const agg_ty = l.typeOf(orig_extra.struct_operand);2880 const agg_ty = l.typeOf(orig_extra.struct_operand);
28812881
2882 const agg_bits: u16 = @intCast(agg_ty.bitSize(zcu));2882 const agg_bits: u16 = @intCast(agg_ty.bitSize(zcu));
...@@ -2899,7 +2899,7 @@ fn packedStructFieldValBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Err...@@ -2899,7 +2899,7 @@ fn packedStructFieldValBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Err
2899 main_block.addBr(l, orig_inst, field_val);2899 main_block.addBr(l, orig_inst, field_val);
29002900
2901 return .{ .ty_pl = .{2901 return .{ .ty_pl = .{
2902 .ty = .fromType(field_ty),2902 .ty = field_ty,
2903 .payload = try l.addBlockBody(main_block.body()),2903 .payload = try l.addBlockBody(main_block.body()),
2904 } };2904 } };
2905}2905}
...@@ -2909,7 +2909,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro...@@ -2909,7 +2909,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro
2909 const gpa = zcu.gpa;2909 const gpa = zcu.gpa;
29102910
2911 const orig_ty_pl = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_pl;2911 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;
2913 const agg_field_count = agg_ty.structFieldCount(zcu);2913 const agg_field_count = agg_ty.structFieldCount(zcu);
2914 var opv_field_count: u32 = 0;2914 var opv_field_count: u32 = 0;
2915 for (0..agg_field_count) |field_idx| {2915 for (0..agg_field_count) |field_idx| {
...@@ -2954,7 +2954,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro...@@ -2954,7 +2954,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro
2954 main_block.addBr(l, orig_inst, result);2954 main_block.addBr(l, orig_inst, result);
29552955
2956 return .{ .ty_pl = .{2956 return .{ .ty_pl = .{
2957 .ty = .fromType(agg_ty),2957 .ty = agg_ty,
2958 .payload = try l.addBlockBody(main_block.body()),2958 .payload = try l.addBlockBody(main_block.body()),
2959 } };2959 } };
2960}2960}
...@@ -2965,7 +2965,7 @@ fn arrayToVectorBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air....@@ -2965,7 +2965,7 @@ fn arrayToVectorBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.
2965 const gpa = zcu.gpa;2965 const gpa = zcu.gpa;
29662966
2967 const orig_ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;2967 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;
2969 const len: usize = @intCast(vec_ty.vectorLen(zcu));2969 const len: usize = @intCast(vec_ty.vectorLen(zcu));
29702970
2971 var bfa_buf: [64 + 2]Air.Inst.Index = undefined;2971 var bfa_buf: [64 + 2]Air.Inst.Index = undefined;
...@@ -2989,14 +2989,14 @@ fn arrayToVectorBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air....@@ -2989,14 +2989,14 @@ fn arrayToVectorBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.
2989 const result = main_block.add(l, .{2989 const result = main_block.add(l, .{
2990 .tag = .aggregate_init,2990 .tag = .aggregate_init,
2991 .data = .{ .ty_pl = .{2991 .data = .{ .ty_pl = .{
2992 .ty = .fromType(vec_ty),2992 .ty = vec_ty,
2993 .payload = elems_start,2993 .payload = elems_start,
2994 } },2994 } },
2995 }).toRef();2995 }).toRef();
2996 main_block.addBr(l, orig_inst, result);2996 main_block.addBr(l, orig_inst, result);
29972997
2998 return .{ .ty_pl = .{2998 return .{ .ty_pl = .{
2999 .ty = .fromType(vec_ty),2999 .ty = vec_ty,
3000 .payload = try l.addBlockBody(main_block.body()),3000 .payload = try l.addBlockBody(main_block.body()),
3001 } };3001 } };
3002}3002}
...@@ -3080,7 +3080,7 @@ const Block = struct {...@@ -3080,7 +3080,7 @@ const Block = struct {
3080 return b.add(l, .{3080 return b.add(l, .{
3081 .tag = tag,3081 .tag = tag,
3082 .data = .{ .ty_op = .{3082 .data = .{ .ty_op = .{
3083 .ty = .fromType(ty),3083 .ty = ty,
3084 .operand = operand,3084 .operand = operand,
3085 } },3085 } },
3086 });3086 });
...@@ -3146,7 +3146,7 @@ const Block = struct {...@@ -3146,7 +3146,7 @@ const Block = struct {
3146 return b.add(l, .{3146 return b.add(l, .{
3147 .tag = if (opts.optimized) .cmp_vector_optimized else .cmp_vector,3147 .tag = if (opts.optimized) .cmp_vector_optimized else .cmp_vector,
3148 .data = .{ .ty_pl = .{3148 .data = .{ .ty_pl = .{
3149 .ty = Air.internedToRef(bool_vec_ty.toIntern()),3149 .ty = bool_vec_ty,
3150 .payload = try l.addExtra(Air.VectorCmp, .{3150 .payload = try l.addExtra(Air.VectorCmp, .{
3151 .lhs = lhs,3151 .lhs = lhs,
3152 .rhs = rhs,3152 .rhs = rhs,
...@@ -3194,7 +3194,7 @@ const Block = struct {...@@ -3194,7 +3194,7 @@ const Block = struct {
3194 if (result_ty.toIntern() != operand_ty.toIntern()) return b.add(l, .{3194 if (result_ty.toIntern() != operand_ty.toIntern()) return b.add(l, .{
3195 .tag = .bit_cast,3195 .tag = .bit_cast,
3196 .data = .{ .ty_op = .{3196 .data = .{ .ty_op = .{
3197 .ty = .fromType(result_ty),3197 .ty = result_ty,
3198 .operand = operand,3198 .operand = operand,
3199 } },3199 } },
3200 }).toRef();3200 }).toRef();
...@@ -3221,7 +3221,7 @@ const Block = struct {...@@ -3221,7 +3221,7 @@ const Block = struct {
3221 if (result_ty.toIntern() != operand_ty.toIntern()) return b.add(l, .{3221 if (result_ty.toIntern() != operand_ty.toIntern()) return b.add(l, .{
3222 .tag = .ptr_cast,3222 .tag = .ptr_cast,
3223 .data = .{ .ty_op = .{3223 .data = .{ .ty_op = .{
3224 .ty = .fromType(result_ty),3224 .ty = result_ty,
3225 .operand = operand,3225 .operand = operand,
3226 } },3226 } },
3227 }).toRef();3227 }).toRef();
...@@ -3343,7 +3343,7 @@ const Loop = struct {...@@ -3343,7 +3343,7 @@ const Loop = struct {
3343 .inst = parent_block.add(l, .{3343 .inst = parent_block.add(l, .{
3344 .tag = .loop,3344 .tag = .loop,
3345 .data = .{ .ty_pl = .{3345 .data = .{ .ty_pl = .{
3346 .ty = .noreturn_type,3346 .ty = .noreturn,
3347 .payload = undefined,3347 .payload = undefined,
3348 } },3348 } },
3349 }),3349 }),
...@@ -3466,7 +3466,7 @@ fn compilerRtCall(...@@ -3466,7 +3466,7 @@ fn compilerRtCall(
3466 main_block.addBr(l, orig_inst, casted_result);3466 main_block.addBr(l, orig_inst, casted_result);
34673467
3468 return l.replaceInst(orig_inst, .block, .{ .ty_pl = .{3468 return l.replaceInst(orig_inst, .block, .{ .ty_pl = .{
3469 .ty = .fromType(result_ty),3469 .ty = result_ty,
3470 .payload = try l.addBlockBody(main_block.body()),3470 .payload = try l.addBlockBody(main_block.body()),
3471 } });3471 } });
3472}3472}
...@@ -3522,7 +3522,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {...@@ -3522,7 +3522,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
3522 const target = zcu.getTarget();3522 const target = zcu.getTarget();
35233523
3524 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;3524 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;
3526 const src_ty = l.typeOf(ty_op.operand);3526 const src_ty = l.typeOf(ty_op.operand);
35273527
3528 const src_info = src_ty.intInfo(zcu);3528 const src_info = src_ty.intInfo(zcu);
...@@ -3568,7 +3568,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {...@@ -3568,7 +3568,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
3568 main_block.addBr(l, orig_inst, casted_result);3568 main_block.addBr(l, orig_inst, casted_result);
35693569
3570 return .{ .block_payload = .{ .ty_pl = .{3570 return .{ .block_payload = .{ .ty_pl = .{
3571 .ty = .fromType(dest_ty),3571 .ty = dest_ty,
3572 .payload = try l.addBlockBody(main_block.body()),3572 .payload = try l.addBlockBody(main_block.body()),
3573 } } };3573 } } };
3574 }3574 }
...@@ -3602,7 +3602,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {...@@ -3602,7 +3602,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
3602 main_block.addBr(l, orig_inst, casted_result);3602 main_block.addBr(l, orig_inst, casted_result);
36033603
3604 return .{ .block_payload = .{ .ty_pl = .{3604 return .{ .block_payload = .{ .ty_pl = .{
3605 .ty = .fromType(dest_ty),3605 .ty = dest_ty,
3606 .payload = try l.addBlockBody(main_block.body()),3606 .payload = try l.addBlockBody(main_block.body()),
3607 } } };3607 } } };
3608}3608}
...@@ -3616,7 +3616,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {...@@ -3616,7 +3616,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
36163616
3617 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;3617 const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op;
3618 const src_ty = l.typeOf(ty_op.operand);3618 const src_ty = l.typeOf(ty_op.operand);
3619 const dest_ty = ty_op.ty.toType();3619 const dest_ty = ty_op.ty;
36203620
3621 const dest_info = dest_ty.intInfo(zcu);3621 const dest_info = dest_ty.intInfo(zcu);
3622 const float_off: u32 = switch (src_ty.floatBits(target)) {3622 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) {...@@ -3658,7 +3658,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
3658 main_block.addBr(l, orig_inst, casted_val);3658 main_block.addBr(l, orig_inst, casted_val);
36593659
3660 return .{ .block_payload = .{ .ty_pl = .{3660 return .{ .block_payload = .{ .ty_pl = .{
3661 .ty = .fromType(dest_ty),3661 .ty = dest_ty,
3662 .payload = try l.addBlockBody(main_block.body()),3662 .payload = try l.addBlockBody(main_block.body()),
3663 } } };3663 } } };
3664 }3664 }
...@@ -3682,7 +3682,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {...@@ -3682,7 +3682,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) {
3682 main_block.addBr(l, orig_inst, result_val);3682 main_block.addBr(l, orig_inst, result_val);
36833683
3684 return .{ .block_payload = .{ .ty_pl = .{3684 return .{ .block_payload = .{ .ty_pl = .{
3685 .ty = .fromType(dest_ty),3685 .ty = dest_ty,
3686 .payload = try l.addBlockBody(main_block.body()),3686 .payload = try l.addBlockBody(main_block.body()),
3687 } } };3687 } } };
3688}3688}
...@@ -3767,7 +3767,7 @@ fn softFloatNegBlockPayload(...@@ -3767,7 +3767,7 @@ fn softFloatNegBlockPayload(
3767 main_block.addBr(l, orig_inst, result);3767 main_block.addBr(l, orig_inst, result);
37683768
3769 return .{ .ty_pl = .{3769 return .{ .ty_pl = .{
3770 .ty = .fromType(float_ty),3770 .ty = float_ty,
3771 .payload = try l.addBlockBody(main_block.body()),3771 .payload = try l.addBlockBody(main_block.body()),
3772 } };3772 } };
3773}3773}
...@@ -3801,7 +3801,7 @@ fn softFloatDivTruncFloorCeilBlockPayload(...@@ -3801,7 +3801,7 @@ fn softFloatDivTruncFloorCeilBlockPayload(
3801 main_block.addBr(l, orig_inst, casted_result);3801 main_block.addBr(l, orig_inst, casted_result);
38023802
3803 return .{ .ty_pl = .{3803 return .{ .ty_pl = .{
3804 .ty = .fromType(float_ty),3804 .ty = float_ty,
3805 .payload = try l.addBlockBody(main_block.body()),3805 .payload = try l.addBlockBody(main_block.body()),
3806 } };3806 } };
3807}3807}
...@@ -3841,7 +3841,7 @@ fn softFloatModBlockPayload(...@@ -3841,7 +3841,7 @@ fn softFloatModBlockPayload(
3841 try condbr.finish(l);3841 try condbr.finish(l);
38423842
3843 return .{ .ty_pl = .{3843 return .{ .ty_pl = .{
3844 .ty = .fromType(float_ty),3844 .ty = float_ty,
3845 .payload = try l.addBlockBody(main_block.body()),3845 .payload = try l.addBlockBody(main_block.body()),
3846 } };3846 } };
3847}3847}
...@@ -3864,7 +3864,7 @@ fn softFloatCmpBlockPayload(...@@ -3864,7 +3864,7 @@ fn softFloatCmpBlockPayload(
3864 main_block.addBr(l, orig_inst, result);3864 main_block.addBr(l, orig_inst, result);
38653865
3866 return .{ .ty_pl = .{3866 return .{ .ty_pl = .{
3867 .ty = .bool_type,3867 .ty = .bool,
3868 .payload = try l.addBlockBody(main_block.body()),3868 .payload = try l.addBlockBody(main_block.body()),
3869 } };3869 } };
3870}3870}
src/Air/Liveness.zig+1-1
...@@ -661,7 +661,7 @@ fn analyzeInst(...@@ -661,7 +661,7 @@ fn analyzeInst(
661 },661 },
662 .aggregate_init => {662 .aggregate_init => {
663 const ty_pl = inst_datas[@backingInt(inst)].ty_pl;663 const ty_pl = inst_datas[@backingInt(inst)].ty_pl;
664 const aggregate_ty = ty_pl.ty.toType();664 const aggregate_ty = ty_pl.ty;
665 const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip)));665 const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip)));
666 const elements = @as([]const Air.Inst.Ref, @ptrCast(a.air.extra.items[ty_pl.payload..][0..len]));666 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 {...@@ -343,7 +343,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void {
343 // big tombs343 // big tombs
344 .aggregate_init => {344 .aggregate_init => {
345 const ty_pl = data[@backingInt(inst)].ty_pl;345 const ty_pl = data[@backingInt(inst)].ty_pl;
346 const aggregate_ty = ty_pl.ty.toType();346 const aggregate_ty = ty_pl.ty;
347 const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip)));347 const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip)));
348 const elements = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]));348 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 {...@@ -453,7 +453,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void {
453 },453 },
454 .block, .dbg_inline_block => |tag| {454 .block, .dbg_inline_block => |tag| {
455 const ty_pl = data[@backingInt(inst)].ty_pl;455 const ty_pl = data[@backingInt(inst)].ty_pl;
456 const block_ty = ty_pl.ty.toType();456 const block_ty = ty_pl.ty;
457 const block_body = switch (tag) {457 const block_body = switch (tag) {
458 .block => self.air.unwrapBlock(inst).body,458 .block => self.air.unwrapBlock(inst).body,
459 .dbg_inline_block => self.air.unwrapDbgBlock(inst).body,459 .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 {...@@ -121,7 +121,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
121 .bit_cast, .bit_cast_safe => {121 .bit_cast, .bit_cast_safe => {
122 const ty_op = data[@backingInt(inst)].ty_op;122 const ty_op = data[@backingInt(inst)].ty_op;
123 const operand_ty = air.typeOf(ty_op.operand, ip);123 const operand_ty = air.typeOf(ty_op.operand, ip);
124 const result_ty = ty_op.ty.toType();124 const result_ty = ty_op.ty;
125 // Enums are allowed here even if their backing type is implicit.125 // Enums are allowed here even if their backing type is implicit.
126 if (!operand_ty.hasBitRepresentation(zcu) and operand_ty.zigTypeTag(zcu) != .@"enum") {126 if (!operand_ty.hasBitRepresentation(zcu) and operand_ty.zigTypeTag(zcu) != .@"enum") {
127 return verify.fail("bad operand type");127 return verify.fail("bad operand type");
...@@ -136,7 +136,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {...@@ -136,7 +136,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
136 .ptr_cast => {136 .ptr_cast => {
137 const ty_op = data[@backingInt(inst)].ty_op;137 const ty_op = data[@backingInt(inst)].ty_op;
138 const operand_ty = air.typeOf(ty_op.operand, ip);138 const operand_ty = air.typeOf(ty_op.operand, ip);
139 const result_ty = ty_op.ty.toType();139 const result_ty = ty_op.ty;
140 const operand_scalar_ty = operand_ty.scalarType(zcu);140 const operand_scalar_ty = operand_ty.scalarType(zcu);
141 const result_scalar_ty = result_ty.scalarType(zcu);141 const result_scalar_ty = result_ty.scalarType(zcu);
142 if (operand_ty.isSliceAtRuntime(zcu)) {142 if (operand_ty.isSliceAtRuntime(zcu)) {
...@@ -154,7 +154,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {...@@ -154,7 +154,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
154 .ptr_from_int => {154 .ptr_from_int => {
155 const ty_op = data[@backingInt(inst)].ty_op;155 const ty_op = data[@backingInt(inst)].ty_op;
156 const operand_ty = air.typeOf(ty_op.operand, ip);156 const operand_ty = air.typeOf(ty_op.operand, ip);
157 const result_ty = ty_op.ty.toType();157 const result_ty = ty_op.ty;
158 const operand_scalar_ty = operand_ty.scalarType(zcu);158 const operand_scalar_ty = operand_ty.scalarType(zcu);
159 const result_scalar_ty = result_ty.scalarType(zcu);159 const result_scalar_ty = result_ty.scalarType(zcu);
160 if (operand_scalar_ty.toIntern() != .usize_type) return verify.fail("bad operand type");160 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 {...@@ -165,7 +165,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
165 .int_from_ptr => {165 .int_from_ptr => {
166 const ty_op = data[@backingInt(inst)].ty_op;166 const ty_op = data[@backingInt(inst)].ty_op;
167 const operand_ty = air.typeOf(ty_op.operand, ip);167 const operand_ty = air.typeOf(ty_op.operand, ip);
168 const result_ty = ty_op.ty.toType();168 const result_ty = ty_op.ty;
169 const operand_scalar_ty = operand_ty.scalarType(zcu);169 const operand_scalar_ty = operand_ty.scalarType(zcu);
170 const result_scalar_ty = result_ty.scalarType(zcu);170 const result_scalar_ty = result_ty.scalarType(zcu);
171 if (!operand_scalar_ty.isPtrAtRuntime(zcu)) return verify.fail("bad operand type");171 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 {...@@ -176,7 +176,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
176 .error_cast => {176 .error_cast => {
177 const ty_op = data[@backingInt(inst)].ty_op;177 const ty_op = data[@backingInt(inst)].ty_op;
178 const operand_ty = air.typeOf(ty_op.operand, ip);178 const operand_ty = air.typeOf(ty_op.operand, ip);
179 const result_ty = ty_op.ty.toType();179 const result_ty = ty_op.ty;
180 switch (operand_ty.zigTypeTag(zcu)) {180 switch (operand_ty.zigTypeTag(zcu)) {
181 else => return verify.fail("bad operand type"),181 else => return verify.fail("bad operand type"),
182 .error_union => {182 .error_union => {
...@@ -195,7 +195,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {...@@ -195,7 +195,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
195 .error_from_int => {195 .error_from_int => {
196 const ty_op = data[@backingInt(inst)].ty_op;196 const ty_op = data[@backingInt(inst)].ty_op;
197 const operand_ty = air.typeOf(ty_op.operand, ip);197 const operand_ty = air.typeOf(ty_op.operand, ip);
198 const result_ty = ty_op.ty.toType();198 const result_ty = ty_op.ty;
199 if (!operand_ty.isUnsignedInt(zcu)) return verify.fail("bad operand type");199 if (!operand_ty.isUnsignedInt(zcu)) return verify.fail("bad operand type");
200 if (operand_ty.bitSize(zcu) != zcu.errorSetBits()) return verify.fail("bad operand bit size");200 if (operand_ty.bitSize(zcu) != zcu.errorSetBits()) return verify.fail("bad operand bit size");
201 if (result_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad result type");201 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 {...@@ -203,7 +203,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
203 .int_from_error => {203 .int_from_error => {
204 const ty_op = data[@backingInt(inst)].ty_op;204 const ty_op = data[@backingInt(inst)].ty_op;
205 const operand_ty = air.typeOf(ty_op.operand, ip);205 const operand_ty = air.typeOf(ty_op.operand, ip);
206 const result_ty = ty_op.ty.toType();206 const result_ty = ty_op.ty;
207 if (operand_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad operand type");207 if (operand_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad operand type");
208 if (!result_ty.isUnsignedInt(zcu)) return verify.fail("bad result type");208 if (!result_ty.isUnsignedInt(zcu)) return verify.fail("bad result type");
209 if (result_ty.bitSize(zcu) != zcu.errorSetBits()) return verify.fail("bad result bit size");209 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 {...@@ -211,7 +211,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
211 .union_from_enum => {211 .union_from_enum => {
212 const ty_op = data[@backingInt(inst)].ty_op;212 const ty_op = data[@backingInt(inst)].ty_op;
213 const operand_ty = air.typeOf(ty_op.operand, ip);213 const operand_ty = air.typeOf(ty_op.operand, ip);
214 const result_ty = ty_op.ty.toType();214 const result_ty = ty_op.ty;
215 if (operand_ty.zigTypeTag(zcu) != .@"enum") return verify.fail("bad operand type");215 if (operand_ty.zigTypeTag(zcu) != .@"enum") return verify.fail("bad operand type");
216 if (result_ty.zigTypeTag(zcu) != .@"union") return verify.fail("bad result type");216 if (result_ty.zigTypeTag(zcu) != .@"union") return verify.fail("bad result type");
217 const union_tag_ty = result_ty.unionTagType(zcu) orelse return verify.fail("union type is not tagged");217 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 {...@@ -222,7 +222,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void {
222 const ty_pl = data[@backingInt(inst)].ty_pl;222 const ty_pl = data[@backingInt(inst)].ty_pl;
223 const bin_op = air.extraData(Air.Bin, ty_pl.payload).data;223 const bin_op = air.extraData(Air.Bin, ty_pl.payload).data;
224 const ptr_ty = air.typeOf(bin_op.lhs, ip);224 const ptr_ty = air.typeOf(bin_op.lhs, ip);
225 const result_ty = ty_pl.ty.toType();225 const result_ty = ty_pl.ty;
226 if (ptr_ty.zigTypeTag(zcu) != .pointer) return verify.fail("bad pointer type");226 if (ptr_ty.zigTypeTag(zcu) != .pointer) return verify.fail("bad pointer type");
227 if (result_ty.zigTypeTag(zcu) != .pointer) return verify.fail("bad result type");227 if (result_ty.zigTypeTag(zcu) != .pointer) return verify.fail("bad result type");
228 const ptr_info = ptr_ty.ptrInfo(zcu);228 const ptr_info = ptr_ty.ptrInfo(zcu);
src/Air/print.zig+7-7
...@@ -387,20 +387,20 @@ const Writer = struct {...@@ -387,20 +387,20 @@ const Writer = struct {
387387
388 fn writeArg(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {388 fn writeArg(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {
389 const arg = w.air.instructions.items(.data)[@backingInt(inst)].arg;389 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);
391 try s.print(", {d}", .{arg.zir_param_index});391 try s.print(", {d}", .{arg.zir_param_index});
392 }392 }
393393
394 fn writeTyOp(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {394 fn writeTyOp(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {
395 const ty_op = w.air.instructions.items(.data)[@backingInt(inst)].ty_op;395 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);
397 try s.writeAll(", ");397 try s.writeAll(", ");
398 try w.writeOperand(s, inst, 0, ty_op.operand);398 try w.writeOperand(s, inst, 0, ty_op.operand);
399 }399 }
400400
401 fn writeBlock(w: *Writer, s: *std.Io.Writer, tag: Air.Inst.Tag, inst: Air.Inst.Index) Error!void {401 fn writeBlock(w: *Writer, s: *std.Io.Writer, tag: Air.Inst.Tag, inst: Air.Inst.Index) Error!void {
402 const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl;402 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
405 const body = switch (tag) {405 const body = switch (tag) {
406 .block => w.air.unwrapBlock(inst).body,406 .block => w.air.unwrapBlock(inst).body,
...@@ -448,7 +448,7 @@ const Writer = struct {...@@ -448,7 +448,7 @@ const Writer = struct {
448 fn writeAggregateInit(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {448 fn writeAggregateInit(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {
449 const zcu = w.pt.zcu;449 const zcu = w.pt.zcu;
450 const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl;450 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;
452 const len = @as(usize, @intCast(vector_ty.arrayLen(zcu)));452 const len = @as(usize, @intCast(vector_ty.arrayLen(zcu)));
453 const elements = @as([]const Air.Inst.Ref, @ptrCast(w.air.extra.items[ty_pl.payload..][0..len]));453 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 {...@@ -482,7 +482,7 @@ const Writer = struct {
482 const ty_pl = data[@backingInt(inst)].ty_pl;482 const ty_pl = data[@backingInt(inst)].ty_pl;
483 const extra = w.air.extraData(Air.Bin, ty_pl.payload).data;483 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;
486 try w.writeType(s, inst_ty);486 try w.writeType(s, inst_ty);
487 try s.writeAll(", ");487 try s.writeAll(", ");
488 try w.writeOperand(s, inst, 0, extra.lhs);488 try w.writeOperand(s, inst, 0, extra.lhs);
...@@ -608,7 +608,7 @@ const Writer = struct {...@@ -608,7 +608,7 @@ const Writer = struct {
608 fn writeRuntimeNavPtr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {608 fn writeRuntimeNavPtr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void {
609 const ip = &w.pt.zcu.intern_pool;609 const ip = &w.pt.zcu.intern_pool;
610 const ty_nav = w.air.instructions.items(.data)[@backingInt(inst)].ty_nav;610 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);
612 try s.print(", '{f}'", .{ip.getNav(ty_nav.nav).fqn.fmt(ip)});612 try s.print(", '{f}'", .{ip.getNav(ty_nav.nav).fqn.fmt(ip)});
613 }613 }
614614
...@@ -799,7 +799,7 @@ const Writer = struct {...@@ -799,7 +799,7 @@ const Writer = struct {
799 try w.writeOperand(s, inst, 0, unwrapped_try.error_union_ptr);799 try w.writeOperand(s, inst, 0, unwrapped_try.error_union_ptr);
800800
801 try s.writeAll(", ");801 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);
803 if (w.skip_body) return s.writeAll(", ...");803 if (w.skip_body) return s.writeAll(", ...");
804 try s.writeAll(", {\n");804 try s.writeAll(", {\n");
805 const old_indent = w.indent;805 const old_indent = w.indent;
src/Sema.zig+51-67
...@@ -577,7 +577,7 @@ pub const Block = struct {...@@ -577,7 +577,7 @@ pub const Block = struct {
577 return block.addInst(.{577 return block.addInst(.{
578 .tag = tag,578 .tag = tag,
579 .data = .{ .ty_op = .{579 .data = .{ .ty_op = .{
580 .ty = Air.internedToRef(ty.toIntern()),580 .ty = ty,
581 .operand = operand,581 .operand = operand,
582 } },582 } },
583 });583 });
...@@ -636,7 +636,6 @@ pub const Block = struct {...@@ -636,7 +636,6 @@ pub const Block = struct {
636 field_index: u32,636 field_index: u32,
637 ptr_field_ty: Type,637 ptr_field_ty: Type,
638 ) !Air.Inst.Ref {638 ) !Air.Inst.Ref {
639 const ty = Air.internedToRef(ptr_field_ty.toIntern());
640 const tag: Air.Inst.Tag = switch (field_index) {639 const tag: Air.Inst.Tag = switch (field_index) {
641 0 => .struct_field_ptr_index_0,640 0 => .struct_field_ptr_index_0,
642 1 => .struct_field_ptr_index_1,641 1 => .struct_field_ptr_index_1,
...@@ -646,7 +645,7 @@ pub const Block = struct {...@@ -646,7 +645,7 @@ pub const Block = struct {
646 return block.addInst(.{645 return block.addInst(.{
647 .tag = .struct_field_ptr,646 .tag = .struct_field_ptr,
648 .data = .{ .ty_pl = .{647 .data = .{ .ty_pl = .{
649 .ty = ty,648 .ty = ptr_field_ty,
650 .payload = try block.sema.addExtra(Air.StructField{649 .payload = try block.sema.addExtra(Air.StructField{
651 .struct_operand = struct_ptr,650 .struct_operand = struct_ptr,
652 .field_index = field_index,651 .field_index = field_index,
...@@ -658,7 +657,7 @@ pub const Block = struct {...@@ -658,7 +657,7 @@ pub const Block = struct {
658 return block.addInst(.{657 return block.addInst(.{
659 .tag = tag,658 .tag = tag,
660 .data = .{ .ty_op = .{659 .data = .{ .ty_op = .{
661 .ty = ty,660 .ty = ptr_field_ty,
662 .operand = struct_ptr,661 .operand = struct_ptr,
663 } },662 } },
664 });663 });
...@@ -673,7 +672,7 @@ pub const Block = struct {...@@ -673,7 +672,7 @@ pub const Block = struct {
673 return block.addInst(.{672 return block.addInst(.{
674 .tag = .agg_field_val,673 .tag = .agg_field_val,
675 .data = .{ .ty_pl = .{674 .data = .{ .ty_pl = .{
676 .ty = Air.internedToRef(field_ty.toIntern()),675 .ty = field_ty,
677 .payload = try block.sema.addExtra(Air.StructField{676 .payload = try block.sema.addExtra(Air.StructField{
678 .struct_operand = struct_val,677 .struct_operand = struct_val,
679 .field_index = field_index,678 .field_index = field_index,
...@@ -691,7 +690,7 @@ pub const Block = struct {...@@ -691,7 +690,7 @@ pub const Block = struct {
691 return block.addInst(.{690 return block.addInst(.{
692 .tag = .slice_elem_ptr,691 .tag = .slice_elem_ptr,
693 .data = .{ .ty_pl = .{692 .data = .{ .ty_pl = .{
694 .ty = Air.internedToRef(elem_ptr_ty.toIntern()),693 .ty = elem_ptr_ty,
695 .payload = try block.sema.addExtra(Air.Bin{694 .payload = try block.sema.addExtra(Air.Bin{
696 .lhs = slice,695 .lhs = slice,
697 .rhs = elem_index,696 .rhs = elem_index,
...@@ -705,16 +704,6 @@ pub const Block = struct {...@@ -705,16 +704,6 @@ pub const Block = struct {
705 array_ptr: Air.Inst.Ref,704 array_ptr: Air.Inst.Ref,
706 elem_index: Air.Inst.Ref,705 elem_index: Air.Inst.Ref,
707 elem_ptr_ty: Type,706 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,
718 ) !Air.Inst.Ref {707 ) !Air.Inst.Ref {
719 return block.addInst(.{708 return block.addInst(.{
720 .tag = .ptr_elem_ptr,709 .tag = .ptr_elem_ptr,
...@@ -735,10 +724,10 @@ pub const Block = struct {...@@ -735,10 +724,10 @@ pub const Block = struct {
735 return block.addInst(.{724 return block.addInst(.{
736 .tag = if (block.float_mode == .optimized) .cmp_vector_optimized else .cmp_vector,725 .tag = if (block.float_mode == .optimized) .cmp_vector_optimized else .cmp_vector,
737 .data = .{ .ty_pl = .{726 .data = .{ .ty_pl = .{
738 .ty = Air.internedToRef((try pt.vectorType(.{727 .ty = (try pt.vectorType(.{
739 .len = sema.typeOf(lhs).vectorLen(zcu),728 .len = sema.typeOf(lhs).vectorLen(zcu),
740 .child = .bool_type,729 .child = .bool_type,
741 })).toIntern()),730 })),
742 .payload = try sema.addExtra(Air.VectorCmp{731 .payload = try sema.addExtra(Air.VectorCmp{
743 .lhs = lhs,732 .lhs = lhs,
744 .rhs = rhs,733 .rhs = rhs,
...@@ -771,7 +760,6 @@ pub const Block = struct {...@@ -771,7 +760,6 @@ pub const Block = struct {
771 elements: []const Air.Inst.Ref,760 elements: []const Air.Inst.Ref,
772 ) !Air.Inst.Ref {761 ) !Air.Inst.Ref {
773 const sema = block.sema;762 const sema = block.sema;
774 const ty_ref = Air.internedToRef(aggregate_ty.toIntern());
775 try sema.air_extra.ensureUnusedCapacity(sema.gpa, elements.len);763 try sema.air_extra.ensureUnusedCapacity(sema.gpa, elements.len);
776 const extra_index: u32 = @intCast(sema.air_extra.items.len);764 const extra_index: u32 = @intCast(sema.air_extra.items.len);
777 sema.appendRefsAssumeCapacity(elements);765 sema.appendRefsAssumeCapacity(elements);
...@@ -779,7 +767,7 @@ pub const Block = struct {...@@ -779,7 +767,7 @@ pub const Block = struct {
779 return block.addInst(.{767 return block.addInst(.{
780 .tag = .aggregate_init,768 .tag = .aggregate_init,
781 .data = .{ .ty_pl = .{769 .data = .{ .ty_pl = .{
782 .ty = ty_ref,770 .ty = aggregate_ty,
783 .payload = extra_index,771 .payload = extra_index,
784 } },772 } },
785 });773 });
...@@ -794,7 +782,7 @@ pub const Block = struct {...@@ -794,7 +782,7 @@ pub const Block = struct {
794 return block.addInst(.{782 return block.addInst(.{
795 .tag = .union_init,783 .tag = .union_init,
796 .data = .{ .ty_pl = .{784 .data = .{ .ty_pl = .{
797 .ty = Air.internedToRef(union_ty.toIntern()),785 .ty = union_ty,
798 .payload = try block.sema.addExtra(Air.UnionInit{786 .payload = try block.sema.addExtra(Air.UnionInit{
799 .field_index = field_index,787 .field_index = field_index,
800 .init = init,788 .init = init,
...@@ -3761,7 +3749,7 @@ fn finishResolveComptimeKnownAllocPtr(...@@ -3761,7 +3749,7 @@ fn finishResolveComptimeKnownAllocPtr(
3761 // this one to drop the side effect. We also need to rewrite the stores; we'll turn them to this3749 // this one to drop the side effect. We also need to rewrite the stores; we'll turn them to this
3762 // too because it doesn't really matter what they become.3750 // too because it doesn't really matter what they become.
3763 const nop_inst: Air.Inst = .{ .tag = .ptr_from_int, .data = .{ .ty_op = .{3751 const nop_inst: Air.Inst = .{ .tag = .ptr_from_int, .data = .{ .ty_op = .{
3764 .ty = .fromIntern(alloc_ty.toIntern()),3752 .ty = alloc_ty,
3765 .operand = .zero_usize,3753 .operand = .zero_usize,
3766 } } };3754 } } };
37673755
...@@ -4037,7 +4025,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com...@@ -4037,7 +4025,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
4037 sema.air_instructions.set(@backingInt(placeholder_inst), .{4025 sema.air_instructions.set(@backingInt(placeholder_inst), .{
4038 .tag = .block,4026 .tag = .block,
4039 .data = .{ .ty_pl = .{4027 .data = .{ .ty_pl = .{
4040 .ty = .void_type,4028 .ty = .void,
4041 .payload = sema.addExtraAssumeCapacity(Air.Block{4029 .payload = sema.addExtraAssumeCapacity(Air.Block{
4042 .body_len = @intCast(replacement_block.instructions.items.len),4030 .body_len = @intCast(replacement_block.instructions.items.len),
4043 }),4031 }),
...@@ -5191,7 +5179,7 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError...@@ -5191,7 +5179,7 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError
5191 sema.air_instructions.appendAssumeCapacity(.{5179 sema.air_instructions.appendAssumeCapacity(.{
5192 .tag = .loop,5180 .tag = .loop,
5193 .data = .{ .ty_pl = .{5181 .data = .{ .ty_pl = .{
5194 .ty = .noreturn_type,5182 .ty = .noreturn,
5195 .payload = undefined,5183 .payload = undefined,
5196 } },5184 } },
5197 });5185 });
...@@ -5349,7 +5337,7 @@ fn resolveBlockBody(...@@ -5349,7 +5337,7 @@ fn resolveBlockBody(
5349 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).@"struct".field_names.len +5337 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).@"struct".field_names.len +
5350 child_block.instructions.items.len);5338 child_block.instructions.items.len);
5351 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{5339 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5352 .ty = Air.internedToRef(operand_ty.toIntern()),5340 .ty = operand_ty,
5353 .payload = sema.addExtraAssumeCapacity(Air.Block{5341 .payload = sema.addExtraAssumeCapacity(Air.Block{
5354 .body_len = @intCast(child_block.instructions.items.len),5342 .body_len = @intCast(child_block.instructions.items.len),
5355 }),5343 }),
...@@ -5431,7 +5419,7 @@ fn resolveAnalyzedBlock(...@@ -5431,7 +5419,7 @@ fn resolveAnalyzedBlock(
5431 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len +5419 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len +
5432 child_block.instructions.items.len);5420 child_block.instructions.items.len);
5433 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{5421 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5434 .ty = .noreturn_type,5422 .ty = .noreturn,
5435 .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{5423 .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{
5436 .func = child_block.inlining.?.func,5424 .func = child_block.inlining.?.func,
5437 .body_len = @intCast(child_block.instructions.items.len),5425 .body_len = @intCast(child_block.instructions.items.len),
...@@ -5469,7 +5457,7 @@ fn resolveAnalyzedBlock(...@@ -5469,7 +5457,7 @@ fn resolveAnalyzedBlock(
5469 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len +5457 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len +
5470 child_block.instructions.items.len);5458 child_block.instructions.items.len);
5471 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{5459 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5472 .ty = .void_type,5460 .ty = .void,
5473 .payload = sema.addExtraAssumeCapacity(Air.Block{5461 .payload = sema.addExtraAssumeCapacity(Air.Block{
5474 .body_len = @intCast(child_block.instructions.items.len),5462 .body_len = @intCast(child_block.instructions.items.len),
5475 }),5463 }),
...@@ -5479,7 +5467,7 @@ fn resolveAnalyzedBlock(...@@ -5479,7 +5467,7 @@ fn resolveAnalyzedBlock(
5479 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len +5467 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len +
5480 child_block.instructions.items.len);5468 child_block.instructions.items.len);
5481 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{5469 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5482 .ty = .void_type,5470 .ty = .void,
5483 .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{5471 .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{
5484 .func = child_block.inlining.?.func,5472 .func = child_block.inlining.?.func,
5485 .body_len = @intCast(child_block.instructions.items.len),5473 .body_len = @intCast(child_block.instructions.items.len),
...@@ -5528,13 +5516,12 @@ fn resolveAnalyzedBlock(...@@ -5528,13 +5516,12 @@ fn resolveAnalyzedBlock(
55285516
5529 try sema.checkMergeAllowed(child_block, type_src, resolved_ty);5517 try sema.checkMergeAllowed(child_block, type_src, resolved_ty);
55305518
5531 const ty_inst = Air.internedToRef(resolved_ty.toIntern());
5532 switch (block_tag) {5519 switch (block_tag) {
5533 .block => {5520 .block => {
5534 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len +5521 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len +
5535 child_block.instructions.items.len);5522 child_block.instructions.items.len);
5536 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{5523 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5537 .ty = ty_inst,5524 .ty = resolved_ty,
5538 .payload = sema.addExtraAssumeCapacity(Air.Block{5525 .payload = sema.addExtraAssumeCapacity(Air.Block{
5539 .body_len = @intCast(child_block.instructions.items.len),5526 .body_len = @intCast(child_block.instructions.items.len),
5540 }),5527 }),
...@@ -5544,7 +5531,7 @@ fn resolveAnalyzedBlock(...@@ -5544,7 +5531,7 @@ fn resolveAnalyzedBlock(
5544 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len +5531 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len +
5545 child_block.instructions.items.len);5532 child_block.instructions.items.len);
5546 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{5533 sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{
5547 .ty = ty_inst,5534 .ty = resolved_ty,
5548 .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{5535 .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{
5549 .func = child_block.inlining.?.func,5536 .func = child_block.inlining.?.func,
5550 .body_len = @intCast(child_block.instructions.items.len),5537 .body_len = @intCast(child_block.instructions.items.len),
...@@ -5585,7 +5572,7 @@ fn resolveAnalyzedBlock(...@@ -5585,7 +5572,7 @@ fn resolveAnalyzedBlock(
55855572
5586 sema.air_instructions.items(.tag)[@backingInt(br)] = .block;5573 sema.air_instructions.items(.tag)[@backingInt(br)] = .block;
5587 sema.air_instructions.items(.data)[@backingInt(br)] = .{ .ty_pl = .{5574 sema.air_instructions.items(.data)[@backingInt(br)] = .{ .ty_pl = .{
5588 .ty = .noreturn_type,5575 .ty = .noreturn,
5589 .payload = sema.addExtraAssumeCapacity(Air.Block{5576 .payload = sema.addExtraAssumeCapacity(Air.Block{
5590 .body_len = sub_block_len,5577 .body_len = sub_block_len,
5591 }),5578 }),
...@@ -6093,7 +6080,7 @@ pub fn analyzeSaveErrRetIndex(sema: *Sema, block: *Block) SemaError!Air.Inst.Ref...@@ -6093,7 +6080,7 @@ pub fn analyzeSaveErrRetIndex(sema: *Sema, block: *Block) SemaError!Air.Inst.Ref
6093 return try block.addInst(.{6080 return try block.addInst(.{
6094 .tag = .save_err_return_trace_index,6081 .tag = .save_err_return_trace_index,
6095 .data = .{ .ty_pl = .{6082 .data = .{ .ty_pl = .{
6096 .ty = Air.internedToRef(stack_trace_ty.toIntern()),6083 .ty = stack_trace_ty,
6097 .payload = @intCast(field_index),6084 .payload = @intCast(field_index),
6098 } },6085 } },
6099 });6086 });
...@@ -6140,7 +6127,7 @@ fn popErrorReturnTrace(...@@ -6140,7 +6127,7 @@ fn popErrorReturnTrace(
6140 .tag = .block,6127 .tag = .block,
6141 .data = .{6128 .data = .{
6142 .ty_pl = .{6129 .ty_pl = .{
6143 .ty = .void_type,6130 .ty = .void,
6144 .payload = undefined, // updated below6131 .payload = undefined, // updated below
6145 },6132 },
6146 },6133 },
...@@ -6294,7 +6281,7 @@ fn zirCall(...@@ -6294,7 +6281,7 @@ fn zirCall(
6294 const save_inst = try block.insertInst(block_index, .{6281 const save_inst = try block.insertInst(block_index, .{
6295 .tag = .save_err_return_trace_index,6282 .tag = .save_err_return_trace_index,
6296 .data = .{ .ty_pl = .{6283 .data = .{ .ty_pl = .{
6297 .ty = Air.internedToRef(stack_trace_ty.toIntern()),6284 .ty = stack_trace_ty,
6298 .payload = @intCast(field_index),6285 .payload = @intCast(field_index),
6299 } },6286 } },
6300 });6287 });
...@@ -10364,7 +10351,7 @@ fn analyzeSwitchBlock(...@@ -10364,7 +10351,7 @@ fn analyzeSwitchBlock(
10364 const air_ref = try child_block.addInst(.{10351 const air_ref = try child_block.addInst(.{
10365 .tag = air_tag,10352 .tag = air_tag,
10366 .data = .{ .ty_pl = .{10353 .data = .{ .ty_pl = .{
10367 .ty = .noreturn_type,10354 .ty = .noreturn,
10368 .payload = payload_index,10355 .payload = payload_index,
10369 } },10356 } },
10370 });10357 });
...@@ -10446,7 +10433,7 @@ fn analyzeSwitchBlock(...@@ -10446,7 +10433,7 @@ fn analyzeSwitchBlock(
10446 sema.air_instructions.set(@backingInt(placeholder_inst), .{10433 sema.air_instructions.set(@backingInt(placeholder_inst), .{
10447 .tag = .block,10434 .tag = .block,
10448 .data = .{ .ty_pl = .{10435 .data = .{ .ty_pl = .{
10449 .ty = .noreturn_type,10436 .ty = .noreturn,
10450 .payload = sema.addExtraAssumeCapacity(Air.Block{10437 .payload = sema.addExtraAssumeCapacity(Air.Block{
10451 .body_len = @intCast(replacement_block.instructions.items.len),10438 .body_len = @intCast(replacement_block.instructions.items.len),
10452 }),10439 }),
...@@ -12401,7 +12388,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion(...@@ -12401,7 +12388,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion(
12401 .tag = .block,12388 .tag = .block,
12402 .data = .{12389 .data = .{
12403 .ty_pl = .{12390 .ty_pl = .{
12404 .ty = .fromType(capture_ty),12391 .ty = capture_ty,
12405 .payload = undefined, // updated below12392 .payload = undefined, // updated below
12406 },12393 },
12407 },12394 },
...@@ -12492,7 +12479,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion(...@@ -12492,7 +12479,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion(
12492 try sema.air_instructions.append(sema.gpa, .{12479 try sema.air_instructions.append(sema.gpa, .{
12493 .tag = .get_union_tag,12480 .tag = .get_union_tag,
12494 .data = .{ .ty_op = .{12481 .data = .{ .ty_op = .{
12495 .ty = .fromIntern(union_obj.enum_tag_type),12482 .ty = .fromInterned(union_obj.enum_tag_type),
12496 .operand = loaded_operand,12483 .operand = loaded_operand,
12497 } },12484 } },
12498 });12485 });
...@@ -13140,7 +13127,7 @@ fn zirShl(...@@ -13140,7 +13127,7 @@ fn zirShl(
13140 const op_ov = try block.addInst(.{13127 const op_ov = try block.addInst(.{
13141 .tag = .shl_with_overflow,13128 .tag = .shl_with_overflow,
13142 .data = .{ .ty_pl = .{13129 .data = .{ .ty_pl = .{
13143 .ty = .fromIntern(op_ov_tuple_ty.toIntern()),13130 .ty = op_ov_tuple_ty,
13144 .payload = try sema.addExtra(Air.Bin{13131 .payload = try sema.addExtra(Air.Bin{
13145 .lhs = lhs,13132 .lhs = lhs,
13146 .rhs = rhs,13133 .rhs = rhs,
...@@ -13673,7 +13660,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -13673,7 +13660,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
13673 const lhs_dest_slice = try block.addInst(.{13660 const lhs_dest_slice = try block.addInst(.{
13674 .tag = .slice,13661 .tag = .slice,
13675 .data = .{ .ty_pl = .{13662 .data = .{ .ty_pl = .{
13676 .ty = .fromType(slice_ty),13663 .ty = slice_ty,
13677 .payload = try sema.addExtra(Air.Bin{13664 .payload = try sema.addExtra(Air.Bin{
13678 .lhs = many_alloc,13665 .lhs = many_alloc,
13679 .rhs = try pt.intRef(.usize, lhs_len),13666 .rhs = try pt.intRef(.usize, lhs_len),
...@@ -13688,7 +13675,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -13688,7 +13675,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
13688 const rhs_dest_offset = try block.addInst(.{13675 const rhs_dest_offset = try block.addInst(.{
13689 .tag = .ptr_add,13676 .tag = .ptr_add,
13690 .data = .{ .ty_pl = .{13677 .data = .{ .ty_pl = .{
13691 .ty = Air.internedToRef(many_ty.toIntern()),13678 .ty = many_ty,
13692 .payload = try sema.addExtra(Air.Bin{13679 .payload = try sema.addExtra(Air.Bin{
13693 .lhs = many_alloc,13680 .lhs = many_alloc,
13694 .rhs = try pt.intRef(.usize, lhs_len),13681 .rhs = try pt.intRef(.usize, lhs_len),
...@@ -13698,7 +13685,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -13698,7 +13685,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
13698 const rhs_dest_slice = try block.addInst(.{13685 const rhs_dest_slice = try block.addInst(.{
13699 .tag = .slice,13686 .tag = .slice,
13700 .data = .{ .ty_pl = .{13687 .data = .{ .ty_pl = .{
13701 .ty = .fromType(slice_ty),13688 .ty = slice_ty,
13702 .payload = try sema.addExtra(Air.Bin{13689 .payload = try sema.addExtra(Air.Bin{
13703 .lhs = rhs_dest_offset,13690 .lhs = rhs_dest_offset,
13704 .rhs = try pt.intRef(.usize, rhs_len),13691 .rhs = try pt.intRef(.usize, rhs_len),
...@@ -14970,7 +14957,7 @@ fn zirOverflowArithmetic(...@@ -14970,7 +14957,7 @@ fn zirOverflowArithmetic(
14970 return block.addInst(.{14957 return block.addInst(.{
14971 .tag = air_tag,14958 .tag = air_tag,
14972 .data = .{ .ty_pl = .{14959 .data = .{ .ty_pl = .{
14973 .ty = Air.internedToRef(tuple_ty.toIntern()),14960 .ty = tuple_ty,
14974 .payload = try block.sema.addExtra(Air.Bin{14961 .payload = try block.sema.addExtra(Air.Bin{
14975 .lhs = lhs,14962 .lhs = lhs,
14976 .rhs = rhs,14963 .rhs = rhs,
...@@ -15267,7 +15254,7 @@ fn analyzePtrArithmetic(...@@ -15267,7 +15254,7 @@ fn analyzePtrArithmetic(
15267 return block.addInst(.{15254 return block.addInst(.{
15268 .tag = air_tag,15255 .tag = air_tag,
15269 .data = .{ .ty_pl = .{15256 .data = .{ .ty_pl = .{
15270 .ty = .fromType(new_ptr_ty),15257 .ty = new_ptr_ty,
15271 .payload = try sema.addExtra(Air.Bin{15258 .payload = try sema.addExtra(Air.Bin{
15272 .lhs = ptr,15259 .lhs = ptr,
15273 .rhs = offset,15260 .rhs = offset,
...@@ -15330,7 +15317,7 @@ fn zirAsm(...@@ -15330,7 +15317,7 @@ fn zirAsm(
15330 const ConstraintName = struct { c: []const u8, n: []const u8 };15317 const ConstraintName = struct { c: []const u8, n: []const u8 };
15331 const out_args = try sema.arena.alloc(Air.Inst.Ref, outputs_len);15318 const out_args = try sema.arena.alloc(Air.Inst.Ref, outputs_len);
15332 const outputs = try sema.arena.alloc(ConstraintName, outputs_len);15319 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
15335 for (out_args, 0..) |*arg, out_i| {15322 for (out_args, 0..) |*arg, out_i| {
15336 const output = sema.code.extraData(Zir.Inst.Asm.Output, extra_i);15323 const output = sema.code.extraData(Zir.Inst.Asm.Output, extra_i);
...@@ -15352,7 +15339,7 @@ fn zirAsm(...@@ -15352,7 +15339,7 @@ fn zirAsm(
1535215339
15353 const out_ty = try sema.resolveType(block, ret_ty_src, output.data.operand);15340 const out_ty = try sema.resolveType(block, ret_ty_src, output.data.operand);
15354 try sema.ensureLayoutResolved(out_ty, ret_ty_src, .asm_out_type);15341 try sema.ensureLayoutResolved(out_ty, ret_ty_src, .asm_out_type);
15355 expr_ty = .fromType(out_ty);15342 expr_ty = out_ty;
15356 break :out_ty out_ty;15343 break :out_ty out_ty;
15357 } else {15344 } else {
15358 const inst = sema.resolveInst(output.data.operand);15345 const inst = sema.resolveInst(output.data.operand);
...@@ -15547,7 +15534,7 @@ fn zirAsm(...@@ -15547,7 +15534,7 @@ fn zirAsm(
15547 buffer[input.c.len + 1 + input.n.len] = 0;15534 buffer[input.c.len + 1 + input.n.len] = 0;
15548 sema.air_extra.items.len += (input.c.len + input.n.len + (2 + 3)) / 4;15535 sema.air_extra.items.len += (input.c.len + input.n.len + (2 + 3)) / 4;
15549 }15536 }
15550 if (try expr_ty.toType().onePossibleValue(pt)) |opv| return .fromValue(opv);15537 if (try expr_ty.onePossibleValue(pt)) |opv| return .fromValue(opv);
15551 return asm_air;15538 return asm_air;
15552}15539}
1555315540
...@@ -17459,7 +17446,7 @@ fn zirBoolBr(...@@ -17459,7 +17446,7 @@ fn zirBoolBr(
17459 try sema.air_instructions.append(gpa, .{17446 try sema.air_instructions.append(gpa, .{
17460 .tag = .block,17447 .tag = .block,
17461 .data = .{ .ty_pl = .{17448 .data = .{ .ty_pl = .{
17462 .ty = .bool_type,17449 .ty = .bool,
17463 .payload = undefined,17450 .payload = undefined,
17464 } },17451 } },
17465 });17452 });
...@@ -17879,13 +17866,12 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr...@@ -17879,13 +17866,12 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr
17879 new.child = err_union_ty.errorUnionPayload(zcu).toIntern();17866 new.child = err_union_ty.errorUnionPayload(zcu).toIntern();
17880 break :info new;17867 break :info new;
17881 });17868 });
17882 const res_ty_ref = Air.internedToRef(res_ty.toIntern());
17883 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.TryPtr).@"struct".field_names.len +17869 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.TryPtr).@"struct".field_names.len +
17884 sub_block.instructions.items.len);17870 sub_block.instructions.items.len);
17885 const try_inst = try parent_block.addInst(.{17871 const try_inst = try parent_block.addInst(.{
17886 .tag = if (is_cold) .try_ptr_cold else .try_ptr,17872 .tag = if (is_cold) .try_ptr_cold else .try_ptr,
17887 .data = .{ .ty_pl = .{17873 .data = .{ .ty_pl = .{
17888 .ty = res_ty_ref,17874 .ty = res_ty,
17889 .payload = sema.addExtraAssumeCapacity(Air.TryPtr{17875 .payload = sema.addExtraAssumeCapacity(Air.TryPtr{
17890 .ptr = operand,17876 .ptr = operand,
17891 .body_len = @intCast(sub_block.instructions.items.len),17877 .body_len = @intCast(sub_block.instructions.items.len),
...@@ -18137,7 +18123,7 @@ fn maybePushErrorTrace(...@@ -18137,7 +18123,7 @@ fn maybePushErrorTrace(
18137 sema.air_instructions.appendAssumeCapacity(.{18123 sema.air_instructions.appendAssumeCapacity(.{
18138 .tag = .block,18124 .tag = .block,
18139 .data = .{ .ty_pl = .{18125 .data = .{ .ty_pl = .{
18140 .ty = .void_type,18126 .ty = .void,
18141 .payload = block_payload,18127 .payload = block_payload,
18142 } },18128 } },
18143 });18129 });
...@@ -19333,10 +19319,9 @@ fn zirArrayInit(...@@ -19333,10 +19319,9 @@ fn zirArrayInit(
19333 .child = array_ty.fieldType(i, zcu).toIntern(),19319 .child = array_ty.fieldType(i, zcu).toIntern(),
19334 .flags = .{ .address_space = target_util.defaultAddressSpace(target, .local) },19320 .flags = .{ .address_space = target_util.defaultAddressSpace(target, .local) },
19335 });19321 });
19336 const elem_ptr_ty_ref = Air.internedToRef(elem_ptr_ty.toIntern());
1933719322
19338 const index = try pt.intRef(.usize, i);19323 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);
19340 _ = try block.addBinOp(.store, elem_ptr, arg);19325 _ = try block.addBinOp(.store, elem_ptr, arg);
19341 }19326 }
19342 return sema.makePtrConst(block, alloc);19327 return sema.makePtrConst(block, alloc);
...@@ -19346,11 +19331,10 @@ fn zirArrayInit(...@@ -19346,11 +19331,10 @@ fn zirArrayInit(
19346 .child = array_ty.childType(zcu).toIntern(),19331 .child = array_ty.childType(zcu).toIntern(),
19347 .flags = .{ .address_space = target_util.defaultAddressSpace(target, .local) },19332 .flags = .{ .address_space = target_util.defaultAddressSpace(target, .local) },
19348 });19333 });
19349 const elem_ptr_ty_ref = Air.internedToRef(elem_ptr_ty.toIntern());
1935019334
19351 for (resolved_args, 0..) |arg, i| {19335 for (resolved_args, 0..) |arg, i| {
19352 const index = try pt.intRef(.usize, i);19336 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);
19354 _ = try block.addBinOp(.store, elem_ptr, arg);19338 _ = try block.addBinOp(.store, elem_ptr, arg);
19355 }19339 }
19356 return sema.makePtrConst(block, alloc);19340 return sema.makePtrConst(block, alloc);
...@@ -22239,7 +22223,7 @@ fn ptrCastFull(...@@ -22239,7 +22223,7 @@ fn ptrCastFull(
22239 break :ptr try block.addInst(.{22223 break :ptr try block.addInst(.{
22240 .tag = .addrspace_cast,22224 .tag = .addrspace_cast,
22241 .data = .{ .ty_op = .{22225 .data = .{ .ty_op = .{
22242 .ty = Air.internedToRef(intermediate_ty.toIntern()),22226 .ty = intermediate_ty,
22243 .operand = pre_addrspace_cast,22227 .operand = pre_addrspace_cast,
22244 } },22228 } },
22245 });22229 });
...@@ -22364,7 +22348,7 @@ fn ptrCastFull(...@@ -22364,7 +22348,7 @@ fn ptrCastFull(
22364 return block.addInst(.{22348 return block.addInst(.{
22365 .tag = .slice,22349 .tag = .slice,
22366 .data = .{ .ty_pl = .{22350 .data = .{ .ty_pl = .{
22367 .ty = Air.internedToRef(dest_ty.toIntern()),22351 .ty = dest_ty,
22368 .payload = try sema.addExtra(Air.Bin{22352 .payload = try sema.addExtra(Air.Bin{
22369 .lhs = coerced_ptr,22353 .lhs = coerced_ptr,
22370 .rhs = result_len,22354 .rhs = result_len,
...@@ -23233,7 +23217,7 @@ fn zirCmpxchg(...@@ -23233,7 +23217,7 @@ fn zirCmpxchg(
23233 return block.addInst(.{23217 return block.addInst(.{
23234 .tag = air_tag,23218 .tag = air_tag,
23235 .data = .{ .ty_pl = .{23219 .data = .{ .ty_pl = .{
23236 .ty = Air.internedToRef(result_ty.toIntern()),23220 .ty = result_ty,
23237 .payload = try sema.addExtra(Air.Cmpxchg{23221 .payload = try sema.addExtra(Air.Cmpxchg{
23238 .ptr = ptr,23222 .ptr = ptr,
23239 .expected_value = expected_value,23223 .expected_value = expected_value,
...@@ -23498,7 +23482,7 @@ fn analyzeShuffle(...@@ -23498,7 +23482,7 @@ fn analyzeShuffle(
23498 return block.addInst(.{23482 return block.addInst(.{
23499 .tag = .shuffle_two,23483 .tag = .shuffle_two,
23500 .data = .{ .ty_pl = .{23484 .data = .{ .ty_pl = .{
23501 .ty = Air.internedToRef(result_ty.toIntern()),23485 .ty = result_ty,
23502 .payload = air_extra_idx,23486 .payload = air_extra_idx,
23503 } },23487 } },
23504 });23488 });
...@@ -23517,7 +23501,7 @@ fn analyzeShuffle(...@@ -23517,7 +23501,7 @@ fn analyzeShuffle(
23517 return block.addInst(.{23501 return block.addInst(.{
23518 .tag = .shuffle_one,23502 .tag = .shuffle_one,
23519 .data = .{ .ty_pl = .{23503 .data = .{ .ty_pl = .{
23520 .ty = Air.internedToRef(result_ty.toIntern()),23504 .ty = result_ty,
23521 .payload = air_extra_idx,23505 .payload = air_extra_idx,
23522 } },23506 } },
23523 });23507 });
...@@ -23536,7 +23520,7 @@ fn analyzeShuffle(...@@ -23536,7 +23520,7 @@ fn analyzeShuffle(
23536 return block.addInst(.{23520 return block.addInst(.{
23537 .tag = .shuffle_one,23521 .tag = .shuffle_one,
23538 .data = .{ .ty_pl = .{23522 .data = .{ .ty_pl = .{
23539 .ty = Air.internedToRef(result_ty.toIntern()),23523 .ty = result_ty,
23540 .payload = air_extra_idx,23524 .payload = air_extra_idx,
23541 } },23525 } },
23542 });23526 });
...@@ -24083,7 +24067,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins...@@ -24083,7 +24067,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
24083 break :result try block.addInst(.{24067 break :result try block.addInst(.{
24084 .tag = .field_parent_ptr,24068 .tag = .field_parent_ptr,
24085 .data = .{ .ty_pl = .{24069 .data = .{ .ty_pl = .{
24086 .ty = .fromType(unaligned_parent_ptr_ty),24070 .ty = unaligned_parent_ptr_ty,
24087 .payload = try block.sema.addExtra(Air.FieldParentPtr{24071 .payload = try block.sema.addExtra(Air.FieldParentPtr{
24088 .field_ptr = casted_field_ptr,24072 .field_ptr = casted_field_ptr,
24089 .field_index = @intCast(field_index),24073 .field_index = @intCast(field_index),
...@@ -25939,7 +25923,7 @@ fn addSafetyCheckExtra(...@@ -25939,7 +25923,7 @@ fn addSafetyCheckExtra(
25939 sema.air_instructions.appendAssumeCapacity(.{25923 sema.air_instructions.appendAssumeCapacity(.{
25940 .tag = .block,25924 .tag = .block,
25941 .data = .{ .ty_pl = .{25925 .data = .{ .ty_pl = .{
25942 .ty = .void_type,25926 .ty = .void,
25943 .payload = sema.addExtraAssumeCapacity(Air.Block{25927 .payload = sema.addExtraAssumeCapacity(Air.Block{
25944 .body_len = 1,25928 .body_len = 1,
25945 }),25929 }),
...@@ -26485,7 +26469,7 @@ fn analyzeSpirvRuntimeArrayLen(...@@ -26485,7 +26469,7 @@ fn analyzeSpirvRuntimeArrayLen(
26485 return block.addInst(.{26469 return block.addInst(.{
26486 .tag = .spirv_runtime_array_len,26470 .tag = .spirv_runtime_array_len,
26487 .data = .{ .ty_pl = .{26471 .data = .{ .ty_pl = .{
26488 .ty = .u32_type,26472 .ty = .u32,
26489 .payload = try sema.addExtra(Air.StructField{26473 .payload = try sema.addExtra(Air.StructField{
26490 .struct_operand = struct_operand,26474 .struct_operand = struct_operand,
26491 .field_index = field_index,26475 .field_index = field_index,
...@@ -30935,7 +30919,7 @@ fn analyzeNavRefInner(sema: *Sema, block: *Block, src: LazySrcLoc, orig_nav_inde...@@ -30935,7 +30919,7 @@ fn analyzeNavRefInner(sema: *Sema, block: *Block, src: LazySrcLoc, orig_nav_inde
30935 return block.addInst(.{30919 return block.addInst(.{
30936 .tag = .runtime_nav_ptr,30920 .tag = .runtime_nav_ptr,
30937 .data = .{ .ty_nav = .{30921 .data = .{ .ty_nav = .{
30938 .ty = ptr_ty.toIntern(),30922 .ty = ptr_ty,
30939 .nav = nav_index,30923 .nav = nav_index,
30940 } },30924 } },
30941 });30925 });
...@@ -31898,7 +31882,7 @@ fn analyzeSlice(...@@ -31898,7 +31882,7 @@ fn analyzeSlice(
31898 const result = try block.addInst(.{31882 const result = try block.addInst(.{
31899 .tag = .slice,31883 .tag = .slice,
31900 .data = .{ .ty_pl = .{31884 .data = .{ .ty_pl = .{
31901 .ty = Air.internedToRef(return_ty.toIntern()),31885 .ty = return_ty,
31902 .payload = try sema.addExtra(Air.Bin{31886 .payload = try sema.addExtra(Air.Bin{
31903 .lhs = new_ptr,31887 .lhs = new_ptr,
31904 .rhs = new_len,31888 .rhs = new_len,
src/Zcu/PerThread.zig+1-1
...@@ -3378,7 +3378,7 @@ fn analyzeFuncBodyInner(...@@ -3378,7 +3378,7 @@ fn analyzeFuncBodyInner(
3378 sema.air_instructions.appendAssumeCapacity(.{3378 sema.air_instructions.appendAssumeCapacity(.{
3379 .tag = .arg,3379 .tag = .arg,
3380 .data = .{ .arg = .{3380 .data = .{ .arg = .{
3381 .ty = .fromIntern(param_ty.toIntern()),3381 .ty = param_ty,
3382 .zir_param_index = @intCast(zir_param_index),3382 .zir_param_index = @intCast(zir_param_index),
3383 } },3383 } },
3384 });3384 });
src/codegen/aarch64.zig+1-1
...@@ -75,7 +75,7 @@ pub fn generate(...@@ -75,7 +75,7 @@ pub fn generate(
75 const air_args = for (air_main_body, 0..) |air_inst_index, body_index| {75 const air_args = for (air_main_body, 0..) |air_inst_index, body_index| {
76 if (air.instructions.items(.tag)[@backingInt(air_inst_index)] != .arg) break air_main_body[0..body_index];76 if (air.instructions.items(.tag)[@backingInt(air_inst_index)] != .arg) break air_main_body[0..body_index];
77 const arg = air.instructions.items(.data)[@backingInt(air_inst_index)].arg;77 const arg = air.instructions.items(.data)[@backingInt(air_inst_index)].arg;
78 const param_ty = arg.ty.toType();78 const param_ty = arg.ty;
79 const param_vi = param_vi: {79 const param_vi = param_vi: {
80 if (arg.zir_param_index >= named_params_len) {80 if (arg.zir_param_index >= named_params_len) {
81 assert(func_type.is_var_args);81 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 {...@@ -279,7 +279,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
279 const unwrapped_asm = isel.air.unwrapAsm(air_inst_index);279 const unwrapped_asm = isel.air.unwrapAsm(air_inst_index);
280280
281 for (unwrapped_asm.outputs) |operand| if (operand != .none) try isel.analyzeUse(operand);281 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
284 air_body_index += 1;284 air_body_index += 1;
285 air_inst_index = air_body[air_body_index];285 air_inst_index = air_body[air_body_index];
...@@ -348,7 +348,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {...@@ -348,7 +348,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
348 => {348 => {
349 const ty_op = air_data[@backingInt(air_inst_index)].ty_op;349 const ty_op = air_data[@backingInt(air_inst_index)].ty_op;
350 maybe_noop: {350 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;
352 if (true) break :maybe_noop;352 if (true) break :maybe_noop;
353 if (ty_op.operand.toIndex()) |src_air_inst_index| {353 if (ty_op.operand.toIndex()) |src_air_inst_index| {
354 if (isel.hints.get(src_air_inst_index)) |hint_vpsi| {354 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 {...@@ -792,7 +792,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
792 },792 },
793 .aggregate_init => {793 .aggregate_init => {
794 const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl;794 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
797 for (elements) |element| try isel.analyzeUse(element);797 for (elements) |element| try isel.analyzeUse(element);
798 try isel.def_order.putNoClobber(gpa, air_inst_index, {});798 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,...@@ -2475,10 +2475,10 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
24752475
2476 const ty_pl = air.data(air.inst_index).ty_pl;2476 const ty_pl = air.data(air.inst_index).ty_pl;
2477 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;2477 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
2480 const base_vi = try isel.use(bin_op.lhs);2480 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);
2482 const base_part_vi = try base_part_it.only(isel);2482 const base_part_vi = try base_part_it.only(isel);
2483 const base_part_mat = try base_part_vi.?.matReg(isel);2483 const base_part_mat = try base_part_vi.?.matReg(isel);
2484 const index_vi = try isel.use(bin_op.rhs);2484 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,...@@ -2656,9 +2656,9 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
2656 const lhs_vi = try isel.use(bin_op.lhs);2656 const lhs_vi = try isel.use(bin_op.lhs);
2657 const rhs_vi = try isel.use(bin_op.rhs);2657 const rhs_vi = try isel.use(bin_op.rhs);
2658 const ty_size = lhs_vi.size(isel);2658 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);
2660 const overflow_vi = try overflow_it.only(isel);2660 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);
2662 const wrapped_vi = try wrapped_it.only(isel);2662 const wrapped_vi = try wrapped_it.only(isel);
2663 try wrapped_vi.?.addOrSubtract(isel, ty, lhs_vi, switch (air_tag) {2663 try wrapped_vi.?.addOrSubtract(isel, ty, lhs_vi, switch (air_tag) {
2664 else => unreachable,2664 else => unreachable,
...@@ -2731,11 +2731,11 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -2731,11 +2731,11 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
2731 if (!std.mem.eql(u8, name, "_")) {2731 if (!std.mem.eql(u8, name, "_")) {
2732 const operand_gop = try as.operands.getOrPut(gpa, name);2732 const operand_gop = try as.operands.getOrPut(gpa, name);
2733 if (operand_gop.found_existing) return isel.fail("duplicate output name: '{s}'", .{name});2733 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)) {
2735 0 => unreachable,2735 0 => unreachable,
2736 1...4 => output_ra.w(),2736 1...4 => output_ra.w(),
2737 5...8 => output_ra.x(),2737 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)}),
2739 } };2739 } };
2740 }2740 }
2741 } else if (std.mem.eql(u8, constraint, "=r")) {2741 } 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,...@@ -2746,11 +2746,11 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
2746 if (!std.mem.eql(u8, name, "_")) {2746 if (!std.mem.eql(u8, name, "_")) {
2747 const operand_gop = try as.operands.getOrPut(gpa, name);2747 const operand_gop = try as.operands.getOrPut(gpa, name);
2748 if (operand_gop.found_existing) return isel.fail("duplicate output name: '{s}'", .{name});2748 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)) {
2750 0 => unreachable,2750 0 => unreachable,
2751 1...4 => output_ra.w(),2751 1...4 => output_ra.w(),
2752 5...8 => output_ra.x(),2752 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)}),
2754 } };2754 } };
2755 }2755 }
2756 } else return isel.fail("invalid constraint: '{s}'", .{constraint}),2756 } 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,...@@ -3156,9 +3156,9 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
3156 defer res_vi.value.deref(isel);3156 defer res_vi.value.deref(isel);
31573157
3158 const ty_op = air.data(air.inst_index).ty_op;3158 const ty_op = air.data(air.inst_index).ty_op;
3159 const ty = ty_op.ty.toType();3159 const ty = ty_op.ty;
3160 const int_info: std.lang.Type.Int = int_info: {3160 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 };
3162 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });3162 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });
3163 break :int_info ty.intInfo(zcu);3163 break :int_info ty.intInfo(zcu);
3164 };3164 };
...@@ -3215,7 +3215,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -3215,7 +3215,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
3215 if (isel.live_values.fetchRemove(air.inst_index)) |dst_vi| unused: {3215 if (isel.live_values.fetchRemove(air.inst_index)) |dst_vi| unused: {
3216 defer dst_vi.value.deref(isel);3216 defer dst_vi.value.deref(isel);
3217 const ty_op = air.data(air.inst_index).ty_op;3217 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;
3219 const dst_tag = dst_ty.zigTypeTag(zcu);3219 const dst_tag = dst_ty.zigTypeTag(zcu);
3220 const src_ty = isel.air.typeOf(ty_op.operand, ip);3220 const src_ty = isel.air.typeOf(ty_op.operand, ip);
3221 const src_tag = src_ty.zigTypeTag(zcu);3221 const src_tag = src_ty.zigTypeTag(zcu);
...@@ -3869,7 +3869,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -3869,7 +3869,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
3869 defer res_vi.value.deref(isel);3869 defer res_vi.value.deref(isel);
38703870
3871 const ty_op = air.data(air.inst_index).ty_op;3871 const ty_op = air.data(air.inst_index).ty_op;
3872 const ty = ty_op.ty.toType();3872 const ty = ty_op.ty;
3873 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });3873 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });
3874 const int_info = ty.intInfo(zcu);3874 const int_info = ty.intInfo(zcu);
3875 if (int_info.bits > 64) return isel.fail("too big {t} {f}", .{ air_tag, isel.fmtType(ty) });3875 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,...@@ -3933,7 +3933,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
3933 defer res_vi.value.deref(isel);3933 defer res_vi.value.deref(isel);
39343934
3935 const ty_op = air.data(air.inst_index).ty_op;3935 const ty_op = air.data(air.inst_index).ty_op;
3936 const ty = ty_op.ty.toType();3936 const ty = ty_op.ty;
3937 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });3937 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });
3938 const int_info = ty.intInfo(zcu);3938 const int_info = ty.intInfo(zcu);
3939 if (int_info.bits > 64) return isel.fail("too big {t} {f}", .{ air_tag, isel.fmtType(ty) });3939 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,...@@ -4235,7 +4235,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
4235 defer res_vi.value.deref(isel);4235 defer res_vi.value.deref(isel);
42364236
4237 const ty_op = air.data(air.inst_index).ty_op;4237 const ty_op = air.data(air.inst_index).ty_op;
4238 const ty = ty_op.ty.toType();4238 const ty = ty_op.ty;
4239 if (!ty.isRuntimeFloat()) {4239 if (!ty.isRuntimeFloat()) {
4240 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });4240 if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) });
4241 switch (ty.intInfo(zcu).bits) {4241 switch (ty.intInfo(zcu).bits) {
...@@ -4860,7 +4860,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -4860,7 +4860,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
4860 const error_union_ptr_mat = try error_union_ptr_vi.matReg(isel);4860 const error_union_ptr_mat = try error_union_ptr_vi.matReg(isel);
4861 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {4861 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {
4862 defer payload_ptr_vi.value.deref(isel);4862 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)) {
4864 0 => try payload_ptr_vi.value.move(isel, unwrapped_try.error_union_ptr),4864 0 => try payload_ptr_vi.value.move(isel, unwrapped_try.error_union_ptr),
4865 else => |payload_offset| {4865 else => |payload_offset| {
4866 const payload_ptr_ra = try payload_ptr_vi.value.defReg(isel) orelse break :unused;4866 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,...@@ -4989,7 +4989,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
4989 if (size <= Value.max_parts and ip.zigTypeTag(ptr_info.child) != .@"union") {4989 if (size <= Value.max_parts and ip.zigTypeTag(ptr_info.child) != .@"union") {
4990 const ptr_vi = try isel.use(ty_op.operand);4990 const ptr_vi = try isel.use(ty_op.operand);
4991 const ptr_mat = try ptr_vi.matReg(isel);4991 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, .{
4993 .@"volatile" = ptr_info.flags.is_volatile,4993 .@"volatile" = ptr_info.flags.is_volatile,
4994 });4994 });
4995 try ptr_mat.finish(isel);4995 try ptr_mat.finish(isel);
...@@ -5137,7 +5137,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5137,7 +5137,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5137 defer dst_vi.value.deref(isel);5137 defer dst_vi.value.deref(isel);
51385138
5139 const ty_op = air.data(air.inst_index).ty_op;5139 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;
5141 const dst_bits = dst_ty.floatBits(isel.target);5141 const dst_bits = dst_ty.floatBits(isel.target);
5142 const src_ty = isel.air.typeOf(ty_op.operand, ip);5142 const src_ty = isel.air.typeOf(ty_op.operand, ip);
5143 const src_bits = src_ty.floatBits(isel.target);5143 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,...@@ -5247,7 +5247,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5247 defer dst_vi.value.deref(isel);5247 defer dst_vi.value.deref(isel);
52485248
5249 const ty_op = air.data(air.inst_index).ty_op;5249 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;
5251 const dst_int_info = dst_ty.intInfo(zcu);5251 const dst_int_info = dst_ty.intInfo(zcu);
5252 const src_ty = isel.air.typeOf(ty_op.operand, ip);5252 const src_ty = isel.air.typeOf(ty_op.operand, ip);
5253 const src_int_info = src_ty.intInfo(zcu);5253 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,...@@ -5338,7 +5338,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5338 defer dst_vi.value.deref(isel);5338 defer dst_vi.value.deref(isel);
53395339
5340 const ty_op = air.data(air.inst_index).ty_op;5340 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;
5342 const dst_int_info = dst_ty.intInfo(zcu);5342 const dst_int_info = dst_ty.intInfo(zcu);
5343 const src_ty = isel.air.typeOf(ty_op.operand, ip);5343 const src_ty = isel.air.typeOf(ty_op.operand, ip);
5344 const src_int_info = src_ty.intInfo(zcu);5344 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,...@@ -5440,7 +5440,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5440 defer dst_vi.value.deref(isel);5440 defer dst_vi.value.deref(isel);
54415441
5442 const ty_op = air.data(air.inst_index).ty_op;5442 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;
5444 const src_ty = isel.air.typeOf(ty_op.operand, ip);5444 const src_ty = isel.air.typeOf(ty_op.operand, ip);
5445 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) });5445 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) });
5446 const dst_int_info = dst_ty.intInfo(zcu);5446 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,...@@ -5536,7 +5536,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5536 const opt_vi = try isel.use(ty_op.operand);5536 const opt_vi = try isel.use(ty_op.operand);
5537 var payload_part_it = opt_vi.field(opt_ty, 0, payload_vi.value.size(isel));5537 var payload_part_it = opt_vi.field(opt_ty, 0, payload_vi.value.size(isel));
5538 const payload_part_vi = try payload_part_it.only(isel);5538 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.?);
5540 }5540 }
5541 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;5541 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
5542 },5542 },
...@@ -5576,16 +5576,16 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5576,16 +5576,16 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5576 defer opt_vi.value.deref(isel);5576 defer opt_vi.value.deref(isel);
55775577
5578 const ty_op = air.data(air.inst_index).ty_op;5578 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)) {
5580 try opt_vi.value.move(isel, ty_op.operand);5580 try opt_vi.value.move(isel, ty_op.operand);
5581 break :unused;5581 break :unused;
5582 }5582 }
55835583
5584 const payload_size = isel.air.typeOf(ty_op.operand, ip).abiSize(zcu);5584 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);
5586 const payload_part_vi = try payload_part_it.only(isel);5586 const payload_part_vi = try payload_part_it.only(isel);
5587 try payload_part_vi.?.move(isel, ty_op.operand);5587 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);
5589 const has_value_part_vi = try has_value_part_it.only(isel);5589 const has_value_part_vi = try has_value_part_it.only(isel);
5590 const has_value_part_ra = try has_value_part_vi.?.defReg(isel) orelse break :unused;5590 const has_value_part_ra = try has_value_part_vi.?.defReg(isel) orelse break :unused;
5591 try isel.emit(.movz(has_value_part_ra.w(), 1, .{ .lsl = .@"0" }));5591 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,...@@ -5602,11 +5602,11 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5602 const error_union_vi = try isel.use(ty_op.operand);5602 const error_union_vi = try isel.use(ty_op.operand);
5603 var payload_part_it = error_union_vi.field(5603 var payload_part_it = error_union_vi.field(
5604 error_union_ty,5604 error_union_ty,
5605 codegen.errUnionPayloadOffset(ty_op.ty.toType(), zcu),5605 codegen.errUnionPayloadOffset(ty_op.ty, zcu),
5606 payload_vi.value.size(isel),5606 payload_vi.value.size(isel),
5607 );5607 );
5608 const payload_part_vi = try payload_part_it.only(isel);5608 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.?);
5610 }5610 }
5611 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;5611 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
5612 },5612 },
...@@ -5624,7 +5624,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5624,7 +5624,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5624 error_set_vi.value.size(isel),5624 error_set_vi.value.size(isel),
5625 );5625 );
5626 const error_set_part_vi = try error_set_part_it.only(isel);5626 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.?);
5628 }5628 }
5629 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;5629 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
5630 },5630 },
...@@ -5632,7 +5632,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5632,7 +5632,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5632 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {5632 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {
5633 defer payload_ptr_vi.value.deref(isel);5633 defer payload_ptr_vi.value.deref(isel);
5634 const ty_op = air.data(air.inst_index).ty_op;5634 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)) {
5636 0 => try payload_ptr_vi.value.move(isel, ty_op.operand),5636 0 => try payload_ptr_vi.value.move(isel, ty_op.operand),
5637 else => |payload_offset| {5637 else => |payload_offset| {
5638 const payload_ptr_ra = try payload_ptr_vi.value.defReg(isel) orelse break :unused;5638 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,...@@ -5660,7 +5660,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5660 const error_union_ptr_info = error_union_ptr_ty.ptrInfo(zcu);5660 const error_union_ptr_info = error_union_ptr_ty.ptrInfo(zcu);
5661 const error_union_ptr_vi = try isel.use(ty_op.operand);5661 const error_union_ptr_vi = try isel.use(ty_op.operand);
5662 const error_union_ptr_mat = try error_union_ptr_vi.matReg(isel);5662 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, .{
5664 .offset = codegen.errUnionErrorOffset(5664 .offset = codegen.errUnionErrorOffset(
5665 ZigType.fromInterned(error_union_ptr_info.child).errorUnionPayload(zcu),5665 ZigType.fromInterned(error_union_ptr_info.child).errorUnionPayload(zcu),
5666 zcu,5666 zcu,
...@@ -5675,7 +5675,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5675,7 +5675,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5675 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {5675 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {
5676 defer payload_ptr_vi.value.deref(isel);5676 defer payload_ptr_vi.value.deref(isel);
5677 const ty_op = air.data(air.inst_index).ty_op;5677 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);
5679 const error_union_ty = isel.air.typeOf(ty_op.operand, ip).childType(zcu);5679 const error_union_ty = isel.air.typeOf(ty_op.operand, ip).childType(zcu);
5680 const error_set_size = error_union_ty.errorUnionSet(zcu).abiSize(zcu);5680 const error_set_size = error_union_ty.errorUnionSet(zcu).abiSize(zcu);
5681 const error_union_ptr_vi = try isel.use(ty_op.operand);5681 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,...@@ -5712,7 +5712,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5712 defer error_union_vi.value.deref(isel);5712 defer error_union_vi.value.deref(isel);
57135713
5714 const ty_op = air.data(air.inst_index).ty_op;5714 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;
5716 const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type;5716 const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type;
5717 const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type);5717 const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type);
5718 const payload_ty: ZigType = .fromInterned(error_union_info.payload_type);5718 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,...@@ -5739,7 +5739,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5739 defer error_union_vi.value.deref(isel);5739 defer error_union_vi.value.deref(isel);
57405740
5741 const ty_op = air.data(air.inst_index).ty_op;5741 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;
5743 const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type;5743 const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type;
5744 const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type);5744 const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type);
5745 const payload_ty: ZigType = .fromInterned(error_union_info.payload_type);5745 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,...@@ -5766,7 +5766,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5766 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;5766 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;
5767 switch (codegen.fieldOffset(5767 switch (codegen.fieldOffset(
5768 isel.air.typeOf(extra.struct_operand, ip),5768 isel.air.typeOf(extra.struct_operand, ip),
5769 ty_pl.ty.toType(),5769 ty_pl.ty,
5770 extra.field_index,5770 extra.field_index,
5771 zcu,5771 zcu,
5772 )) {5772 )) {
...@@ -5799,7 +5799,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5799,7 +5799,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5799 const ty_op = air.data(air.inst_index).ty_op;5799 const ty_op = air.data(air.inst_index).ty_op;
5800 switch (codegen.fieldOffset(5800 switch (codegen.fieldOffset(
5801 isel.air.typeOf(ty_op.operand, ip),5801 isel.air.typeOf(ty_op.operand, ip),
5802 ty_op.ty.toType(),5802 ty_op.ty,
5803 switch (air_tag) {5803 switch (air_tag) {
5804 else => unreachable,5804 else => unreachable,
5805 .struct_field_ptr_index_0 => 0,5805 .struct_field_ptr_index_0 => 0,
...@@ -5835,7 +5835,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5835,7 +5835,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5835 const ty_pl = air.data(air.inst_index).ty_pl;5835 const ty_pl = air.data(air.inst_index).ty_pl;
5836 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;5836 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;
5837 const agg_ty = isel.air.typeOf(extra.struct_operand, ip);5837 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;
5839 const field_bit_offset, const field_bit_size, const is_packed = switch (agg_ty.containerLayout(zcu)) {5839 const field_bit_offset, const field_bit_size, const is_packed = switch (agg_ty.containerLayout(zcu)) {
5840 .auto, .@"extern" => .{5840 .auto, .@"extern" => .{
5841 8 * agg_ty.structFieldOffset(extra.field_index, zcu),5841 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,...@@ -5861,7 +5861,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5861 .@"struct" => {5861 .@"struct" => {
5862 var agg_part_it = agg_vi.field(agg_ty, @divExact(field_bit_offset, 8), @divExact(field_bit_size, 8));5862 var agg_part_it = agg_vi.field(agg_ty, @divExact(field_bit_offset, 8), @divExact(field_bit_size, 8));
5863 while (try agg_part_it.next(isel)) |agg_part| {5863 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));
5865 const field_part_vi = try field_part_it.only(isel);5865 const field_part_vi = try field_part_it.only(isel);
5866 if (field_part_vi.? == agg_part.vi) continue;5866 if (field_part_vi.? == agg_part.vi) continue;
5867 var field_subpart_it = field_part_vi.?.parts(isel);5867 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,...@@ -5931,7 +5931,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5931 const union_vi = try isel.use(ty_op.operand);5931 const union_vi = try isel.use(ty_op.operand);
5932 var tag_part_it = union_vi.field(union_ty, union_layout.tagOffset(), union_layout.tag_size);5932 var tag_part_it = union_vi.field(union_ty, union_layout.tagOffset(), union_layout.tag_size);
5933 const tag_part_vi = try tag_part_it.only(isel);5933 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.?);
5935 }5935 }
5936 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;5936 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
5937 },5937 },
...@@ -5940,10 +5940,10 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5940,10 +5940,10 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5940 defer slice_vi.value.deref(isel);5940 defer slice_vi.value.deref(isel);
5941 const ty_pl = air.data(air.inst_index).ty_pl;5941 const ty_pl = air.data(air.inst_index).ty_pl;
5942 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;5942 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);
5944 const ptr_part_vi = try ptr_part_it.only(isel);5944 const ptr_part_vi = try ptr_part_it.only(isel);
5945 try ptr_part_vi.?.move(isel, bin_op.lhs);5945 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);
5947 const len_part_vi = try len_part_it.only(isel);5947 const len_part_vi = try len_part_it.only(isel);
5948 try len_part_vi.?.move(isel, bin_op.rhs);5948 try len_part_vi.?.move(isel, bin_op.rhs);
5949 }5949 }
...@@ -5956,7 +5956,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5956,7 +5956,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5956 const slice_vi = try isel.use(ty_op.operand);5956 const slice_vi = try isel.use(ty_op.operand);
5957 var len_part_it = slice_vi.field(isel.air.typeOf(ty_op.operand, ip), 8, 8);5957 var len_part_it = slice_vi.field(isel.air.typeOf(ty_op.operand, ip), 8, 8);
5958 const len_part_vi = try len_part_it.only(isel);5958 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.?);
5960 }5960 }
5961 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;5961 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
5962 },5962 },
...@@ -5967,7 +5967,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5967,7 +5967,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5967 const slice_vi = try isel.use(ty_op.operand);5967 const slice_vi = try isel.use(ty_op.operand);
5968 var ptr_part_it = slice_vi.field(isel.air.typeOf(ty_op.operand, ip), 0, 8);5968 var ptr_part_it = slice_vi.field(isel.air.typeOf(ty_op.operand, ip), 0, 8);
5969 const ptr_part_vi = try ptr_part_it.only(isel);5969 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.?);
5971 }5971 }
5972 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;5972 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
5973 },5973 },
...@@ -6180,7 +6180,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -6180,7 +6180,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
61806180
6181 const ty_pl = air.data(air.inst_index).ty_pl;6181 const ty_pl = air.data(air.inst_index).ty_pl;
6182 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;6182 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
6185 const slice_vi = try isel.use(bin_op.lhs);6185 const slice_vi = try isel.use(bin_op.lhs);
6186 var ptr_part_it = slice_vi.field(isel.air.typeOf(bin_op.lhs, ip), 0, 8);6186 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,...@@ -6286,7 +6286,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
62866286
6287 const ty_pl = air.data(air.inst_index).ty_pl;6287 const ty_pl = air.data(air.inst_index).ty_pl;
6288 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;6288 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
6291 const base_vi = try isel.use(bin_op.lhs);6291 const base_vi = try isel.use(bin_op.lhs);
6292 const base_mat = try base_vi.matReg(isel);6292 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,...@@ -6301,10 +6301,10 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
6301 if (isel.live_values.fetchRemove(air.inst_index)) |slice_vi| {6301 if (isel.live_values.fetchRemove(air.inst_index)) |slice_vi| {
6302 defer slice_vi.value.deref(isel);6302 defer slice_vi.value.deref(isel);
6303 const ty_op = air.data(air.inst_index).ty_op;6303 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);
6305 const ptr_part_vi = try ptr_part_it.only(isel);6305 const ptr_part_vi = try ptr_part_it.only(isel);
6306 try ptr_part_vi.?.move(isel, ty_op.operand);6306 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);
6308 const len_part_vi = try len_part_it.only(isel);6308 const len_part_vi = try len_part_it.only(isel);
6309 if (try len_part_vi.?.defReg(isel)) |len_ra| try isel.movImmediate(6309 if (try len_part_vi.?.defReg(isel)) |len_ra| try isel.movImmediate(
6310 len_ra.x(),6310 len_ra.x(),
...@@ -6318,7 +6318,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -6318,7 +6318,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
6318 defer dst_vi.value.deref(isel);6318 defer dst_vi.value.deref(isel);
63196319
6320 const ty_op = air.data(air.inst_index).ty_op;6320 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;
6322 const src_ty = isel.air.typeOf(ty_op.operand, ip);6322 const src_ty = isel.air.typeOf(ty_op.operand, ip);
6323 if (!dst_ty.isAbiInt(zcu)) return isel.fail("bad {t} {f} {f}", .{ air_tag, isel.fmtType(dst_ty), isel.fmtType(src_ty) });6323 if (!dst_ty.isAbiInt(zcu)) return isel.fail("bad {t} {f} {f}", .{ air_tag, isel.fmtType(dst_ty), isel.fmtType(src_ty) });
6324 const dst_int_info = dst_ty.intInfo(zcu);6324 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,...@@ -6460,7 +6460,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
6460 defer dst_vi.value.deref(isel);6460 defer dst_vi.value.deref(isel);
64616461
6462 const ty_op = air.data(air.inst_index).ty_op;6462 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;
6464 const src_ty = isel.air.typeOf(ty_op.operand, ip);6464 const src_ty = isel.air.typeOf(ty_op.operand, ip);
6465 const dst_bits = dst_ty.floatBits(isel.target);6465 const dst_bits = dst_ty.floatBits(isel.target);
6466 if (!src_ty.isAbiInt(zcu)) return isel.fail("bad {t} {f} {f}", .{ air_tag, isel.fmtType(dst_ty), isel.fmtType(src_ty) });6466 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,...@@ -6884,7 +6884,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
6884 defer agg_vi.value.deref(isel);6884 defer agg_vi.value.deref(isel);
68856885
6886 const ty_pl = air.data(air.inst_index).ty_pl;6886 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;
6888 switch (ip.indexToKey(agg_ty.toIntern())) {6888 switch (ip.indexToKey(agg_ty.toIntern())) {
6889 .array_type => |array_type| {6889 .array_type => |array_type| {
6890 const elems: []const Air.Inst.Ref =6890 const elems: []const Air.Inst.Ref =
...@@ -6959,7 +6959,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -6959,7 +6959,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
69596959
6960 const ty_pl = air.data(air.inst_index).ty_pl;6960 const ty_pl = air.data(air.inst_index).ty_pl;
6961 const extra = isel.air.extraData(Air.UnionInit, ty_pl.payload).data;6961 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;
6963 const loaded_union = ip.loadUnionType(union_ty.toIntern());6963 const loaded_union = ip.loadUnionType(union_ty.toIntern());
6964 const union_layout = ZigType.getUnionLayout(loaded_union, zcu);6964 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,...@@ -7171,7 +7171,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
7171 const ty_pl = air.data(air.inst_index).ty_pl;7171 const ty_pl = air.data(air.inst_index).ty_pl;
7172 const extra = isel.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;7172 const extra = isel.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
7173 switch (codegen.fieldOffset(7173 switch (codegen.fieldOffset(
7174 ty_pl.ty.toType(),7174 ty_pl.ty,
7175 isel.air.typeOf(extra.field_ptr, ip),7175 isel.air.typeOf(extra.field_ptr, ip),
7176 extra.field_index,7176 extra.field_index,
7177 zcu,7177 zcu,
...@@ -7259,7 +7259,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -7259,7 +7259,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
7259 const maybe_arg_vi = isel.live_values.fetchRemove(air.inst_index);7259 const maybe_arg_vi = isel.live_values.fetchRemove(air.inst_index);
7260 defer if (maybe_arg_vi) |arg_vi| arg_vi.value.deref(isel);7260 defer if (maybe_arg_vi) |arg_vi| arg_vi.value.deref(isel);
7261 const ty_op = air.data(air.inst_index).ty_op;7261 const ty_op = air.data(air.inst_index).ty_op;
7262 const ty = ty_op.ty.toType();7262 const ty = ty_op.ty;
7263 var param_it: CallAbiIterator = .init;7263 var param_it: CallAbiIterator = .init;
7264 const param_vi = try param_it.param(isel, ty);7264 const param_vi = try param_it.param(isel, ty);
7265 defer param_vi.?.deref(isel);7265 defer param_vi.?.deref(isel);
...@@ -7459,7 +7459,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -7459,7 +7459,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
7459 const ty_op = air.data(air.inst_index).ty_op;7459 const ty_op = air.data(air.inst_index).ty_op;
7460 const va_list_ptr_vi = try isel.use(ty_op.operand);7460 const va_list_ptr_vi = try isel.use(ty_op.operand);
7461 const va_list_ptr_mat = try va_list_ptr_vi.matReg(isel);7461 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, .{});
7463 try va_list_ptr_mat.finish(isel);7463 try va_list_ptr_mat.finish(isel);
7464 }7464 }
7465 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;7465 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...@@ -3413,7 +3413,7 @@ fn airIntCast(f: *Function, inst: Air.Inst.Index, operation: []const u8, info: B
3413 const zcu = pt.zcu;3413 const zcu = pt.zcu;
3414 const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op;3414 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;
3417 const inst_scalar_ty = inst_ty.scalarType(zcu);3417 const inst_scalar_ty = inst_ty.scalarType(zcu);
3418 const operand_ty = f.typeOf(ty_op.operand);3418 const operand_ty = f.typeOf(ty_op.operand);
3419 const operand_scalar_ty = operand_ty.scalarType(zcu);3419 const operand_scalar_ty = operand_ty.scalarType(zcu);
...@@ -7219,7 +7219,7 @@ fn airMulAdd(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -7219,7 +7219,7 @@ fn airMulAdd(f: *Function, inst: Air.Inst.Index) !CValue {
7219fn airRuntimeNavPtr(f: *Function, inst: Air.Inst.Index) !CValue {7219fn airRuntimeNavPtr(f: *Function, inst: Air.Inst.Index) !CValue {
7220 const ty_nav = f.air.instructions.items(.data)[@backingInt(inst)].ty_nav;7220 const ty_nav = f.air.instructions.items(.data)[@backingInt(inst)].ty_nav;
7221 const w = &f.code.writer;7221 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);
7223 try f.writeCValue(w, local, .other);7223 try f.writeCValue(w, local, .other);
7224 try w.writeAll(" = ");7224 try w.writeAll(" = ");
7225 try f.dg.renderNav(w, ty_nav.nav, .other);7225 try f.dg.renderNav(w, ty_nav.nav, .other);
...@@ -7261,7 +7261,7 @@ fn airCVaArg(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -7261,7 +7261,7 @@ fn airCVaArg(f: *Function, inst: Air.Inst.Index) !CValue {
7261 try w.writeAll(" = va_arg(*(va_list *)");7261 try w.writeAll(" = va_arg(*(va_list *)");
7262 try f.writeCValue(w, va_list, .other);7262 try f.writeCValue(w, va_list, .other);
7263 try w.writeAll(", ");7263 try w.writeAll(", ");
7264 try f.renderType(w, ty_op.ty.toType());7264 try f.renderType(w, ty_op.ty);
7265 try w.writeAll(");");7265 try w.writeAll(");");
7266 try f.newline();7266 try f.newline();
7267 return local;7267 return local;
src/codegen/llvm/FuncGen.zig+6-6
...@@ -1164,7 +1164,7 @@ fn airRetLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void {...@@ -1164,7 +1164,7 @@ fn airRetLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void {
1164fn airCVaArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {1164fn airCVaArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {
1165 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;1165 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;
1166 const list = try self.resolveInst(ty_op.operand);1166 const list = try self.resolveInst(ty_op.operand);
1167 const arg_ty = ty_op.ty.toType();1167 const arg_ty = ty_op.ty;
1168 const llvm_arg_ty = try self.object.lowerType(arg_ty, .as_value);1168 const llvm_arg_ty = try self.object.lowerType(arg_ty, .as_value);
11691169
1170 return self.wip.vaArg(list, llvm_arg_ty, "");1170 return self.wip.vaArg(list, llvm_arg_ty, "");
...@@ -1175,7 +1175,7 @@ fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu...@@ -1175,7 +1175,7 @@ fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu
1175 const zcu = o.zcu;1175 const zcu = o.zcu;
1176 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;1176 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;
1177 const src_list = try self.resolveInst(ty_op.operand);1177 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
1180 const dest_list = try self.buildZigAlloca(va_list_ty, .none);1180 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...@@ -2393,11 +2393,11 @@ fn airFieldParentPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Build
23932393
2394 const field_ptr = try self.resolveInst(extra.field_ptr);2394 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);
2397 const field_offset = parent_ty.structFieldOffset(extra.field_index, zcu);2397 const field_offset = parent_ty.structFieldOffset(extra.field_index, zcu);
2398 if (field_offset == 0) return field_ptr;2398 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);
2401 const llvm_usize = try o.lowerType(.usize, .as_value);2401 const llvm_usize = try o.lowerType(.usize, .as_value);
24022402
2403 const field_ptr_int = try self.wip.cast(.ptrtoint, field_ptr, llvm_usize, "");2403 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...@@ -3191,7 +3191,7 @@ fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) Allocator.Er
3191 const zcu = self.object.zcu;3191 const zcu = self.object.zcu;
31923192
3193 const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl;3193 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;
3195 const field_index = ty_pl.payload;3195 const field_index = ty_pl.payload;
31963196
3197 assert(self.err_ret_trace != .none);3197 assert(self.err_ret_trace != .none);
...@@ -5902,7 +5902,7 @@ fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui...@@ -5902,7 +5902,7 @@ fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui
5902 const ip = &zcu.intern_pool;5902 const ip = &zcu.intern_pool;
5903 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;5903 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;
5904 const operand = try self.resolveInst(ty_op.operand);5904 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
5907 const names = error_set_ty.errorSetNames(zcu);5907 const names = error_set_ty.errorSetNames(zcu);
5908 const valid_block = try self.wip.block(@intCast(names.len), "Valid");5908 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 {...@@ -3536,7 +3536,7 @@ fn airWrapErrUnionPayload(func: *Func, inst: Air.Inst.Index) !void {
3536 const zcu = pt.zcu;3536 const zcu = pt.zcu;
3537 const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op;3537 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;
3540 const pl_ty = eu_ty.errorUnionPayload(zcu);3540 const pl_ty = eu_ty.errorUnionPayload(zcu);
3541 const err_ty = eu_ty.errorUnionSet(zcu);3541 const err_ty = eu_ty.errorUnionSet(zcu);
3542 const operand = try func.resolveInst(ty_op.operand);3542 const operand = try func.resolveInst(ty_op.operand);
...@@ -3561,7 +3561,7 @@ fn airWrapErrUnionErr(func: *Func, inst: Air.Inst.Index) !void {...@@ -3561,7 +3561,7 @@ fn airWrapErrUnionErr(func: *Func, inst: Air.Inst.Index) !void {
3561 const zcu = pt.zcu;3561 const zcu = pt.zcu;
3562 const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op;3562 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;
3565 const pl_ty = eu_ty.errorUnionPayload(zcu);3565 const pl_ty = eu_ty.errorUnionPayload(zcu);
3566 const err_ty = eu_ty.errorUnionSet(zcu);3566 const err_ty = eu_ty.errorUnionSet(zcu);
35673567
...@@ -3583,7 +3583,7 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void {...@@ -3583,7 +3583,7 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void {
3583 const zcu = func.pt.zcu;3583 const zcu = func.pt.zcu;
3584 const ip = &zcu.intern_pool;3584 const ip = &zcu.intern_pool;
3585 const ty_nav = func.air.instructions.items(.data)[@backingInt(inst)].ty_nav;3585 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
3588 const nav = ip.getNav(ty_nav.nav);3588 const nav = ip.getNav(ty_nav.nav);
3589 const tlv_sym_index = if (func.bin_file.cast(.elf)) |elf_file| sym: {3589 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 {...@@ -7295,7 +7295,7 @@ fn airFloatFromInt(func: *Func, inst: Air.Inst.Index) !void {
7295 const operand = try func.resolveInst(ty_op.operand);7295 const operand = try func.resolveInst(ty_op.operand);
72967296
7297 const src_ty = func.typeOf(ty_op.operand);7297 const src_ty = func.typeOf(ty_op.operand);
7298 const dst_ty = ty_op.ty.toType();7298 const dst_ty = ty_op.ty;
72997299
7300 const src_reg, const src_lock = try func.promoteReg(src_ty, operand);7300 const src_reg, const src_lock = try func.promoteReg(src_ty, operand);
7301 defer if (src_lock) |lock| func.register_manager.unlockReg(lock);7301 defer if (src_lock) |lock| func.register_manager.unlockReg(lock);
...@@ -7358,7 +7358,7 @@ fn airIntFromFloat(func: *Func, inst: Air.Inst.Index) !void {...@@ -7358,7 +7358,7 @@ fn airIntFromFloat(func: *Func, inst: Air.Inst.Index) !void {
73587358
7359 const operand = try func.resolveInst(ty_op.operand);7359 const operand = try func.resolveInst(ty_op.operand);
7360 const src_ty = func.typeOf(ty_op.operand);7360 const src_ty = func.typeOf(ty_op.operand);
7361 const dst_ty = ty_op.ty.toType();7361 const dst_ty = ty_op.ty;
73627362
7363 const is_unsigned = dst_ty.isUnsignedInt(zcu);7363 const is_unsigned = dst_ty.isUnsignedInt(zcu);
7364 const src_bits = src_ty.bitSize(zcu);7364 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 {...@@ -2650,7 +2650,7 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void {
2650 const zcu = pt.zcu;2650 const zcu = pt.zcu;
2651 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;2651 const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op;
2652 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {2652 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;
2654 const payload_ty = error_union_ty.errorUnionPayload(zcu);2654 const payload_ty = error_union_ty.errorUnionPayload(zcu);
2655 const mcv = try self.resolveInst(ty_op.operand);2655 const mcv = try self.resolveInst(ty_op.operand);
2656 if (!payload_ty.hasRuntimeBits(zcu)) break :result mcv;2656 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 {...@@ -7064,7 +7064,7 @@ fn airFieldParentPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
7064 const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl;7064 const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl;
7065 const extra = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;7065 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;
7068 const parent_ty = parent_ptr_ty.childType(zcu);7068 const parent_ty = parent_ptr_ty.childType(zcu);
7069 const result_ty_id = try cg.resolveType(parent_ptr_ty, .indirect);7069 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 {...@@ -1591,7 +1591,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
1591 .int_cast => {1591 .int_cast => {
1592 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;1592 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;
1595 const operand = try cg.resolveInst(ty_op.operand);1595 const operand = try cg.resolveInst(ty_op.operand);
1596 const src_ty = cg.typeOf(ty_op.operand);1596 const src_ty = cg.typeOf(ty_op.operand);
15971597
...@@ -1620,7 +1620,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -1620,7 +1620,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
1620 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;1620 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;
16211621
1622 const operand = try cg.resolveInst(ty_op.operand);1622 const operand = try cg.resolveInst(ty_op.operand);
1623 const dest_ty = ty_op.ty.toType();1623 const dest_ty = ty_op.ty;
1624 const src_ty = cg.typeOf(ty_op.operand);1624 const src_ty = cg.typeOf(ty_op.operand);
16251625
1626 if (dest_ty.zigTypeTag(zcu) == .vector or src_ty.zigTypeTag(zcu) == .vector) {1626 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 {...@@ -2385,7 +2385,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
2385 const zcu = pt.zcu;2385 const zcu = pt.zcu;
2386 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;2386 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;
2387 const operand = try cg.resolveInst(ty_op.operand);2387 const operand = try cg.resolveInst(ty_op.operand);
2388 const elem_ty = ty_op.ty.toType();2388 const elem_ty = ty_op.ty;
2389 const ptr_ty = cg.typeOf(ty_op.operand);2389 const ptr_ty = cg.typeOf(ty_op.operand);
2390 const ptr_info = ptr_ty.ptrInfo(zcu);2390 const ptr_info = ptr_ty.ptrInfo(zcu);
23912391
...@@ -6176,7 +6176,7 @@ fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -6176,7 +6176,7 @@ fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6176 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;6176 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;
61776177
6178 const operand = try cg.resolveInst(ty_op.operand);6178 const operand = try cg.resolveInst(ty_op.operand);
6179 const err_ty = ty_op.ty.toType();6179 const err_ty = ty_op.ty;
6180 const pl_ty = err_ty.errorUnionPayload(zcu);6180 const pl_ty = err_ty.errorUnionPayload(zcu);
61816181
6182 const result = result: {6182 const result = result: {
...@@ -6402,7 +6402,7 @@ fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -6402,7 +6402,7 @@ fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6402 const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl;6402 const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl;
6403 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;6403 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);
6406 const elem_size = elem_ty.abiSize(zcu);6406 const elem_size = elem_ty.abiSize(zcu);
64076407
6408 const slice = try cg.resolveInst(bin_op.lhs);6408 const slice = try cg.resolveInst(bin_op.lhs);
...@@ -6441,7 +6441,7 @@ fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -6441,7 +6441,7 @@ fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
64416441
6442 const operand = try cg.resolveInst(ty_op.operand);6442 const operand = try cg.resolveInst(ty_op.operand);
6443 const array_ty = cg.typeOf(ty_op.operand).childType(zcu);6443 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
6446 // create a slice on the stack6446 // create a slice on the stack
6447 const slice_local = try cg.allocStack(slice_ty);6447 const slice_local = try cg.allocStack(slice_ty);
...@@ -6489,7 +6489,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -6489,7 +6489,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6489 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;6489 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
64906490
6491 const ptr_ty = cg.typeOf(bin_op.lhs);6491 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);
6493 const elem_size = elem_ty.abiSize(zcu);6493 const elem_size = elem_ty.abiSize(zcu);
64946494
6495 const ptr = try cg.resolveInst(bin_op.lhs);6495 const ptr = try cg.resolveInst(bin_op.lhs);
...@@ -7499,7 +7499,7 @@ fn airErrorSetHasValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -7499,7 +7499,7 @@ fn airErrorSetHasValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
7499 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;7499 const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op;
75007500
7501 const operand = try cg.resolveInst(ty_op.operand);7501 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;
7503 const result = try cg.allocLocal(Type.bool);7503 const result = try cg.allocLocal(Type.bool);
75047504
7505 const names = error_set_ty.errorSetNames(zcu);7505 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 {...@@ -43354,7 +43354,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
43354 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });43354 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
43355 try ops[0].toSlicePtr(cg);43355 try ops[0].toSlicePtr(cg);
43356 var res: [1]Temp = undefined;43356 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 &.{ .{
43358 .patterns = &.{43358 .patterns = &.{
43359 .{ .src = .{ .to_gpr, .simm32, .none } },43359 .{ .src = .{ .to_gpr, .simm32, .none } },
43360 },43360 },
...@@ -43468,7 +43468,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -43468,7 +43468,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
43468 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });43468 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
43469 try ops[0].toSlicePtr(cg);43469 try ops[0].toSlicePtr(cg);
43470 var res: [1]Temp = undefined;43470 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 &.{ .{
43472 .patterns = &.{43472 .patterns = &.{
43473 .{ .src = .{ .to_gpr, .simm32, .none } },43473 .{ .src = .{ .to_gpr, .simm32, .none } },
43474 },43474 },
...@@ -52208,7 +52208,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -52208,7 +52208,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
52208 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;52208 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
52209 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });52209 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
52210 var res: [2]Temp = undefined;52210 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 &.{ .{
52212 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .exact_signed_int = 8 }, .any },52212 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .exact_signed_int = 8 }, .any },
52213 .patterns = &.{52213 .patterns = &.{
52214 .{ .src = .{ .to_mut_gpr, .imm8, .none } },52214 .{ .src = .{ .to_mut_gpr, .imm8, .none } },
...@@ -53044,7 +53044,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -53044,7 +53044,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
53044 } }) catch |err| switch (err) {53044 } }) catch |err| switch (err) {
53045 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{53045 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
53046 @tagName(air_tag),53046 @tagName(air_tag),
53047 ty_pl.ty.toType().fmt(pt),53047 ty_pl.ty.fmt(pt),
53048 ops[0].tracking(cg),53048 ops[0].tracking(cg),
53049 ops[1].tracking(cg),53049 ops[1].tracking(cg),
53050 }),53050 }),
...@@ -53058,7 +53058,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -53058,7 +53058,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
53058 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;53058 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
53059 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });53059 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
53060 var res: [2]Temp = undefined;53060 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 &.{ .{
53062 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .exact_signed_int = 8 }, .any },53062 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .exact_signed_int = 8 }, .any },
53063 .patterns = &.{53063 .patterns = &.{
53064 .{ .src = .{ .to_mut_gpr, .imm8, .none } },53064 .{ .src = .{ .to_mut_gpr, .imm8, .none } },
...@@ -53949,7 +53949,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -53949,7 +53949,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
53949 } }) catch |err| switch (err) {53949 } }) catch |err| switch (err) {
53950 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{53950 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
53951 @tagName(air_tag),53951 @tagName(air_tag),
53952 ty_pl.ty.toType().fmt(pt),53952 ty_pl.ty.fmt(pt),
53953 ops[0].tracking(cg),53953 ops[0].tracking(cg),
53954 ops[1].tracking(cg),53954 ops[1].tracking(cg),
53955 }),53955 }),
...@@ -53963,7 +53963,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -53963,7 +53963,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
53963 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;53963 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
53964 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });53964 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
53965 var res: [2]Temp = undefined;53965 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 &.{ .{
53967 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .exact_signed_int = 8 }, .any },53967 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .exact_signed_int = 8 }, .any },
53968 .patterns = &.{53968 .patterns = &.{
53969 .{ .src = .{ .{ .to_reg = .al }, .mem, .none } },53969 .{ .src = .{ .{ .to_reg = .al }, .mem, .none } },
...@@ -57546,7 +57546,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -57546,7 +57546,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
57546 } }) catch |err| switch (err) {57546 } }) catch |err| switch (err) {
57547 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{57547 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
57548 @tagName(air_tag),57548 @tagName(air_tag),
57549 ty_pl.ty.toType().fmt(pt),57549 ty_pl.ty.fmt(pt),
57550 ops[0].tracking(cg),57550 ops[0].tracking(cg),
57551 ops[1].tracking(cg),57551 ops[1].tracking(cg),
57552 }),57552 }),
...@@ -57560,7 +57560,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -57560,7 +57560,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
57560 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;57560 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
57561 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });57561 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
57562 var res: [2]Temp = undefined;57562 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 &.{ .{
57564 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .unsigned_int = .byte }, .any },57564 .src_constraints = .{ .{ .exact_signed_int = 8 }, .{ .unsigned_int = .byte }, .any },
57565 .patterns = &.{57565 .patterns = &.{
57566 .{ .src = .{ .mut_mem, .{ .imm = 1 }, .none } },57566 .{ .src = .{ .mut_mem, .{ .imm = 1 }, .none } },
...@@ -60891,7 +60891,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -60891,7 +60891,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
60891 } }) catch |err| switch (err) {60891 } }) catch |err| switch (err) {
60892 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{60892 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
60893 @tagName(air_tag),60893 @tagName(air_tag),
60894 ty_pl.ty.toType().fmt(pt),60894 ty_pl.ty.fmt(pt),
60895 ops[0].tracking(cg),60895 ops[0].tracking(cg),
60896 ops[1].tracking(cg),60896 ops[1].tracking(cg),
60897 }),60897 }),
...@@ -65659,7 +65659,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -65659,7 +65659,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
65659 const ty_op = air_datas[@backingInt(inst)].ty_op;65659 const ty_op = air_datas[@backingInt(inst)].ty_op;
65660 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});65660 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
65661 var res: [1]Temp = undefined;65661 var res: [1]Temp = undefined;
65662 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{65662 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
65663 .src_constraints = .{ .{ .bool_vec = .byte }, .any, .any },65663 .src_constraints = .{ .{ .bool_vec = .byte }, .any, .any },
65664 .patterns = &.{65664 .patterns = &.{
65665 .{ .src = .{ .mut_mem, .none, .none } },65665 .{ .src = .{ .mut_mem, .none, .none } },
...@@ -67432,7 +67432,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -67432,7 +67432,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
67432 } }) catch |err| switch (err) {67432 } }) catch |err| switch (err) {
67433 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{67433 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
67434 @tagName(air_tag),67434 @tagName(air_tag),
67435 ty_op.ty.toType().fmt(pt),67435 ty_op.ty.fmt(pt),
67436 ops[0].tracking(cg),67436 ops[0].tracking(cg),
67437 }),67437 }),
67438 else => |e| return e,67438 else => |e| return e,
...@@ -67499,7 +67499,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -67499,7 +67499,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
67499 const ty_op = air_datas[@backingInt(inst)].ty_op;67499 const ty_op = air_datas[@backingInt(inst)].ty_op;
67500 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});67500 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
67501 var res: [1]Temp = undefined;67501 var res: [1]Temp = undefined;
67502 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{67502 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
67503 .required_features = .{ .slow_incdec, null, null, null },67503 .required_features = .{ .slow_incdec, null, null, null },
67504 .src_constraints = .{ .{ .exact_signed_int = 1 }, .any, .any },67504 .src_constraints = .{ .{ .exact_signed_int = 1 }, .any, .any },
67505 .patterns = &.{67505 .patterns = &.{
...@@ -70604,7 +70604,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -70604,7 +70604,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
70604 const ty_op = air_datas[@backingInt(inst)].ty_op;70604 const ty_op = air_datas[@backingInt(inst)].ty_op;
70605 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});70605 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
70606 var res: [1]Temp = undefined;70606 var res: [1]Temp = undefined;
70607 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{70607 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
70608 .required_features = .{ .slow_incdec, null, null, null },70608 .required_features = .{ .slow_incdec, null, null, null },
70609 .src_constraints = .{ .{ .exact_signed_int = 1 }, .any, .any },70609 .src_constraints = .{ .{ .exact_signed_int = 1 }, .any, .any },
70610 .patterns = &.{70610 .patterns = &.{
...@@ -71001,7 +71001,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -71001,7 +71001,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
71001 const ty_op = air_datas[@backingInt(inst)].ty_op;71001 const ty_op = air_datas[@backingInt(inst)].ty_op;
71002 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});71002 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
71003 var res: [1]Temp = undefined;71003 var res: [1]Temp = undefined;
71004 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{71004 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
71005 .src_constraints = .{ .{ .exact_signed_int = 1 }, .any, .any },71005 .src_constraints = .{ .{ .exact_signed_int = 1 }, .any, .any },
71006 .patterns = &.{71006 .patterns = &.{
71007 .{ .src = .{ .mut_mem, .none, .none } },71007 .{ .src = .{ .mut_mem, .none, .none } },
...@@ -71889,7 +71889,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -71889,7 +71889,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
71889 const ty_op = air_datas[@backingInt(inst)].ty_op;71889 const ty_op = air_datas[@backingInt(inst)].ty_op;
71890 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});71890 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
71891 var res: [1]Temp = undefined;71891 var res: [1]Temp = undefined;
71892 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{71892 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
71893 .src_constraints = .{ .{ .exact_int = 8 }, .any, .any },71893 .src_constraints = .{ .{ .exact_int = 8 }, .any, .any },
71894 .patterns = &.{71894 .patterns = &.{
71895 .{ .src = .{ .mut_mem, .none, .none } },71895 .{ .src = .{ .mut_mem, .none, .none } },
...@@ -72527,7 +72527,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -72527,7 +72527,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
72527 } }) catch |err| switch (err) {72527 } }) catch |err| switch (err) {
72528 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{72528 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
72529 @tagName(air_tag),72529 @tagName(air_tag),
72530 ty_op.ty.toType().fmt(pt),72530 ty_op.ty.fmt(pt),
72531 ops[0].tracking(cg),72531 ops[0].tracking(cg),
72532 }),72532 }),
72533 else => |e| return e,72533 else => |e| return e,
...@@ -72538,7 +72538,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -72538,7 +72538,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
72538 const ty_op = air_datas[@backingInt(inst)].ty_op;72538 const ty_op = air_datas[@backingInt(inst)].ty_op;
72539 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});72539 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
72540 var res: [1]Temp = undefined;72540 var res: [1]Temp = undefined;
72541 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{72541 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
72542 .src_constraints = .{ .{ .exact_int = 1 }, .any, .any },72542 .src_constraints = .{ .{ .exact_int = 1 }, .any, .any },
72543 .patterns = &.{72543 .patterns = &.{
72544 .{ .src = .{ .mut_mem, .none, .none } },72544 .{ .src = .{ .mut_mem, .none, .none } },
...@@ -75629,7 +75629,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -75629,7 +75629,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
75629 } }) catch |err| switch (err) {75629 } }) catch |err| switch (err) {
75630 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{75630 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
75631 @tagName(air_tag),75631 @tagName(air_tag),
75632 ty_op.ty.toType().fmt(pt),75632 ty_op.ty.fmt(pt),
75633 ops[0].tracking(cg),75633 ops[0].tracking(cg),
75634 }),75634 }),
75635 else => |e| return e,75635 else => |e| return e,
...@@ -77552,7 +77552,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -77552,7 +77552,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
77552 const ty_op = air_datas[@backingInt(inst)].ty_op;77552 const ty_op = air_datas[@backingInt(inst)].ty_op;
77553 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});77553 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
77554 var res: [1]Temp = undefined;77554 var res: [1]Temp = undefined;
77555 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{77555 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
77556 .required_features = .{ .cmov, null, null, null },77556 .required_features = .{ .cmov, null, null, null },
77557 .src_constraints = .{ .{ .int = .byte }, .any, .any },77557 .src_constraints = .{ .{ .int = .byte }, .any, .any },
77558 .patterns = &.{77558 .patterns = &.{
...@@ -82071,7 +82071,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -82071,7 +82071,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
82071 .lt, .lte => {},82071 .lt, .lte => {},
82072 .gt, .gte => std.mem.swap(Temp, &ops[0], &ops[1]),82072 .gt, .gte => std.mem.swap(Temp, &ops[0], &ops[1]),
82073 }82073 }
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) {
82075 else => unreachable,82075 else => unreachable,
82076 .lt, .gt => .l,82076 .lt, .gt => .l,
82077 .lte, .gte => .le,82077 .lte, .gte => .le,
...@@ -84587,7 +84587,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -84587,7 +84587,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
84587 } },84587 } },
84588 });84588 });
84589 },84589 },
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) {
84591 else => unreachable,84591 else => unreachable,
84592 .eq => .e,84592 .eq => .e,
84593 .neq => .ne,84593 .neq => .ne,
...@@ -89364,7 +89364,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -89364,7 +89364,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
89364 },89364 },
89365 .load => {89365 .load => {
89366 const ty_op = air_datas[@backingInt(inst)].ty_op;89366 const ty_op = air_datas[@backingInt(inst)].ty_op;
89367 const val_ty = ty_op.ty.toType();89367 const val_ty = ty_op.ty;
89368 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});89368 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
89369 var res: [1]Temp = undefined;89369 var res: [1]Temp = undefined;
89370 cg.select(&res, &.{val_ty}, &ops, comptime &.{ .{89370 cg.select(&res, &.{val_ty}, &ops, comptime &.{ .{
...@@ -89693,7 +89693,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -89693,7 +89693,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
89693 const ty_op = air_datas[@backingInt(inst)].ty_op;89693 const ty_op = air_datas[@backingInt(inst)].ty_op;
89694 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});89694 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
89695 var res: [1]Temp = undefined;89695 var res: [1]Temp = undefined;
89696 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{89696 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
89697 .required_features = .{ .f16c, null, null, null },89697 .required_features = .{ .f16c, null, null, null },
89698 .src_constraints = .{ .{ .scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },89698 .src_constraints = .{ .{ .scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
89699 .dst_constraints = .{ .{ .scalar_float = .{ .of = .word, .is = .word } }, .any },89699 .dst_constraints = .{ .{ .scalar_float = .{ .of = .word, .is = .word } }, .any },
...@@ -91706,7 +91706,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -91706,7 +91706,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
91706 } }) catch |err| switch (err) {91706 } }) catch |err| switch (err) {
91707 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{91707 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
91708 @tagName(air_tag),91708 @tagName(air_tag),
91709 ty_op.ty.toType().fmt(pt),91709 ty_op.ty.fmt(pt),
91710 cg.typeOf(ty_op.operand).fmt(pt),91710 cg.typeOf(ty_op.operand).fmt(pt),
91711 ops[0].tracking(cg),91711 ops[0].tracking(cg),
91712 }),91712 }),
...@@ -91718,7 +91718,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -91718,7 +91718,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
91718 const ty_op = air_datas[@backingInt(inst)].ty_op;91718 const ty_op = air_datas[@backingInt(inst)].ty_op;
91719 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});91719 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
91720 var res: [1]Temp = undefined;91720 var res: [1]Temp = undefined;
91721 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{91721 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
91722 .required_features = .{ .f16c, null, null, null },91722 .required_features = .{ .f16c, null, null, null },
91723 .src_constraints = .{ .{ .scalar_float = .{ .of = .word, .is = .word } }, .any, .any },91723 .src_constraints = .{ .{ .scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
91724 .dst_constraints = .{ .{ .scalar_float = .{ .of = .dword, .is = .dword } }, .any },91724 .dst_constraints = .{ .{ .scalar_float = .{ .of = .dword, .is = .dword } }, .any },
...@@ -93381,7 +93381,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -93381,7 +93381,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
93381 } }) catch |err| switch (err) {93381 } }) catch |err| switch (err) {
93382 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{93382 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
93383 @tagName(air_tag),93383 @tagName(air_tag),
93384 ty_op.ty.toType().fmt(pt),93384 ty_op.ty.fmt(pt),
93385 cg.typeOf(ty_op.operand).fmt(pt),93385 cg.typeOf(ty_op.operand).fmt(pt),
93386 ops[0].tracking(cg),93386 ops[0].tracking(cg),
93387 }),93387 }),
...@@ -93391,7 +93391,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -93391,7 +93391,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
93391 },93391 },
93392 .int_cast => |air_tag| {93392 .int_cast => |air_tag| {
93393 const ty_op = air_datas[@backingInt(inst)].ty_op;93393 const ty_op = air_datas[@backingInt(inst)].ty_op;
93394 const dst_ty = ty_op.ty.toType();93394 const dst_ty = ty_op.ty;
93395 const src_ty = cg.typeOf(ty_op.operand);93395 const src_ty = cg.typeOf(ty_op.operand);
93396 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});93396 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
93397 var res: [1]Temp = undefined;93397 var res: [1]Temp = undefined;
...@@ -98152,7 +98152,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -98152,7 +98152,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
98152 const ty_op = air_datas[@backingInt(inst)].ty_op;98152 const ty_op = air_datas[@backingInt(inst)].ty_op;
98153 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});98153 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
98154 var res: [1]Temp = undefined;98154 var res: [1]Temp = undefined;
98155 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{98155 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
98156 .src_constraints = .{ .{ .signed_int = .gpr }, .any, .any },98156 .src_constraints = .{ .{ .signed_int = .gpr }, .any, .any },
98157 .dst_constraints = .{ .{ .exact_signed_int = 1 }, .any },98157 .dst_constraints = .{ .{ .exact_signed_int = 1 }, .any },
98158 .patterns = &.{98158 .patterns = &.{
...@@ -103805,7 +103805,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103805,7 +103805,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103805 } }) catch |err| switch (err) {103805 } }) catch |err| switch (err) {
103806 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{103806 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
103807 @tagName(air_tag),103807 @tagName(air_tag),
103808 ty_op.ty.toType().fmt(pt),103808 ty_op.ty.fmt(pt),
103809 cg.typeOf(ty_op.operand).fmt(pt),103809 cg.typeOf(ty_op.operand).fmt(pt),
103810 ops[0].tracking(cg),103810 ops[0].tracking(cg),
103811 }),103811 }),
...@@ -103816,10 +103816,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103816,10 +103816,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103816 .optional_payload => {103816 .optional_payload => {
103817 const ty_op = air_datas[@backingInt(inst)].ty_op;103817 const ty_op = air_datas[@backingInt(inst)].ty_op;
103818 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});103818 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))103819 const pl = if (!hack_around_sema_opv_bugs or ty_op.ty.hasRuntimeBits(zcu))
103820 try ops[0].read(ty_op.ty.toType(), .{}, cg)103820 try ops[0].read(ty_op.ty, .{}, cg)
103821 else103821 else
103822 try cg.tempInit(ty_op.ty.toType(), .none);103822 try cg.tempInit(ty_op.ty, .none);
103823 try pl.finish(inst, &.{ty_op.operand}, &ops, cg);103823 try pl.finish(inst, &.{ty_op.operand}, &ops, cg);
103824 },103824 },
103825 .optional_payload_ptr => {103825 .optional_payload_ptr => {
...@@ -103844,7 +103844,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103844,7 +103844,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103844 },103844 },
103845 .wrap_optional => {103845 .wrap_optional => {
103846 const ty_op = air_datas[@backingInt(inst)].ty_op;103846 const ty_op = air_datas[@backingInt(inst)].ty_op;
103847 const opt_ty = ty_op.ty.toType();103847 const opt_ty = ty_op.ty;
103848 const opt_pl_ty = cg.typeOf(ty_op.operand);103848 const opt_pl_ty = cg.typeOf(ty_op.operand);
103849 const opt_pl_abi_size: u31 = @intCast(opt_pl_ty.abiSize(zcu));103849 const opt_pl_abi_size: u31 = @intCast(opt_pl_ty.abiSize(zcu));
103850 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});103850 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
...@@ -103859,7 +103859,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103859,7 +103859,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103859 },103859 },
103860 .unwrap_errunion_payload => {103860 .unwrap_errunion_payload => {
103861 const ty_op = air_datas[@backingInt(inst)].ty_op;103861 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;
103863 const eu_pl_off: i32 = @intCast(codegen.errUnionPayloadOffset(eu_pl_ty, zcu));103863 const eu_pl_off: i32 = @intCast(codegen.errUnionPayloadOffset(eu_pl_ty, zcu));
103864 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});103864 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
103865 const pl = if (!hack_around_sema_opv_bugs or eu_pl_ty.hasRuntimeBits(zcu))103865 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 {...@@ -103871,7 +103871,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103871 .unwrap_errunion_err => {103871 .unwrap_errunion_err => {
103872 const ty_op = air_datas[@backingInt(inst)].ty_op;103872 const ty_op = air_datas[@backingInt(inst)].ty_op;
103873 const eu_ty = cg.typeOf(ty_op.operand);103873 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;
103875 const eu_pl_ty = eu_ty.errorUnionPayload(zcu);103875 const eu_pl_ty = eu_ty.errorUnionPayload(zcu);
103876 const eu_err_off: i32 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));103876 const eu_err_off: i32 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));
103877 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});103877 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
...@@ -103890,7 +103890,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103890,7 +103890,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103890 .unwrap_errunion_err_ptr => {103890 .unwrap_errunion_err_ptr => {
103891 const ty_op = air_datas[@backingInt(inst)].ty_op;103891 const ty_op = air_datas[@backingInt(inst)].ty_op;
103892 const eu_ty = cg.typeOf(ty_op.operand).childType(zcu);103892 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;
103894 const eu_pl_ty = eu_ty.errorUnionPayload(zcu);103894 const eu_pl_ty = eu_ty.errorUnionPayload(zcu);
103895 const eu_err_off: i32 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));103895 const eu_err_off: i32 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));
103896 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});103896 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
...@@ -103915,7 +103915,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103915,7 +103915,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103915 },103915 },
103916 .wrap_errunion_payload => {103916 .wrap_errunion_payload => {
103917 const ty_op = air_datas[@backingInt(inst)].ty_op;103917 const ty_op = air_datas[@backingInt(inst)].ty_op;
103918 const eu_ty = ty_op.ty.toType();103918 const eu_ty = ty_op.ty;
103919 const eu_err_ty = eu_ty.errorUnionSet(zcu);103919 const eu_err_ty = eu_ty.errorUnionSet(zcu);
103920 const eu_pl_ty = cg.typeOf(ty_op.operand);103920 const eu_pl_ty = cg.typeOf(ty_op.operand);
103921 const eu_err_off: u31 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));103921 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 {...@@ -103930,7 +103930,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103930 },103930 },
103931 .wrap_errunion_err => {103931 .wrap_errunion_err => {
103932 const ty_op = air_datas[@backingInt(inst)].ty_op;103932 const ty_op = air_datas[@backingInt(inst)].ty_op;
103933 const eu_ty = ty_op.ty.toType();103933 const eu_ty = ty_op.ty;
103934 const eu_pl_ty = eu_ty.errorUnionPayload(zcu);103934 const eu_pl_ty = eu_ty.errorUnionPayload(zcu);
103935 const eu_err_off: u31 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));103935 const eu_err_off: u31 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu));
103936 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});103936 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
...@@ -103944,7 +103944,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103944,7 +103944,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103944 var ops = try cg.tempsFromOperands(inst, .{struct_field.struct_operand});103944 var ops = try cg.tempsFromOperands(inst, .{struct_field.struct_operand});
103945 try ops[0].toOffset(@intCast(codegen.fieldOffset(103945 try ops[0].toOffset(@intCast(codegen.fieldOffset(
103946 cg.typeOf(struct_field.struct_operand),103946 cg.typeOf(struct_field.struct_operand),
103947 ty_pl.ty.toType(),103947 ty_pl.ty,
103948 struct_field.field_index,103948 struct_field.field_index,
103949 zcu,103949 zcu,
103950 )), cg);103950 )), cg);
...@@ -103959,7 +103959,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103959,7 +103959,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103959 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});103959 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
103960 try ops[0].toOffset(@intCast(codegen.fieldOffset(103960 try ops[0].toOffset(@intCast(codegen.fieldOffset(
103961 cg.typeOf(ty_op.operand),103961 cg.typeOf(ty_op.operand),
103962 ty_op.ty.toType(),103962 ty_op.ty,
103963 switch (air_tag) {103963 switch (air_tag) {
103964 else => unreachable,103964 else => unreachable,
103965 .struct_field_ptr_index_0 => 0,103965 .struct_field_ptr_index_0 => 0,
...@@ -103975,7 +103975,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103975,7 +103975,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103975 const ty_pl = air_datas[@backingInt(inst)].ty_pl;103975 const ty_pl = air_datas[@backingInt(inst)].ty_pl;
103976 const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data;103976 const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data;
103977 const agg_ty = cg.typeOf(struct_field.struct_operand);103977 const agg_ty = cg.typeOf(struct_field.struct_operand);
103978 const field_ty = ty_pl.ty.toType();103978 const field_ty = ty_pl.ty;
103979 const field_off: u31 = switch (agg_ty.containerLayout(zcu)) {103979 const field_off: u31 = switch (agg_ty.containerLayout(zcu)) {
103980 .auto, .@"extern" => @intCast(agg_ty.structFieldOffset(struct_field.field_index, zcu)),103980 .auto, .@"extern" => @intCast(agg_ty.structFieldOffset(struct_field.field_index, zcu)),
103981 .@"packed" => unreachable,103981 .@"packed" => unreachable,
...@@ -104004,7 +104004,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -104004,7 +104004,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104004 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});104004 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
104005 const union_layout = union_ty.unionGetLayout(zcu);104005 const union_layout = union_ty.unionGetLayout(zcu);
104006 assert(union_layout.tag_size > 0);104006 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, .{
104008 .disp = @intCast(union_layout.tagOffset()),104008 .disp = @intCast(union_layout.tagOffset()),
104009 }, cg);104009 }, cg);
104010 try res.finish(inst, &.{ty_op.operand}, &ops, cg);104010 try res.finish(inst, &.{ty_op.operand}, &ops, cg);
...@@ -104364,7 +104364,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -104364,7 +104364,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104364 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;104364 const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data;
104365 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });104365 var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs });
104366 try ops[0].toSlicePtr(cg);104366 try ops[0].toSlicePtr(cg);
104367 const dst_ty = ty_pl.ty.toType();104367 const dst_ty = ty_pl.ty;
104368 zero_offset: {104368 zero_offset: {
104369 const elem_size = dst_ty.childType(zcu).abiSize(zcu);104369 const elem_size = dst_ty.childType(zcu).abiSize(zcu);
104370 if (hack_around_sema_opv_bugs and elem_size == 0) break :zero_offset;104370 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 {...@@ -104420,7 +104420,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104420 const ty_op = air_datas[@backingInt(inst)].ty_op;104420 const ty_op = air_datas[@backingInt(inst)].ty_op;
104421 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});104421 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
104422 var res: [1]Temp = undefined;104422 var res: [1]Temp = undefined;
104423 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{104423 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
104424 .required_features = .{ .f16c, null, null, null },104424 .required_features = .{ .f16c, null, null, null },
104425 .src_constraints = .{ .{ .float = .word }, .any, .any },104425 .src_constraints = .{ .{ .float = .word }, .any, .any },
104426 .dst_constraints = .{ .{ .int = .dword }, .any },104426 .dst_constraints = .{ .{ .int = .dword }, .any },
...@@ -115175,7 +115175,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -115175,7 +115175,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
115175 } }) catch |err| switch (err) {115175 } }) catch |err| switch (err) {
115176 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{115176 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
115177 @tagName(air_tag),115177 @tagName(air_tag),
115178 ty_op.ty.toType().fmt(pt),115178 ty_op.ty.fmt(pt),
115179 cg.typeOf(ty_op.operand).fmt(pt),115179 cg.typeOf(ty_op.operand).fmt(pt),
115180 ops[0].tracking(cg),115180 ops[0].tracking(cg),
115181 }),115181 }),
...@@ -115189,7 +115189,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -115189,7 +115189,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
115189 const ty_op = air_datas[@backingInt(inst)].ty_op;115189 const ty_op = air_datas[@backingInt(inst)].ty_op;
115190 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});115190 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
115191 var res: [1]Temp = undefined;115191 var res: [1]Temp = undefined;
115192 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{115192 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
115193 .required_features = .{ .f16c, null, null, null },115193 .required_features = .{ .f16c, null, null, null },
115194 .src_constraints = .{ .{ .signed_int = .byte }, .any, .any },115194 .src_constraints = .{ .{ .signed_int = .byte }, .any, .any },
115195 .dst_constraints = .{ .{ .float = .word }, .any },115195 .dst_constraints = .{ .{ .float = .word }, .any },
...@@ -127066,7 +127066,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -127066,7 +127066,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
127066 } }) catch |err| switch (err) {127066 } }) catch |err| switch (err) {
127067 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{127067 error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{
127068 @tagName(air_tag),127068 @tagName(air_tag),
127069 ty_op.ty.toType().fmt(pt),127069 ty_op.ty.fmt(pt),
127070 cg.typeOf(ty_op.operand).fmt(pt),127070 cg.typeOf(ty_op.operand).fmt(pt),
127071 ops[0].tracking(cg),127071 ops[0].tracking(cg),
127072 }),127072 }),
...@@ -168982,7 +168982,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -168982,7 +168982,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
168982 const ty_op = air_datas[@backingInt(inst)].ty_op;168982 const ty_op = air_datas[@backingInt(inst)].ty_op;
168983 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});168983 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand});
168984 var res: [1]Temp = undefined;168984 var res: [1]Temp = undefined;
168985 cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{168985 cg.select(&res, &.{ty_op.ty}, &ops, comptime &.{ .{
168986 .dst_constraints = .{ .{ .bool_vec = .qword }, .any },168986 .dst_constraints = .{ .{ .bool_vec = .qword }, .any },
168987 .src_constraints = .{ .bool, .any, .any },168987 .src_constraints = .{ .bool, .any, .any },
168988 .patterns = &.{168988 .patterns = &.{
...@@ -170811,7 +170811,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -170811,7 +170811,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
170811 } }) catch |err| switch (err) {170811 } }) catch |err| switch (err) {
170812 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{170812 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
170813 @tagName(air_tag),170813 @tagName(air_tag),
170814 ty_op.ty.toType().fmt(pt),170814 ty_op.ty.fmt(pt),
170815 ops[0].tracking(cg),170815 ops[0].tracking(cg),
170816 }),170816 }),
170817 else => |e| return e,170817 else => |e| return e,
...@@ -171333,7 +171333,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -171333,7 +171333,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
171333 },171333 },
171334 .error_set_has_value => |air_tag| {171334 .error_set_has_value => |air_tag| {
171335 const ty_op = air_datas[@backingInt(inst)].ty_op;171335 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)};
171337 var res: [1]Temp = undefined;171337 var res: [1]Temp = undefined;
171338 cg.select(&res, &.{.bool}, &ops, comptime &.{ .{171338 cg.select(&res, &.{.bool}, &ops, comptime &.{ .{
171339 .required_features = .{ .avx, null, null, null },171339 .required_features = .{ .avx, null, null, null },
...@@ -171415,7 +171415,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -171415,7 +171415,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
171415 } }) catch |err| switch (err) {171415 } }) catch |err| switch (err) {
171416 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{171416 error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{
171417 @tagName(air_tag),171417 @tagName(air_tag),
171418 ty_op.ty.toType().fmt(pt),171418 ty_op.ty.fmt(pt),
171419 ops[0].tracking(cg),171419 ops[0].tracking(cg),
171420 }),171420 }),
171421 else => |e| return e,171421 else => |e| return e,
...@@ -171425,7 +171425,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -171425,7 +171425,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
171425 },171425 },
171426 .aggregate_init => |air_tag| fallback: {171426 .aggregate_init => |air_tag| fallback: {
171427 const ty_pl = air_datas[@backingInt(inst)].ty_pl;171427 const ty_pl = air_datas[@backingInt(inst)].ty_pl;
171428 const agg_ty = ty_pl.ty.toType();171428 const agg_ty = ty_pl.ty;
171429 if (agg_ty.isVector(zcu) and agg_ty.childType(zcu).toIntern() == .bool_type) {171429 if (agg_ty.isVector(zcu) and agg_ty.childType(zcu).toIntern() == .bool_type) {
171430 break :fallback try cg.airAggregateInitBoolVec(inst);171430 break :fallback try cg.airAggregateInitBoolVec(inst);
171431 }171431 }
...@@ -171496,7 +171496,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -171496,7 +171496,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
171496 .union_init => {171496 .union_init => {
171497 const ty_pl = air_datas[@backingInt(inst)].ty_pl;171497 const ty_pl = air_datas[@backingInt(inst)].ty_pl;
171498 const union_init = cg.air.extraData(Air.UnionInit, ty_pl.payload).data;171498 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;
171500 var ops = try cg.tempsFromOperands(inst, .{union_init.init});171500 var ops = try cg.tempsFromOperands(inst, .{union_init.init});
171501 var res = try cg.tempAllocMem(union_ty);171501 var res = try cg.tempAllocMem(union_ty);
171502 const union_layout = union_ty.unionGetLayout(zcu);171502 const union_layout = union_ty.unionGetLayout(zcu);
...@@ -172948,7 +172948,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -172948,7 +172948,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
172948 const field_parent_ptr = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;172948 const field_parent_ptr = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
172949 var ops = try cg.tempsFromOperands(inst, .{field_parent_ptr.field_ptr});172949 var ops = try cg.tempsFromOperands(inst, .{field_parent_ptr.field_ptr});
172950 try ops[0].toOffset(-@as(i32, @intCast(codegen.fieldOffset(172950 try ops[0].toOffset(-@as(i32, @intCast(codegen.fieldOffset(
172951 ty_pl.ty.toType(),172951 ty_pl.ty,
172952 cg.typeOf(field_parent_ptr.field_ptr),172952 cg.typeOf(field_parent_ptr.field_ptr),
172953 field_parent_ptr.field_index,172953 field_parent_ptr.field_index,
172954 zcu,172954 zcu,
...@@ -173071,7 +173071,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -173071,7 +173071,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
173071 },173071 },
173072 .save_err_return_trace_index => {173072 .save_err_return_trace_index => {
173073 const ty_pl = air_datas[@backingInt(inst)].ty_pl;173073 const ty_pl = air_datas[@backingInt(inst)].ty_pl;
173074 const agg_ty = ty_pl.ty.toType();173074 const agg_ty = ty_pl.ty;
173075 assert(agg_ty.containerLayout(zcu) != .@"packed");173075 assert(agg_ty.containerLayout(zcu) != .@"packed");
173076 var ert: Temp = .{ .index = err_ret_trace_index };173076 var ert: Temp = .{ .index = err_ret_trace_index };
173077 var res = try ert.load(.usize, .{ .disp = @intCast(agg_ty.structFieldOffset(ty_pl.payload, zcu)) }, cg);173077 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 {...@@ -173115,7 +173115,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
173115 else => unreachable,173115 else => unreachable,
173116 };173116 };
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 });
173119 if (is_threadlocal) while (try res.toRegClass(true, .general_purpose, cg)) {};173119 if (is_threadlocal) while (try res.toRegClass(true, .general_purpose, cg)) {};
173120 try res.finish(inst, &.{}, &.{}, cg);173120 try res.finish(inst, &.{}, &.{}, cg);
173121 },173121 },