| ... | @@ -2009,9 +2009,11 @@ fn genInst(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -2009,9 +2009,11 @@ fn genInst(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2009 | | 2009 | |
| 2010 | fn genBody(func: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | 2010 | fn genBody(func: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 2011 | for (body) |inst| { | 2011 | for (body) |inst| { |
| | 2012 | if (func.liveness.isUnused(inst) and !func.air.mustLower(inst)) { |
| | 2013 | continue; |
| | 2014 | } |
| 2012 | const old_bookkeeping_value = func.air_bookkeeping; | 2015 | const old_bookkeeping_value = func.air_bookkeeping; |
| 2013 | // TODO: Determine why we need to pre-allocate an extra 4 possible values here. | 2016 | try func.currentBranch().values.ensureUnusedCapacity(func.gpa, Liveness.bpi); |
| 2014 | try func.currentBranch().values.ensureUnusedCapacity(func.gpa, Liveness.bpi + 4); | | |
| 2015 | try func.genInst(inst); | 2017 | try func.genInst(inst); |
| 2016 | | 2018 | |
| 2017 | if (builtin.mode == .Debug and func.air_bookkeeping < old_bookkeeping_value + 1) { | 2019 | if (builtin.mode == .Debug and func.air_bookkeeping < old_bookkeeping_value + 1) { |
| ... | @@ -2185,7 +2187,7 @@ fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif | ... | @@ -2185,7 +2187,7 @@ fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif |
| 2185 | } | 2187 | } |
| 2186 | | 2188 | |
| 2187 | const result_value = result_value: { | 2189 | const result_value = result_value: { |
| 2188 | if (func.liveness.isUnused(inst) or (!ret_ty.hasRuntimeBitsIgnoreComptime() and !ret_ty.isError())) { | 2190 | if (!ret_ty.hasRuntimeBitsIgnoreComptime() and !ret_ty.isError()) { |
| 2189 | break :result_value WValue{ .none = {} }; | 2191 | break :result_value WValue{ .none = {} }; |
| 2190 | } else if (ret_ty.isNoReturn()) { | 2192 | } else if (ret_ty.isNoReturn()) { |
| 2191 | try func.addTag(.@"unreachable"); | 2193 | try func.addTag(.@"unreachable"); |
| ... | @@ -2494,7 +2496,6 @@ fn airArg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -2494,7 +2496,6 @@ fn airArg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2494 | | 2496 | |
| 2495 | fn airBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { | 2497 | fn airBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { |
| 2496 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 2498 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 2497 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 2498 | const lhs = try func.resolveInst(bin_op.lhs); | 2499 | const lhs = try func.resolveInst(bin_op.lhs); |
| 2499 | const rhs = try func.resolveInst(bin_op.rhs); | 2500 | const rhs = try func.resolveInst(bin_op.rhs); |
| 2500 | const ty = func.air.typeOf(bin_op.lhs); | 2501 | const ty = func.air.typeOf(bin_op.lhs); |
| ... | @@ -2649,7 +2650,6 @@ const FloatOp = enum { | ... | @@ -2649,7 +2650,6 @@ const FloatOp = enum { |
| 2649 | | 2650 | |
| 2650 | fn airUnaryFloatOp(func: *CodeGen, inst: Air.Inst.Index, op: FloatOp) InnerError!void { | 2651 | fn airUnaryFloatOp(func: *CodeGen, inst: Air.Inst.Index, op: FloatOp) InnerError!void { |
| 2651 | const un_op = func.air.instructions.items(.data)[inst].un_op; | 2652 | const un_op = func.air.instructions.items(.data)[inst].un_op; |
| 2652 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{un_op}); | | |
| 2653 | const operand = try func.resolveInst(un_op); | 2653 | const operand = try func.resolveInst(un_op); |
| 2654 | const ty = func.air.typeOf(un_op); | 2654 | const ty = func.air.typeOf(un_op); |
| 2655 | | 2655 | |
| ... | @@ -2723,7 +2723,6 @@ fn floatOp(func: *CodeGen, float_op: FloatOp, ty: Type, args: []const WValue) In | ... | @@ -2723,7 +2723,6 @@ fn floatOp(func: *CodeGen, float_op: FloatOp, ty: Type, args: []const WValue) In |
| 2723 | | 2723 | |
| 2724 | fn airWrapBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { | 2724 | fn airWrapBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { |
| 2725 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 2725 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 2726 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 2727 | | 2726 | |
| 2728 | const lhs = try func.resolveInst(bin_op.lhs); | 2727 | const lhs = try func.resolveInst(bin_op.lhs); |
| 2729 | const rhs = try func.resolveInst(bin_op.rhs); | 2728 | const rhs = try func.resolveInst(bin_op.rhs); |
| ... | @@ -3218,9 +3217,6 @@ fn airCondBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3218,9 +3217,6 @@ fn airCondBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3218 | | 3217 | |
| 3219 | func.branches.appendAssumeCapacity(.{}); | 3218 | func.branches.appendAssumeCapacity(.{}); |
| 3220 | try func.currentBranch().values.ensureUnusedCapacity(func.gpa, @intCast(u32, liveness_condbr.else_deaths.len)); | 3219 | try func.currentBranch().values.ensureUnusedCapacity(func.gpa, @intCast(u32, liveness_condbr.else_deaths.len)); |
| 3221 | for (liveness_condbr.else_deaths) |death| { | | |
| 3222 | func.processDeath(Air.indexToRef(death)); | | |
| 3223 | } | | |
| 3224 | try func.genBody(else_body); | 3220 | try func.genBody(else_body); |
| 3225 | try func.endBlock(); | 3221 | try func.endBlock(); |
| 3226 | var else_stack = func.branches.pop(); | 3222 | var else_stack = func.branches.pop(); |
| ... | @@ -3229,9 +3225,6 @@ fn airCondBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3229,9 +3225,6 @@ fn airCondBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3229 | // Outer block that matches the condition | 3225 | // Outer block that matches the condition |
| 3230 | func.branches.appendAssumeCapacity(.{}); | 3226 | func.branches.appendAssumeCapacity(.{}); |
| 3231 | try func.currentBranch().values.ensureUnusedCapacity(func.gpa, @intCast(u32, liveness_condbr.then_deaths.len)); | 3227 | try func.currentBranch().values.ensureUnusedCapacity(func.gpa, @intCast(u32, liveness_condbr.then_deaths.len)); |
| 3232 | for (liveness_condbr.then_deaths) |death| { | | |
| 3233 | func.processDeath(Air.indexToRef(death)); | | |
| 3234 | } | | |
| 3235 | try func.genBody(then_body); | 3228 | try func.genBody(then_body); |
| 3236 | var then_stack = func.branches.pop(); | 3229 | var then_stack = func.branches.pop(); |
| 3237 | defer then_stack.deinit(func.gpa); | 3230 | defer then_stack.deinit(func.gpa); |
| ... | @@ -3249,7 +3242,7 @@ fn mergeBranch(func: *CodeGen, branch: *const Branch) !void { | ... | @@ -3249,7 +3242,7 @@ fn mergeBranch(func: *CodeGen, branch: *const Branch) !void { |
| 3249 | const target_keys = target_slice.items(.key); | 3242 | const target_keys = target_slice.items(.key); |
| 3250 | const target_values = target_slice.items(.value); | 3243 | const target_values = target_slice.items(.value); |
| 3251 | | 3244 | |
| 3252 | try parent.values.ensureUnusedCapacity(func.gpa, branch.values.count()); | 3245 | try parent.values.ensureTotalCapacity(func.gpa, parent.values.capacity() + branch.values.count()); |
| 3253 | for (target_keys, 0..) |key, index| { | 3246 | for (target_keys, 0..) |key, index| { |
| 3254 | // TODO: process deaths from branches | 3247 | // TODO: process deaths from branches |
| 3255 | parent.values.putAssumeCapacity(key, target_values[index]); | 3248 | parent.values.putAssumeCapacity(key, target_values[index]); |
| ... | @@ -3258,7 +3251,6 @@ fn mergeBranch(func: *CodeGen, branch: *const Branch) !void { | ... | @@ -3258,7 +3251,6 @@ fn mergeBranch(func: *CodeGen, branch: *const Branch) !void { |
| 3258 | | 3251 | |
| 3259 | fn airCmp(func: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) InnerError!void { | 3252 | fn airCmp(func: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) InnerError!void { |
| 3260 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 3253 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 3261 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 3262 | | 3254 | |
| 3263 | const lhs = try func.resolveInst(bin_op.lhs); | 3255 | const lhs = try func.resolveInst(bin_op.lhs); |
| 3264 | const rhs = try func.resolveInst(bin_op.rhs); | 3256 | const rhs = try func.resolveInst(bin_op.rhs); |
| ... | @@ -3375,7 +3367,6 @@ fn airBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3375,7 +3367,6 @@ fn airBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3375 | | 3367 | |
| 3376 | fn airNot(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 3368 | fn airNot(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3377 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 3369 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 3378 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 3379 | | 3370 | |
| 3380 | const operand = try func.resolveInst(ty_op.operand); | 3371 | const operand = try func.resolveInst(ty_op.operand); |
| 3381 | const operand_ty = func.air.typeOf(ty_op.operand); | 3372 | const operand_ty = func.air.typeOf(ty_op.operand); |
| ... | @@ -3441,7 +3432,7 @@ fn airUnreachable(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3441,7 +3432,7 @@ fn airUnreachable(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3441 | | 3432 | |
| 3442 | fn airBitcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 3433 | fn airBitcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3443 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 3434 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 3444 | const result = if (!func.liveness.isUnused(inst)) result: { | 3435 | const result = result: { |
| 3445 | const operand = try func.resolveInst(ty_op.operand); | 3436 | const operand = try func.resolveInst(ty_op.operand); |
| 3446 | const wanted_ty = func.air.typeOfIndex(inst); | 3437 | const wanted_ty = func.air.typeOfIndex(inst); |
| 3447 | const given_ty = func.air.typeOf(ty_op.operand); | 3438 | const given_ty = func.air.typeOf(ty_op.operand); |
| ... | @@ -3450,7 +3441,7 @@ fn airBitcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3450,7 +3441,7 @@ fn airBitcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3450 | break :result try bitcast_result.toLocal(func, wanted_ty); | 3441 | break :result try bitcast_result.toLocal(func, wanted_ty); |
| 3451 | } | 3442 | } |
| 3452 | break :result func.reuseOperand(ty_op.operand, operand); | 3443 | break :result func.reuseOperand(ty_op.operand, operand); |
| 3453 | } else WValue{ .none = {} }; | 3444 | }; |
| 3454 | func.finishAir(inst, result, &.{ty_op.operand}); | 3445 | func.finishAir(inst, result, &.{ty_op.operand}); |
| 3455 | } | 3446 | } |
| 3456 | | 3447 | |
| ... | @@ -3474,7 +3465,6 @@ fn bitcast(func: *CodeGen, wanted_ty: Type, given_ty: Type, operand: WValue) Inn | ... | @@ -3474,7 +3465,6 @@ fn bitcast(func: *CodeGen, wanted_ty: Type, given_ty: Type, operand: WValue) Inn |
| 3474 | fn airStructFieldPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 3465 | fn airStructFieldPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3475 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 3466 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 3476 | const extra = func.air.extraData(Air.StructField, ty_pl.payload); | 3467 | const extra = func.air.extraData(Air.StructField, ty_pl.payload); |
| 3477 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{extra.data.struct_operand}); | | |
| 3478 | | 3468 | |
| 3479 | const struct_ptr = try func.resolveInst(extra.data.struct_operand); | 3469 | const struct_ptr = try func.resolveInst(extra.data.struct_operand); |
| 3480 | const struct_ty = func.air.typeOf(extra.data.struct_operand).childType(); | 3470 | const struct_ty = func.air.typeOf(extra.data.struct_operand).childType(); |
| ... | @@ -3484,7 +3474,6 @@ fn airStructFieldPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3484,7 +3474,6 @@ fn airStructFieldPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3484 | | 3474 | |
| 3485 | fn airStructFieldPtrIndex(func: *CodeGen, inst: Air.Inst.Index, index: u32) InnerError!void { | 3475 | fn airStructFieldPtrIndex(func: *CodeGen, inst: Air.Inst.Index, index: u32) InnerError!void { |
| 3486 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 3476 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 3487 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 3488 | const struct_ptr = try func.resolveInst(ty_op.operand); | 3477 | const struct_ptr = try func.resolveInst(ty_op.operand); |
| 3489 | const struct_ty = func.air.typeOf(ty_op.operand).childType(); | 3478 | const struct_ty = func.air.typeOf(ty_op.operand).childType(); |
| 3490 | | 3479 | |
| ... | @@ -3529,7 +3518,6 @@ fn structFieldPtr( | ... | @@ -3529,7 +3518,6 @@ fn structFieldPtr( |
| 3529 | fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 3518 | fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3530 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 3519 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 3531 | const struct_field = func.air.extraData(Air.StructField, ty_pl.payload).data; | 3520 | const struct_field = func.air.extraData(Air.StructField, ty_pl.payload).data; |
| 3532 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{struct_field.struct_operand}); | | |
| 3533 | | 3521 | |
| 3534 | const struct_ty = func.air.typeOf(struct_field.struct_operand); | 3522 | const struct_ty = func.air.typeOf(struct_field.struct_operand); |
| 3535 | const operand = try func.resolveInst(struct_field.struct_operand); | 3523 | const operand = try func.resolveInst(struct_field.struct_operand); |
| ... | @@ -3795,7 +3783,6 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3795,7 +3783,6 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3795 | | 3783 | |
| 3796 | fn airIsErr(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerError!void { | 3784 | fn airIsErr(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerError!void { |
| 3797 | const un_op = func.air.instructions.items(.data)[inst].un_op; | 3785 | const un_op = func.air.instructions.items(.data)[inst].un_op; |
| 3798 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{un_op}); | | |
| 3799 | const operand = try func.resolveInst(un_op); | 3786 | const operand = try func.resolveInst(un_op); |
| 3800 | const err_union_ty = func.air.typeOf(un_op); | 3787 | const err_union_ty = func.air.typeOf(un_op); |
| 3801 | const pl_ty = err_union_ty.errorUnionPayload(); | 3788 | const pl_ty = err_union_ty.errorUnionPayload(); |
| ... | @@ -3830,7 +3817,6 @@ fn airIsErr(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerErro | ... | @@ -3830,7 +3817,6 @@ fn airIsErr(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerErro |
| 3830 | | 3817 | |
| 3831 | fn airUnwrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { | 3818 | fn airUnwrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { |
| 3832 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 3819 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 3833 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 3834 | | 3820 | |
| 3835 | const operand = try func.resolveInst(ty_op.operand); | 3821 | const operand = try func.resolveInst(ty_op.operand); |
| 3836 | const op_ty = func.air.typeOf(ty_op.operand); | 3822 | const op_ty = func.air.typeOf(ty_op.operand); |
| ... | @@ -3853,7 +3839,6 @@ fn airUnwrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: boo | ... | @@ -3853,7 +3839,6 @@ fn airUnwrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: boo |
| 3853 | | 3839 | |
| 3854 | fn airUnwrapErrUnionError(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { | 3840 | fn airUnwrapErrUnionError(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { |
| 3855 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 3841 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 3856 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 3857 | | 3842 | |
| 3858 | const operand = try func.resolveInst(ty_op.operand); | 3843 | const operand = try func.resolveInst(ty_op.operand); |
| 3859 | const op_ty = func.air.typeOf(ty_op.operand); | 3844 | const op_ty = func.air.typeOf(ty_op.operand); |
| ... | @@ -3877,7 +3862,6 @@ fn airUnwrapErrUnionError(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) | ... | @@ -3877,7 +3862,6 @@ fn airUnwrapErrUnionError(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) |
| 3877 | | 3862 | |
| 3878 | fn airWrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 3863 | fn airWrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3879 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 3864 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 3880 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 3881 | | 3865 | |
| 3882 | const operand = try func.resolveInst(ty_op.operand); | 3866 | const operand = try func.resolveInst(ty_op.operand); |
| 3883 | const err_ty = func.air.typeOfIndex(inst); | 3867 | const err_ty = func.air.typeOfIndex(inst); |
| ... | @@ -3904,7 +3888,6 @@ fn airWrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void | ... | @@ -3904,7 +3888,6 @@ fn airWrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void |
| 3904 | | 3888 | |
| 3905 | fn airWrapErrUnionErr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 3889 | fn airWrapErrUnionErr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3906 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 3890 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 3907 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 3908 | | 3891 | |
| 3909 | const operand = try func.resolveInst(ty_op.operand); | 3892 | const operand = try func.resolveInst(ty_op.operand); |
| 3910 | const err_ty = func.air.getRefType(ty_op.ty); | 3893 | const err_ty = func.air.getRefType(ty_op.ty); |
| ... | @@ -3931,7 +3914,6 @@ fn airWrapErrUnionErr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3931,7 +3914,6 @@ fn airWrapErrUnionErr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3931 | | 3914 | |
| 3932 | fn airIntcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 3915 | fn airIntcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3933 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 3916 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 3934 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 3935 | | 3917 | |
| 3936 | const ty = func.air.getRefType(ty_op.ty); | 3918 | const ty = func.air.getRefType(ty_op.ty); |
| 3937 | const operand = try func.resolveInst(ty_op.operand); | 3919 | const operand = try func.resolveInst(ty_op.operand); |
| ... | @@ -3998,7 +3980,6 @@ fn intcast(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro | ... | @@ -3998,7 +3980,6 @@ fn intcast(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro |
| 3998 | | 3980 | |
| 3999 | fn airIsNull(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode, op_kind: enum { value, ptr }) InnerError!void { | 3981 | fn airIsNull(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode, op_kind: enum { value, ptr }) InnerError!void { |
| 4000 | const un_op = func.air.instructions.items(.data)[inst].un_op; | 3982 | const un_op = func.air.instructions.items(.data)[inst].un_op; |
| 4001 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{un_op}); | | |
| 4002 | const operand = try func.resolveInst(un_op); | 3983 | const operand = try func.resolveInst(un_op); |
| 4003 | | 3984 | |
| 4004 | const op_ty = func.air.typeOf(un_op); | 3985 | const op_ty = func.air.typeOf(un_op); |
| ... | @@ -4043,7 +4024,7 @@ fn airOptionalPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4043,7 +4024,7 @@ fn airOptionalPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4043 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 4024 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 4044 | const opt_ty = func.air.typeOf(ty_op.operand); | 4025 | const opt_ty = func.air.typeOf(ty_op.operand); |
| 4045 | const payload_ty = func.air.typeOfIndex(inst); | 4026 | const payload_ty = func.air.typeOfIndex(inst); |
| 4046 | if (func.liveness.isUnused(inst) or !payload_ty.hasRuntimeBitsIgnoreComptime()) { | 4027 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) { |
| 4047 | return func.finishAir(inst, .none, &.{ty_op.operand}); | 4028 | return func.finishAir(inst, .none, &.{ty_op.operand}); |
| 4048 | } | 4029 | } |
| 4049 | | 4030 | |
| ... | @@ -4063,7 +4044,6 @@ fn airOptionalPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4063,7 +4044,6 @@ fn airOptionalPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4063 | | 4044 | |
| 4064 | fn airOptionalPayloadPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4045 | fn airOptionalPayloadPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4065 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 4046 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 4066 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 4067 | const operand = try func.resolveInst(ty_op.operand); | 4047 | const operand = try func.resolveInst(ty_op.operand); |
| 4068 | const opt_ty = func.air.typeOf(ty_op.operand).childType(); | 4048 | const opt_ty = func.air.typeOf(ty_op.operand).childType(); |
| 4069 | | 4049 | |
| ... | @@ -4108,7 +4088,6 @@ fn airOptionalPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!voi | ... | @@ -4108,7 +4088,6 @@ fn airOptionalPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!voi |
| 4108 | | 4088 | |
| 4109 | fn airWrapOptional(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4089 | fn airWrapOptional(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4110 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 4090 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 4111 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 4112 | const payload_ty = func.air.typeOf(ty_op.operand); | 4091 | const payload_ty = func.air.typeOf(ty_op.operand); |
| 4113 | | 4092 | |
| 4114 | const result = result: { | 4093 | const result = result: { |
| ... | @@ -4147,7 +4126,6 @@ fn airWrapOptional(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4147,7 +4126,6 @@ fn airWrapOptional(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4147 | fn airSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4126 | fn airSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4148 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 4127 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 4149 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; | 4128 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 4150 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 4151 | | 4129 | |
| 4152 | const lhs = try func.resolveInst(bin_op.lhs); | 4130 | const lhs = try func.resolveInst(bin_op.lhs); |
| 4153 | const rhs = try func.resolveInst(bin_op.rhs); | 4131 | const rhs = try func.resolveInst(bin_op.rhs); |
| ... | @@ -4162,7 +4140,6 @@ fn airSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4162,7 +4140,6 @@ fn airSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4162 | | 4140 | |
| 4163 | fn airSliceLen(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4141 | fn airSliceLen(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4164 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 4142 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 4165 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 4166 | | 4143 | |
| 4167 | const operand = try func.resolveInst(ty_op.operand); | 4144 | const operand = try func.resolveInst(ty_op.operand); |
| 4168 | const len = try func.load(operand, Type.usize, func.ptrSize()); | 4145 | const len = try func.load(operand, Type.usize, func.ptrSize()); |
| ... | @@ -4172,7 +4149,6 @@ fn airSliceLen(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4172,7 +4149,6 @@ fn airSliceLen(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4172 | | 4149 | |
| 4173 | fn airSliceElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4150 | fn airSliceElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4174 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 4151 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 4175 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 4176 | | 4152 | |
| 4177 | const slice_ty = func.air.typeOf(bin_op.lhs); | 4153 | const slice_ty = func.air.typeOf(bin_op.lhs); |
| 4178 | const slice = try func.resolveInst(bin_op.lhs); | 4154 | const slice = try func.resolveInst(bin_op.lhs); |
| ... | @@ -4203,7 +4179,6 @@ fn airSliceElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4203,7 +4179,6 @@ fn airSliceElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4203 | fn airSliceElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4179 | fn airSliceElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4204 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 4180 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 4205 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; | 4181 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 4206 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 4207 | | 4182 | |
| 4208 | const elem_ty = func.air.getRefType(ty_pl.ty).childType(); | 4183 | const elem_ty = func.air.getRefType(ty_pl.ty).childType(); |
| 4209 | const elem_size = elem_ty.abiSize(func.target); | 4184 | const elem_size = elem_ty.abiSize(func.target); |
| ... | @@ -4226,7 +4201,6 @@ fn airSliceElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4226,7 +4201,6 @@ fn airSliceElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4226 | | 4201 | |
| 4227 | fn airSlicePtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4202 | fn airSlicePtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4228 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 4203 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 4229 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 4230 | const operand = try func.resolveInst(ty_op.operand); | 4204 | const operand = try func.resolveInst(ty_op.operand); |
| 4231 | const ptr = try func.load(operand, Type.usize, 0); | 4205 | const ptr = try func.load(operand, Type.usize, 0); |
| 4232 | const result = try ptr.toLocal(func, Type.usize); | 4206 | const result = try ptr.toLocal(func, Type.usize); |
| ... | @@ -4235,7 +4209,6 @@ fn airSlicePtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4235,7 +4209,6 @@ fn airSlicePtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4235 | | 4209 | |
| 4236 | fn airTrunc(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4210 | fn airTrunc(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4237 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 4211 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 4238 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 4239 | | 4212 | |
| 4240 | const operand = try func.resolveInst(ty_op.operand); | 4213 | const operand = try func.resolveInst(ty_op.operand); |
| 4241 | const wanted_ty = func.air.getRefType(ty_op.ty); | 4214 | const wanted_ty = func.air.getRefType(ty_op.ty); |
| ... | @@ -4264,19 +4237,14 @@ fn trunc(func: *CodeGen, operand: WValue, wanted_ty: Type, given_ty: Type) Inner | ... | @@ -4264,19 +4237,14 @@ fn trunc(func: *CodeGen, operand: WValue, wanted_ty: Type, given_ty: Type) Inner |
| 4264 | | 4237 | |
| 4265 | fn airBoolToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4238 | fn airBoolToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4266 | const un_op = func.air.instructions.items(.data)[inst].un_op; | 4239 | const un_op = func.air.instructions.items(.data)[inst].un_op; |
| 4267 | const result = if (func.liveness.isUnused(inst)) | 4240 | const operand = try func.resolveInst(un_op); |
| 4268 | WValue{ .none = {} } | 4241 | const result = func.reuseOperand(un_op, operand); |
| 4269 | else result: { | | |
| 4270 | const operand = try func.resolveInst(un_op); | | |
| 4271 | break :result func.reuseOperand(un_op, operand); | | |
| 4272 | }; | | |
| 4273 | | 4242 | |
| 4274 | func.finishAir(inst, result, &.{un_op}); | 4243 | func.finishAir(inst, result, &.{un_op}); |
| 4275 | } | 4244 | } |
| 4276 | | 4245 | |
| 4277 | fn airArrayToSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4246 | fn airArrayToSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4278 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 4247 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 4279 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 4280 | | 4248 | |
| 4281 | const operand = try func.resolveInst(ty_op.operand); | 4249 | const operand = try func.resolveInst(ty_op.operand); |
| 4282 | const array_ty = func.air.typeOf(ty_op.operand).childType(); | 4250 | const array_ty = func.air.typeOf(ty_op.operand).childType(); |
| ... | @@ -4299,7 +4267,6 @@ fn airArrayToSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4299,7 +4267,6 @@ fn airArrayToSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4299 | | 4267 | |
| 4300 | fn airPtrToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4268 | fn airPtrToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4301 | const un_op = func.air.instructions.items(.data)[inst].un_op; | 4269 | const un_op = func.air.instructions.items(.data)[inst].un_op; |
| 4302 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{un_op}); | | |
| 4303 | const operand = try func.resolveInst(un_op); | 4270 | const operand = try func.resolveInst(un_op); |
| 4304 | | 4271 | |
| 4305 | const result = switch (operand) { | 4272 | const result = switch (operand) { |
| ... | @@ -4312,7 +4279,6 @@ fn airPtrToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4312,7 +4279,6 @@ fn airPtrToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4312 | | 4279 | |
| 4313 | fn airPtrElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4280 | fn airPtrElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4314 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 4281 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 4315 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 4316 | | 4282 | |
| 4317 | const ptr_ty = func.air.typeOf(bin_op.lhs); | 4283 | const ptr_ty = func.air.typeOf(bin_op.lhs); |
| 4318 | const ptr = try func.resolveInst(bin_op.lhs); | 4284 | const ptr = try func.resolveInst(bin_op.lhs); |
| ... | @@ -4350,7 +4316,6 @@ fn airPtrElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4350,7 +4316,6 @@ fn airPtrElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4350 | fn airPtrElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4316 | fn airPtrElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4351 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 4317 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 4352 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; | 4318 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 4353 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 4354 | | 4319 | |
| 4355 | const ptr_ty = func.air.typeOf(bin_op.lhs); | 4320 | const ptr_ty = func.air.typeOf(bin_op.lhs); |
| 4356 | const elem_ty = func.air.getRefType(ty_pl.ty).childType(); | 4321 | const elem_ty = func.air.getRefType(ty_pl.ty).childType(); |
| ... | @@ -4380,7 +4345,6 @@ fn airPtrElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4380,7 +4345,6 @@ fn airPtrElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4380 | fn airPtrBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { | 4345 | fn airPtrBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { |
| 4381 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 4346 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 4382 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; | 4347 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 4383 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 4384 | | 4348 | |
| 4385 | const ptr = try func.resolveInst(bin_op.lhs); | 4349 | const ptr = try func.resolveInst(bin_op.lhs); |
| 4386 | const offset = try func.resolveInst(bin_op.rhs); | 4350 | const offset = try func.resolveInst(bin_op.rhs); |
| ... | @@ -4504,7 +4468,6 @@ fn memset(func: *CodeGen, ptr: WValue, len: WValue, value: WValue) InnerError!vo | ... | @@ -4504,7 +4468,6 @@ fn memset(func: *CodeGen, ptr: WValue, len: WValue, value: WValue) InnerError!vo |
| 4504 | | 4468 | |
| 4505 | fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4469 | fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4506 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 4470 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 4507 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 4508 | | 4471 | |
| 4509 | const array_ty = func.air.typeOf(bin_op.lhs); | 4472 | const array_ty = func.air.typeOf(bin_op.lhs); |
| 4510 | const array = try func.resolveInst(bin_op.lhs); | 4473 | const array = try func.resolveInst(bin_op.lhs); |
| ... | @@ -4573,7 +4536,6 @@ fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4573,7 +4536,6 @@ fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4573 | | 4536 | |
| 4574 | fn airFloatToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4537 | fn airFloatToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4575 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 4538 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 4576 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 4577 | | 4539 | |
| 4578 | const operand = try func.resolveInst(ty_op.operand); | 4540 | const operand = try func.resolveInst(ty_op.operand); |
| 4579 | const dest_ty = func.air.typeOfIndex(inst); | 4541 | const dest_ty = func.air.typeOfIndex(inst); |
| ... | @@ -4598,7 +4560,6 @@ fn airFloatToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4598,7 +4560,6 @@ fn airFloatToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4598 | | 4560 | |
| 4599 | fn airIntToFloat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4561 | fn airIntToFloat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4600 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 4562 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 4601 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 4602 | | 4563 | |
| 4603 | const operand = try func.resolveInst(ty_op.operand); | 4564 | const operand = try func.resolveInst(ty_op.operand); |
| 4604 | const dest_ty = func.air.typeOfIndex(inst); | 4565 | const dest_ty = func.air.typeOfIndex(inst); |
| ... | @@ -4713,10 +4674,6 @@ fn airShuffle(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4713,10 +4674,6 @@ fn airShuffle(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4713 | const child_ty = inst_ty.childType(); | 4674 | const child_ty = inst_ty.childType(); |
| 4714 | const elem_size = child_ty.abiSize(func.target); | 4675 | const elem_size = child_ty.abiSize(func.target); |
| 4715 | | 4676 | |
| 4716 | if (func.liveness.isUnused(inst)) { | | |
| 4717 | return func.finishAir(inst, .none, &.{ extra.a, extra.b }); | | |
| 4718 | } | | |
| 4719 | | | |
| 4720 | const module = func.bin_file.base.options.module.?; | 4677 | const module = func.bin_file.base.options.module.?; |
| 4721 | // TODO: One of them could be by ref; handle in loop | 4678 | // TODO: One of them could be by ref; handle in loop |
| 4722 | if (isByRef(func.air.typeOf(extra.a), func.target) or isByRef(inst_ty, func.target)) { | 4679 | if (isByRef(func.air.typeOf(extra.a), func.target) or isByRef(inst_ty, func.target)) { |
| ... | @@ -4782,7 +4739,6 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4782,7 +4739,6 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4782 | const elements = @ptrCast([]const Air.Inst.Ref, func.air.extra[ty_pl.payload..][0..len]); | 4739 | const elements = @ptrCast([]const Air.Inst.Ref, func.air.extra[ty_pl.payload..][0..len]); |
| 4783 | | 4740 | |
| 4784 | const result: WValue = result_value: { | 4741 | const result: WValue = result_value: { |
| 4785 | if (func.liveness.isUnused(inst)) break :result_value WValue.none; | | |
| 4786 | switch (result_ty.zigTypeTag()) { | 4742 | switch (result_ty.zigTypeTag()) { |
| 4787 | .Array => { | 4743 | .Array => { |
| 4788 | const result = try func.allocStack(result_ty); | 4744 | const result = try func.allocStack(result_ty); |
| ... | @@ -4888,7 +4844,6 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4888,7 +4844,6 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4888 | fn airUnionInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4844 | fn airUnionInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4889 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 4845 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 4890 | const extra = func.air.extraData(Air.UnionInit, ty_pl.payload).data; | 4846 | const extra = func.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 4891 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{extra.init}); | | |
| 4892 | | 4847 | |
| 4893 | const result = result: { | 4848 | const result = result: { |
| 4894 | const union_ty = func.air.typeOfIndex(inst); | 4849 | const union_ty = func.air.typeOfIndex(inst); |
| ... | @@ -4927,7 +4882,6 @@ fn airPrefetch(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4927,7 +4882,6 @@ fn airPrefetch(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4927 | | 4882 | |
| 4928 | fn airWasmMemorySize(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 4883 | fn airWasmMemorySize(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4929 | const pl_op = func.air.instructions.items(.data)[inst].pl_op; | 4884 | const pl_op = func.air.instructions.items(.data)[inst].pl_op; |
| 4930 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{pl_op.operand}); | | |
| 4931 | | 4885 | |
| 4932 | const result = try func.allocLocal(func.air.typeOfIndex(inst)); | 4886 | const result = try func.allocLocal(func.air.typeOfIndex(inst)); |
| 4933 | try func.addLabel(.memory_size, pl_op.payload); | 4887 | try func.addLabel(.memory_size, pl_op.payload); |
| ... | @@ -4937,7 +4891,6 @@ fn airWasmMemorySize(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4937,7 +4891,6 @@ fn airWasmMemorySize(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4937 | | 4891 | |
| 4938 | fn airWasmMemoryGrow(func: *CodeGen, inst: Air.Inst.Index) !void { | 4892 | fn airWasmMemoryGrow(func: *CodeGen, inst: Air.Inst.Index) !void { |
| 4939 | const pl_op = func.air.instructions.items(.data)[inst].pl_op; | 4893 | const pl_op = func.air.instructions.items(.data)[inst].pl_op; |
| 4940 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{pl_op.operand}); | | |
| 4941 | | 4894 | |
| 4942 | const operand = try func.resolveInst(pl_op.operand); | 4895 | const operand = try func.resolveInst(pl_op.operand); |
| 4943 | const result = try func.allocLocal(func.air.typeOfIndex(inst)); | 4896 | const result = try func.allocLocal(func.air.typeOfIndex(inst)); |
| ... | @@ -5049,7 +5002,6 @@ fn airSetUnionTag(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5049,7 +5002,6 @@ fn airSetUnionTag(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5049 | | 5002 | |
| 5050 | fn airGetUnionTag(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5003 | fn airGetUnionTag(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5051 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 5004 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 5052 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 5053 | | 5005 | |
| 5054 | const un_ty = func.air.typeOf(ty_op.operand); | 5006 | const un_ty = func.air.typeOf(ty_op.operand); |
| 5055 | const tag_ty = func.air.typeOfIndex(inst); | 5007 | const tag_ty = func.air.typeOfIndex(inst); |
| ... | @@ -5069,7 +5021,6 @@ fn airGetUnionTag(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5069,7 +5021,6 @@ fn airGetUnionTag(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5069 | | 5021 | |
| 5070 | fn airFpext(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5022 | fn airFpext(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5071 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 5023 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 5072 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 5073 | | 5024 | |
| 5074 | const dest_ty = func.air.typeOfIndex(inst); | 5025 | const dest_ty = func.air.typeOfIndex(inst); |
| 5075 | const operand = try func.resolveInst(ty_op.operand); | 5026 | const operand = try func.resolveInst(ty_op.operand); |
| ... | @@ -5115,7 +5066,6 @@ fn fpext(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerError! | ... | @@ -5115,7 +5066,6 @@ fn fpext(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerError! |
| 5115 | | 5066 | |
| 5116 | fn airFptrunc(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5067 | fn airFptrunc(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5117 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 5068 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 5118 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 5119 | | 5069 | |
| 5120 | const dest_ty = func.air.typeOfIndex(inst); | 5070 | const dest_ty = func.air.typeOfIndex(inst); |
| 5121 | const operand = try func.resolveInst(ty_op.operand); | 5071 | const operand = try func.resolveInst(ty_op.operand); |
| ... | @@ -5156,7 +5106,6 @@ fn fptrunc(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro | ... | @@ -5156,7 +5106,6 @@ fn fptrunc(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro |
| 5156 | | 5106 | |
| 5157 | fn airErrUnionPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5107 | fn airErrUnionPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5158 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 5108 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 5159 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 5160 | | 5109 | |
| 5161 | const err_set_ty = func.air.typeOf(ty_op.operand).childType(); | 5110 | const err_set_ty = func.air.typeOf(ty_op.operand).childType(); |
| 5162 | const payload_ty = err_set_ty.errorUnionPayload(); | 5111 | const payload_ty = err_set_ty.errorUnionPayload(); |
| ... | @@ -5171,8 +5120,6 @@ fn airErrUnionPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!voi | ... | @@ -5171,8 +5120,6 @@ fn airErrUnionPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!voi |
| 5171 | ); | 5120 | ); |
| 5172 | | 5121 | |
| 5173 | const result = result: { | 5122 | const result = result: { |
| 5174 | if (func.liveness.isUnused(inst)) break :result WValue{ .none = {} }; | | |
| 5175 | | | |
| 5176 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) { | 5123 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) { |
| 5177 | break :result func.reuseOperand(ty_op.operand, operand); | 5124 | break :result func.reuseOperand(ty_op.operand, operand); |
| 5178 | } | 5125 | } |
| ... | @@ -5185,7 +5132,6 @@ fn airErrUnionPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!voi | ... | @@ -5185,7 +5132,6 @@ fn airErrUnionPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!voi |
| 5185 | fn airFieldParentPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5132 | fn airFieldParentPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5186 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 5133 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 5187 | const extra = func.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 5134 | const extra = func.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 5188 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{extra.field_ptr}); | | |
| 5189 | | 5135 | |
| 5190 | const field_ptr = try func.resolveInst(extra.field_ptr); | 5136 | const field_ptr = try func.resolveInst(extra.field_ptr); |
| 5191 | const parent_ty = func.air.getRefType(ty_pl.ty).childType(); | 5137 | const parent_ty = func.air.getRefType(ty_pl.ty).childType(); |
| ... | @@ -5225,7 +5171,6 @@ fn airRetAddr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5225,7 +5171,6 @@ fn airRetAddr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5225 | | 5171 | |
| 5226 | fn airPopcount(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5172 | fn airPopcount(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5227 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 5173 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 5228 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 5229 | | 5174 | |
| 5230 | const operand = try func.resolveInst(ty_op.operand); | 5175 | const operand = try func.resolveInst(ty_op.operand); |
| 5231 | const op_ty = func.air.typeOf(ty_op.operand); | 5176 | const op_ty = func.air.typeOf(ty_op.operand); |
| ... | @@ -5270,7 +5215,6 @@ fn airPopcount(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5270,7 +5215,6 @@ fn airPopcount(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5270 | | 5215 | |
| 5271 | fn airErrorName(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5216 | fn airErrorName(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5272 | const un_op = func.air.instructions.items(.data)[inst].un_op; | 5217 | const un_op = func.air.instructions.items(.data)[inst].un_op; |
| 5273 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{un_op}); | | |
| 5274 | | 5218 | |
| 5275 | const operand = try func.resolveInst(un_op); | 5219 | const operand = try func.resolveInst(un_op); |
| 5276 | // First retrieve the symbol index to the error name table | 5220 | // First retrieve the symbol index to the error name table |
| ... | @@ -5312,7 +5256,6 @@ fn airErrorName(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5312,7 +5256,6 @@ fn airErrorName(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5312 | | 5256 | |
| 5313 | fn airPtrSliceFieldPtr(func: *CodeGen, inst: Air.Inst.Index, offset: u32) InnerError!void { | 5257 | fn airPtrSliceFieldPtr(func: *CodeGen, inst: Air.Inst.Index, offset: u32) InnerError!void { |
| 5314 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 5258 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 5315 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 5316 | const slice_ptr = try func.resolveInst(ty_op.operand); | 5259 | const slice_ptr = try func.resolveInst(ty_op.operand); |
| 5317 | const result = try func.buildPointerOffset(slice_ptr, offset, .new); | 5260 | const result = try func.buildPointerOffset(slice_ptr, offset, .new); |
| 5318 | func.finishAir(inst, result, &.{ty_op.operand}); | 5261 | func.finishAir(inst, result, &.{ty_op.operand}); |
| ... | @@ -5322,7 +5265,6 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro | ... | @@ -5322,7 +5265,6 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro |
| 5322 | assert(op == .add or op == .sub); | 5265 | assert(op == .add or op == .sub); |
| 5323 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 5266 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 5324 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; | 5267 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5325 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ extra.lhs, extra.rhs }); | | |
| 5326 | | 5268 | |
| 5327 | const lhs_op = try func.resolveInst(extra.lhs); | 5269 | const lhs_op = try func.resolveInst(extra.lhs); |
| 5328 | const rhs_op = try func.resolveInst(extra.rhs); | 5270 | const rhs_op = try func.resolveInst(extra.rhs); |
| ... | @@ -5465,7 +5407,6 @@ fn addSubWithOverflowBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, | ... | @@ -5465,7 +5407,6 @@ fn addSubWithOverflowBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, |
| 5465 | fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5407 | fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5466 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 5408 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 5467 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; | 5409 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5468 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ extra.lhs, extra.rhs }); | | |
| 5469 | | 5410 | |
| 5470 | const lhs = try func.resolveInst(extra.lhs); | 5411 | const lhs = try func.resolveInst(extra.lhs); |
| 5471 | const rhs = try func.resolveInst(extra.rhs); | 5412 | const rhs = try func.resolveInst(extra.rhs); |
| ... | @@ -5513,7 +5454,6 @@ fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5513,7 +5454,6 @@ fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5513 | fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5454 | fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5514 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; | 5455 | const ty_pl = func.air.instructions.items(.data)[inst].ty_pl; |
| 5515 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; | 5456 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5516 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ extra.lhs, extra.rhs }); | | |
| 5517 | | 5457 | |
| 5518 | const lhs = try func.resolveInst(extra.lhs); | 5458 | const lhs = try func.resolveInst(extra.lhs); |
| 5519 | const rhs = try func.resolveInst(extra.rhs); | 5459 | const rhs = try func.resolveInst(extra.rhs); |
| ... | @@ -5599,7 +5539,6 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5599,7 +5539,6 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5599 | | 5539 | |
| 5600 | fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: enum { max, min }) InnerError!void { | 5540 | fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: enum { max, min }) InnerError!void { |
| 5601 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 5541 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 5602 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 5603 | | 5542 | |
| 5604 | const ty = func.air.typeOfIndex(inst); | 5543 | const ty = func.air.typeOfIndex(inst); |
| 5605 | if (ty.zigTypeTag() == .Vector) { | 5544 | if (ty.zigTypeTag() == .Vector) { |
| ... | @@ -5631,8 +5570,6 @@ fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: enum { max, min }) InnerE | ... | @@ -5631,8 +5570,6 @@ fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: enum { max, min }) InnerE |
| 5631 | fn airMulAdd(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5570 | fn airMulAdd(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5632 | const pl_op = func.air.instructions.items(.data)[inst].pl_op; | 5571 | const pl_op = func.air.instructions.items(.data)[inst].pl_op; |
| 5633 | const bin_op = func.air.extraData(Air.Bin, pl_op.payload).data; | 5572 | const bin_op = func.air.extraData(Air.Bin, pl_op.payload).data; |
| 5634 | if (func.liveness.isUnused(inst)) | | |
| 5635 | return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs, pl_op.operand }); | | |
| 5636 | | 5573 | |
| 5637 | const ty = func.air.typeOfIndex(inst); | 5574 | const ty = func.air.typeOfIndex(inst); |
| 5638 | if (ty.zigTypeTag() == .Vector) { | 5575 | if (ty.zigTypeTag() == .Vector) { |
| ... | @@ -5665,7 +5602,6 @@ fn airMulAdd(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5665,7 +5602,6 @@ fn airMulAdd(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5665 | | 5602 | |
| 5666 | fn airClz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5603 | fn airClz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5667 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 5604 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 5668 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 5669 | | 5605 | |
| 5670 | const ty = func.air.typeOf(ty_op.operand); | 5606 | const ty = func.air.typeOf(ty_op.operand); |
| 5671 | const result_ty = func.air.typeOfIndex(inst); | 5607 | const result_ty = func.air.typeOfIndex(inst); |
| ... | @@ -5718,7 +5654,6 @@ fn airClz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5718,7 +5654,6 @@ fn airClz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5718 | | 5654 | |
| 5719 | fn airCtz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5655 | fn airCtz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5720 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 5656 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 5721 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 5722 | | 5657 | |
| 5723 | const ty = func.air.typeOf(ty_op.operand); | 5658 | const ty = func.air.typeOf(ty_op.operand); |
| 5724 | const result_ty = func.air.typeOfIndex(inst); | 5659 | const result_ty = func.air.typeOfIndex(inst); |
| ... | @@ -5886,7 +5821,6 @@ fn lowerTry( | ... | @@ -5886,7 +5821,6 @@ fn lowerTry( |
| 5886 | | 5821 | |
| 5887 | fn airByteSwap(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5822 | fn airByteSwap(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5888 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; | 5823 | const ty_op = func.air.instructions.items(.data)[inst].ty_op; |
| 5889 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ty_op.operand}); | | |
| 5890 | | 5824 | |
| 5891 | const ty = func.air.typeOfIndex(inst); | 5825 | const ty = func.air.typeOfIndex(inst); |
| 5892 | const operand = try func.resolveInst(ty_op.operand); | 5826 | const operand = try func.resolveInst(ty_op.operand); |
| ... | @@ -5957,7 +5891,6 @@ fn airByteSwap(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5957,7 +5891,6 @@ fn airByteSwap(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5957 | | 5891 | |
| 5958 | fn airDiv(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5892 | fn airDiv(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5959 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 5893 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 5960 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 5961 | | 5894 | |
| 5962 | const ty = func.air.typeOfIndex(inst); | 5895 | const ty = func.air.typeOfIndex(inst); |
| 5963 | const lhs = try func.resolveInst(bin_op.lhs); | 5896 | const lhs = try func.resolveInst(bin_op.lhs); |
| ... | @@ -5972,7 +5905,6 @@ fn airDiv(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5972,7 +5905,6 @@ fn airDiv(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5972 | | 5905 | |
| 5973 | fn airDivFloor(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5906 | fn airDivFloor(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5974 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 5907 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 5975 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 5976 | | 5908 | |
| 5977 | const ty = func.air.typeOfIndex(inst); | 5909 | const ty = func.air.typeOfIndex(inst); |
| 5978 | const lhs = try func.resolveInst(bin_op.lhs); | 5910 | const lhs = try func.resolveInst(bin_op.lhs); |
| ... | @@ -6121,7 +6053,6 @@ fn signAbsValue(func: *CodeGen, operand: WValue, ty: Type) InnerError!WValue { | ... | @@ -6121,7 +6053,6 @@ fn signAbsValue(func: *CodeGen, operand: WValue, ty: Type) InnerError!WValue { |
| 6121 | fn airSatBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { | 6053 | fn airSatBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { |
| 6122 | assert(op == .add or op == .sub); | 6054 | assert(op == .add or op == .sub); |
| 6123 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 6055 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 6124 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 6125 | | 6056 | |
| 6126 | const ty = func.air.typeOfIndex(inst); | 6057 | const ty = func.air.typeOfIndex(inst); |
| 6127 | const lhs = try func.resolveInst(bin_op.lhs); | 6058 | const lhs = try func.resolveInst(bin_op.lhs); |
| ... | @@ -6234,7 +6165,6 @@ fn signedSat(func: *CodeGen, lhs_operand: WValue, rhs_operand: WValue, ty: Type, | ... | @@ -6234,7 +6165,6 @@ fn signedSat(func: *CodeGen, lhs_operand: WValue, rhs_operand: WValue, ty: Type, |
| 6234 | | 6165 | |
| 6235 | fn airShlSat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6166 | fn airShlSat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6236 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; | 6167 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 6237 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | | |
| 6238 | | 6168 | |
| 6239 | const ty = func.air.typeOfIndex(inst); | 6169 | const ty = func.air.typeOfIndex(inst); |
| 6240 | const int_info = ty.intInfo(func.target); | 6170 | const int_info = ty.intInfo(func.target); |
| ... | @@ -6393,7 +6323,6 @@ fn callIntrinsic( | ... | @@ -6393,7 +6323,6 @@ fn callIntrinsic( |
| 6393 | | 6323 | |
| 6394 | fn airTagName(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6324 | fn airTagName(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6395 | const un_op = func.air.instructions.items(.data)[inst].un_op; | 6325 | const un_op = func.air.instructions.items(.data)[inst].un_op; |
| 6396 | if (func.liveness.isUnused(inst)) return func.finishAir(inst, .none, &.{un_op}); | | |
| 6397 | const operand = try func.resolveInst(un_op); | 6326 | const operand = try func.resolveInst(un_op); |
| 6398 | const enum_ty = func.air.typeOf(un_op); | 6327 | const enum_ty = func.air.typeOf(un_op); |
| 6399 | | 6328 | |