authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-20 13:11:37-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-20 13:11:37-07:00
logbf4e2ab8d16e74374c4769f90e1f4042c0f968a1
treeb8d90b0f5b2e578ef1b7a699a418e320cd36b5c8
parent515a4942201c802aa2254f5aa083aa249a929aec

loongarch: update Type API usage

fixes invisible merge conflicts with ba0cfda93dabd07ded441ecf475fc28a90bd495e

2 files changed, 27 insertions(+), 27 deletions(-)

src/codegen/loongarch.zig+1-1
......@@ -92,7 +92,7 @@ pub fn generate(
9292 for (air_main_body) |air_inst_index| {
9393 if (air.instructions.items(.tag)[@backingInt(air_inst_index)] != .arg) break;
9494 const arg = air.instructions.items(.data)[@backingInt(air_inst_index)].arg;
95 const param_ty = arg.ty.toType();
95 const param_ty = arg.ty;
9696 if (arg.zir_param_index >= named_params_len)
9797 assert(func_type.is_var_args);
9898 const param_vi1 = try cc_it1.resolve(param_ty, false) orelse unreachable;
src/codegen/loongarch/Select.zig+26-26
......@@ -2487,7 +2487,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
24872487 const operands: []const Air.Inst.Ref = @ptrCast(isel.air.extra.items[extra.end..][0 .. extra.data.flags.outputs_len + extra.data.inputs_len]);
24882488
24892489 for (operands) |operand| if (operand != .none) try isel.analyzeUse(operand);
2490 if (ty_pl.ty != .void_type) try isel.def_order.putNoClobber(gpa, air_inst_index, {});
2490 if (ty_pl.ty.ip_index != .void_type) try isel.def_order.putNoClobber(gpa, air_inst_index, {});
24912491 },
24922492 .not,
24932493 .clz,
......@@ -2630,7 +2630,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
26302630 },
26312631 .aggregate_init => {
26322632 const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl;
2633 const elements: []const Air.Inst.Ref = @ptrCast(isel.air.extra.items[ty_pl.payload..][0..@intCast(ty_pl.ty.toType().arrayLen(zcu))]);
2633 const elements: []const Air.Inst.Ref = @ptrCast(isel.air.extra.items[ty_pl.payload..][0..@intCast(ty_pl.ty.arrayLen(zcu))]);
26342634
26352635 for (elements) |element| try isel.analyzeUse(element);
26362636 try isel.def_order.putNoClobber(gpa, air_inst_index, {});
......@@ -2664,9 +2664,9 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
26642664 .block => Air.Block,
26652665 .dbg_inline_block => Air.DbgInlineBlock,
26662666 }, ty_pl.payload);
2667 const result_ty = ty_pl.ty.toInterned().?;
2667 const result_ty = ty_pl.ty;
26682668
2669 if (result_ty == .noreturn_type) {
2669 if (result_ty.ip_index == .noreturn_type) {
26702670 try isel.analyze(@ptrCast(isel.air.extra.items[extra.end..][0..extra.data.body_len]));
26712671 break;
26722672 }
......@@ -2676,7 +2676,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
26762676 const block_entry = isel.active_blocks.pop().?;
26772677 assert(block_entry.key == air_inst_index);
26782678
2679 if (result_ty != .void_type) try isel.def_order.putNoClobber(gpa, air_inst_index, {});
2679 if (result_ty.ip_index != .void_type) try isel.def_order.putNoClobber(gpa, air_inst_index, {});
26802680 },
26812681 .call,
26822682 .call_always_tail,
......@@ -3118,14 +3118,14 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
31183118 .dbg_inline_block => {
31193119 const ty_pl = air.data(air.inst_index).ty_pl;
31203120 const extra = isel.air.extraData(Air.DbgInlineBlock, ty_pl.payload);
3121 try isel.block(air.inst_index, ty_pl.ty.toType(), @ptrCast(
3121 try isel.block(air.inst_index, ty_pl.ty, @ptrCast(
31223122 isel.air.extra.items[extra.end..][0..extra.data.body_len],
31233123 ));
31243124 },
31253125 .block => {
31263126 const ty_pl = air.data(air.inst_index).ty_pl;
31273127 const extra = isel.air.extraData(Air.Block, ty_pl.payload);
3128 try isel.block(air.inst_index, ty_pl.ty.toType(), @ptrCast(
3128 try isel.block(air.inst_index, ty_pl.ty, @ptrCast(
31293129 isel.air.extra.items[extra.end..][0..extra.data.body_len],
31303130 ));
31313131 },
......@@ -3578,7 +3578,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
35783578
35793579 const ty_op = air.data(air.inst_index).ty_op;
35803580 const src_vi = try isel.use(ty_op.operand);
3581 const ty = ty_op.ty.toType();
3581 const ty = ty_op.ty;
35823582 switch (ty.zigTypeTag(zcu)) {
35833583 .bool => {
35843584 // boolean not
......@@ -3621,7 +3621,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
36213621
36223622 const ty_op = air.data(air.inst_index).ty_op;
36233623 const src_vi = try isel.use(ty_op.operand);
3624 const src_ty = ty_op.ty.toType();
3624 const src_ty = ty_op.ty;
36253625 const src_bits = src_ty.bitSize(zcu);
36263626 try res_vi.value.reextendAdvanced(
36273627 isel,
......@@ -3691,7 +3691,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
36913691 => if (isel.live_values.fetchRemove(air.inst_index)) |dst_vi| unused: {
36923692 defer dst_vi.value.deref(isel);
36933693 const ty_op = air.data(air.inst_index).ty_op;
3694 const dst_ty = ty_op.ty.toType();
3694 const dst_ty = ty_op.ty;
36953695 const dst_tag = dst_ty.zigTypeTag(zcu);
36963696 const src_ty = isel.air.typeOf(ty_op.operand, ip);
36973697 const src_tag = src_ty.zigTypeTag(zcu);
......@@ -3964,7 +3964,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
39643964 defer dst_vi.value.deref(isel);
39653965
39663966 const ty_op = air.data(air.inst_index).ty_op;
3967 const dst_ty = ty_op.ty.toType();
3967 const dst_ty = ty_op.ty;
39683968 const dst_int_info = dst_ty.intInfo(zcu);
39693969 const src_ty = isel.air.typeOf(ty_op.operand, ip);
39703970 const src_int_info = src_ty.intInfo(zcu);
......@@ -4154,7 +4154,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
41544154
41554155 const ty_pl = air.data(air.inst_index).ty_pl;
41564156 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;
4157 const elem_size = ty_pl.ty.toType().childType(zcu).abiSize(zcu);
4157 const elem_size = ty_pl.ty.childType(zcu).abiSize(zcu);
41584158
41594159 const slice_vi = try isel.use(bin_op.lhs);
41604160 const base_ptr_mat = try slice_vi.mat(isel, .{
......@@ -4173,7 +4173,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
41734173
41744174 const ty_pl = air.data(air.inst_index).ty_pl;
41754175 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;
4176 const elem_size = ty_pl.ty.toType().childType(zcu).abiSize(zcu);
4176 const elem_size = ty_pl.ty.childType(zcu).abiSize(zcu);
41774177
41784178 const base_vi = try isel.use(bin_op.lhs);
41794179 const base_ptr_mat = try base_vi.mat(isel, .{
......@@ -4196,7 +4196,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
41964196
41974197 const ty_pl = air.data(air.inst_index).ty_pl;
41984198 const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data;
4199 const elem_size = ty_pl.ty.toType().childType(zcu).abiSize(zcu);
4199 const elem_size = ty_pl.ty.childType(zcu).abiSize(zcu);
42004200
42014201 const base_vi = try isel.use(bin_op.lhs);
42024202 const base_mat = try base_vi.matIntRegZeroExt(isel);
......@@ -4266,7 +4266,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
42664266 if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {
42674267 defer payload_ptr_vi.value.deref(isel);
42684268
4269 const payload_offset = codegen.errUnionPayloadOffset(unwrapped_try.error_union_payload_ptr_ty.toType().childType(zcu), zcu);
4269 const payload_offset = codegen.errUnionPayloadOffset(unwrapped_try.error_union_payload_ptr_ty.childType(zcu), zcu);
42704270 if (payload_offset == 0) {
42714271 try payload_ptr_vi.value.defMove(isel, unwrapped_try.error_union_ptr);
42724272 } else {
......@@ -4307,7 +4307,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
43074307 defer agg_vi.value.deref(isel);
43084308
43094309 const ty_pl = air.data(air.inst_index).ty_pl;
4310 const agg_ty = ty_pl.ty.toType();
4310 const agg_ty = ty_pl.ty;
43114311 switch (ip.indexToKey(agg_ty.toIntern())) {
43124312 .array_type => |array_type| {
43134313 const elem_ty = ZigType.fromInterned(array_type.child);
......@@ -4380,7 +4380,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
43804380 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;
43814381 switch (codegen.fieldOffset(
43824382 isel.air.typeOf(extra.struct_operand, ip),
4383 ty_pl.ty.toType(),
4383 ty_pl.ty,
43844384 extra.field_index,
43854385 zcu,
43864386 )) {
......@@ -4403,7 +4403,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
44034403 const ty_op = air.data(air.inst_index).ty_op;
44044404 switch (codegen.fieldOffset(
44054405 isel.air.typeOf(ty_op.operand, ip),
4406 ty_op.ty.toType(),
4406 ty_op.ty,
44074407 switch (air_tag) {
44084408 else => unreachable,
44094409 .struct_field_ptr_index_0 => 0,
......@@ -4429,7 +4429,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
44294429 const ty_pl = air.data(air.inst_index).ty_pl;
44304430 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;
44314431 const agg_ty = isel.air.typeOf(extra.struct_operand, ip);
4432 const field_ty = ty_pl.ty.toType();
4432 const field_ty = ty_pl.ty;
44334433
44344434 const field_bit_offset, const field_bit_size, const is_packed = switch (agg_ty.containerLayout(zcu)) {
44354435 .auto, .@"extern" => .{
......@@ -4476,7 +4476,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
44764476
44774477 const ty_pl = air.data(air.inst_index).ty_pl;
44784478 const extra = isel.air.extraData(Air.UnionInit, ty_pl.payload).data;
4479 const union_ty = ty_pl.ty.toType();
4479 const union_ty = ty_pl.ty;
44804480 const loaded_union = ip.loadUnionType(union_ty.toIntern());
44814481 const union_layout = ZigType.getUnionLayout(loaded_union, zcu);
44824482
......@@ -4549,7 +4549,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
45494549 defer opt_vi.value.deref(isel);
45504550
45514551 const ty_op = air.data(air.inst_index).ty_op;
4552 if (ty_op.ty.toType().optionalReprIsPayload(zcu)) {
4552 if (ty_op.ty.optionalReprIsPayload(zcu)) {
45534553 try opt_vi.value.defMove(isel, ty_op.operand);
45544554 break :unused;
45554555 }
......@@ -4568,7 +4568,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
45684568 const ty_pl = air.data(air.inst_index).ty_pl;
45694569 const extra = isel.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
45704570 switch (codegen.fieldOffset(
4571 ty_pl.ty.toType(),
4571 ty_pl.ty,
45724572 isel.air.typeOf(extra.field_ptr, ip),
45734573 extra.field_index,
45744574 zcu,
......@@ -4592,7 +4592,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
45924592 isel,
45934593 try error_union_vi.partExact(
45944594 isel,
4595 codegen.errUnionPayloadOffset(ty_op.ty.toType(), zcu),
4595 codegen.errUnionPayloadOffset(ty_op.ty, zcu),
45964596 payload_vi.value.size(isel),
45974597 ),
45984598 );
......@@ -4616,7 +4616,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
46164616 defer error_union_vi.value.deref(isel);
46174617
46184618 const ty_op = air.data(air.inst_index).ty_op;
4619 const error_union_ty = ty_op.ty.toType();
4619 const error_union_ty = ty_op.ty;
46204620 const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type;
46214621 const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type);
46224622 const payload_ty: ZigType = .fromInterned(error_union_info.payload_type);
......@@ -4639,7 +4639,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
46394639 defer error_union_vi.value.deref(isel);
46404640
46414641 const ty_op = air.data(air.inst_index).ty_op;
4642 const error_union_ty = ty_op.ty.toType();
4642 const error_union_ty = ty_op.ty;
46434643 const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type;
46444644 const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type);
46454645 const payload_ty: ZigType = .fromInterned(error_union_info.payload_type);
......@@ -4658,7 +4658,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
46584658 .errunion_payload_ptr_set => if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: {
46594659 defer payload_ptr_vi.value.deref(isel);
46604660 const ty_op = air.data(air.inst_index).ty_op;
4661 const payload_ty = ty_op.ty.toType().childType(zcu);
4661 const payload_ty = ty_op.ty.childType(zcu);
46624662 const eu_ty = isel.air.typeOf(ty_op.operand, ip).childType(zcu);
46634663 const error_set_size = eu_ty.errorUnionSet(zcu).abiSize(zcu);
46644664