| ... | ... | @@ -2487,7 +2487,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 2487 | 2487 | const operands: []const Air.Inst.Ref = @ptrCast(isel.air.extra.items[extra.end..][0 .. extra.data.flags.outputs_len + extra.data.inputs_len]); |
| 2488 | 2488 | |
| 2489 | 2489 | 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, {}); |
| 2491 | 2491 | }, |
| 2492 | 2492 | .not, |
| 2493 | 2493 | .clz, |
| ... | ... | @@ -2630,7 +2630,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 2630 | 2630 | }, |
| 2631 | 2631 | .aggregate_init => { |
| 2632 | 2632 | 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))]); |
| 2634 | 2634 | |
| 2635 | 2635 | for (elements) |element| try isel.analyzeUse(element); |
| 2636 | 2636 | 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 { |
| 2664 | 2664 | .block => Air.Block, |
| 2665 | 2665 | .dbg_inline_block => Air.DbgInlineBlock, |
| 2666 | 2666 | }, ty_pl.payload); |
| 2667 | | const result_ty = ty_pl.ty.toInterned().?; |
| 2667 | const result_ty = ty_pl.ty; |
| 2668 | 2668 | |
| 2669 | | if (result_ty == .noreturn_type) { |
| 2669 | if (result_ty.ip_index == .noreturn_type) { |
| 2670 | 2670 | try isel.analyze(@ptrCast(isel.air.extra.items[extra.end..][0..extra.data.body_len])); |
| 2671 | 2671 | break; |
| 2672 | 2672 | } |
| ... | ... | @@ -2676,7 +2676,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 2676 | 2676 | const block_entry = isel.active_blocks.pop().?; |
| 2677 | 2677 | assert(block_entry.key == air_inst_index); |
| 2678 | 2678 | |
| 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, {}); |
| 2680 | 2680 | }, |
| 2681 | 2681 | .call, |
| 2682 | 2682 | .call_always_tail, |
| ... | ... | @@ -3118,14 +3118,14 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 3118 | 3118 | .dbg_inline_block => { |
| 3119 | 3119 | const ty_pl = air.data(air.inst_index).ty_pl; |
| 3120 | 3120 | 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( |
| 3122 | 3122 | isel.air.extra.items[extra.end..][0..extra.data.body_len], |
| 3123 | 3123 | )); |
| 3124 | 3124 | }, |
| 3125 | 3125 | .block => { |
| 3126 | 3126 | const ty_pl = air.data(air.inst_index).ty_pl; |
| 3127 | 3127 | 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( |
| 3129 | 3129 | isel.air.extra.items[extra.end..][0..extra.data.body_len], |
| 3130 | 3130 | )); |
| 3131 | 3131 | }, |
| ... | ... | @@ -3578,7 +3578,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 3578 | 3578 | |
| 3579 | 3579 | const ty_op = air.data(air.inst_index).ty_op; |
| 3580 | 3580 | const src_vi = try isel.use(ty_op.operand); |
| 3581 | | const ty = ty_op.ty.toType(); |
| 3581 | const ty = ty_op.ty; |
| 3582 | 3582 | switch (ty.zigTypeTag(zcu)) { |
| 3583 | 3583 | .bool => { |
| 3584 | 3584 | // boolean not |
| ... | ... | @@ -3621,7 +3621,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 3621 | 3621 | |
| 3622 | 3622 | const ty_op = air.data(air.inst_index).ty_op; |
| 3623 | 3623 | const src_vi = try isel.use(ty_op.operand); |
| 3624 | | const src_ty = ty_op.ty.toType(); |
| 3624 | const src_ty = ty_op.ty; |
| 3625 | 3625 | const src_bits = src_ty.bitSize(zcu); |
| 3626 | 3626 | try res_vi.value.reextendAdvanced( |
| 3627 | 3627 | isel, |
| ... | ... | @@ -3691,7 +3691,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 3691 | 3691 | => if (isel.live_values.fetchRemove(air.inst_index)) |dst_vi| unused: { |
| 3692 | 3692 | defer dst_vi.value.deref(isel); |
| 3693 | 3693 | 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; |
| 3695 | 3695 | const dst_tag = dst_ty.zigTypeTag(zcu); |
| 3696 | 3696 | const src_ty = isel.air.typeOf(ty_op.operand, ip); |
| 3697 | 3697 | const src_tag = src_ty.zigTypeTag(zcu); |
| ... | ... | @@ -3964,7 +3964,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 3964 | 3964 | defer dst_vi.value.deref(isel); |
| 3965 | 3965 | |
| 3966 | 3966 | 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; |
| 3968 | 3968 | const dst_int_info = dst_ty.intInfo(zcu); |
| 3969 | 3969 | const src_ty = isel.air.typeOf(ty_op.operand, ip); |
| 3970 | 3970 | 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, |
| 4154 | 4154 | |
| 4155 | 4155 | const ty_pl = air.data(air.inst_index).ty_pl; |
| 4156 | 4156 | 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); |
| 4158 | 4158 | |
| 4159 | 4159 | const slice_vi = try isel.use(bin_op.lhs); |
| 4160 | 4160 | 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, |
| 4173 | 4173 | |
| 4174 | 4174 | const ty_pl = air.data(air.inst_index).ty_pl; |
| 4175 | 4175 | 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); |
| 4177 | 4177 | |
| 4178 | 4178 | const base_vi = try isel.use(bin_op.lhs); |
| 4179 | 4179 | 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, |
| 4196 | 4196 | |
| 4197 | 4197 | const ty_pl = air.data(air.inst_index).ty_pl; |
| 4198 | 4198 | 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); |
| 4200 | 4200 | |
| 4201 | 4201 | const base_vi = try isel.use(bin_op.lhs); |
| 4202 | 4202 | 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, |
| 4266 | 4266 | if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: { |
| 4267 | 4267 | defer payload_ptr_vi.value.deref(isel); |
| 4268 | 4268 | |
| 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); |
| 4270 | 4270 | if (payload_offset == 0) { |
| 4271 | 4271 | try payload_ptr_vi.value.defMove(isel, unwrapped_try.error_union_ptr); |
| 4272 | 4272 | } else { |
| ... | ... | @@ -4307,7 +4307,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 4307 | 4307 | defer agg_vi.value.deref(isel); |
| 4308 | 4308 | |
| 4309 | 4309 | 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; |
| 4311 | 4311 | switch (ip.indexToKey(agg_ty.toIntern())) { |
| 4312 | 4312 | .array_type => |array_type| { |
| 4313 | 4313 | 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, |
| 4380 | 4380 | const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data; |
| 4381 | 4381 | switch (codegen.fieldOffset( |
| 4382 | 4382 | isel.air.typeOf(extra.struct_operand, ip), |
| 4383 | | ty_pl.ty.toType(), |
| 4383 | ty_pl.ty, |
| 4384 | 4384 | extra.field_index, |
| 4385 | 4385 | zcu, |
| 4386 | 4386 | )) { |
| ... | ... | @@ -4403,7 +4403,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 4403 | 4403 | const ty_op = air.data(air.inst_index).ty_op; |
| 4404 | 4404 | switch (codegen.fieldOffset( |
| 4405 | 4405 | isel.air.typeOf(ty_op.operand, ip), |
| 4406 | | ty_op.ty.toType(), |
| 4406 | ty_op.ty, |
| 4407 | 4407 | switch (air_tag) { |
| 4408 | 4408 | else => unreachable, |
| 4409 | 4409 | .struct_field_ptr_index_0 => 0, |
| ... | ... | @@ -4429,7 +4429,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 4429 | 4429 | const ty_pl = air.data(air.inst_index).ty_pl; |
| 4430 | 4430 | const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data; |
| 4431 | 4431 | 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; |
| 4433 | 4433 | |
| 4434 | 4434 | const field_bit_offset, const field_bit_size, const is_packed = switch (agg_ty.containerLayout(zcu)) { |
| 4435 | 4435 | .auto, .@"extern" => .{ |
| ... | ... | @@ -4476,7 +4476,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 4476 | 4476 | |
| 4477 | 4477 | const ty_pl = air.data(air.inst_index).ty_pl; |
| 4478 | 4478 | 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; |
| 4480 | 4480 | const loaded_union = ip.loadUnionType(union_ty.toIntern()); |
| 4481 | 4481 | const union_layout = ZigType.getUnionLayout(loaded_union, zcu); |
| 4482 | 4482 | |
| ... | ... | @@ -4549,7 +4549,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 4549 | 4549 | defer opt_vi.value.deref(isel); |
| 4550 | 4550 | |
| 4551 | 4551 | 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)) { |
| 4553 | 4553 | try opt_vi.value.defMove(isel, ty_op.operand); |
| 4554 | 4554 | break :unused; |
| 4555 | 4555 | } |
| ... | ... | @@ -4568,7 +4568,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 4568 | 4568 | const ty_pl = air.data(air.inst_index).ty_pl; |
| 4569 | 4569 | const extra = isel.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 4570 | 4570 | switch (codegen.fieldOffset( |
| 4571 | | ty_pl.ty.toType(), |
| 4571 | ty_pl.ty, |
| 4572 | 4572 | isel.air.typeOf(extra.field_ptr, ip), |
| 4573 | 4573 | extra.field_index, |
| 4574 | 4574 | zcu, |
| ... | ... | @@ -4592,7 +4592,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 4592 | 4592 | isel, |
| 4593 | 4593 | try error_union_vi.partExact( |
| 4594 | 4594 | isel, |
| 4595 | | codegen.errUnionPayloadOffset(ty_op.ty.toType(), zcu), |
| 4595 | codegen.errUnionPayloadOffset(ty_op.ty, zcu), |
| 4596 | 4596 | payload_vi.value.size(isel), |
| 4597 | 4597 | ), |
| 4598 | 4598 | ); |
| ... | ... | @@ -4616,7 +4616,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 4616 | 4616 | defer error_union_vi.value.deref(isel); |
| 4617 | 4617 | |
| 4618 | 4618 | 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; |
| 4620 | 4620 | const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type; |
| 4621 | 4621 | const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type); |
| 4622 | 4622 | 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, |
| 4639 | 4639 | defer error_union_vi.value.deref(isel); |
| 4640 | 4640 | |
| 4641 | 4641 | 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; |
| 4643 | 4643 | const error_union_info = ip.indexToKey(error_union_ty.toIntern()).error_union_type; |
| 4644 | 4644 | const error_set_ty: ZigType = .fromInterned(error_union_info.error_set_type); |
| 4645 | 4645 | 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, |
| 4658 | 4658 | .errunion_payload_ptr_set => if (isel.live_values.fetchRemove(air.inst_index)) |payload_ptr_vi| unused: { |
| 4659 | 4659 | defer payload_ptr_vi.value.deref(isel); |
| 4660 | 4660 | 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); |
| 4662 | 4662 | const eu_ty = isel.air.typeOf(ty_op.operand, ip).childType(zcu); |
| 4663 | 4663 | const error_set_size = eu_ty.errorUnionSet(zcu).abiSize(zcu); |
| 4664 | 4664 | |