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