| ... | ... | @@ -947,19 +947,19 @@ const DeclGen = struct { |
| 947 | 947 | .bytes => |bytes| { |
| 948 | 948 | // TODO: This is really space inefficient, perhaps there is a better |
| 949 | 949 | // way to do it? |
| 950 | | for (constituents, bytes) |*constituent, byte| { |
| 951 | | constituent.* = try self.constInt(elem_ty_ref, byte); |
| 950 | for (bytes, 0..) |byte, i| { |
| 951 | constituents[i] = try self.constInt(elem_ty_ref, byte); |
| 952 | 952 | } |
| 953 | 953 | }, |
| 954 | 954 | .elems => |elems| { |
| 955 | | for (constituents, elems) |*constituent, elem| { |
| 956 | | constituent.* = try self.constant(elem_ty, Value.fromInterned(elem), .indirect); |
| 955 | for (0..@as(usize, @intCast(array_type.len))) |i| { |
| 956 | constituents[i] = try self.constant(elem_ty, Value.fromInterned(elems[i]), .indirect); |
| 957 | 957 | } |
| 958 | 958 | }, |
| 959 | 959 | .repeated_elem => |elem| { |
| 960 | 960 | const val_id = try self.constant(elem_ty, Value.fromInterned(elem), .indirect); |
| 961 | | for (constituents) |*constituent| { |
| 962 | | constituent.* = val_id; |
| 961 | for (0..@as(usize, @intCast(array_type.len))) |i| { |
| 962 | constituents[i] = val_id; |
| 963 | 963 | } |
| 964 | 964 | }, |
| 965 | 965 | } |
| ... | ... | @@ -2199,7 +2199,6 @@ const DeclGen = struct { |
| 2199 | 2199 | fn genInst(self: *DeclGen, inst: Air.Inst.Index) !void { |
| 2200 | 2200 | const mod = self.module; |
| 2201 | 2201 | const ip = &mod.intern_pool; |
| 2202 | | // TODO: remove now-redundant isUnused calls from AIR handler functions |
| 2203 | 2202 | if (self.liveness.isUnused(inst) and !self.air.mustLower(inst, ip)) |
| 2204 | 2203 | return; |
| 2205 | 2204 | |
| ... | ... | @@ -2365,8 +2364,6 @@ const DeclGen = struct { |
| 2365 | 2364 | } |
| 2366 | 2365 | |
| 2367 | 2366 | fn airBinOpSimple(self: *DeclGen, inst: Air.Inst.Index, comptime opcode: Opcode) !?IdRef { |
| 2368 | | if (self.liveness.isUnused(inst)) return null; |
| 2369 | | |
| 2370 | 2367 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 2371 | 2368 | const lhs_id = try self.resolve(bin_op.lhs); |
| 2372 | 2369 | const rhs_id = try self.resolve(bin_op.rhs); |
| ... | ... | @@ -2376,7 +2373,6 @@ const DeclGen = struct { |
| 2376 | 2373 | } |
| 2377 | 2374 | |
| 2378 | 2375 | fn airShift(self: *DeclGen, inst: Air.Inst.Index, comptime unsigned: Opcode, comptime signed: Opcode) !?IdRef { |
| 2379 | | if (self.liveness.isUnused(inst)) return null; |
| 2380 | 2376 | const mod = self.module; |
| 2381 | 2377 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 2382 | 2378 | const lhs_id = try self.resolve(bin_op.lhs); |
| ... | ... | @@ -2431,8 +2427,6 @@ const DeclGen = struct { |
| 2431 | 2427 | } |
| 2432 | 2428 | |
| 2433 | 2429 | fn airMinMax(self: *DeclGen, inst: Air.Inst.Index, op: std.math.CompareOperator) !?IdRef { |
| 2434 | | if (self.liveness.isUnused(inst)) return null; |
| 2435 | | |
| 2436 | 2430 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 2437 | 2431 | const lhs_id = try self.resolve(bin_op.lhs); |
| 2438 | 2432 | const rhs_id = try self.resolve(bin_op.rhs); |
| ... | ... | @@ -2544,7 +2538,6 @@ const DeclGen = struct { |
| 2544 | 2538 | comptime sop: Opcode, |
| 2545 | 2539 | comptime uop: Opcode, |
| 2546 | 2540 | ) !?IdRef { |
| 2547 | | if (self.liveness.isUnused(inst)) return null; |
| 2548 | 2541 | |
| 2549 | 2542 | // LHS and RHS are guaranteed to have the same type, and AIR guarantees |
| 2550 | 2543 | // the result to be the same as the LHS and RHS, which matches SPIR-V. |
| ... | ... | @@ -2614,8 +2607,6 @@ const DeclGen = struct { |
| 2614 | 2607 | } |
| 2615 | 2608 | |
| 2616 | 2609 | fn airAbs(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 2617 | | if (self.liveness.isUnused(inst)) return null; |
| 2618 | | |
| 2619 | 2610 | const mod = self.module; |
| 2620 | 2611 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2621 | 2612 | const operand_id = try self.resolve(ty_op.operand); |
| ... | ... | @@ -2678,8 +2669,6 @@ const DeclGen = struct { |
| 2678 | 2669 | comptime ucmp: Opcode, |
| 2679 | 2670 | comptime scmp: Opcode, |
| 2680 | 2671 | ) !?IdRef { |
| 2681 | | if (self.liveness.isUnused(inst)) return null; |
| 2682 | | |
| 2683 | 2672 | const mod = self.module; |
| 2684 | 2673 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 2685 | 2674 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| ... | ... | @@ -2793,7 +2782,6 @@ const DeclGen = struct { |
| 2793 | 2782 | } |
| 2794 | 2783 | |
| 2795 | 2784 | fn airShlOverflow(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 2796 | | if (self.liveness.isUnused(inst)) return null; |
| 2797 | 2785 | const mod = self.module; |
| 2798 | 2786 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 2799 | 2787 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| ... | ... | @@ -2887,8 +2875,6 @@ const DeclGen = struct { |
| 2887 | 2875 | } |
| 2888 | 2876 | |
| 2889 | 2877 | fn airMulAdd(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 2890 | | if (self.liveness.isUnused(inst)) return null; |
| 2891 | | |
| 2892 | 2878 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; |
| 2893 | 2879 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 2894 | 2880 | |
| ... | ... | @@ -2923,7 +2909,6 @@ const DeclGen = struct { |
| 2923 | 2909 | } |
| 2924 | 2910 | |
| 2925 | 2911 | fn airSplat(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 2926 | | if (self.liveness.isUnused(inst)) return null; |
| 2927 | 2912 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2928 | 2913 | const operand_id = try self.resolve(ty_op.operand); |
| 2929 | 2914 | const result_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -2934,7 +2919,6 @@ const DeclGen = struct { |
| 2934 | 2919 | } |
| 2935 | 2920 | |
| 2936 | 2921 | fn airReduce(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 2937 | | if (self.liveness.isUnused(inst)) return null; |
| 2938 | 2922 | const mod = self.module; |
| 2939 | 2923 | const reduce = self.air.instructions.items(.data)[@intFromEnum(inst)].reduce; |
| 2940 | 2924 | const operand = try self.resolve(reduce.operand); |
| ... | ... | @@ -3002,7 +2986,6 @@ const DeclGen = struct { |
| 3002 | 2986 | |
| 3003 | 2987 | fn airShuffle(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3004 | 2988 | const mod = self.module; |
| 3005 | | if (self.liveness.isUnused(inst)) return null; |
| 3006 | 2989 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3007 | 2990 | const extra = self.air.extraData(Air.Shuffle, ty_pl.payload).data; |
| 3008 | 2991 | const a = try self.resolve(extra.a); |
| ... | ... | @@ -3115,7 +3098,6 @@ const DeclGen = struct { |
| 3115 | 3098 | } |
| 3116 | 3099 | |
| 3117 | 3100 | fn airPtrAdd(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3118 | | if (self.liveness.isUnused(inst)) return null; |
| 3119 | 3101 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3120 | 3102 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3121 | 3103 | const ptr_id = try self.resolve(bin_op.lhs); |
| ... | ... | @@ -3127,7 +3109,6 @@ const DeclGen = struct { |
| 3127 | 3109 | } |
| 3128 | 3110 | |
| 3129 | 3111 | fn airPtrSub(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3130 | | if (self.liveness.isUnused(inst)) return null; |
| 3131 | 3112 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3132 | 3113 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3133 | 3114 | const ptr_id = try self.resolve(bin_op.lhs); |
| ... | ... | @@ -3303,7 +3284,6 @@ const DeclGen = struct { |
| 3303 | 3284 | inst: Air.Inst.Index, |
| 3304 | 3285 | comptime op: std.math.CompareOperator, |
| 3305 | 3286 | ) !?IdRef { |
| 3306 | | if (self.liveness.isUnused(inst)) return null; |
| 3307 | 3287 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3308 | 3288 | const lhs_id = try self.resolve(bin_op.lhs); |
| 3309 | 3289 | const rhs_id = try self.resolve(bin_op.rhs); |
| ... | ... | @@ -3314,8 +3294,6 @@ const DeclGen = struct { |
| 3314 | 3294 | } |
| 3315 | 3295 | |
| 3316 | 3296 | fn airVectorCmp(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3317 | | if (self.liveness.isUnused(inst)) return null; |
| 3318 | | |
| 3319 | 3297 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3320 | 3298 | const vec_cmp = self.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 3321 | 3299 | const lhs_id = try self.resolve(vec_cmp.lhs); |
| ... | ... | @@ -3397,7 +3375,6 @@ const DeclGen = struct { |
| 3397 | 3375 | } |
| 3398 | 3376 | |
| 3399 | 3377 | fn airBitCast(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3400 | | if (self.liveness.isUnused(inst)) return null; |
| 3401 | 3378 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3402 | 3379 | const operand_id = try self.resolve(ty_op.operand); |
| 3403 | 3380 | const operand_ty = self.typeOf(ty_op.operand); |
| ... | ... | @@ -3406,8 +3383,6 @@ const DeclGen = struct { |
| 3406 | 3383 | } |
| 3407 | 3384 | |
| 3408 | 3385 | fn airIntCast(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3409 | | if (self.liveness.isUnused(inst)) return null; |
| 3410 | | |
| 3411 | 3386 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3412 | 3387 | const operand_id = try self.resolve(ty_op.operand); |
| 3413 | 3388 | const src_ty = self.typeOf(ty_op.operand); |
| ... | ... | @@ -3463,16 +3438,12 @@ const DeclGen = struct { |
| 3463 | 3438 | } |
| 3464 | 3439 | |
| 3465 | 3440 | fn airIntFromPtr(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3466 | | if (self.liveness.isUnused(inst)) return null; |
| 3467 | | |
| 3468 | 3441 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 3469 | 3442 | const operand_id = try self.resolve(un_op); |
| 3470 | 3443 | return try self.intFromPtr(operand_id); |
| 3471 | 3444 | } |
| 3472 | 3445 | |
| 3473 | 3446 | fn airFloatFromInt(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3474 | | if (self.liveness.isUnused(inst)) return null; |
| 3475 | | |
| 3476 | 3447 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3477 | 3448 | const operand_ty = self.typeOf(ty_op.operand); |
| 3478 | 3449 | const operand_id = try self.resolve(ty_op.operand); |
| ... | ... | @@ -3497,8 +3468,6 @@ const DeclGen = struct { |
| 3497 | 3468 | } |
| 3498 | 3469 | |
| 3499 | 3470 | fn airIntFromFloat(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3500 | | if (self.liveness.isUnused(inst)) return null; |
| 3501 | | |
| 3502 | 3471 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3503 | 3472 | const operand_id = try self.resolve(ty_op.operand); |
| 3504 | 3473 | const dest_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3522,8 +3491,6 @@ const DeclGen = struct { |
| 3522 | 3491 | } |
| 3523 | 3492 | |
| 3524 | 3493 | fn airIntFromBool(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3525 | | if (self.liveness.isUnused(inst)) return null; |
| 3526 | | |
| 3527 | 3494 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 3528 | 3495 | const operand_id = try self.resolve(un_op); |
| 3529 | 3496 | const result_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3538,8 +3505,6 @@ const DeclGen = struct { |
| 3538 | 3505 | } |
| 3539 | 3506 | |
| 3540 | 3507 | fn airFloatCast(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3541 | | if (self.liveness.isUnused(inst)) return null; |
| 3542 | | |
| 3543 | 3508 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3544 | 3509 | const operand_id = try self.resolve(ty_op.operand); |
| 3545 | 3510 | const dest_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3555,7 +3520,6 @@ const DeclGen = struct { |
| 3555 | 3520 | } |
| 3556 | 3521 | |
| 3557 | 3522 | fn airNot(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3558 | | if (self.liveness.isUnused(inst)) return null; |
| 3559 | 3523 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3560 | 3524 | const operand_id = try self.resolve(ty_op.operand); |
| 3561 | 3525 | const result_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3587,8 +3551,6 @@ const DeclGen = struct { |
| 3587 | 3551 | } |
| 3588 | 3552 | |
| 3589 | 3553 | fn airArrayToSlice(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3590 | | if (self.liveness.isUnused(inst)) return null; |
| 3591 | | |
| 3592 | 3554 | const mod = self.module; |
| 3593 | 3555 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3594 | 3556 | const array_ptr_ty = self.typeOf(ty_op.operand); |
| ... | ... | @@ -3613,8 +3575,6 @@ const DeclGen = struct { |
| 3613 | 3575 | } |
| 3614 | 3576 | |
| 3615 | 3577 | fn airSlice(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3616 | | if (self.liveness.isUnused(inst)) return null; |
| 3617 | | |
| 3618 | 3578 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3619 | 3579 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3620 | 3580 | const ptr_id = try self.resolve(bin_op.lhs); |
| ... | ... | @@ -3627,8 +3587,6 @@ const DeclGen = struct { |
| 3627 | 3587 | } |
| 3628 | 3588 | |
| 3629 | 3589 | fn airAggregateInit(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3630 | | if (self.liveness.isUnused(inst)) return null; |
| 3631 | | |
| 3632 | 3590 | const mod = self.module; |
| 3633 | 3591 | const ip = &mod.intern_pool; |
| 3634 | 3592 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| ... | ... | @@ -3681,9 +3639,9 @@ const DeclGen = struct { |
| 3681 | 3639 | const elem_ids = try self.gpa.alloc(IdRef, n_elems); |
| 3682 | 3640 | defer self.gpa.free(elem_ids); |
| 3683 | 3641 | |
| 3684 | | for (elements, elem_ids) |element, *elem_id| { |
| 3642 | for (elements, 0..) |element, i| { |
| 3685 | 3643 | const id = try self.resolve(element); |
| 3686 | | elem_id.* = try self.convertToIndirect(result_ty.childType(mod), id); |
| 3644 | elem_ids[i] = try self.convertToIndirect(result_ty.childType(mod), id); |
| 3687 | 3645 | } |
| 3688 | 3646 | |
| 3689 | 3647 | return try self.constructComposite(result_ty, elem_ids); |
| ... | ... | @@ -3694,9 +3652,9 @@ const DeclGen = struct { |
| 3694 | 3652 | const elem_ids = try self.gpa.alloc(IdRef, n_elems); |
| 3695 | 3653 | defer self.gpa.free(elem_ids); |
| 3696 | 3654 | |
| 3697 | | for (elements, elem_ids) |element, *elem_id| { |
| 3655 | for (elements, 0..) |element, i| { |
| 3698 | 3656 | const id = try self.resolve(element); |
| 3699 | | elem_id.* = try self.convertToIndirect(array_info.elem_type, id); |
| 3657 | elem_ids[i] = try self.convertToIndirect(array_info.elem_type, id); |
| 3700 | 3658 | } |
| 3701 | 3659 | |
| 3702 | 3660 | if (array_info.sentinel) |sentinel_val| { |
| ... | ... | @@ -3750,7 +3708,6 @@ const DeclGen = struct { |
| 3750 | 3708 | } |
| 3751 | 3709 | |
| 3752 | 3710 | fn airSliceField(self: *DeclGen, inst: Air.Inst.Index, field: u32) !?IdRef { |
| 3753 | | if (self.liveness.isUnused(inst)) return null; |
| 3754 | 3711 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3755 | 3712 | const field_ty = self.typeOfIndex(inst); |
| 3756 | 3713 | const operand_id = try self.resolve(ty_op.operand); |
| ... | ... | @@ -3807,8 +3764,6 @@ const DeclGen = struct { |
| 3807 | 3764 | } |
| 3808 | 3765 | |
| 3809 | 3766 | fn airPtrElemPtr(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3810 | | if (self.liveness.isUnused(inst)) return null; |
| 3811 | | |
| 3812 | 3767 | const mod = self.module; |
| 3813 | 3768 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3814 | 3769 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| ... | ... | @@ -3826,8 +3781,6 @@ const DeclGen = struct { |
| 3826 | 3781 | } |
| 3827 | 3782 | |
| 3828 | 3783 | fn airArrayElemVal(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3829 | | if (self.liveness.isUnused(inst)) return null; |
| 3830 | | |
| 3831 | 3784 | const mod = self.module; |
| 3832 | 3785 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3833 | 3786 | const array_ty = self.typeOf(bin_op.lhs); |
| ... | ... | @@ -3848,8 +3801,6 @@ const DeclGen = struct { |
| 3848 | 3801 | } |
| 3849 | 3802 | |
| 3850 | 3803 | fn airPtrElemVal(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3851 | | if (self.liveness.isUnused(inst)) return null; |
| 3852 | | |
| 3853 | 3804 | const mod = self.module; |
| 3854 | 3805 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3855 | 3806 | const ptr_ty = self.typeOf(bin_op.lhs); |
| ... | ... | @@ -3906,8 +3857,6 @@ const DeclGen = struct { |
| 3906 | 3857 | } |
| 3907 | 3858 | |
| 3908 | 3859 | fn airGetUnionTag(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3909 | | if (self.liveness.isUnused(inst)) return null; |
| 3910 | | |
| 3911 | 3860 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3912 | 3861 | const un_ty = self.typeOf(ty_op.operand); |
| 3913 | 3862 | |
| ... | ... | @@ -3991,8 +3940,6 @@ const DeclGen = struct { |
| 3991 | 3940 | } |
| 3992 | 3941 | |
| 3993 | 3942 | fn airUnionInit(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 3994 | | if (self.liveness.isUnused(inst)) return null; |
| 3995 | | |
| 3996 | 3943 | const mod = self.module; |
| 3997 | 3944 | const ip = &mod.intern_pool; |
| 3998 | 3945 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| ... | ... | @@ -4009,8 +3956,6 @@ const DeclGen = struct { |
| 4009 | 3956 | } |
| 4010 | 3957 | |
| 4011 | 3958 | fn airStructFieldVal(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 4012 | | if (self.liveness.isUnused(inst)) return null; |
| 4013 | | |
| 4014 | 3959 | const mod = self.module; |
| 4015 | 3960 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 4016 | 3961 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| ... | ... | @@ -4131,7 +4076,6 @@ const DeclGen = struct { |
| 4131 | 4076 | } |
| 4132 | 4077 | |
| 4133 | 4078 | fn airStructFieldPtrIndex(self: *DeclGen, inst: Air.Inst.Index, field_index: u32) !?IdRef { |
| 4134 | | if (self.liveness.isUnused(inst)) return null; |
| 4135 | 4079 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4136 | 4080 | const struct_ptr = try self.resolve(ty_op.operand); |
| 4137 | 4081 | const struct_ptr_ty = self.typeOf(ty_op.operand); |
| ... | ... | @@ -4185,7 +4129,6 @@ const DeclGen = struct { |
| 4185 | 4129 | } |
| 4186 | 4130 | |
| 4187 | 4131 | fn airAlloc(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 4188 | | if (self.liveness.isUnused(inst)) return null; |
| 4189 | 4132 | const mod = self.module; |
| 4190 | 4133 | const ptr_ty = self.typeOfIndex(inst); |
| 4191 | 4134 | assert(ptr_ty.ptrAddressSpace(mod) == .generic); |
| ... | ... | @@ -4769,9 +4712,7 @@ const DeclGen = struct { |
| 4769 | 4712 | |
| 4770 | 4713 | try self.beginSpvBlock(ok_block); |
| 4771 | 4714 | } |
| 4772 | | if (self.liveness.isUnused(inst)) { |
| 4773 | | return null; |
| 4774 | | } |
| 4715 | |
| 4775 | 4716 | if (!eu_layout.payload_has_bits) { |
| 4776 | 4717 | return null; |
| 4777 | 4718 | } |
| ... | ... | @@ -4781,8 +4722,6 @@ const DeclGen = struct { |
| 4781 | 4722 | } |
| 4782 | 4723 | |
| 4783 | 4724 | fn airErrUnionErr(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 4784 | | if (self.liveness.isUnused(inst)) return null; |
| 4785 | | |
| 4786 | 4725 | const mod = self.module; |
| 4787 | 4726 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4788 | 4727 | const operand_id = try self.resolve(ty_op.operand); |
| ... | ... | @@ -4806,8 +4745,6 @@ const DeclGen = struct { |
| 4806 | 4745 | } |
| 4807 | 4746 | |
| 4808 | 4747 | fn airErrUnionPayload(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 4809 | | if (self.liveness.isUnused(inst)) return null; |
| 4810 | | |
| 4811 | 4748 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4812 | 4749 | const operand_id = try self.resolve(ty_op.operand); |
| 4813 | 4750 | const payload_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -4821,8 +4758,6 @@ const DeclGen = struct { |
| 4821 | 4758 | } |
| 4822 | 4759 | |
| 4823 | 4760 | fn airWrapErrUnionErr(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 4824 | | if (self.liveness.isUnused(inst)) return null; |
| 4825 | | |
| 4826 | 4761 | const mod = self.module; |
| 4827 | 4762 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4828 | 4763 | const err_union_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -4844,8 +4779,6 @@ const DeclGen = struct { |
| 4844 | 4779 | } |
| 4845 | 4780 | |
| 4846 | 4781 | fn airWrapErrUnionPayload(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 4847 | | if (self.liveness.isUnused(inst)) return null; |
| 4848 | | |
| 4849 | 4782 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4850 | 4783 | const err_union_ty = self.typeOfIndex(inst); |
| 4851 | 4784 | const operand_id = try self.resolve(ty_op.operand); |
| ... | ... | @@ -4865,8 +4798,6 @@ const DeclGen = struct { |
| 4865 | 4798 | } |
| 4866 | 4799 | |
| 4867 | 4800 | fn airIsNull(self: *DeclGen, inst: Air.Inst.Index, is_pointer: bool, pred: enum { is_null, is_non_null }) !?IdRef { |
| 4868 | | if (self.liveness.isUnused(inst)) return null; |
| 4869 | | |
| 4870 | 4801 | const mod = self.module; |
| 4871 | 4802 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4872 | 4803 | const operand_id = try self.resolve(un_op); |
| ... | ... | @@ -4939,8 +4870,6 @@ const DeclGen = struct { |
| 4939 | 4870 | } |
| 4940 | 4871 | |
| 4941 | 4872 | fn airIsErr(self: *DeclGen, inst: Air.Inst.Index, pred: enum { is_err, is_non_err }) !?IdRef { |
| 4942 | | if (self.liveness.isUnused(inst)) return null; |
| 4943 | | |
| 4944 | 4873 | const mod = self.module; |
| 4945 | 4874 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4946 | 4875 | const operand_id = try self.resolve(un_op); |
| ... | ... | @@ -4975,8 +4904,6 @@ const DeclGen = struct { |
| 4975 | 4904 | } |
| 4976 | 4905 | |
| 4977 | 4906 | fn airUnwrapOptional(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 4978 | | if (self.liveness.isUnused(inst)) return null; |
| 4979 | | |
| 4980 | 4907 | const mod = self.module; |
| 4981 | 4908 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4982 | 4909 | const operand_id = try self.resolve(ty_op.operand); |
| ... | ... | @@ -4993,8 +4920,6 @@ const DeclGen = struct { |
| 4993 | 4920 | } |
| 4994 | 4921 | |
| 4995 | 4922 | fn airUnwrapOptionalPtr(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 4996 | | if (self.liveness.isUnused(inst)) return null; |
| 4997 | | |
| 4998 | 4923 | const mod = self.module; |
| 4999 | 4924 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5000 | 4925 | const operand_id = try self.resolve(ty_op.operand); |
| ... | ... | @@ -5019,8 +4944,6 @@ const DeclGen = struct { |
| 5019 | 4944 | } |
| 5020 | 4945 | |
| 5021 | 4946 | fn airWrapOptional(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 5022 | | if (self.liveness.isUnused(inst)) return null; |
| 5023 | | |
| 5024 | 4947 | const mod = self.module; |
| 5025 | 4948 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5026 | 4949 | const payload_ty = self.typeOf(ty_op.operand); |