| ... | ... | @@ -189,7 +189,8 @@ struct ConstCastPtrSentinel { |
| 189 | 189 | static IrInstruction *ir_gen_node(IrBuilder *irb, AstNode *node, Scope *scope); |
| 190 | 190 | static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, Scope *scope, LVal lval, |
| 191 | 191 | ResultLoc *result_loc); |
| 192 | | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *source_instr, |
| 192 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, ZigType *expected_type); |
| 193 | static IrInstruction *ir_implicit_cast2(IrAnalyze *ira, IrInstruction *value_source_instr, |
| 193 | 194 | IrInstruction *value, ZigType *expected_type); |
| 194 | 195 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr, |
| 195 | 196 | ResultLoc *result_loc); |
| ... | ... | @@ -11720,7 +11721,7 @@ static IrInstruction *ir_analyze_optional_wrap(IrAnalyze *ira, IrInstruction *so |
| 11720 | 11721 | |
| 11721 | 11722 | if (instr_is_comptime(value)) { |
| 11722 | 11723 | ZigType *payload_type = wanted_type->data.maybe.child_type; |
| 11723 | | IrInstruction *casted_payload = ir_implicit_cast(ira, source_instr, value, payload_type); |
| 11724 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); |
| 11724 | 11725 | if (type_is_invalid(casted_payload->value.type)) |
| 11725 | 11726 | return ira->codegen->invalid_instruction; |
| 11726 | 11727 | |
| ... | ... | @@ -11763,7 +11764,7 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction |
| 11763 | 11764 | ZigType *payload_type = wanted_type->data.error_union.payload_type; |
| 11764 | 11765 | ZigType *err_set_type = wanted_type->data.error_union.err_set_type; |
| 11765 | 11766 | if (instr_is_comptime(value)) { |
| 11766 | | IrInstruction *casted_payload = ir_implicit_cast(ira, source_instr, value, payload_type); |
| 11767 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); |
| 11767 | 11768 | if (type_is_invalid(casted_payload->value.type)) |
| 11768 | 11769 | return ira->codegen->invalid_instruction; |
| 11769 | 11770 | |
| ... | ... | @@ -11883,7 +11884,7 @@ static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *so |
| 11883 | 11884 | { |
| 11884 | 11885 | assert(wanted_type->id == ZigTypeIdErrorUnion); |
| 11885 | 11886 | |
| 11886 | | IrInstruction *casted_value = ir_implicit_cast(ira, source_instr, value, wanted_type->data.error_union.err_set_type); |
| 11887 | IrInstruction *casted_value = ir_implicit_cast(ira, value, wanted_type->data.error_union.err_set_type); |
| 11887 | 11888 | |
| 11888 | 11889 | if (instr_is_comptime(casted_value)) { |
| 11889 | 11890 | ConstExprValue *val = ir_resolve_const(ira, casted_value, UndefBad); |
| ... | ... | @@ -12068,7 +12069,7 @@ static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *sour |
| 12068 | 12069 | enum_type = ir_resolve_union_tag_type(ira, target, target->value.type); |
| 12069 | 12070 | if (type_is_invalid(enum_type)) |
| 12070 | 12071 | return ira->codegen->invalid_instruction; |
| 12071 | | enum_target = ir_implicit_cast(ira, source_instr, target, enum_type); |
| 12072 | enum_target = ir_implicit_cast(ira, target, enum_type); |
| 12072 | 12073 | if (type_is_invalid(enum_target->value.type)) |
| 12073 | 12074 | return ira->codegen->invalid_instruction; |
| 12074 | 12075 | } else if (target->value.type->id == ZigTypeIdEnum) { |
| ... | ... | @@ -12164,7 +12165,7 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so |
| 12164 | 12165 | if ((err = type_resolve(ira->codegen, wanted_type, ResolveStatusZeroBitsKnown))) |
| 12165 | 12166 | return ira->codegen->invalid_instruction; |
| 12166 | 12167 | |
| 12167 | | IrInstruction *target = ir_implicit_cast(ira, source_instr, uncasted_target, wanted_type->data.unionation.tag_type); |
| 12168 | IrInstruction *target = ir_implicit_cast(ira, uncasted_target, wanted_type->data.unionation.tag_type); |
| 12168 | 12169 | if (type_is_invalid(target->value.type)) |
| 12169 | 12170 | return ira->codegen->invalid_instruction; |
| 12170 | 12171 | |
| ... | ... | @@ -13385,8 +13386,8 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 13385 | 13386 | actual_type->data.pointer.child_type, source_node, |
| 13386 | 13387 | !wanted_type->data.pointer.is_const).id == ConstCastResultIdOk && |
| 13387 | 13388 | // `types_match_const_cast_only` only gets info for child_types |
| 13388 | | (!wanted_type->data.pointer.is_const || actual_type->data.pointer.is_const) && |
| 13389 | | (!wanted_type->data.pointer.is_volatile || actual_type->data.pointer.is_volatile)) |
| 13389 | (!actual_type->data.pointer.is_const || wanted_type->data.pointer.is_const) && |
| 13390 | (!actual_type->data.pointer.is_volatile || wanted_type->data.pointer.is_volatile)) |
| 13390 | 13391 | { |
| 13391 | 13392 | if ((err = ir_cast_ptr_align(ira, source_instr, wanted_type, actual_type, value->source_node))) |
| 13392 | 13393 | return ira->codegen->invalid_instruction; |
| ... | ... | @@ -13413,7 +13414,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 13413 | 13414 | { |
| 13414 | 13415 | TypeStructField *ptr_field = actual_type->data.structure.fields[slice_ptr_index]; |
| 13415 | 13416 | IrInstruction *slice_ptr = ir_analyze_struct_value_field_value(ira, source_instr, value, ptr_field); |
| 13416 | | return ir_implicit_cast(ira, source_instr, slice_ptr, wanted_type); |
| 13417 | return ir_implicit_cast2(ira, source_instr, slice_ptr, wanted_type); |
| 13417 | 13418 | } |
| 13418 | 13419 | } |
| 13419 | 13420 | |
| ... | ... | @@ -13516,7 +13517,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 13516 | 13517 | return ira->codegen->invalid_instruction; |
| 13517 | 13518 | } |
| 13518 | 13519 | |
| 13519 | | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *source_instr, |
| 13520 | static IrInstruction *ir_implicit_cast2(IrAnalyze *ira, IrInstruction *value_source_instr, |
| 13520 | 13521 | IrInstruction *value, ZigType *expected_type) |
| 13521 | 13522 | { |
| 13522 | 13523 | assert(value); |
| ... | ... | @@ -13531,7 +13532,11 @@ static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *source_ins |
| 13531 | 13532 | if (value->value.type->id == ZigTypeIdUnreachable) |
| 13532 | 13533 | return value; |
| 13533 | 13534 | |
| 13534 | | return ir_analyze_cast(ira, source_instr, expected_type, value); |
| 13535 | return ir_analyze_cast(ira, value_source_instr, expected_type, value); |
| 13536 | } |
| 13537 | |
| 13538 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, ZigType *expected_type) { |
| 13539 | return ir_implicit_cast2(ira, value, value, expected_type); |
| 13535 | 13540 | } |
| 13536 | 13541 | |
| 13537 | 13542 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr, |
| ... | ... | @@ -13669,7 +13674,7 @@ static bool ir_resolve_align(IrAnalyze *ira, IrInstruction *value, ZigType *elem |
| 13669 | 13674 | } |
| 13670 | 13675 | } |
| 13671 | 13676 | |
| 13672 | | IrInstruction *casted_value = ir_implicit_cast(ira, value, value, get_align_amt_type(ira->codegen)); |
| 13677 | IrInstruction *casted_value = ir_implicit_cast(ira, value, get_align_amt_type(ira->codegen)); |
| 13673 | 13678 | if (type_is_invalid(casted_value->value.type)) |
| 13674 | 13679 | return false; |
| 13675 | 13680 | |
| ... | ... | @@ -13681,7 +13686,7 @@ static bool ir_resolve_unsigned(IrAnalyze *ira, IrInstruction *value, ZigType *i |
| 13681 | 13686 | if (type_is_invalid(value->value.type)) |
| 13682 | 13687 | return false; |
| 13683 | 13688 | |
| 13684 | | IrInstruction *casted_value = ir_implicit_cast(ira, value, value, int_type); |
| 13689 | IrInstruction *casted_value = ir_implicit_cast(ira, value, int_type); |
| 13685 | 13690 | if (type_is_invalid(casted_value->value.type)) |
| 13686 | 13691 | return false; |
| 13687 | 13692 | |
| ... | ... | @@ -13701,7 +13706,7 @@ static bool ir_resolve_bool(IrAnalyze *ira, IrInstruction *value, bool *out) { |
| 13701 | 13706 | if (type_is_invalid(value->value.type)) |
| 13702 | 13707 | return false; |
| 13703 | 13708 | |
| 13704 | | IrInstruction *casted_value = ir_implicit_cast(ira, value, value, ira->codegen->builtin_types.entry_bool); |
| 13709 | IrInstruction *casted_value = ir_implicit_cast(ira, value, ira->codegen->builtin_types.entry_bool); |
| 13705 | 13710 | if (type_is_invalid(casted_value->value.type)) |
| 13706 | 13711 | return false; |
| 13707 | 13712 | |
| ... | ... | @@ -13729,7 +13734,7 @@ static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, Atomic |
| 13729 | 13734 | assert(atomic_order_val->type->id == ZigTypeIdMetaType); |
| 13730 | 13735 | ZigType *atomic_order_type = atomic_order_val->data.x_type; |
| 13731 | 13736 | |
| 13732 | | IrInstruction *casted_value = ir_implicit_cast(ira, value, value, atomic_order_type); |
| 13737 | IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_order_type); |
| 13733 | 13738 | if (type_is_invalid(casted_value->value.type)) |
| 13734 | 13739 | return false; |
| 13735 | 13740 | |
| ... | ... | @@ -13749,7 +13754,7 @@ static bool ir_resolve_atomic_rmw_op(IrAnalyze *ira, IrInstruction *value, Atomi |
| 13749 | 13754 | assert(atomic_rmw_op_val->type->id == ZigTypeIdMetaType); |
| 13750 | 13755 | ZigType *atomic_rmw_op_type = atomic_rmw_op_val->data.x_type; |
| 13751 | 13756 | |
| 13752 | | IrInstruction *casted_value = ir_implicit_cast(ira, value, value, atomic_rmw_op_type); |
| 13757 | IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_rmw_op_type); |
| 13753 | 13758 | if (type_is_invalid(casted_value->value.type)) |
| 13754 | 13759 | return false; |
| 13755 | 13760 | |
| ... | ... | @@ -13769,7 +13774,7 @@ static bool ir_resolve_global_linkage(IrAnalyze *ira, IrInstruction *value, Glob |
| 13769 | 13774 | assert(global_linkage_val->type->id == ZigTypeIdMetaType); |
| 13770 | 13775 | ZigType *global_linkage_type = global_linkage_val->data.x_type; |
| 13771 | 13776 | |
| 13772 | | IrInstruction *casted_value = ir_implicit_cast(ira, value, value, global_linkage_type); |
| 13777 | IrInstruction *casted_value = ir_implicit_cast(ira, value, global_linkage_type); |
| 13773 | 13778 | if (type_is_invalid(casted_value->value.type)) |
| 13774 | 13779 | return false; |
| 13775 | 13780 | |
| ... | ... | @@ -13789,7 +13794,7 @@ static bool ir_resolve_float_mode(IrAnalyze *ira, IrInstruction *value, FloatMod |
| 13789 | 13794 | assert(float_mode_val->type->id == ZigTypeIdMetaType); |
| 13790 | 13795 | ZigType *float_mode_type = float_mode_val->data.x_type; |
| 13791 | 13796 | |
| 13792 | | IrInstruction *casted_value = ir_implicit_cast(ira, value, value, float_mode_type); |
| 13797 | IrInstruction *casted_value = ir_implicit_cast(ira, value, float_mode_type); |
| 13793 | 13798 | if (type_is_invalid(casted_value->value.type)) |
| 13794 | 13799 | return false; |
| 13795 | 13800 | |
| ... | ... | @@ -13808,7 +13813,7 @@ static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) { |
| 13808 | 13813 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 13809 | 13814 | true, false, PtrLenUnknown, 0, 0, 0, false); |
| 13810 | 13815 | ZigType *str_type = get_slice_type(ira->codegen, ptr_type); |
| 13811 | | IrInstruction *casted_value = ir_implicit_cast(ira, value, value, str_type); |
| 13816 | IrInstruction *casted_value = ir_implicit_cast(ira, value, str_type); |
| 13812 | 13817 | if (type_is_invalid(casted_value->value.type)) |
| 13813 | 13818 | return nullptr; |
| 13814 | 13819 | |
| ... | ... | @@ -13872,7 +13877,7 @@ static IrInstruction *ir_analyze_instruction_return(IrAnalyze *ira, IrInstructio |
| 13872 | 13877 | return ir_finish_anal(ira, result); |
| 13873 | 13878 | } |
| 13874 | 13879 | |
| 13875 | | IrInstruction *casted_operand = ir_implicit_cast(ira, &instruction->base, operand, ira->explicit_return_type); |
| 13880 | IrInstruction *casted_operand = ir_implicit_cast(ira, operand, ira->explicit_return_type); |
| 13876 | 13881 | if (type_is_invalid(casted_operand->value.type)) { |
| 13877 | 13882 | AstNode *source_node = ira->explicit_return_type_source_node; |
| 13878 | 13883 | if (source_node != nullptr) { |
| ... | ... | @@ -13914,11 +13919,11 @@ static IrInstruction *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp |
| 13914 | 13919 | |
| 13915 | 13920 | ZigType *bool_type = ira->codegen->builtin_types.entry_bool; |
| 13916 | 13921 | |
| 13917 | | IrInstruction *casted_op1 = ir_implicit_cast(ira, &bin_op_instruction->base, op1, bool_type); |
| 13922 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, bool_type); |
| 13918 | 13923 | if (casted_op1 == ira->codegen->invalid_instruction) |
| 13919 | 13924 | return ira->codegen->invalid_instruction; |
| 13920 | 13925 | |
| 13921 | | IrInstruction *casted_op2 = ir_implicit_cast(ira, &bin_op_instruction->base, op2, bool_type); |
| 13926 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, bool_type); |
| 13922 | 13927 | if (casted_op2 == ira->codegen->invalid_instruction) |
| 13923 | 13928 | return ira->codegen->invalid_instruction; |
| 13924 | 13929 | |
| ... | ... | @@ -14187,11 +14192,11 @@ static IrInstruction *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp * |
| 14187 | 14192 | ZigType *tag_type = union_val->value.type->data.unionation.tag_type; |
| 14188 | 14193 | assert(tag_type != nullptr); |
| 14189 | 14194 | |
| 14190 | | IrInstruction *casted_union = ir_implicit_cast(ira, &bin_op_instruction->base, union_val, tag_type); |
| 14195 | IrInstruction *casted_union = ir_implicit_cast(ira, union_val, tag_type); |
| 14191 | 14196 | if (type_is_invalid(casted_union->value.type)) |
| 14192 | 14197 | return ira->codegen->invalid_instruction; |
| 14193 | 14198 | |
| 14194 | | IrInstruction *casted_val = ir_implicit_cast(ira, &bin_op_instruction->base, enum_val, tag_type); |
| 14199 | IrInstruction *casted_val = ir_implicit_cast(ira, enum_val, tag_type); |
| 14195 | 14200 | if (type_is_invalid(casted_val->value.type)) |
| 14196 | 14201 | return ira->codegen->invalid_instruction; |
| 14197 | 14202 | |
| ... | ... | @@ -14354,11 +14359,11 @@ static IrInstruction *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp * |
| 14354 | 14359 | return ira->codegen->invalid_instruction; |
| 14355 | 14360 | } |
| 14356 | 14361 | |
| 14357 | | IrInstruction *casted_op1 = ir_implicit_cast(ira, &bin_op_instruction->base, op1, resolved_type); |
| 14362 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, resolved_type); |
| 14358 | 14363 | if (casted_op1 == ira->codegen->invalid_instruction) |
| 14359 | 14364 | return ira->codegen->invalid_instruction; |
| 14360 | 14365 | |
| 14361 | | IrInstruction *casted_op2 = ir_implicit_cast(ira, &bin_op_instruction->base, op2, resolved_type); |
| 14366 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, resolved_type); |
| 14362 | 14367 | if (casted_op2 == ira->codegen->invalid_instruction) |
| 14363 | 14368 | return ira->codegen->invalid_instruction; |
| 14364 | 14369 | |
| ... | ... | @@ -14706,7 +14711,7 @@ static IrInstruction *ir_analyze_math_op(IrAnalyze *ira, IrInstruction *source_i |
| 14706 | 14711 | return ira->codegen->invalid_instruction; |
| 14707 | 14712 | } |
| 14708 | 14713 | } |
| 14709 | | return ir_implicit_cast(ira, source_instr, result_instruction, type_entry); |
| 14714 | return ir_implicit_cast(ira, result_instruction, type_entry); |
| 14710 | 14715 | } |
| 14711 | 14716 | |
| 14712 | 14717 | static IrInstruction *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { |
| ... | ... | @@ -14771,7 +14776,7 @@ static IrInstruction *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *b |
| 14771 | 14776 | } |
| 14772 | 14777 | } |
| 14773 | 14778 | |
| 14774 | | casted_op2 = ir_implicit_cast(ira, &bin_op_instruction->base, op2, shift_amt_type); |
| 14779 | casted_op2 = ir_implicit_cast(ira, op2, shift_amt_type); |
| 14775 | 14780 | if (casted_op2 == ira->codegen->invalid_instruction) |
| 14776 | 14781 | return ira->codegen->invalid_instruction; |
| 14777 | 14782 | } |
| ... | ... | @@ -14880,7 +14885,7 @@ static IrInstruction *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 14880 | 14885 | |
| 14881 | 14886 | // look for pointer math |
| 14882 | 14887 | if (is_pointer_arithmetic_allowed(op1->value.type, op_id)) { |
| 14883 | | IrInstruction *casted_op2 = ir_implicit_cast(ira, &instruction->base, op2, ira->codegen->builtin_types.entry_usize); |
| 14888 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, ira->codegen->builtin_types.entry_usize); |
| 14884 | 14889 | if (type_is_invalid(casted_op2->value.type)) |
| 14885 | 14890 | return ira->codegen->invalid_instruction; |
| 14886 | 14891 | |
| ... | ... | @@ -15016,7 +15021,7 @@ static IrInstruction *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 15016 | 15021 | ok = bigint_cmp(&rem_result, &mod_result) == CmpEQ; |
| 15017 | 15022 | } |
| 15018 | 15023 | } else { |
| 15019 | | IrInstruction *casted_op2 = ir_implicit_cast(ira, &instruction->base, op2, resolved_type); |
| 15024 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, resolved_type); |
| 15020 | 15025 | if (casted_op2 == ira->codegen->invalid_instruction) |
| 15021 | 15026 | return ira->codegen->invalid_instruction; |
| 15022 | 15027 | |
| ... | ... | @@ -15080,11 +15085,11 @@ static IrInstruction *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 15080 | 15085 | } |
| 15081 | 15086 | } |
| 15082 | 15087 | |
| 15083 | | IrInstruction *casted_op1 = ir_implicit_cast(ira, &instruction->base, op1, resolved_type); |
| 15088 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, resolved_type); |
| 15084 | 15089 | if (casted_op1 == ira->codegen->invalid_instruction) |
| 15085 | 15090 | return ira->codegen->invalid_instruction; |
| 15086 | 15091 | |
| 15087 | | IrInstruction *casted_op2 = ir_implicit_cast(ira, &instruction->base, op2, resolved_type); |
| 15092 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, resolved_type); |
| 15088 | 15093 | if (casted_op2 == ira->codegen->invalid_instruction) |
| 15089 | 15094 | return ira->codegen->invalid_instruction; |
| 15090 | 15095 | |
| ... | ... | @@ -16297,7 +16302,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 16297 | 16302 | // In this case we can pointer cast the result location. |
| 16298 | 16303 | IrInstruction *casted_value; |
| 16299 | 16304 | if (value != nullptr) { |
| 16300 | | casted_value = ir_implicit_cast(ira, value, value, dest_type); |
| 16305 | casted_value = ir_implicit_cast(ira, value, dest_type); |
| 16301 | 16306 | } else { |
| 16302 | 16307 | casted_value = nullptr; |
| 16303 | 16308 | } |
| ... | ... | @@ -16588,7 +16593,7 @@ static IrInstruction *get_async_call_result_loc(IrAnalyze *ira, IrInstructionCal |
| 16588 | 16593 | // Result location will be inside the async frame. |
| 16589 | 16594 | return nullptr; |
| 16590 | 16595 | } |
| 16591 | | return ir_implicit_cast(ira, ret_ptr_uncasted, ret_ptr_uncasted, get_pointer_to_type(ira->codegen, fn_ret_type, false)); |
| 16596 | return ir_implicit_cast(ira, ret_ptr_uncasted, get_pointer_to_type(ira->codegen, fn_ret_type, false)); |
| 16592 | 16597 | } |
| 16593 | 16598 | |
| 16594 | 16599 | static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc *call_instruction, ZigFn *fn_entry, |
| ... | ... | @@ -16625,7 +16630,7 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc |
| 16625 | 16630 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { |
| 16626 | 16631 | return result_loc; |
| 16627 | 16632 | } |
| 16628 | | result_loc = ir_implicit_cast(ira, &call_instruction->base, result_loc, get_pointer_to_type(ira->codegen, frame_type, false)); |
| 16633 | result_loc = ir_implicit_cast(ira, result_loc, get_pointer_to_type(ira->codegen, frame_type, false)); |
| 16629 | 16634 | if (type_is_invalid(result_loc->value.type)) |
| 16630 | 16635 | return ira->codegen->invalid_instruction; |
| 16631 | 16636 | return &ir_build_call_gen(ira, &call_instruction->base, fn_entry, fn_ref, arg_count, |
| ... | ... | @@ -16646,7 +16651,7 @@ static bool ir_analyze_fn_call_inline_arg(IrAnalyze *ira, AstNode *fn_proto_node |
| 16646 | 16651 | if (type_is_invalid(param_type)) |
| 16647 | 16652 | return false; |
| 16648 | 16653 | |
| 16649 | | casted_arg = ir_implicit_cast(ira, arg, arg, param_type); |
| 16654 | casted_arg = ir_implicit_cast(ira, arg, param_type); |
| 16650 | 16655 | if (type_is_invalid(casted_arg->value.type)) |
| 16651 | 16656 | return false; |
| 16652 | 16657 | } else { |
| ... | ... | @@ -16686,7 +16691,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod |
| 16686 | 16691 | if (type_is_invalid(param_type)) |
| 16687 | 16692 | return false; |
| 16688 | 16693 | |
| 16689 | | casted_arg = ir_implicit_cast(ira, arg, arg, param_type); |
| 16694 | casted_arg = ir_implicit_cast(ira, arg, param_type); |
| 16690 | 16695 | if (type_is_invalid(casted_arg->value.type)) |
| 16691 | 16696 | return false; |
| 16692 | 16697 | } else { |
| ... | ... | @@ -16927,7 +16932,7 @@ static IrInstruction *ir_analyze_store_ptr(IrAnalyze *ira, IrInstruction *source |
| 16927 | 16932 | } |
| 16928 | 16933 | |
| 16929 | 16934 | ZigType *child_type = ptr->value.type->data.pointer.child_type; |
| 16930 | | IrInstruction *value = ir_implicit_cast(ira, uncasted_value, uncasted_value, child_type); |
| 16935 | IrInstruction *value = ir_implicit_cast(ira, uncasted_value, child_type); |
| 16931 | 16936 | if (value == ira->codegen->invalid_instruction) |
| 16932 | 16937 | return ira->codegen->invalid_instruction; |
| 16933 | 16938 | |
| ... | ... | @@ -17044,13 +17049,13 @@ static IrInstruction *analyze_casted_new_stack(IrAnalyze *ira, IrInstructionCall |
| 17044 | 17049 | { |
| 17045 | 17050 | ZigType *needed_frame_type = get_pointer_to_type(ira->codegen, |
| 17046 | 17051 | get_fn_frame_type(ira->codegen, fn_entry), false); |
| 17047 | | return ir_implicit_cast(ira, &call_instruction->base, new_stack, needed_frame_type); |
| 17052 | return ir_implicit_cast(ira, new_stack, needed_frame_type); |
| 17048 | 17053 | } else { |
| 17049 | 17054 | ZigType *u8_ptr = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 17050 | 17055 | false, false, PtrLenUnknown, target_fn_align(ira->codegen->zig_target), 0, 0, false); |
| 17051 | 17056 | ZigType *u8_slice = get_slice_type(ira->codegen, u8_ptr); |
| 17052 | 17057 | ira->codegen->need_frame_size_prefix_data = true; |
| 17053 | | return ir_implicit_cast(ira, &call_instruction->base, new_stack, u8_slice); |
| 17058 | return ir_implicit_cast(ira, new_stack, u8_slice); |
| 17054 | 17059 | } |
| 17055 | 17060 | } |
| 17056 | 17061 | |
| ... | ... | @@ -17524,7 +17529,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 17524 | 17529 | return ira->codegen->invalid_instruction; |
| 17525 | 17530 | } |
| 17526 | 17531 | |
| 17527 | | IrInstruction *casted_arg = ir_implicit_cast(ira, first_arg, first_arg, param_type); |
| 17532 | IrInstruction *casted_arg = ir_implicit_cast(ira, first_arg, param_type); |
| 17528 | 17533 | if (type_is_invalid(casted_arg->value.type)) |
| 17529 | 17534 | return ira->codegen->invalid_instruction; |
| 17530 | 17535 | |
| ... | ... | @@ -17559,7 +17564,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 17559 | 17564 | ZigType *param_type = fn_type_id->param_info[next_arg_index].type; |
| 17560 | 17565 | if (type_is_invalid(param_type)) |
| 17561 | 17566 | return ira->codegen->invalid_instruction; |
| 17562 | | casted_arg = ir_implicit_cast(ira, arg_tuple_arg, arg_tuple_arg, param_type); |
| 17567 | casted_arg = ir_implicit_cast(ira, arg_tuple_arg, param_type); |
| 17563 | 17568 | if (type_is_invalid(casted_arg->value.type)) |
| 17564 | 17569 | return ira->codegen->invalid_instruction; |
| 17565 | 17570 | } else { |
| ... | ... | @@ -17575,7 +17580,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 17575 | 17580 | ZigType *param_type = fn_type_id->param_info[next_arg_index].type; |
| 17576 | 17581 | if (type_is_invalid(param_type)) |
| 17577 | 17582 | return ira->codegen->invalid_instruction; |
| 17578 | | casted_arg = ir_implicit_cast(ira, old_arg, old_arg, param_type); |
| 17583 | casted_arg = ir_implicit_cast(ira, old_arg, param_type); |
| 17579 | 17584 | if (type_is_invalid(casted_arg->value.type)) |
| 17580 | 17585 | return ira->codegen->invalid_instruction; |
| 17581 | 17586 | } else { |
| ... | ... | @@ -18007,7 +18012,7 @@ static IrInstruction *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstructi |
| 18007 | 18012 | return ir_unreach_error(ira); |
| 18008 | 18013 | |
| 18009 | 18014 | ZigType *bool_type = ira->codegen->builtin_types.entry_bool; |
| 18010 | | IrInstruction *casted_condition = ir_implicit_cast(ira, &cond_br_instruction->base, condition, bool_type); |
| 18015 | IrInstruction *casted_condition = ir_implicit_cast(ira, condition, bool_type); |
| 18011 | 18016 | if (type_is_invalid(casted_condition->value.type)) |
| 18012 | 18017 | return ir_unreach_error(ira); |
| 18013 | 18018 | |
| ... | ... | @@ -18257,7 +18262,7 @@ skip_resolve_peer_types: |
| 18257 | 18262 | ir_assert(predecessor->instruction_list.length != 0, &phi_instruction->base); |
| 18258 | 18263 | IrInstruction *branch_instruction = predecessor->instruction_list.pop(); |
| 18259 | 18264 | ir_set_cursor_at_end(&ira->new_irb, predecessor); |
| 18260 | | IrInstruction *casted_value = ir_implicit_cast(ira, new_value, new_value, resolved_type); |
| 18265 | IrInstruction *casted_value = ir_implicit_cast(ira, new_value, resolved_type); |
| 18261 | 18266 | if (type_is_invalid(casted_value->value.type)) { |
| 18262 | 18267 | return ira->codegen->invalid_instruction; |
| 18263 | 18268 | } |
| ... | ... | @@ -18443,7 +18448,7 @@ static IrInstruction *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruct |
| 18443 | 18448 | array_type->data.structure.resolve_status == ResolveStatusBeingInferred) |
| 18444 | 18449 | { |
| 18445 | 18450 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 18446 | | IrInstruction *casted_elem_index = ir_implicit_cast(ira, elem_index, elem_index, usize); |
| 18451 | IrInstruction *casted_elem_index = ir_implicit_cast(ira, elem_index, usize); |
| 18447 | 18452 | if (casted_elem_index == ira->codegen->invalid_instruction) |
| 18448 | 18453 | return ira->codegen->invalid_instruction; |
| 18449 | 18454 | ir_assert(instr_is_comptime(casted_elem_index), &elem_ptr_instruction->base); |
| ... | ... | @@ -18458,7 +18463,7 @@ static IrInstruction *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruct |
| 18458 | 18463 | } |
| 18459 | 18464 | |
| 18460 | 18465 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 18461 | | IrInstruction *casted_elem_index = ir_implicit_cast(ira, elem_index, elem_index, usize); |
| 18466 | IrInstruction *casted_elem_index = ir_implicit_cast(ira, elem_index, usize); |
| 18462 | 18467 | if (casted_elem_index == ira->codegen->invalid_instruction) |
| 18463 | 18468 | return ira->codegen->invalid_instruction; |
| 18464 | 18469 | |
| ... | ... | @@ -19832,7 +19837,7 @@ static IrInstruction *ir_analyze_instruction_array_type(IrAnalyze *ira, |
| 19832 | 19837 | IrInstruction *uncasted_sentinel = array_type_instruction->sentinel->child; |
| 19833 | 19838 | if (type_is_invalid(uncasted_sentinel->value.type)) |
| 19834 | 19839 | return ira->codegen->invalid_instruction; |
| 19835 | | IrInstruction *sentinel = ir_implicit_cast(ira, &array_type_instruction->base, uncasted_sentinel, child_type); |
| 19840 | IrInstruction *sentinel = ir_implicit_cast(ira, uncasted_sentinel, child_type); |
| 19836 | 19841 | if (type_is_invalid(sentinel->value.type)) |
| 19837 | 19842 | return ira->codegen->invalid_instruction; |
| 19838 | 19843 | sentinel_val = ir_resolve_const(ira, sentinel, UndefBad); |
| ... | ... | @@ -20106,7 +20111,7 @@ static IrInstruction *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionCt |
| 20106 | 20111 | if (type_is_invalid(int_type)) |
| 20107 | 20112 | return ira->codegen->invalid_instruction; |
| 20108 | 20113 | |
| 20109 | | IrInstruction *op = ir_implicit_cast(ira, &instruction->base, instruction->op->child, int_type); |
| 20114 | IrInstruction *op = ir_implicit_cast(ira, instruction->op->child, int_type); |
| 20110 | 20115 | if (type_is_invalid(op->value.type)) |
| 20111 | 20116 | return ira->codegen->invalid_instruction; |
| 20112 | 20117 | |
| ... | ... | @@ -20135,7 +20140,7 @@ static IrInstruction *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionCl |
| 20135 | 20140 | if (type_is_invalid(int_type)) |
| 20136 | 20141 | return ira->codegen->invalid_instruction; |
| 20137 | 20142 | |
| 20138 | | IrInstruction *op = ir_implicit_cast(ira, &instruction->base, instruction->op->child, int_type); |
| 20143 | IrInstruction *op = ir_implicit_cast(ira, instruction->op->child, int_type); |
| 20139 | 20144 | if (type_is_invalid(op->value.type)) |
| 20140 | 20145 | return ira->codegen->invalid_instruction; |
| 20141 | 20146 | |
| ... | ... | @@ -20164,7 +20169,7 @@ static IrInstruction *ir_analyze_instruction_pop_count(IrAnalyze *ira, IrInstruc |
| 20164 | 20169 | if (type_is_invalid(int_type)) |
| 20165 | 20170 | return ira->codegen->invalid_instruction; |
| 20166 | 20171 | |
| 20167 | | IrInstruction *op = ir_implicit_cast(ira, &instruction->base, instruction->op->child, int_type); |
| 20172 | IrInstruction *op = ir_implicit_cast(ira, instruction->op->child, int_type); |
| 20168 | 20173 | if (type_is_invalid(op->value.type)) |
| 20169 | 20174 | return ira->codegen->invalid_instruction; |
| 20170 | 20175 | |
| ... | ... | @@ -20274,7 +20279,7 @@ static IrInstruction *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 20274 | 20279 | return ir_unreach_error(ira); |
| 20275 | 20280 | } |
| 20276 | 20281 | |
| 20277 | | IrInstruction *casted_case_value = ir_implicit_cast(ira, case_value, case_value, target_value->value.type); |
| 20282 | IrInstruction *casted_case_value = ir_implicit_cast(ira, case_value, target_value->value.type); |
| 20278 | 20283 | if (type_is_invalid(casted_case_value->value.type)) |
| 20279 | 20284 | return ir_unreach_error(ira); |
| 20280 | 20285 | |
| ... | ... | @@ -20324,7 +20329,7 @@ static IrInstruction *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 20324 | 20329 | continue; |
| 20325 | 20330 | } |
| 20326 | 20331 | |
| 20327 | | IrInstruction *casted_new_value = ir_implicit_cast(ira, new_value, new_value, target_value->value.type); |
| 20332 | IrInstruction *casted_new_value = ir_implicit_cast(ira, new_value, target_value->value.type); |
| 20328 | 20333 | if (type_is_invalid(casted_new_value->value.type)) |
| 20329 | 20334 | continue; |
| 20330 | 20335 | |
| ... | ... | @@ -20494,7 +20499,7 @@ static IrInstruction *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstru |
| 20494 | 20499 | if (type_is_invalid(first_prong_value->value.type)) |
| 20495 | 20500 | return ira->codegen->invalid_instruction; |
| 20496 | 20501 | |
| 20497 | | IrInstruction *first_casted_prong_value = ir_implicit_cast(ira, &instruction->base, first_prong_value, enum_type); |
| 20502 | IrInstruction *first_casted_prong_value = ir_implicit_cast(ira, first_prong_value, enum_type); |
| 20498 | 20503 | if (type_is_invalid(first_casted_prong_value->value.type)) |
| 20499 | 20504 | return ira->codegen->invalid_instruction; |
| 20500 | 20505 | |
| ... | ... | @@ -20510,7 +20515,7 @@ static IrInstruction *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstru |
| 20510 | 20515 | if (type_is_invalid(this_prong_inst->value.type)) |
| 20511 | 20516 | return ira->codegen->invalid_instruction; |
| 20512 | 20517 | |
| 20513 | | IrInstruction *this_casted_prong_value = ir_implicit_cast(ira, &instruction->base, this_prong_inst, enum_type); |
| 20518 | IrInstruction *this_casted_prong_value = ir_implicit_cast(ira, this_prong_inst, enum_type); |
| 20514 | 20519 | if (type_is_invalid(this_casted_prong_value->value.type)) |
| 20515 | 20520 | return ira->codegen->invalid_instruction; |
| 20516 | 20521 | |
| ... | ... | @@ -21130,7 +21135,7 @@ static IrInstruction *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstruct |
| 21130 | 21135 | if (type_is_invalid(value->value.type)) |
| 21131 | 21136 | return ira->codegen->invalid_instruction; |
| 21132 | 21137 | |
| 21133 | | IrInstruction *casted_value = ir_implicit_cast(ira, &instruction->base, value, ira->codegen->builtin_types.entry_global_error_set); |
| 21138 | IrInstruction *casted_value = ir_implicit_cast(ira, value, ira->codegen->builtin_types.entry_global_error_set); |
| 21134 | 21139 | if (type_is_invalid(casted_value->value.type)) |
| 21135 | 21140 | return ira->codegen->invalid_instruction; |
| 21136 | 21141 | |
| ... | ... | @@ -21238,7 +21243,7 @@ static IrInstruction *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira, |
| 21238 | 21243 | field_ptr->value.type->data.pointer.is_volatile, |
| 21239 | 21244 | PtrLenSingle, |
| 21240 | 21245 | field_ptr_align, 0, 0, false); |
| 21241 | | IrInstruction *casted_field_ptr = ir_implicit_cast(ira, &instruction->base, field_ptr, field_ptr_type); |
| 21246 | IrInstruction *casted_field_ptr = ir_implicit_cast(ira, field_ptr, field_ptr_type); |
| 21242 | 21247 | if (type_is_invalid(casted_field_ptr->value.type)) |
| 21243 | 21248 | return ira->codegen->invalid_instruction; |
| 21244 | 21249 | |
| ... | ... | @@ -22382,7 +22387,7 @@ static Error get_const_field_sentinel(IrAnalyze *ira, IrInstruction *source_inst |
| 22382 | 22387 | { |
| 22383 | 22388 | ConstExprValue *field_val = get_const_field(ira, struct_value, name, field_index); |
| 22384 | 22389 | IrInstruction *field_inst = ir_const(ira, source_instr, field_val->type); |
| 22385 | | IrInstruction *casted_field_inst = ir_implicit_cast(ira, source_instr, field_inst, |
| 22390 | IrInstruction *casted_field_inst = ir_implicit_cast(ira, field_inst, |
| 22386 | 22391 | get_optional_type(ira->codegen, elem_type)); |
| 22387 | 22392 | if (type_is_invalid(casted_field_inst->value.type)) |
| 22388 | 22393 | return ErrorSemanticAnalyzeFail; |
| ... | ... | @@ -22529,7 +22534,7 @@ static IrInstruction *ir_analyze_instruction_type(IrAnalyze *ira, IrInstructionT |
| 22529 | 22534 | if (type_is_invalid(type_info_ir->value.type)) |
| 22530 | 22535 | return ira->codegen->invalid_instruction; |
| 22531 | 22536 | |
| 22532 | | IrInstruction *casted_ir = ir_implicit_cast(ira, &instruction->base, type_info_ir, ir_type_info_get_type(ira, nullptr, nullptr)); |
| 22537 | IrInstruction *casted_ir = ir_implicit_cast(ira, type_info_ir, ir_type_info_get_type(ira, nullptr, nullptr)); |
| 22533 | 22538 | if (type_is_invalid(casted_ir->value.type)) |
| 22534 | 22539 | return ira->codegen->invalid_instruction; |
| 22535 | 22540 | |
| ... | ... | @@ -22890,7 +22895,7 @@ static IrInstruction *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructi |
| 22890 | 22895 | |
| 22891 | 22896 | // TODO let this be volatile |
| 22892 | 22897 | ZigType *ptr_type = get_pointer_to_type(ira->codegen, operand_type, false); |
| 22893 | | IrInstruction *casted_ptr = ir_implicit_cast(ira, &instruction->base, ptr, ptr_type); |
| 22898 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr, ptr_type); |
| 22894 | 22899 | if (type_is_invalid(casted_ptr->value.type)) |
| 22895 | 22900 | return ira->codegen->invalid_instruction; |
| 22896 | 22901 | |
| ... | ... | @@ -22918,11 +22923,11 @@ static IrInstruction *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructi |
| 22918 | 22923 | if (!ir_resolve_atomic_order(ira, failure_order_value, &failure_order)) |
| 22919 | 22924 | return ira->codegen->invalid_instruction; |
| 22920 | 22925 | |
| 22921 | | IrInstruction *casted_cmp_value = ir_implicit_cast(ira, &instruction->base, cmp_value, operand_type); |
| 22926 | IrInstruction *casted_cmp_value = ir_implicit_cast(ira, cmp_value, operand_type); |
| 22922 | 22927 | if (type_is_invalid(casted_cmp_value->value.type)) |
| 22923 | 22928 | return ira->codegen->invalid_instruction; |
| 22924 | 22929 | |
| 22925 | | IrInstruction *casted_new_value = ir_implicit_cast(ira, &instruction->base, new_value, operand_type); |
| 22930 | IrInstruction *casted_new_value = ir_implicit_cast(ira, new_value, operand_type); |
| 22926 | 22931 | if (type_is_invalid(casted_new_value->value.type)) |
| 22927 | 22932 | return ira->codegen->invalid_instruction; |
| 22928 | 22933 | |
| ... | ... | @@ -23016,7 +23021,7 @@ static IrInstruction *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruct |
| 23016 | 23021 | } |
| 23017 | 23022 | |
| 23018 | 23023 | if (dest_type->id == ZigTypeIdComptimeInt) { |
| 23019 | | return ir_implicit_cast(ira, &instruction->base, target, dest_type); |
| 23024 | return ir_implicit_cast(ira, target, dest_type); |
| 23020 | 23025 | } |
| 23021 | 23026 | |
| 23022 | 23027 | if (instr_is_comptime(target)) { |
| ... | ... | @@ -23073,7 +23078,7 @@ static IrInstruction *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstruct |
| 23073 | 23078 | } |
| 23074 | 23079 | |
| 23075 | 23080 | if (instr_is_comptime(target)) { |
| 23076 | | return ir_implicit_cast(ira, &instruction->base, target, dest_type); |
| 23081 | return ir_implicit_cast(ira, target, dest_type); |
| 23077 | 23082 | } |
| 23078 | 23083 | |
| 23079 | 23084 | if (dest_type->id == ZigTypeIdComptimeInt) { |
| ... | ... | @@ -23201,7 +23206,7 @@ static IrInstruction *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstru |
| 23201 | 23206 | src_ptr_align, 0, 0, false); |
| 23202 | 23207 | ZigType *u8_slice = get_slice_type(ira->codegen, u8_ptr); |
| 23203 | 23208 | |
| 23204 | | IrInstruction *casted_value = ir_implicit_cast(ira, &instruction->base, target, u8_slice); |
| 23209 | IrInstruction *casted_value = ir_implicit_cast(ira, target, u8_slice); |
| 23205 | 23210 | if (type_is_invalid(casted_value->value.type)) |
| 23206 | 23211 | return ira->codegen->invalid_instruction; |
| 23207 | 23212 | |
| ... | ... | @@ -23350,7 +23355,7 @@ static IrInstruction *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrInst |
| 23350 | 23355 | return ira->codegen->invalid_instruction; |
| 23351 | 23356 | |
| 23352 | 23357 | if (target->value.type->id == ZigTypeIdComptimeInt) { |
| 23353 | | return ir_implicit_cast(ira, &instruction->base, target, dest_type); |
| 23358 | return ir_implicit_cast(ira, target, dest_type); |
| 23354 | 23359 | } |
| 23355 | 23360 | |
| 23356 | 23361 | if (target->value.type->id != ZigTypeIdFloat && target->value.type->id != ZigTypeIdComptimeFloat) { |
| ... | ... | @@ -23371,7 +23376,7 @@ static IrInstruction *ir_analyze_instruction_err_to_int(IrAnalyze *ira, IrInstru |
| 23371 | 23376 | if (target->value.type->id == ZigTypeIdErrorSet) { |
| 23372 | 23377 | casted_target = target; |
| 23373 | 23378 | } else { |
| 23374 | | casted_target = ir_implicit_cast(ira, &instruction->base, target, ira->codegen->builtin_types.entry_global_error_set); |
| 23379 | casted_target = ir_implicit_cast(ira, target, ira->codegen->builtin_types.entry_global_error_set); |
| 23375 | 23380 | if (type_is_invalid(casted_target->value.type)) |
| 23376 | 23381 | return ira->codegen->invalid_instruction; |
| 23377 | 23382 | } |
| ... | ... | @@ -23384,7 +23389,7 @@ static IrInstruction *ir_analyze_instruction_int_to_err(IrAnalyze *ira, IrInstru |
| 23384 | 23389 | if (type_is_invalid(target->value.type)) |
| 23385 | 23390 | return ira->codegen->invalid_instruction; |
| 23386 | 23391 | |
| 23387 | | IrInstruction *casted_target = ir_implicit_cast(ira, &instruction->base, target, ira->codegen->err_tag_type); |
| 23392 | IrInstruction *casted_target = ir_implicit_cast(ira, target, ira->codegen->err_tag_type); |
| 23388 | 23393 | if (type_is_invalid(casted_target->value.type)) |
| 23389 | 23394 | return ira->codegen->invalid_instruction; |
| 23390 | 23395 | |
| ... | ... | @@ -23459,7 +23464,7 @@ static IrInstruction *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInstruction *s |
| 23459 | 23464 | buf_ptr(&mask->value.type->name))); |
| 23460 | 23465 | return ira->codegen->invalid_instruction; |
| 23461 | 23466 | } |
| 23462 | | mask = ir_implicit_cast(ira, source_instr, mask, get_vector_type(ira->codegen, len_mask, |
| 23467 | mask = ir_implicit_cast(ira, mask, get_vector_type(ira->codegen, len_mask, |
| 23463 | 23468 | ira->codegen->builtin_types.entry_i32)); |
| 23464 | 23469 | if (type_is_invalid(mask->value.type)) |
| 23465 | 23470 | return ira->codegen->invalid_instruction; |
| ... | ... | @@ -23502,7 +23507,7 @@ static IrInstruction *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInstruction *s |
| 23502 | 23507 | len_a = len_b; |
| 23503 | 23508 | a = ir_const_undef(ira, a, get_vector_type(ira->codegen, len_a, scalar_type)); |
| 23504 | 23509 | } else { |
| 23505 | | a = ir_implicit_cast(ira, source_instr, a, get_vector_type(ira->codegen, len_a, scalar_type)); |
| 23510 | a = ir_implicit_cast(ira, a, get_vector_type(ira->codegen, len_a, scalar_type)); |
| 23506 | 23511 | if (type_is_invalid(a->value.type)) |
| 23507 | 23512 | return ira->codegen->invalid_instruction; |
| 23508 | 23513 | } |
| ... | ... | @@ -23511,7 +23516,7 @@ static IrInstruction *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInstruction *s |
| 23511 | 23516 | len_b = len_a; |
| 23512 | 23517 | b = ir_const_undef(ira, b, get_vector_type(ira->codegen, len_b, scalar_type)); |
| 23513 | 23518 | } else { |
| 23514 | | b = ir_implicit_cast(ira, source_instr, b, get_vector_type(ira->codegen, len_b, scalar_type)); |
| 23519 | b = ir_implicit_cast(ira, b, get_vector_type(ira->codegen, len_b, scalar_type)); |
| 23515 | 23520 | if (type_is_invalid(b->value.type)) |
| 23516 | 23521 | return ira->codegen->invalid_instruction; |
| 23517 | 23522 | } |
| ... | ... | @@ -23687,7 +23692,7 @@ static IrInstruction *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstruct |
| 23687 | 23692 | |
| 23688 | 23693 | ZigType *bool_type = ira->codegen->builtin_types.entry_bool; |
| 23689 | 23694 | |
| 23690 | | IrInstruction *casted_value = ir_implicit_cast(ira, &instruction->base, value, bool_type); |
| 23695 | IrInstruction *casted_value = ir_implicit_cast(ira, value, bool_type); |
| 23691 | 23696 | if (type_is_invalid(casted_value->value.type)) |
| 23692 | 23697 | return ira->codegen->invalid_instruction; |
| 23693 | 23698 | |
| ... | ... | @@ -23736,15 +23741,15 @@ static IrInstruction *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructio |
| 23736 | 23741 | ZigType *u8_ptr = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile, |
| 23737 | 23742 | PtrLenUnknown, dest_align, 0, 0, false); |
| 23738 | 23743 | |
| 23739 | | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, &instruction->base, dest_ptr, u8_ptr); |
| 23744 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr); |
| 23740 | 23745 | if (type_is_invalid(casted_dest_ptr->value.type)) |
| 23741 | 23746 | return ira->codegen->invalid_instruction; |
| 23742 | 23747 | |
| 23743 | | IrInstruction *casted_byte = ir_implicit_cast(ira, &instruction->base, byte_value, u8); |
| 23748 | IrInstruction *casted_byte = ir_implicit_cast(ira, byte_value, u8); |
| 23744 | 23749 | if (type_is_invalid(casted_byte->value.type)) |
| 23745 | 23750 | return ira->codegen->invalid_instruction; |
| 23746 | 23751 | |
| 23747 | | IrInstruction *casted_count = ir_implicit_cast(ira, &instruction->base, count_value, usize); |
| 23752 | IrInstruction *casted_count = ir_implicit_cast(ira, count_value, usize); |
| 23748 | 23753 | if (type_is_invalid(casted_count->value.type)) |
| 23749 | 23754 | return ira->codegen->invalid_instruction; |
| 23750 | 23755 | |
| ... | ... | @@ -23871,15 +23876,15 @@ static IrInstruction *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructio |
| 23871 | 23876 | ZigType *u8_ptr_const = get_pointer_to_type_extra(ira->codegen, u8, true, src_is_volatile, |
| 23872 | 23877 | PtrLenUnknown, src_align, 0, 0, false); |
| 23873 | 23878 | |
| 23874 | | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, &instruction->base, dest_ptr, u8_ptr_mut); |
| 23879 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr_mut); |
| 23875 | 23880 | if (type_is_invalid(casted_dest_ptr->value.type)) |
| 23876 | 23881 | return ira->codegen->invalid_instruction; |
| 23877 | 23882 | |
| 23878 | | IrInstruction *casted_src_ptr = ir_implicit_cast(ira, &instruction->base, src_ptr, u8_ptr_const); |
| 23883 | IrInstruction *casted_src_ptr = ir_implicit_cast(ira, src_ptr, u8_ptr_const); |
| 23879 | 23884 | if (type_is_invalid(casted_src_ptr->value.type)) |
| 23880 | 23885 | return ira->codegen->invalid_instruction; |
| 23881 | 23886 | |
| 23882 | | IrInstruction *casted_count = ir_implicit_cast(ira, &instruction->base, count_value, usize); |
| 23887 | IrInstruction *casted_count = ir_implicit_cast(ira, count_value, usize); |
| 23883 | 23888 | if (type_is_invalid(casted_count->value.type)) |
| 23884 | 23889 | return ira->codegen->invalid_instruction; |
| 23885 | 23890 | |
| ... | ... | @@ -24019,7 +24024,7 @@ static IrInstruction *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstruction |
| 24019 | 24024 | return ira->codegen->invalid_instruction; |
| 24020 | 24025 | |
| 24021 | 24026 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 24022 | | IrInstruction *casted_start = ir_implicit_cast(ira, &instruction->base, start, usize); |
| 24027 | IrInstruction *casted_start = ir_implicit_cast(ira, start, usize); |
| 24023 | 24028 | if (type_is_invalid(casted_start->value.type)) |
| 24024 | 24029 | return ira->codegen->invalid_instruction; |
| 24025 | 24030 | |
| ... | ... | @@ -24028,7 +24033,7 @@ static IrInstruction *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstruction |
| 24028 | 24033 | end = instruction->end->child; |
| 24029 | 24034 | if (type_is_invalid(end->value.type)) |
| 24030 | 24035 | return ira->codegen->invalid_instruction; |
| 24031 | | end = ir_implicit_cast(ira, &instruction->base, end, usize); |
| 24036 | end = ir_implicit_cast(ira, end, usize); |
| 24032 | 24037 | if (type_is_invalid(end->value.type)) |
| 24033 | 24038 | return ira->codegen->invalid_instruction; |
| 24034 | 24039 | } else { |
| ... | ... | @@ -24599,7 +24604,7 @@ static IrInstruction *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstr |
| 24599 | 24604 | if (type_is_invalid(op1->value.type)) |
| 24600 | 24605 | return ira->codegen->invalid_instruction; |
| 24601 | 24606 | |
| 24602 | | IrInstruction *casted_op1 = ir_implicit_cast(ira, &instruction->base, op1, dest_type); |
| 24607 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, dest_type); |
| 24603 | 24608 | if (type_is_invalid(casted_op1->value.type)) |
| 24604 | 24609 | return ira->codegen->invalid_instruction; |
| 24605 | 24610 | |
| ... | ... | @@ -24611,9 +24616,9 @@ static IrInstruction *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstr |
| 24611 | 24616 | if (instruction->op == IrOverflowOpShl) { |
| 24612 | 24617 | ZigType *shift_amt_type = get_smallest_unsigned_int_type(ira->codegen, |
| 24613 | 24618 | dest_type->data.integral.bit_count - 1); |
| 24614 | | casted_op2 = ir_implicit_cast(ira, &instruction->base, op2, shift_amt_type); |
| 24619 | casted_op2 = ir_implicit_cast(ira, op2, shift_amt_type); |
| 24615 | 24620 | } else { |
| 24616 | | casted_op2 = ir_implicit_cast(ira, &instruction->base, op2, dest_type); |
| 24621 | casted_op2 = ir_implicit_cast(ira, op2, dest_type); |
| 24617 | 24622 | } |
| 24618 | 24623 | if (type_is_invalid(casted_op2->value.type)) |
| 24619 | 24624 | return ira->codegen->invalid_instruction; |
| ... | ... | @@ -24635,7 +24640,7 @@ static IrInstruction *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstr |
| 24635 | 24640 | expected_ptr_type = get_pointer_to_type(ira->codegen, dest_type, false); |
| 24636 | 24641 | } |
| 24637 | 24642 | |
| 24638 | | IrInstruction *casted_result_ptr = ir_implicit_cast(ira, &instruction->base, result_ptr, expected_ptr_type); |
| 24643 | IrInstruction *casted_result_ptr = ir_implicit_cast(ira, result_ptr, expected_ptr_type); |
| 24639 | 24644 | if (type_is_invalid(casted_result_ptr->value.type)) |
| 24640 | 24645 | return ira->codegen->invalid_instruction; |
| 24641 | 24646 | |
| ... | ... | @@ -24745,7 +24750,7 @@ static IrInstruction *ir_analyze_instruction_mul_add(IrAnalyze *ira, IrInstructi |
| 24745 | 24750 | if (type_is_invalid(op1->value.type)) |
| 24746 | 24751 | return ira->codegen->invalid_instruction; |
| 24747 | 24752 | |
| 24748 | | IrInstruction *casted_op1 = ir_implicit_cast(ira, &instruction->base, op1, expr_type); |
| 24753 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, expr_type); |
| 24749 | 24754 | if (type_is_invalid(casted_op1->value.type)) |
| 24750 | 24755 | return ira->codegen->invalid_instruction; |
| 24751 | 24756 | |
| ... | ... | @@ -24753,7 +24758,7 @@ static IrInstruction *ir_analyze_instruction_mul_add(IrAnalyze *ira, IrInstructi |
| 24753 | 24758 | if (type_is_invalid(op2->value.type)) |
| 24754 | 24759 | return ira->codegen->invalid_instruction; |
| 24755 | 24760 | |
| 24756 | | IrInstruction *casted_op2 = ir_implicit_cast(ira, &instruction->base, op2, expr_type); |
| 24761 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, expr_type); |
| 24757 | 24762 | if (type_is_invalid(casted_op2->value.type)) |
| 24758 | 24763 | return ira->codegen->invalid_instruction; |
| 24759 | 24764 | |
| ... | ... | @@ -24761,7 +24766,7 @@ static IrInstruction *ir_analyze_instruction_mul_add(IrAnalyze *ira, IrInstructi |
| 24761 | 24766 | if (type_is_invalid(op3->value.type)) |
| 24762 | 24767 | return ira->codegen->invalid_instruction; |
| 24763 | 24768 | |
| 24764 | | IrInstruction *casted_op3 = ir_implicit_cast(ira, &instruction->base, op3, expr_type); |
| 24769 | IrInstruction *casted_op3 = ir_implicit_cast(ira, op3, expr_type); |
| 24765 | 24770 | if (type_is_invalid(casted_op3->value.type)) |
| 24766 | 24771 | return ira->codegen->invalid_instruction; |
| 24767 | 24772 | |
| ... | ... | @@ -25133,14 +25138,14 @@ static IrInstruction *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 25133 | 25138 | IrInstruction *start_value_uncasted = range->start->child; |
| 25134 | 25139 | if (type_is_invalid(start_value_uncasted->value.type)) |
| 25135 | 25140 | return ira->codegen->invalid_instruction; |
| 25136 | | IrInstruction *start_value = ir_implicit_cast(ira, &instruction->base, start_value_uncasted, switch_type); |
| 25141 | IrInstruction *start_value = ir_implicit_cast(ira, start_value_uncasted, switch_type); |
| 25137 | 25142 | if (type_is_invalid(start_value->value.type)) |
| 25138 | 25143 | return ira->codegen->invalid_instruction; |
| 25139 | 25144 | |
| 25140 | 25145 | IrInstruction *end_value_uncasted = range->end->child; |
| 25141 | 25146 | if (type_is_invalid(end_value_uncasted->value.type)) |
| 25142 | 25147 | return ira->codegen->invalid_instruction; |
| 25143 | | IrInstruction *end_value = ir_implicit_cast(ira, &instruction->base, end_value_uncasted, switch_type); |
| 25148 | IrInstruction *end_value = ir_implicit_cast(ira, end_value_uncasted, switch_type); |
| 25144 | 25149 | if (type_is_invalid(end_value->value.type)) |
| 25145 | 25150 | return ira->codegen->invalid_instruction; |
| 25146 | 25151 | |
| ... | ... | @@ -25197,14 +25202,14 @@ static IrInstruction *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 25197 | 25202 | IrInstruction *start_value_uncasted = range->start->child; |
| 25198 | 25203 | if (type_is_invalid(start_value_uncasted->value.type)) |
| 25199 | 25204 | return ira->codegen->invalid_instruction; |
| 25200 | | IrInstruction *start_value = ir_implicit_cast(ira, &instruction->base, start_value_uncasted, switch_type); |
| 25205 | IrInstruction *start_value = ir_implicit_cast(ira, start_value_uncasted, switch_type); |
| 25201 | 25206 | if (type_is_invalid(start_value->value.type)) |
| 25202 | 25207 | return ira->codegen->invalid_instruction; |
| 25203 | 25208 | |
| 25204 | 25209 | IrInstruction *end_value_uncasted = range->end->child; |
| 25205 | 25210 | if (type_is_invalid(end_value_uncasted->value.type)) |
| 25206 | 25211 | return ira->codegen->invalid_instruction; |
| 25207 | | IrInstruction *end_value = ir_implicit_cast(ira, &instruction->base, end_value_uncasted, switch_type); |
| 25212 | IrInstruction *end_value = ir_implicit_cast(ira, end_value_uncasted, switch_type); |
| 25208 | 25213 | if (type_is_invalid(end_value->value.type)) |
| 25209 | 25214 | return ira->codegen->invalid_instruction; |
| 25210 | 25215 | |
| ... | ... | @@ -25255,14 +25260,14 @@ static IrInstruction *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 25255 | 25260 | IrInstruction *start_value = range->start->child; |
| 25256 | 25261 | if (type_is_invalid(start_value->value.type)) |
| 25257 | 25262 | return ira->codegen->invalid_instruction; |
| 25258 | | IrInstruction *casted_start_value = ir_implicit_cast(ira, &instruction->base, start_value, switch_type); |
| 25263 | IrInstruction *casted_start_value = ir_implicit_cast(ira, start_value, switch_type); |
| 25259 | 25264 | if (type_is_invalid(casted_start_value->value.type)) |
| 25260 | 25265 | return ira->codegen->invalid_instruction; |
| 25261 | 25266 | |
| 25262 | 25267 | IrInstruction *end_value = range->end->child; |
| 25263 | 25268 | if (type_is_invalid(end_value->value.type)) |
| 25264 | 25269 | return ira->codegen->invalid_instruction; |
| 25265 | | IrInstruction *casted_end_value = ir_implicit_cast(ira, &instruction->base, end_value, switch_type); |
| 25270 | IrInstruction *casted_end_value = ir_implicit_cast(ira, end_value, switch_type); |
| 25266 | 25271 | if (type_is_invalid(casted_end_value->value.type)) |
| 25267 | 25272 | return ira->codegen->invalid_instruction; |
| 25268 | 25273 | |
| ... | ... | @@ -25302,7 +25307,7 @@ static IrInstruction *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 25302 | 25307 | |
| 25303 | 25308 | IrInstruction *value = range->start->child; |
| 25304 | 25309 | |
| 25305 | | IrInstruction *casted_value = ir_implicit_cast(ira, &instruction->base, value, switch_type); |
| 25310 | IrInstruction *casted_value = ir_implicit_cast(ira, value, switch_type); |
| 25306 | 25311 | if (type_is_invalid(casted_value->value.type)) |
| 25307 | 25312 | return ira->codegen->invalid_instruction; |
| 25308 | 25313 | |
| ... | ... | @@ -25363,7 +25368,7 @@ static IrInstruction *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstruction |
| 25363 | 25368 | ZigType *u8_ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 25364 | 25369 | true, false, PtrLenUnknown, 0, 0, 0, false); |
| 25365 | 25370 | ZigType *str_type = get_slice_type(ira->codegen, u8_ptr_type); |
| 25366 | | IrInstruction *casted_msg = ir_implicit_cast(ira, &instruction->base, msg, str_type); |
| 25371 | IrInstruction *casted_msg = ir_implicit_cast(ira, msg, str_type); |
| 25367 | 25372 | if (type_is_invalid(casted_msg->value.type)) |
| 25368 | 25373 | return ir_unreach_error(ira); |
| 25369 | 25374 | |
| ... | ... | @@ -25973,7 +25978,7 @@ static IrInstruction *ir_analyze_int_to_ptr(IrAnalyze *ira, IrInstruction *sourc |
| 25973 | 25978 | ir_assert(get_src_ptr_type(ptr_type) != nullptr, source_instr); |
| 25974 | 25979 | ir_assert(type_has_bits(ptr_type), source_instr); |
| 25975 | 25980 | |
| 25976 | | IrInstruction *casted_int = ir_implicit_cast(ira, source_instr, target, ira->codegen->builtin_types.entry_usize); |
| 25981 | IrInstruction *casted_int = ir_implicit_cast(ira, target, ira->codegen->builtin_types.entry_usize); |
| 25977 | 25982 | if (type_is_invalid(casted_int->value.type)) |
| 25978 | 25983 | return ira->codegen->invalid_instruction; |
| 25979 | 25984 | |
| ... | ... | @@ -26332,7 +26337,7 @@ static IrInstruction *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstru |
| 26332 | 26337 | |
| 26333 | 26338 | // TODO let this be volatile |
| 26334 | 26339 | ZigType *ptr_type = get_pointer_to_type(ira->codegen, operand_type, false); |
| 26335 | | IrInstruction *casted_ptr = ir_implicit_cast(ira, &instruction->base, ptr_inst, ptr_type); |
| 26340 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr_inst, ptr_type); |
| 26336 | 26341 | if (type_is_invalid(casted_ptr->value.type)) |
| 26337 | 26342 | return ira->codegen->invalid_instruction; |
| 26338 | 26343 | |
| ... | ... | @@ -26355,7 +26360,7 @@ static IrInstruction *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstru |
| 26355 | 26360 | if (type_is_invalid(operand->value.type)) |
| 26356 | 26361 | return ira->codegen->invalid_instruction; |
| 26357 | 26362 | |
| 26358 | | IrInstruction *casted_operand = ir_implicit_cast(ira, &instruction->base, operand, operand_type); |
| 26363 | IrInstruction *casted_operand = ir_implicit_cast(ira, operand, operand_type); |
| 26359 | 26364 | if (type_is_invalid(casted_operand->value.type)) |
| 26360 | 26365 | return ira->codegen->invalid_instruction; |
| 26361 | 26366 | |
| ... | ... | @@ -26394,7 +26399,7 @@ static IrInstruction *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInstr |
| 26394 | 26399 | return ira->codegen->invalid_instruction; |
| 26395 | 26400 | |
| 26396 | 26401 | ZigType *ptr_type = get_pointer_to_type(ira->codegen, operand_type, true); |
| 26397 | | IrInstruction *casted_ptr = ir_implicit_cast(ira, &instruction->base, ptr_inst, ptr_type); |
| 26402 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr_inst, ptr_type); |
| 26398 | 26403 | if (type_is_invalid(casted_ptr->value.type)) |
| 26399 | 26404 | return ira->codegen->invalid_instruction; |
| 26400 | 26405 | |
| ... | ... | @@ -26435,7 +26440,7 @@ static IrInstruction *ir_analyze_instruction_atomic_store(IrAnalyze *ira, IrInst |
| 26435 | 26440 | return ira->codegen->invalid_instruction; |
| 26436 | 26441 | |
| 26437 | 26442 | ZigType *ptr_type = get_pointer_to_type(ira->codegen, operand_type, false); |
| 26438 | | IrInstruction *casted_ptr = ir_implicit_cast(ira, &instruction->base, ptr_inst, ptr_type); |
| 26443 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr_inst, ptr_type); |
| 26439 | 26444 | if (type_is_invalid(casted_ptr->value.type)) |
| 26440 | 26445 | return ira->codegen->invalid_instruction; |
| 26441 | 26446 | |
| ... | ... | @@ -26443,7 +26448,7 @@ static IrInstruction *ir_analyze_instruction_atomic_store(IrAnalyze *ira, IrInst |
| 26443 | 26448 | if (type_is_invalid(value->value.type)) |
| 26444 | 26449 | return ira->codegen->invalid_instruction; |
| 26445 | 26450 | |
| 26446 | | IrInstruction *casted_value = ir_implicit_cast(ira, &instruction->base, value, operand_type); |
| 26451 | IrInstruction *casted_value = ir_implicit_cast(ira, value, operand_type); |
| 26447 | 26452 | if (type_is_invalid(casted_value->value.type)) |
| 26448 | 26453 | return ira->codegen->invalid_instruction; |
| 26449 | 26454 | |
| ... | ... | @@ -26682,7 +26687,7 @@ static IrInstruction *ir_analyze_instruction_float_op(IrAnalyze *ira, IrInstruct |
| 26682 | 26687 | if (type_is_invalid(op1->value.type)) |
| 26683 | 26688 | return ira->codegen->invalid_instruction; |
| 26684 | 26689 | |
| 26685 | | IrInstruction *casted_op1 = ir_implicit_cast(ira, &instruction->base, op1, float_type); |
| 26690 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, float_type); |
| 26686 | 26691 | if (type_is_invalid(casted_op1->value.type)) |
| 26687 | 26692 | return ira->codegen->invalid_instruction; |
| 26688 | 26693 | |
| ... | ... | @@ -26758,7 +26763,7 @@ static IrInstruction *ir_analyze_instruction_bswap(IrAnalyze *ira, IrInstruction |
| 26758 | 26763 | bool is_vector = (vector_len != UINT32_MAX); |
| 26759 | 26764 | ZigType *op_type = is_vector ? get_vector_type(ira->codegen, vector_len, int_type) : int_type; |
| 26760 | 26765 | |
| 26761 | | IrInstruction *op = ir_implicit_cast(ira, &instruction->base, uncasted_op, op_type); |
| 26766 | IrInstruction *op = ir_implicit_cast(ira, uncasted_op, op_type); |
| 26762 | 26767 | if (type_is_invalid(op->value.type)) |
| 26763 | 26768 | return ira->codegen->invalid_instruction; |
| 26764 | 26769 | |
| ... | ... | @@ -26823,7 +26828,7 @@ static IrInstruction *ir_analyze_instruction_bit_reverse(IrAnalyze *ira, IrInstr |
| 26823 | 26828 | if (type_is_invalid(int_type)) |
| 26824 | 26829 | return ira->codegen->invalid_instruction; |
| 26825 | 26830 | |
| 26826 | | IrInstruction *op = ir_implicit_cast(ira, &instruction->base, instruction->op->child, int_type); |
| 26831 | IrInstruction *op = ir_implicit_cast(ira, instruction->op->child, int_type); |
| 26827 | 26832 | if (type_is_invalid(op->value.type)) |
| 26828 | 26833 | return ira->codegen->invalid_instruction; |
| 26829 | 26834 | |
| ... | ... | @@ -26904,7 +26909,7 @@ static IrInstruction *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInstr |
| 26904 | 26909 | if (type_is_invalid(target->value.type)) |
| 26905 | 26910 | return ira->codegen->invalid_instruction; |
| 26906 | 26911 | |
| 26907 | | IrInstruction *casted_target = ir_implicit_cast(ira, &instruction->base, target, tag_type); |
| 26912 | IrInstruction *casted_target = ir_implicit_cast(ira, target, tag_type); |
| 26908 | 26913 | if (type_is_invalid(casted_target->value.type)) |
| 26909 | 26914 | return ira->codegen->invalid_instruction; |
| 26910 | 26915 | |
| ... | ... | @@ -27023,7 +27028,7 @@ static IrInstruction *ir_analyze_instruction_implicit_cast(IrAnalyze *ira, IrIns |
| 27023 | 27028 | ZigType *dest_type = ir_resolve_type(ira, instruction->result_loc_cast->base.source_instruction->child); |
| 27024 | 27029 | if (type_is_invalid(dest_type)) |
| 27025 | 27030 | return ira->codegen->invalid_instruction; |
| 27026 | | return ir_implicit_cast(ira, &instruction->base, operand, dest_type); |
| 27031 | return ir_implicit_cast2(ira, &instruction->base, operand, dest_type); |
| 27027 | 27032 | } |
| 27028 | 27033 | |
| 27029 | 27034 | static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInstructionBitCastSrc *instruction) { |
| ... | ... | @@ -27136,7 +27141,7 @@ static IrInstruction *analyze_frame_ptr_to_anyframe_T(IrAnalyze *ira, IrInstruct |
| 27136 | 27141 | } |
| 27137 | 27142 | |
| 27138 | 27143 | ZigType *any_frame_type = get_any_frame_type(ira->codegen, result_type); |
| 27139 | | IrInstruction *casted_frame = ir_implicit_cast(ira, source_instr, frame, any_frame_type); |
| 27144 | IrInstruction *casted_frame = ir_implicit_cast(ira, frame, any_frame_type); |
| 27140 | 27145 | if (type_is_invalid(casted_frame->value.type)) |
| 27141 | 27146 | return ira->codegen->invalid_instruction; |
| 27142 | 27147 | |
| ... | ... | @@ -27200,7 +27205,7 @@ static IrInstruction *ir_analyze_instruction_resume(IrAnalyze *ira, IrInstructio |
| 27200 | 27205 | } |
| 27201 | 27206 | |
| 27202 | 27207 | ZigType *any_frame_type = get_any_frame_type(ira->codegen, nullptr); |
| 27203 | | IrInstruction *casted_frame = ir_implicit_cast(ira, &instruction->base, frame, any_frame_type); |
| 27208 | IrInstruction *casted_frame = ir_implicit_cast(ira, frame, any_frame_type); |
| 27204 | 27209 | if (type_is_invalid(casted_frame->value.type)) |
| 27205 | 27210 | return ira->codegen->invalid_instruction; |
| 27206 | 27211 | |
| ... | ... | @@ -28052,7 +28057,7 @@ static Error ir_resolve_lazy_raw(AstNode *source_node, ConstExprValue *val) { |
| 28052 | 28057 | if (lazy_slice_type->sentinel != nullptr) { |
| 28053 | 28058 | if (type_is_invalid(lazy_slice_type->sentinel->value.type)) |
| 28054 | 28059 | return ErrorSemanticAnalyzeFail; |
| 28055 | | IrInstruction *sentinel = ir_implicit_cast(ira, lazy_slice_type->sentinel, lazy_slice_type->sentinel, elem_type); |
| 28060 | IrInstruction *sentinel = ir_implicit_cast(ira, lazy_slice_type->sentinel, elem_type); |
| 28056 | 28061 | if (type_is_invalid(sentinel->value.type)) |
| 28057 | 28062 | return ErrorSemanticAnalyzeFail; |
| 28058 | 28063 | sentinel_val = ir_resolve_const(ira, sentinel, UndefBad); |
| ... | ... | @@ -28130,7 +28135,7 @@ static Error ir_resolve_lazy_raw(AstNode *source_node, ConstExprValue *val) { |
| 28130 | 28135 | if (lazy_ptr_type->sentinel != nullptr) { |
| 28131 | 28136 | if (type_is_invalid(lazy_ptr_type->sentinel->value.type)) |
| 28132 | 28137 | return ErrorSemanticAnalyzeFail; |
| 28133 | | IrInstruction *sentinel = ir_implicit_cast(ira, lazy_ptr_type->sentinel, lazy_ptr_type->sentinel, elem_type); |
| 28138 | IrInstruction *sentinel = ir_implicit_cast(ira, lazy_ptr_type->sentinel, elem_type); |
| 28134 | 28139 | if (type_is_invalid(sentinel->value.type)) |
| 28135 | 28140 | return ErrorSemanticAnalyzeFail; |
| 28136 | 28141 | sentinel_val = ir_resolve_const(ira, sentinel, UndefBad); |