| ... | @@ -5705,7 +5705,7 @@ static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *so | ... | @@ -5705,7 +5705,7 @@ static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *so |
| 5705 | static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruction, TypeTableEntry *other_type) { | 5705 | static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruction, TypeTableEntry *other_type) { |
| 5706 | TypeTableEntry *other_type_underlying = get_underlying_type(other_type); | 5706 | TypeTableEntry *other_type_underlying = get_underlying_type(other_type); |
| 5707 | | 5707 | |
| 5708 | if (other_type_underlying->id == TypeTableEntryIdInvalid) { | 5708 | if (type_is_invalid(other_type_underlying)) { |
| 5709 | return false; | 5709 | return false; |
| 5710 | } | 5710 | } |
| 5711 | | 5711 | |
| ... | @@ -5865,7 +5865,7 @@ static ImplicitCastMatchResult ir_types_match_with_implicit_cast(IrAnalyze *ira, | ... | @@ -5865,7 +5865,7 @@ static ImplicitCastMatchResult ir_types_match_with_implicit_cast(IrAnalyze *ira, |
| 5865 | static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, IrInstruction **instructions, size_t instruction_count) { | 5865 | static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, IrInstruction **instructions, size_t instruction_count) { |
| 5866 | assert(instruction_count >= 1); | 5866 | assert(instruction_count >= 1); |
| 5867 | IrInstruction *prev_inst = instructions[0]; | 5867 | IrInstruction *prev_inst = instructions[0]; |
| 5868 | if (prev_inst->value.type->id == TypeTableEntryIdInvalid) { | 5868 | if (type_is_invalid(prev_inst->value.type)) { |
| 5869 | return ira->codegen->builtin_types.entry_invalid; | 5869 | return ira->codegen->builtin_types.entry_invalid; |
| 5870 | } | 5870 | } |
| 5871 | bool any_are_pure_error = (prev_inst->value.type->id == TypeTableEntryIdPureError); | 5871 | bool any_are_pure_error = (prev_inst->value.type->id == TypeTableEntryIdPureError); |
| ... | @@ -5874,7 +5874,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod | ... | @@ -5874,7 +5874,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 5874 | IrInstruction *cur_inst = instructions[i]; | 5874 | IrInstruction *cur_inst = instructions[i]; |
| 5875 | TypeTableEntry *cur_type = cur_inst->value.type; | 5875 | TypeTableEntry *cur_type = cur_inst->value.type; |
| 5876 | TypeTableEntry *prev_type = prev_inst->value.type; | 5876 | TypeTableEntry *prev_type = prev_inst->value.type; |
| 5877 | if (cur_type->id == TypeTableEntryIdInvalid) { | 5877 | if (type_is_invalid(cur_type)) { |
| 5878 | return cur_type; | 5878 | return cur_type; |
| 5879 | } else if (prev_type->id == TypeTableEntryIdUnreachable) { | 5879 | } else if (prev_type->id == TypeTableEntryIdUnreachable) { |
| 5880 | prev_inst = cur_inst; | 5880 | prev_inst = cur_inst; |
| ... | @@ -6317,7 +6317,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node | ... | @@ -6317,7 +6317,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node |
| 6317 | analyzed_executable.backward_branch_quota = backward_branch_quota; | 6317 | analyzed_executable.backward_branch_quota = backward_branch_quota; |
| 6318 | analyzed_executable.begin_scope = scope; | 6318 | analyzed_executable.begin_scope = scope; |
| 6319 | TypeTableEntry *result_type = ir_analyze(codegen, &ir_executable, &analyzed_executable, expected_type, node); | 6319 | TypeTableEntry *result_type = ir_analyze(codegen, &ir_executable, &analyzed_executable, expected_type, node); |
| 6320 | if (result_type->id == TypeTableEntryIdInvalid) | 6320 | if (type_is_invalid(result_type)) |
| 6321 | return codegen->invalid_instruction; | 6321 | return codegen->invalid_instruction; |
| 6322 | | 6322 | |
| 6323 | if (codegen->verbose) { | 6323 | if (codegen->verbose) { |
| ... | @@ -6330,7 +6330,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node | ... | @@ -6330,7 +6330,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node |
| 6330 | } | 6330 | } |
| 6331 | | 6331 | |
| 6332 | static TypeTableEntry *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) { | 6332 | static TypeTableEntry *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) { |
| 6333 | if (type_value->value.type->id == TypeTableEntryIdInvalid) | 6333 | if (type_is_invalid(type_value->value.type)) |
| 6334 | return ira->codegen->builtin_types.entry_invalid; | 6334 | return ira->codegen->builtin_types.entry_invalid; |
| 6335 | | 6335 | |
| 6336 | if (type_value->value.type->id != TypeTableEntryIdMetaType) { | 6336 | if (type_value->value.type->id != TypeTableEntryIdMetaType) { |
| ... | @@ -6350,7 +6350,7 @@ static FnTableEntry *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) { | ... | @@ -6350,7 +6350,7 @@ static FnTableEntry *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) { |
| 6350 | if (fn_value == ira->codegen->invalid_instruction) | 6350 | if (fn_value == ira->codegen->invalid_instruction) |
| 6351 | return nullptr; | 6351 | return nullptr; |
| 6352 | | 6352 | |
| 6353 | if (fn_value->value.type->id == TypeTableEntryIdInvalid) | 6353 | if (type_is_invalid(fn_value->value.type)) |
| 6354 | return nullptr; | 6354 | return nullptr; |
| 6355 | | 6355 | |
| 6356 | if (fn_value->value.type->id != TypeTableEntryIdFn) { | 6356 | if (fn_value->value.type->id != TypeTableEntryIdFn) { |
| ... | @@ -6372,7 +6372,7 @@ static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *sourc | ... | @@ -6372,7 +6372,7 @@ static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *sourc |
| 6372 | if (instr_is_comptime(value)) { | 6372 | if (instr_is_comptime(value)) { |
| 6373 | TypeTableEntry *payload_type = wanted_type->data.maybe.child_type; | 6373 | TypeTableEntry *payload_type = wanted_type->data.maybe.child_type; |
| 6374 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); | 6374 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); |
| 6375 | if (casted_payload->value.type->id == TypeTableEntryIdInvalid) | 6375 | if (type_is_invalid(casted_payload->value.type)) |
| 6376 | return ira->codegen->invalid_instruction; | 6376 | return ira->codegen->invalid_instruction; |
| 6377 | | 6377 | |
| 6378 | ConstExprValue *val = ir_resolve_const(ira, casted_payload, UndefBad); | 6378 | ConstExprValue *val = ir_resolve_const(ira, casted_payload, UndefBad); |
| ... | @@ -6430,7 +6430,7 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction | ... | @@ -6430,7 +6430,7 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction |
| 6430 | if (instr_is_comptime(value)) { | 6430 | if (instr_is_comptime(value)) { |
| 6431 | TypeTableEntry *payload_type = wanted_type->data.error.child_type; | 6431 | TypeTableEntry *payload_type = wanted_type->data.error.child_type; |
| 6432 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); | 6432 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); |
| 6433 | if (casted_payload->value.type->id == TypeTableEntryIdInvalid) | 6433 | if (type_is_invalid(casted_payload->value.type)) |
| 6434 | return ira->codegen->invalid_instruction; | 6434 | return ira->codegen->invalid_instruction; |
| 6435 | | 6435 | |
| 6436 | ConstExprValue *val = ir_resolve_const(ira, casted_payload, UndefBad); | 6436 | ConstExprValue *val = ir_resolve_const(ira, casted_payload, UndefBad); |
| ... | @@ -6529,7 +6529,7 @@ static IrInstruction *ir_analyze_null_to_maybe(IrAnalyze *ira, IrInstruction *so | ... | @@ -6529,7 +6529,7 @@ static IrInstruction *ir_analyze_null_to_maybe(IrAnalyze *ira, IrInstruction *so |
| 6529 | static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *value, | 6529 | static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *value, |
| 6530 | bool is_const, bool is_volatile) | 6530 | bool is_const, bool is_volatile) |
| 6531 | { | 6531 | { |
| 6532 | if (value->value.type->id == TypeTableEntryIdInvalid) | 6532 | if (type_is_invalid(value->value.type)) |
| 6533 | return ira->codegen->invalid_instruction; | 6533 | return ira->codegen->invalid_instruction; |
| 6534 | | 6534 | |
| 6535 | if (value->id == IrInstructionIdLoadPtr) { | 6535 | if (value->id == IrInstructionIdLoadPtr) { |
| ... | @@ -6752,9 +6752,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -6752,9 +6752,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 6752 | TypeTableEntry *isize_type = ira->codegen->builtin_types.entry_isize; | 6752 | TypeTableEntry *isize_type = ira->codegen->builtin_types.entry_isize; |
| 6753 | TypeTableEntry *usize_type = ira->codegen->builtin_types.entry_usize; | 6753 | TypeTableEntry *usize_type = ira->codegen->builtin_types.entry_usize; |
| 6754 | | 6754 | |
| 6755 | if (wanted_type_canon->id == TypeTableEntryIdInvalid || | 6755 | if (type_is_invalid(wanted_type_canon) || type_is_invalid(actual_type_canon)) { |
| 6756 | actual_type_canon->id == TypeTableEntryIdInvalid) | | |
| 6757 | { | | |
| 6758 | return ira->codegen->invalid_instruction; | 6756 | return ira->codegen->invalid_instruction; |
| 6759 | } | 6757 | } |
| 6760 | | 6758 | |
| ... | @@ -7016,9 +7014,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -7016,9 +7014,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 7016 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, TypeTableEntry *expected_type) { | 7014 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, TypeTableEntry *expected_type) { |
| 7017 | assert(value); | 7015 | assert(value); |
| 7018 | assert(value != ira->codegen->invalid_instruction); | 7016 | assert(value != ira->codegen->invalid_instruction); |
| 7019 | assert(!expected_type || expected_type->id != TypeTableEntryIdInvalid); | 7017 | assert(!expected_type || !type_is_invalid(expected_type)); |
| 7020 | assert(value->value.type); | 7018 | assert(value->value.type); |
| 7021 | assert(value->value.type->id != TypeTableEntryIdInvalid); | 7019 | assert(!type_is_invalid(value->value.type)); |
| 7022 | if (expected_type == nullptr) | 7020 | if (expected_type == nullptr) |
| 7023 | return value; // anything will do | 7021 | return value; // anything will do |
| 7024 | if (expected_type == value->value.type) | 7022 | if (expected_type == value->value.type) |
| ... | @@ -7046,7 +7044,7 @@ static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, Typ | ... | @@ -7046,7 +7044,7 @@ static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, Typ |
| 7046 | | 7044 | |
| 7047 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr) { | 7045 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr) { |
| 7048 | TypeTableEntry *type_entry = ptr->value.type; | 7046 | TypeTableEntry *type_entry = ptr->value.type; |
| 7049 | if (type_entry->id == TypeTableEntryIdInvalid) { | 7047 | if (type_is_invalid(type_entry)) { |
| 7050 | return ira->codegen->invalid_instruction; | 7048 | return ira->codegen->invalid_instruction; |
| 7051 | } else if (type_entry->id == TypeTableEntryIdPointer) { | 7049 | } else if (type_entry->id == TypeTableEntryIdPointer) { |
| 7052 | TypeTableEntry *child_type = type_entry->data.pointer.child_type; | 7050 | TypeTableEntry *child_type = type_entry->data.pointer.child_type; |
| ... | @@ -7100,11 +7098,11 @@ static TypeTableEntry *ir_analyze_ref(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -7100,11 +7098,11 @@ static TypeTableEntry *ir_analyze_ref(IrAnalyze *ira, IrInstruction *source_inst |
| 7100 | } | 7098 | } |
| 7101 | | 7099 | |
| 7102 | static bool ir_resolve_usize(IrAnalyze *ira, IrInstruction *value, uint64_t *out) { | 7100 | static bool ir_resolve_usize(IrAnalyze *ira, IrInstruction *value, uint64_t *out) { |
| 7103 | if (value->value.type->id == TypeTableEntryIdInvalid) | 7101 | if (type_is_invalid(value->value.type)) |
| 7104 | return false; | 7102 | return false; |
| 7105 | | 7103 | |
| 7106 | IrInstruction *casted_value = ir_implicit_cast(ira, value, ira->codegen->builtin_types.entry_usize); | 7104 | IrInstruction *casted_value = ir_implicit_cast(ira, value, ira->codegen->builtin_types.entry_usize); |
| 7107 | if (casted_value->value.type->id == TypeTableEntryIdInvalid) | 7105 | if (type_is_invalid(casted_value->value.type)) |
| 7108 | return false; | 7106 | return false; |
| 7109 | | 7107 | |
| 7110 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); | 7108 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); |
| ... | @@ -7116,11 +7114,11 @@ static bool ir_resolve_usize(IrAnalyze *ira, IrInstruction *value, uint64_t *out | ... | @@ -7116,11 +7114,11 @@ static bool ir_resolve_usize(IrAnalyze *ira, IrInstruction *value, uint64_t *out |
| 7116 | } | 7114 | } |
| 7117 | | 7115 | |
| 7118 | static bool ir_resolve_bool(IrAnalyze *ira, IrInstruction *value, bool *out) { | 7116 | static bool ir_resolve_bool(IrAnalyze *ira, IrInstruction *value, bool *out) { |
| 7119 | if (value->value.type->id == TypeTableEntryIdInvalid) | 7117 | if (type_is_invalid(value->value.type)) |
| 7120 | return false; | 7118 | return false; |
| 7121 | | 7119 | |
| 7122 | IrInstruction *casted_value = ir_implicit_cast(ira, value, ira->codegen->builtin_types.entry_bool); | 7120 | IrInstruction *casted_value = ir_implicit_cast(ira, value, ira->codegen->builtin_types.entry_bool); |
| 7123 | if (casted_value->value.type->id == TypeTableEntryIdInvalid) | 7121 | if (type_is_invalid(casted_value->value.type)) |
| 7124 | return false; | 7122 | return false; |
| 7125 | | 7123 | |
| 7126 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); | 7124 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); |
| ... | @@ -7140,11 +7138,11 @@ static bool ir_resolve_comptime(IrAnalyze *ira, IrInstruction *value, bool *out) | ... | @@ -7140,11 +7138,11 @@ static bool ir_resolve_comptime(IrAnalyze *ira, IrInstruction *value, bool *out) |
| 7140 | } | 7138 | } |
| 7141 | | 7139 | |
| 7142 | static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, AtomicOrder *out) { | 7140 | static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, AtomicOrder *out) { |
| 7143 | if (value->value.type->id == TypeTableEntryIdInvalid) | 7141 | if (type_is_invalid(value->value.type)) |
| 7144 | return false; | 7142 | return false; |
| 7145 | | 7143 | |
| 7146 | IrInstruction *casted_value = ir_implicit_cast(ira, value, ira->codegen->builtin_types.entry_atomic_order_enum); | 7144 | IrInstruction *casted_value = ir_implicit_cast(ira, value, ira->codegen->builtin_types.entry_atomic_order_enum); |
| 7147 | if (casted_value->value.type->id == TypeTableEntryIdInvalid) | 7145 | if (type_is_invalid(casted_value->value.type)) |
| 7148 | return false; | 7146 | return false; |
| 7149 | | 7147 | |
| 7150 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); | 7148 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); |
| ... | @@ -7156,12 +7154,12 @@ static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, Atomic | ... | @@ -7156,12 +7154,12 @@ static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, Atomic |
| 7156 | } | 7154 | } |
| 7157 | | 7155 | |
| 7158 | static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) { | 7156 | static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) { |
| 7159 | if (value->value.type->id == TypeTableEntryIdInvalid) | 7157 | if (type_is_invalid(value->value.type)) |
| 7160 | return nullptr; | 7158 | return nullptr; |
| 7161 | | 7159 | |
| 7162 | TypeTableEntry *str_type = get_slice_type(ira->codegen, ira->codegen->builtin_types.entry_u8, true); | 7160 | TypeTableEntry *str_type = get_slice_type(ira->codegen, ira->codegen->builtin_types.entry_u8, true); |
| 7163 | IrInstruction *casted_value = ir_implicit_cast(ira, value, str_type); | 7161 | IrInstruction *casted_value = ir_implicit_cast(ira, value, str_type); |
| 7164 | if (casted_value->value.type->id == TypeTableEntryIdInvalid) | 7162 | if (type_is_invalid(casted_value->value.type)) |
| 7165 | return nullptr; | 7163 | return nullptr; |
| 7166 | | 7164 | |
| 7167 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); | 7165 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); |
| ... | @@ -7191,7 +7189,7 @@ static TypeTableEntry *ir_analyze_instruction_return(IrAnalyze *ira, | ... | @@ -7191,7 +7189,7 @@ static TypeTableEntry *ir_analyze_instruction_return(IrAnalyze *ira, |
| 7191 | IrInstructionReturn *return_instruction) | 7189 | IrInstructionReturn *return_instruction) |
| 7192 | { | 7190 | { |
| 7193 | IrInstruction *value = return_instruction->value->other; | 7191 | IrInstruction *value = return_instruction->value->other; |
| 7194 | if (value->value.type->id == TypeTableEntryIdInvalid) | 7192 | if (type_is_invalid(value->value.type)) |
| 7195 | return ir_unreach_error(ira); | 7193 | return ir_unreach_error(ira); |
| 7196 | ira->implicit_return_type_list.append(value); | 7194 | ira->implicit_return_type_list.append(value); |
| 7197 | | 7195 | |
| ... | @@ -7211,11 +7209,11 @@ static TypeTableEntry *ir_analyze_instruction_const(IrAnalyze *ira, IrInstructio | ... | @@ -7211,11 +7209,11 @@ static TypeTableEntry *ir_analyze_instruction_const(IrAnalyze *ira, IrInstructio |
| 7211 | | 7209 | |
| 7212 | static TypeTableEntry *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { | 7210 | static TypeTableEntry *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { |
| 7213 | IrInstruction *op1 = bin_op_instruction->op1->other; | 7211 | IrInstruction *op1 = bin_op_instruction->op1->other; |
| 7214 | if (op1->value.type->id == TypeTableEntryIdInvalid) | 7212 | if (type_is_invalid(op1->value.type)) |
| 7215 | return ira->codegen->builtin_types.entry_invalid; | 7213 | return ira->codegen->builtin_types.entry_invalid; |
| 7216 | | 7214 | |
| 7217 | IrInstruction *op2 = bin_op_instruction->op2->other; | 7215 | IrInstruction *op2 = bin_op_instruction->op2->other; |
| 7218 | if (op2->value.type->id == TypeTableEntryIdInvalid) | 7216 | if (type_is_invalid(op2->value.type)) |
| 7219 | return ira->codegen->builtin_types.entry_invalid; | 7217 | return ira->codegen->builtin_types.entry_invalid; |
| 7220 | | 7218 | |
| 7221 | TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool; | 7219 | TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool; |
| ... | @@ -7298,13 +7296,13 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -7298,13 +7296,13 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 7298 | | 7296 | |
| 7299 | IrInstruction *instructions[] = {op1, op2}; | 7297 | IrInstruction *instructions[] = {op1, op2}; |
| 7300 | TypeTableEntry *resolved_type = ir_resolve_peer_types(ira, bin_op_instruction->base.source_node, instructions, 2); | 7298 | TypeTableEntry *resolved_type = ir_resolve_peer_types(ira, bin_op_instruction->base.source_node, instructions, 2); |
| 7301 | if (resolved_type->id == TypeTableEntryIdInvalid) | 7299 | if (type_is_invalid(resolved_type)) |
| 7302 | return resolved_type; | 7300 | return resolved_type; |
| 7303 | | 7301 | |
| 7304 | AstNode *source_node = bin_op_instruction->base.source_node; | 7302 | AstNode *source_node = bin_op_instruction->base.source_node; |
| 7305 | switch (resolved_type->id) { | 7303 | switch (resolved_type->id) { |
| 7306 | case TypeTableEntryIdInvalid: | 7304 | case TypeTableEntryIdInvalid: |
| 7307 | return ira->codegen->builtin_types.entry_invalid; | 7305 | zig_unreachable(); // handled above |
| 7308 | | 7306 | |
| 7309 | case TypeTableEntryIdNumLitFloat: | 7307 | case TypeTableEntryIdNumLitFloat: |
| 7310 | case TypeTableEntryIdNumLitInt: | 7308 | case TypeTableEntryIdNumLitInt: |
| ... | @@ -7532,7 +7530,7 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -7532,7 +7530,7 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 7532 | IrInstruction *op2 = bin_op_instruction->op2->other; | 7530 | IrInstruction *op2 = bin_op_instruction->op2->other; |
| 7533 | IrInstruction *instructions[] = {op1, op2}; | 7531 | IrInstruction *instructions[] = {op1, op2}; |
| 7534 | TypeTableEntry *resolved_type = ir_resolve_peer_types(ira, bin_op_instruction->base.source_node, instructions, 2); | 7532 | TypeTableEntry *resolved_type = ir_resolve_peer_types(ira, bin_op_instruction->base.source_node, instructions, 2); |
| 7535 | if (resolved_type->id == TypeTableEntryIdInvalid) | 7533 | if (type_is_invalid(resolved_type)) |
| 7536 | return resolved_type; | 7534 | return resolved_type; |
| 7537 | TypeTableEntry *canon_resolved_type = get_underlying_type(resolved_type); | 7535 | TypeTableEntry *canon_resolved_type = get_underlying_type(resolved_type); |
| 7538 | IrBinOp op_id = bin_op_instruction->op_id; | 7536 | IrBinOp op_id = bin_op_instruction->op_id; |
| ... | @@ -7602,12 +7600,12 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -7602,12 +7600,12 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 7602 | static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruction) { | 7600 | static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruction) { |
| 7603 | IrInstruction *op1 = instruction->op1->other; | 7601 | IrInstruction *op1 = instruction->op1->other; |
| 7604 | TypeTableEntry *op1_canon_type = get_underlying_type(op1->value.type); | 7602 | TypeTableEntry *op1_canon_type = get_underlying_type(op1->value.type); |
| 7605 | if (op1_canon_type->id == TypeTableEntryIdInvalid) | 7603 | if (type_is_invalid(op1_canon_type)) |
| 7606 | return ira->codegen->builtin_types.entry_invalid; | 7604 | return ira->codegen->builtin_types.entry_invalid; |
| 7607 | | 7605 | |
| 7608 | IrInstruction *op2 = instruction->op2->other; | 7606 | IrInstruction *op2 = instruction->op2->other; |
| 7609 | TypeTableEntry *op2_canon_type = get_underlying_type(op2->value.type); | 7607 | TypeTableEntry *op2_canon_type = get_underlying_type(op2->value.type); |
| 7610 | if (op2_canon_type->id == TypeTableEntryIdInvalid) | 7608 | if (type_is_invalid(op2_canon_type)) |
| 7611 | return ira->codegen->builtin_types.entry_invalid; | 7609 | return ira->codegen->builtin_types.entry_invalid; |
| 7612 | | 7610 | |
| 7613 | ConstExprValue *op1_val = ir_resolve_const(ira, op1, UndefBad); | 7611 | ConstExprValue *op1_val = ir_resolve_const(ira, op1, UndefBad); |
| ... | @@ -7741,11 +7739,11 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -7741,11 +7739,11 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 7741 | | 7739 | |
| 7742 | static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp *instruction) { | 7740 | static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp *instruction) { |
| 7743 | IrInstruction *op1 = instruction->op1->other; | 7741 | IrInstruction *op1 = instruction->op1->other; |
| 7744 | if (op1->value.type->id == TypeTableEntryIdInvalid) | 7742 | if (type_is_invalid(op1->value.type)) |
| 7745 | return ira->codegen->builtin_types.entry_invalid; | 7743 | return ira->codegen->builtin_types.entry_invalid; |
| 7746 | | 7744 | |
| 7747 | IrInstruction *op2 = instruction->op2->other; | 7745 | IrInstruction *op2 = instruction->op2->other; |
| 7748 | if (op2->value.type->id == TypeTableEntryIdInvalid) | 7746 | if (type_is_invalid(op2->value.type)) |
| 7749 | return ira->codegen->builtin_types.entry_invalid; | 7747 | return ira->codegen->builtin_types.entry_invalid; |
| 7750 | | 7748 | |
| 7751 | ConstExprValue *array_val = ir_resolve_const(ira, op1, UndefBad); | 7749 | ConstExprValue *array_val = ir_resolve_const(ira, op1, UndefBad); |
| ... | @@ -7832,7 +7830,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc | ... | @@ -7832,7 +7830,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 7832 | VariableTableEntry *var = decl_var_instruction->var; | 7830 | VariableTableEntry *var = decl_var_instruction->var; |
| 7833 | | 7831 | |
| 7834 | IrInstruction *init_value = decl_var_instruction->init_value->other; | 7832 | IrInstruction *init_value = decl_var_instruction->init_value->other; |
| 7835 | if (init_value->value.type->id == TypeTableEntryIdInvalid) { | 7833 | if (type_is_invalid(init_value->value.type)) { |
| 7836 | var->value.type = ira->codegen->builtin_types.entry_invalid; | 7834 | var->value.type = ira->codegen->builtin_types.entry_invalid; |
| 7837 | return var->value.type; | 7835 | return var->value.type; |
| 7838 | } | 7836 | } |
| ... | @@ -7849,7 +7847,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc | ... | @@ -7849,7 +7847,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 7849 | var_type = decl_var_instruction->var_type->other; | 7847 | var_type = decl_var_instruction->var_type->other; |
| 7850 | TypeTableEntry *proposed_type = ir_resolve_type(ira, var_type); | 7848 | TypeTableEntry *proposed_type = ir_resolve_type(ira, var_type); |
| 7851 | explicit_type = validate_var_type(ira->codegen, var_type->source_node, proposed_type); | 7849 | explicit_type = validate_var_type(ira->codegen, var_type->source_node, proposed_type); |
| 7852 | if (explicit_type->id == TypeTableEntryIdInvalid) { | 7850 | if (type_is_invalid(explicit_type)) { |
| 7853 | var->value.type = ira->codegen->builtin_types.entry_invalid; | 7851 | var->value.type = ira->codegen->builtin_types.entry_invalid; |
| 7854 | return var->value.type; | 7852 | return var->value.type; |
| 7855 | } | 7853 | } |
| ... | @@ -7859,12 +7857,15 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc | ... | @@ -7859,12 +7857,15 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 7859 | | 7857 | |
| 7860 | IrInstruction *casted_init_value = ir_implicit_cast(ira, init_value, explicit_type); | 7858 | IrInstruction *casted_init_value = ir_implicit_cast(ira, init_value, explicit_type); |
| 7861 | TypeTableEntry *result_type = get_underlying_type(casted_init_value->value.type); | 7859 | TypeTableEntry *result_type = get_underlying_type(casted_init_value->value.type); |
| | 7860 | if (type_is_invalid(result_type)) { |
| | 7861 | result_type = ira->codegen->builtin_types.entry_invalid; |
| | 7862 | } |
| | 7863 | |
| 7862 | switch (result_type->id) { | 7864 | switch (result_type->id) { |
| 7863 | case TypeTableEntryIdTypeDecl: | 7865 | case TypeTableEntryIdTypeDecl: |
| 7864 | zig_unreachable(); | 7866 | zig_unreachable(); |
| 7865 | case TypeTableEntryIdInvalid: | 7867 | case TypeTableEntryIdInvalid: |
| 7866 | result_type = ira->codegen->builtin_types.entry_invalid; | 7868 | break; // handled above |
| 7867 | break; | | |
| 7868 | case TypeTableEntryIdNumLitFloat: | 7869 | case TypeTableEntryIdNumLitFloat: |
| 7869 | case TypeTableEntryIdNumLitInt: | 7870 | case TypeTableEntryIdNumLitInt: |
| 7870 | if (is_export || is_extern || casted_init_value->value.special == ConstValSpecialRuntime) { | 7871 | if (is_export || is_extern || casted_init_value->value.special == ConstValSpecialRuntime) { |
| ... | @@ -7912,7 +7913,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc | ... | @@ -7912,7 +7913,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 7912 | var->value.type = result_type; | 7913 | var->value.type = result_type; |
| 7913 | assert(var->value.type); | 7914 | assert(var->value.type); |
| 7914 | | 7915 | |
| 7915 | if (result_type->id == TypeTableEntryIdInvalid) { | 7916 | if (type_is_invalid(result_type)) { |
| 7916 | decl_var_instruction->base.other = &decl_var_instruction->base; | 7917 | decl_var_instruction->base.other = &decl_var_instruction->base; |
| 7917 | return ira->codegen->builtin_types.entry_void; | 7918 | return ira->codegen->builtin_types.entry_void; |
| 7918 | } | 7919 | } |
| ... | @@ -7953,11 +7954,11 @@ static bool ir_analyze_fn_call_inline_arg(IrAnalyze *ira, AstNode *fn_proto_node | ... | @@ -7953,11 +7954,11 @@ static bool ir_analyze_fn_call_inline_arg(IrAnalyze *ira, AstNode *fn_proto_node |
| 7953 | assert(param_decl_node->type == NodeTypeParamDecl); | 7954 | assert(param_decl_node->type == NodeTypeParamDecl); |
| 7954 | AstNode *param_type_node = param_decl_node->data.param_decl.type; | 7955 | AstNode *param_type_node = param_decl_node->data.param_decl.type; |
| 7955 | TypeTableEntry *param_type = analyze_type_expr(ira->codegen, *exec_scope, param_type_node); | 7956 | TypeTableEntry *param_type = analyze_type_expr(ira->codegen, *exec_scope, param_type_node); |
| 7956 | if (param_type->id == TypeTableEntryIdInvalid) | 7957 | if (type_is_invalid(param_type)) |
| 7957 | return false; | 7958 | return false; |
| 7958 | | 7959 | |
| 7959 | IrInstruction *casted_arg = ir_implicit_cast(ira, arg, param_type); | 7960 | IrInstruction *casted_arg = ir_implicit_cast(ira, arg, param_type); |
| 7960 | if (casted_arg->value.type->id == TypeTableEntryIdInvalid) | 7961 | if (type_is_invalid(casted_arg->value.type)) |
| 7961 | return false; | 7962 | return false; |
| 7962 | | 7963 | |
| 7963 | ConstExprValue *arg_val = ir_resolve_const(ira, casted_arg, UndefBad); | 7964 | ConstExprValue *arg_val = ir_resolve_const(ira, casted_arg, UndefBad); |
| ... | @@ -7989,7 +7990,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod | ... | @@ -7989,7 +7990,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod |
| 7989 | } else { | 7990 | } else { |
| 7990 | AstNode *param_type_node = param_decl_node->data.param_decl.type; | 7991 | AstNode *param_type_node = param_decl_node->data.param_decl.type; |
| 7991 | TypeTableEntry *param_type = analyze_type_expr(ira->codegen, *child_scope, param_type_node); | 7992 | TypeTableEntry *param_type = analyze_type_expr(ira->codegen, *child_scope, param_type_node); |
| 7992 | if (param_type->id == TypeTableEntryIdInvalid) | 7993 | if (type_is_invalid(param_type)) |
| 7993 | return false; | 7994 | return false; |
| 7994 | | 7995 | |
| 7995 | bool is_var_type = (param_type->id == TypeTableEntryIdVar); | 7996 | bool is_var_type = (param_type->id == TypeTableEntryIdVar); |
| ... | @@ -7998,7 +7999,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod | ... | @@ -7998,7 +7999,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod |
| 7998 | casted_arg = arg; | 7999 | casted_arg = arg; |
| 7999 | } else { | 8000 | } else { |
| 8000 | casted_arg = ir_implicit_cast(ira, arg, param_type); | 8001 | casted_arg = ir_implicit_cast(ira, arg, param_type); |
| 8001 | if (casted_arg->value.type->id == TypeTableEntryIdInvalid) | 8002 | if (type_is_invalid(casted_arg->value.type)) |
| 8002 | return false; | 8003 | return false; |
| 8003 | } | 8004 | } |
| 8004 | } | 8005 | } |
| ... | @@ -8102,7 +8103,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8102,7 +8103,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8102 | first_arg = first_arg_ptr; | 8103 | first_arg = first_arg_ptr; |
| 8103 | } else { | 8104 | } else { |
| 8104 | first_arg = ir_get_deref(ira, first_arg_ptr, first_arg_ptr); | 8105 | first_arg = ir_get_deref(ira, first_arg_ptr, first_arg_ptr); |
| 8105 | if (first_arg->value.type->id == TypeTableEntryIdInvalid) | 8106 | if (type_is_invalid(first_arg->value.type)) |
| 8106 | return ira->codegen->builtin_types.entry_invalid; | 8107 | return ira->codegen->builtin_types.entry_invalid; |
| 8107 | } | 8108 | } |
| 8108 | | 8109 | |
| ... | @@ -8112,7 +8113,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8112,7 +8113,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8112 | | 8113 | |
| 8113 | for (size_t call_i = 0; call_i < call_instruction->arg_count; call_i += 1) { | 8114 | for (size_t call_i = 0; call_i < call_instruction->arg_count; call_i += 1) { |
| 8114 | IrInstruction *old_arg = call_instruction->args[call_i]->other; | 8115 | IrInstruction *old_arg = call_instruction->args[call_i]->other; |
| 8115 | if (old_arg->value.type->id == TypeTableEntryIdInvalid) | 8116 | if (type_is_invalid(old_arg->value.type)) |
| 8116 | return ira->codegen->builtin_types.entry_invalid; | 8117 | return ira->codegen->builtin_types.entry_invalid; |
| 8117 | | 8118 | |
| 8118 | if (!ir_analyze_fn_call_inline_arg(ira, fn_proto_node, old_arg, &exec_scope, &next_proto_i)) | 8119 | if (!ir_analyze_fn_call_inline_arg(ira, fn_proto_node, old_arg, &exec_scope, &next_proto_i)) |
| ... | @@ -8121,7 +8122,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8121,7 +8122,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8121 | | 8122 | |
| 8122 | AstNode *return_type_node = fn_proto_node->data.fn_proto.return_type; | 8123 | AstNode *return_type_node = fn_proto_node->data.fn_proto.return_type; |
| 8123 | TypeTableEntry *return_type = analyze_type_expr(ira->codegen, exec_scope, return_type_node); | 8124 | TypeTableEntry *return_type = analyze_type_expr(ira->codegen, exec_scope, return_type_node); |
| 8124 | if (return_type->id == TypeTableEntryIdInvalid) | 8125 | if (type_is_invalid(return_type)) |
| 8125 | return ira->codegen->builtin_types.entry_invalid; | 8126 | return ira->codegen->builtin_types.entry_invalid; |
| 8126 | | 8127 | |
| 8127 | IrInstruction *result; | 8128 | IrInstruction *result; |
| ... | @@ -8135,7 +8136,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8135,7 +8136,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8135 | result = ir_eval_const_value(ira->codegen, exec_scope, body_node, return_type, | 8136 | result = ir_eval_const_value(ira->codegen, exec_scope, body_node, return_type, |
| 8136 | ira->new_irb.exec->backward_branch_count, ira->new_irb.exec->backward_branch_quota, fn_entry, | 8137 | ira->new_irb.exec->backward_branch_count, ira->new_irb.exec->backward_branch_quota, fn_entry, |
| 8137 | nullptr, call_instruction->base.source_node, nullptr, ira->new_irb.exec); | 8138 | nullptr, call_instruction->base.source_node, nullptr, ira->new_irb.exec); |
| 8138 | if (result->value.type->id == TypeTableEntryIdInvalid) | 8139 | if (type_is_invalid(result->value.type)) |
| 8139 | return ira->codegen->builtin_types.entry_invalid; | 8140 | return ira->codegen->builtin_types.entry_invalid; |
| 8140 | | 8141 | |
| 8141 | ira->codegen->memoized_fn_eval_table.put(exec_scope, result); | 8142 | ira->codegen->memoized_fn_eval_table.put(exec_scope, result); |
| ... | @@ -8178,7 +8179,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8178,7 +8179,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8178 | first_arg = first_arg_ptr; | 8179 | first_arg = first_arg_ptr; |
| 8179 | } else { | 8180 | } else { |
| 8180 | first_arg = ir_get_deref(ira, first_arg_ptr, first_arg_ptr); | 8181 | first_arg = ir_get_deref(ira, first_arg_ptr, first_arg_ptr); |
| 8181 | if (first_arg->value.type->id == TypeTableEntryIdInvalid) | 8182 | if (type_is_invalid(first_arg->value.type)) |
| 8182 | return ira->codegen->builtin_types.entry_invalid; | 8183 | return ira->codegen->builtin_types.entry_invalid; |
| 8183 | } | 8184 | } |
| 8184 | | 8185 | |
| ... | @@ -8193,7 +8194,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8193,7 +8194,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8193 | size_t first_var_arg = inst_fn_type_id.param_count; | 8194 | size_t first_var_arg = inst_fn_type_id.param_count; |
| 8194 | for (size_t call_i = 0; call_i < call_instruction->arg_count; call_i += 1) { | 8195 | for (size_t call_i = 0; call_i < call_instruction->arg_count; call_i += 1) { |
| 8195 | IrInstruction *arg = call_instruction->args[call_i]->other; | 8196 | IrInstruction *arg = call_instruction->args[call_i]->other; |
| 8196 | if (arg->value.type->id == TypeTableEntryIdInvalid) | 8197 | if (type_is_invalid(arg->value.type)) |
| 8197 | return ira->codegen->builtin_types.entry_invalid; | 8198 | return ira->codegen->builtin_types.entry_invalid; |
| 8198 | | 8199 | |
| 8199 | AstNode *param_decl_node = fn_proto_node->data.fn_proto.params.at(next_proto_i); | 8200 | AstNode *param_decl_node = fn_proto_node->data.fn_proto.params.at(next_proto_i); |
| ... | @@ -8224,7 +8225,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8224,7 +8225,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8224 | { | 8225 | { |
| 8225 | AstNode *return_type_node = fn_proto_node->data.fn_proto.return_type; | 8226 | AstNode *return_type_node = fn_proto_node->data.fn_proto.return_type; |
| 8226 | TypeTableEntry *return_type = analyze_type_expr(ira->codegen, impl_fn->child_scope, return_type_node); | 8227 | TypeTableEntry *return_type = analyze_type_expr(ira->codegen, impl_fn->child_scope, return_type_node); |
| 8227 | if (return_type->id == TypeTableEntryIdInvalid) | 8228 | if (type_is_invalid(return_type)) |
| 8228 | return ira->codegen->builtin_types.entry_invalid; | 8229 | return ira->codegen->builtin_types.entry_invalid; |
| 8229 | inst_fn_type_id.return_type = return_type; | 8230 | inst_fn_type_id.return_type = return_type; |
| 8230 | | 8231 | |
| ... | @@ -8241,7 +8242,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8241,7 +8242,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8241 | } else { | 8242 | } else { |
| 8242 | // finish instantiating the function | 8243 | // finish instantiating the function |
| 8243 | impl_fn->type_entry = get_fn_type(ira->codegen, &inst_fn_type_id); | 8244 | impl_fn->type_entry = get_fn_type(ira->codegen, &inst_fn_type_id); |
| 8244 | if (impl_fn->type_entry->id == TypeTableEntryIdInvalid) | 8245 | if (type_is_invalid(impl_fn->type_entry)) |
| 8245 | return ira->codegen->builtin_types.entry_invalid; | 8246 | return ira->codegen->builtin_types.entry_invalid; |
| 8246 | | 8247 | |
| 8247 | impl_fn->ir_executable.source_node = call_instruction->base.source_node; | 8248 | impl_fn->ir_executable.source_node = call_instruction->base.source_node; |
| ... | @@ -8272,16 +8273,16 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8272,16 +8273,16 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8272 | first_arg = first_arg_ptr; | 8273 | first_arg = first_arg_ptr; |
| 8273 | } else { | 8274 | } else { |
| 8274 | first_arg = ir_get_deref(ira, first_arg_ptr, first_arg_ptr); | 8275 | first_arg = ir_get_deref(ira, first_arg_ptr, first_arg_ptr); |
| 8275 | if (first_arg->value.type->id == TypeTableEntryIdInvalid) | 8276 | if (type_is_invalid(first_arg->value.type)) |
| 8276 | return ira->codegen->builtin_types.entry_invalid; | 8277 | return ira->codegen->builtin_types.entry_invalid; |
| 8277 | } | 8278 | } |
| 8278 | | 8279 | |
| 8279 | TypeTableEntry *param_type = fn_type_id->param_info[next_arg_index].type; | 8280 | TypeTableEntry *param_type = fn_type_id->param_info[next_arg_index].type; |
| 8280 | if (param_type->id == TypeTableEntryIdInvalid) | 8281 | if (type_is_invalid(param_type)) |
| 8281 | return ira->codegen->builtin_types.entry_invalid; | 8282 | return ira->codegen->builtin_types.entry_invalid; |
| 8282 | | 8283 | |
| 8283 | IrInstruction *casted_arg = ir_implicit_cast(ira, first_arg, param_type); | 8284 | IrInstruction *casted_arg = ir_implicit_cast(ira, first_arg, param_type); |
| 8284 | if (casted_arg->value.type->id == TypeTableEntryIdInvalid) | 8285 | if (type_is_invalid(casted_arg->value.type)) |
| 8285 | return ira->codegen->builtin_types.entry_invalid; | 8286 | return ira->codegen->builtin_types.entry_invalid; |
| 8286 | | 8287 | |
| 8287 | casted_args[next_arg_index] = casted_arg; | 8288 | casted_args[next_arg_index] = casted_arg; |
| ... | @@ -8289,15 +8290,15 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8289,15 +8290,15 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8289 | } | 8290 | } |
| 8290 | for (size_t call_i = 0; call_i < call_instruction->arg_count; call_i += 1) { | 8291 | for (size_t call_i = 0; call_i < call_instruction->arg_count; call_i += 1) { |
| 8291 | IrInstruction *old_arg = call_instruction->args[call_i]->other; | 8292 | IrInstruction *old_arg = call_instruction->args[call_i]->other; |
| 8292 | if (old_arg->value.type->id == TypeTableEntryIdInvalid) | 8293 | if (type_is_invalid(old_arg->value.type)) |
| 8293 | return ira->codegen->builtin_types.entry_invalid; | 8294 | return ira->codegen->builtin_types.entry_invalid; |
| 8294 | IrInstruction *casted_arg; | 8295 | IrInstruction *casted_arg; |
| 8295 | if (next_arg_index < src_param_count) { | 8296 | if (next_arg_index < src_param_count) { |
| 8296 | TypeTableEntry *param_type = fn_type_id->param_info[next_arg_index].type; | 8297 | TypeTableEntry *param_type = fn_type_id->param_info[next_arg_index].type; |
| 8297 | if (param_type->id == TypeTableEntryIdInvalid) | 8298 | if (type_is_invalid(param_type)) |
| 8298 | return ira->codegen->builtin_types.entry_invalid; | 8299 | return ira->codegen->builtin_types.entry_invalid; |
| 8299 | casted_arg = ir_implicit_cast(ira, old_arg, param_type); | 8300 | casted_arg = ir_implicit_cast(ira, old_arg, param_type); |
| 8300 | if (casted_arg->value.type->id == TypeTableEntryIdInvalid) | 8301 | if (type_is_invalid(casted_arg->value.type)) |
| 8301 | return ira->codegen->builtin_types.entry_invalid; | 8302 | return ira->codegen->builtin_types.entry_invalid; |
| 8302 | } else { | 8303 | } else { |
| 8303 | casted_arg = old_arg; | 8304 | casted_arg = old_arg; |
| ... | @@ -8310,7 +8311,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8310,7 +8311,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8310 | assert(next_arg_index == call_param_count); | 8311 | assert(next_arg_index == call_param_count); |
| 8311 | | 8312 | |
| 8312 | TypeTableEntry *return_type = fn_type_id->return_type; | 8313 | TypeTableEntry *return_type = fn_type_id->return_type; |
| 8313 | if (return_type->id == TypeTableEntryIdInvalid) | 8314 | if (type_is_invalid(return_type)) |
| 8314 | return ira->codegen->builtin_types.entry_invalid; | 8315 | return ira->codegen->builtin_types.entry_invalid; |
| 8315 | | 8316 | |
| 8316 | IrInstruction *new_call_instruction = ir_build_call_from(&ira->new_irb, &call_instruction->base, | 8317 | IrInstruction *new_call_instruction = ir_build_call_from(&ira->new_irb, &call_instruction->base, |
| ... | @@ -8322,7 +8323,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -8322,7 +8323,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 8322 | | 8323 | |
| 8323 | static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionCall *call_instruction) { | 8324 | static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionCall *call_instruction) { |
| 8324 | IrInstruction *fn_ref = call_instruction->fn_ref->other; | 8325 | IrInstruction *fn_ref = call_instruction->fn_ref->other; |
| 8325 | if (fn_ref->value.type->id == TypeTableEntryIdInvalid) | 8326 | if (type_is_invalid(fn_ref->value.type)) |
| 8326 | return ira->codegen->builtin_types.entry_invalid; | 8327 | return ira->codegen->builtin_types.entry_invalid; |
| 8327 | | 8328 | |
| 8328 | bool is_inline = call_instruction->is_comptime || | 8329 | bool is_inline = call_instruction->is_comptime || |
| ... | @@ -8331,7 +8332,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction | ... | @@ -8331,7 +8332,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction |
| 8331 | if (is_inline || instr_is_comptime(fn_ref)) { | 8332 | if (is_inline || instr_is_comptime(fn_ref)) { |
| 8332 | if (fn_ref->value.type->id == TypeTableEntryIdMetaType) { | 8333 | if (fn_ref->value.type->id == TypeTableEntryIdMetaType) { |
| 8333 | TypeTableEntry *dest_type = ir_resolve_type(ira, fn_ref); | 8334 | TypeTableEntry *dest_type = ir_resolve_type(ira, fn_ref); |
| 8334 | if (dest_type->id == TypeTableEntryIdInvalid) | 8335 | if (type_is_invalid(dest_type)) |
| 8335 | return ira->codegen->builtin_types.entry_invalid; | 8336 | return ira->codegen->builtin_types.entry_invalid; |
| 8336 | | 8337 | |
| 8337 | size_t actual_param_count = call_instruction->arg_count; | 8338 | size_t actual_param_count = call_instruction->arg_count; |
| ... | @@ -8345,7 +8346,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction | ... | @@ -8345,7 +8346,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction |
| 8345 | IrInstruction *arg = call_instruction->args[0]->other; | 8346 | IrInstruction *arg = call_instruction->args[0]->other; |
| 8346 | | 8347 | |
| 8347 | IrInstruction *cast_instruction = ir_analyze_cast(ira, &call_instruction->base, dest_type, arg); | 8348 | IrInstruction *cast_instruction = ir_analyze_cast(ira, &call_instruction->base, dest_type, arg); |
| 8348 | if (cast_instruction->value.type->id == TypeTableEntryIdInvalid) | 8349 | if (type_is_invalid(cast_instruction->value.type)) |
| 8349 | return ira->codegen->builtin_types.entry_invalid; | 8350 | return ira->codegen->builtin_types.entry_invalid; |
| 8350 | | 8351 | |
| 8351 | ir_link_new_instruction(cast_instruction, &call_instruction->base); | 8352 | ir_link_new_instruction(cast_instruction, &call_instruction->base); |
| ... | @@ -8383,11 +8384,16 @@ static TypeTableEntry *ir_analyze_unary_prefix_op_err(IrAnalyze *ira, IrInstruct | ... | @@ -8383,11 +8384,16 @@ static TypeTableEntry *ir_analyze_unary_prefix_op_err(IrAnalyze *ira, IrInstruct |
| 8383 | | 8384 | |
| 8384 | TypeTableEntry *meta_type = ir_resolve_type(ira, value); | 8385 | TypeTableEntry *meta_type = ir_resolve_type(ira, value); |
| 8385 | TypeTableEntry *underlying_meta_type = get_underlying_type(meta_type); | 8386 | TypeTableEntry *underlying_meta_type = get_underlying_type(meta_type); |
| | 8387 | |
| | 8388 | if (type_is_invalid(underlying_meta_type)) |
| | 8389 | return ira->codegen->builtin_types.entry_invalid; |
| | 8390 | |
| | 8391 | |
| 8386 | switch (underlying_meta_type->id) { | 8392 | switch (underlying_meta_type->id) { |
| 8387 | case TypeTableEntryIdTypeDecl: | 8393 | case TypeTableEntryIdTypeDecl: |
| | 8394 | case TypeTableEntryIdInvalid: // handled above |
| 8388 | zig_unreachable(); | 8395 | zig_unreachable(); |
| 8389 | case TypeTableEntryIdInvalid: | 8396 | |
| 8390 | return ira->codegen->builtin_types.entry_invalid; | | |
| 8391 | case TypeTableEntryIdVoid: | 8397 | case TypeTableEntryIdVoid: |
| 8392 | case TypeTableEntryIdBool: | 8398 | case TypeTableEntryIdBool: |
| 8393 | case TypeTableEntryIdInt: | 8399 | case TypeTableEntryIdInt: |
| ... | @@ -8433,7 +8439,7 @@ static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp | ... | @@ -8433,7 +8439,7 @@ static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp |
| 8433 | | 8439 | |
| 8434 | TypeTableEntry *ptr_type = value->value.type; | 8440 | TypeTableEntry *ptr_type = value->value.type; |
| 8435 | TypeTableEntry *child_type; | 8441 | TypeTableEntry *child_type; |
| 8436 | if (ptr_type->id == TypeTableEntryIdInvalid) { | 8442 | if (type_is_invalid(ptr_type)) { |
| 8437 | return ira->codegen->builtin_types.entry_invalid; | 8443 | return ira->codegen->builtin_types.entry_invalid; |
| 8438 | } else if (ptr_type->id == TypeTableEntryIdPointer) { | 8444 | } else if (ptr_type->id == TypeTableEntryIdPointer) { |
| 8439 | child_type = ptr_type->data.pointer.child_type; | 8445 | child_type = ptr_type->data.pointer.child_type; |
| ... | @@ -8509,7 +8515,7 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op | ... | @@ -8509,7 +8515,7 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op |
| 8509 | static TypeTableEntry *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { | 8515 | static TypeTableEntry *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { |
| 8510 | IrInstruction *value = un_op_instruction->value->other; | 8516 | IrInstruction *value = un_op_instruction->value->other; |
| 8511 | TypeTableEntry *expr_type = value->value.type; | 8517 | TypeTableEntry *expr_type = value->value.type; |
| 8512 | if (expr_type->id == TypeTableEntryIdInvalid) | 8518 | if (type_is_invalid(expr_type)) |
| 8513 | return ira->codegen->builtin_types.entry_invalid; | 8519 | return ira->codegen->builtin_types.entry_invalid; |
| 8514 | | 8520 | |
| 8515 | bool is_wrap_op = (un_op_instruction->op_id == IrUnOpNegationWrap); | 8521 | bool is_wrap_op = (un_op_instruction->op_id == IrUnOpNegationWrap); |
| ... | @@ -8555,7 +8561,7 @@ static TypeTableEntry *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un | ... | @@ -8555,7 +8561,7 @@ static TypeTableEntry *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un |
| 8555 | static TypeTableEntry *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *instruction) { | 8561 | static TypeTableEntry *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *instruction) { |
| 8556 | IrInstruction *value = instruction->value->other; | 8562 | IrInstruction *value = instruction->value->other; |
| 8557 | TypeTableEntry *expr_type = value->value.type; | 8563 | TypeTableEntry *expr_type = value->value.type; |
| 8558 | if (expr_type->id == TypeTableEntryIdInvalid) | 8564 | if (type_is_invalid(expr_type)) |
| 8559 | return ira->codegen->builtin_types.entry_invalid; | 8565 | return ira->codegen->builtin_types.entry_invalid; |
| 8560 | | 8566 | |
| 8561 | if (expr_type->id == TypeTableEntryIdInt) { | 8567 | if (expr_type->id == TypeTableEntryIdInt) { |
| ... | @@ -8616,7 +8622,7 @@ static TypeTableEntry *ir_analyze_instruction_br(IrAnalyze *ira, IrInstructionBr | ... | @@ -8616,7 +8622,7 @@ static TypeTableEntry *ir_analyze_instruction_br(IrAnalyze *ira, IrInstructionBr |
| 8616 | | 8622 | |
| 8617 | static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstructionCondBr *cond_br_instruction) { | 8623 | static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstructionCondBr *cond_br_instruction) { |
| 8618 | IrInstruction *condition = cond_br_instruction->condition->other; | 8624 | IrInstruction *condition = cond_br_instruction->condition->other; |
| 8619 | if (condition->value.type->id == TypeTableEntryIdInvalid) | 8625 | if (type_is_invalid(condition->value.type)) |
| 8620 | return ir_unreach_error(ira); | 8626 | return ir_unreach_error(ira); |
| 8621 | | 8627 | |
| 8622 | bool is_comptime; | 8628 | bool is_comptime; |
| ... | @@ -8667,7 +8673,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP | ... | @@ -8667,7 +8673,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP |
| 8667 | continue; | 8673 | continue; |
| 8668 | IrInstruction *value = phi_instruction->incoming_values[i]->other; | 8674 | IrInstruction *value = phi_instruction->incoming_values[i]->other; |
| 8669 | assert(value->value.type); | 8675 | assert(value->value.type); |
| 8670 | if (value->value.type->id == TypeTableEntryIdInvalid) | 8676 | if (type_is_invalid(value->value.type)) |
| 8671 | return ira->codegen->builtin_types.entry_invalid; | 8677 | return ira->codegen->builtin_types.entry_invalid; |
| 8672 | | 8678 | |
| 8673 | if (value->value.special != ConstValSpecialRuntime) { | 8679 | if (value->value.special != ConstValSpecialRuntime) { |
| ... | @@ -8696,7 +8702,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP | ... | @@ -8696,7 +8702,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP |
| 8696 | if (!new_value || new_value->value.type->id == TypeTableEntryIdUnreachable) | 8702 | if (!new_value || new_value->value.type->id == TypeTableEntryIdUnreachable) |
| 8697 | continue; | 8703 | continue; |
| 8698 | | 8704 | |
| 8699 | if (new_value->value.type->id == TypeTableEntryIdInvalid) | 8705 | if (type_is_invalid(new_value->value.type)) |
| 8700 | return ira->codegen->builtin_types.entry_invalid; | 8706 | return ira->codegen->builtin_types.entry_invalid; |
| 8701 | | 8707 | |
| 8702 | | 8708 | |
| ... | @@ -8718,7 +8724,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP | ... | @@ -8718,7 +8724,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP |
| 8718 | | 8724 | |
| 8719 | TypeTableEntry *resolved_type = ir_resolve_peer_types(ira, phi_instruction->base.source_node, | 8725 | TypeTableEntry *resolved_type = ir_resolve_peer_types(ira, phi_instruction->base.source_node, |
| 8720 | new_incoming_values.items, new_incoming_values.length); | 8726 | new_incoming_values.items, new_incoming_values.length); |
| 8721 | if (resolved_type->id == TypeTableEntryIdInvalid) | 8727 | if (type_is_invalid(resolved_type)) |
| 8722 | return resolved_type; | 8728 | return resolved_type; |
| 8723 | | 8729 | |
| 8724 | if (resolved_type->id == TypeTableEntryIdNumLitFloat || | 8730 | if (resolved_type->id == TypeTableEntryIdNumLitFloat || |
| ... | @@ -8756,7 +8762,7 @@ static TypeTableEntry *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruc | ... | @@ -8756,7 +8762,7 @@ static TypeTableEntry *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruc |
| 8756 | VariableTableEntry *var, bool is_const_ptr, bool is_volatile_ptr) | 8762 | VariableTableEntry *var, bool is_const_ptr, bool is_volatile_ptr) |
| 8757 | { | 8763 | { |
| 8758 | assert(var->value.type); | 8764 | assert(var->value.type); |
| 8759 | if (var->value.type->id == TypeTableEntryIdInvalid) | 8765 | if (type_is_invalid(var->value.type)) |
| 8760 | return var->value.type; | 8766 | return var->value.type; |
| 8761 | | 8767 | |
| 8762 | bool comptime_var_mem = ir_get_var_is_comptime(var); | 8768 | bool comptime_var_mem = ir_get_var_is_comptime(var); |
| ... | @@ -8816,11 +8822,11 @@ static VariableTableEntry *get_fn_var_by_index(FnTableEntry *fn_entry, size_t in | ... | @@ -8816,11 +8822,11 @@ static VariableTableEntry *get_fn_var_by_index(FnTableEntry *fn_entry, size_t in |
| 8816 | | 8822 | |
| 8817 | static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionElemPtr *elem_ptr_instruction) { | 8823 | static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionElemPtr *elem_ptr_instruction) { |
| 8818 | IrInstruction *array_ptr = elem_ptr_instruction->array_ptr->other; | 8824 | IrInstruction *array_ptr = elem_ptr_instruction->array_ptr->other; |
| 8819 | if (array_ptr->value.type->id == TypeTableEntryIdInvalid) | 8825 | if (type_is_invalid(array_ptr->value.type)) |
| 8820 | return ira->codegen->builtin_types.entry_invalid; | 8826 | return ira->codegen->builtin_types.entry_invalid; |
| 8821 | | 8827 | |
| 8822 | IrInstruction *elem_index = elem_ptr_instruction->elem_index->other; | 8828 | IrInstruction *elem_index = elem_ptr_instruction->elem_index->other; |
| 8823 | if (elem_index->value.type->id == TypeTableEntryIdInvalid) | 8829 | if (type_is_invalid(elem_index->value.type)) |
| 8824 | return ira->codegen->builtin_types.entry_invalid; | 8830 | return ira->codegen->builtin_types.entry_invalid; |
| 8825 | | 8831 | |
| 8826 | // This will be a pointer type because elem ptr IR instruction operates on a pointer to a thing. | 8832 | // This will be a pointer type because elem ptr IR instruction operates on a pointer to a thing. |
| ... | @@ -8830,7 +8836,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -8830,7 +8836,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 8830 | TypeTableEntry *array_type = ptr_type->data.pointer.child_type; | 8836 | TypeTableEntry *array_type = ptr_type->data.pointer.child_type; |
| 8831 | TypeTableEntry *return_type; | 8837 | TypeTableEntry *return_type; |
| 8832 | | 8838 | |
| 8833 | if (array_type->id == TypeTableEntryIdInvalid) { | 8839 | if (type_is_invalid(array_type)) { |
| 8834 | return array_type; | 8840 | return array_type; |
| 8835 | } else if (array_type->id == TypeTableEntryIdArray) { | 8841 | } else if (array_type->id == TypeTableEntryIdArray) { |
| 8836 | if (array_type->data.array.len == 0) { | 8842 | if (array_type->data.array.len == 0) { |
| ... | @@ -9019,7 +9025,7 @@ static TypeTableEntry *ir_analyze_container_member_access_inner(IrAnalyze *ira, | ... | @@ -9019,7 +9025,7 @@ static TypeTableEntry *ir_analyze_container_member_access_inner(IrAnalyze *ira, |
| 9019 | return ira->codegen->builtin_types.entry_invalid; | 9025 | return ira->codegen->builtin_types.entry_invalid; |
| 9020 | TldFn *tld_fn = (TldFn *)tld; | 9026 | TldFn *tld_fn = (TldFn *)tld; |
| 9021 | FnTableEntry *fn_entry = tld_fn->fn_entry; | 9027 | FnTableEntry *fn_entry = tld_fn->fn_entry; |
| 9022 | if (fn_entry->type_entry->id == TypeTableEntryIdInvalid) | 9028 | if (type_is_invalid(fn_entry->type_entry)) |
| 9023 | return ira->codegen->builtin_types.entry_invalid; | 9029 | return ira->codegen->builtin_types.entry_invalid; |
| 9024 | | 9030 | |
| 9025 | IrInstruction *bound_fn_value = ir_build_const_bound_fn(&ira->new_irb, field_ptr_instruction->base.scope, | 9031 | IrInstruction *bound_fn_value = ir_build_const_bound_fn(&ira->new_irb, field_ptr_instruction->base.scope, |
| ... | @@ -9113,7 +9119,7 @@ static TypeTableEntry *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source | ... | @@ -9113,7 +9119,7 @@ static TypeTableEntry *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source |
| 9113 | FnTableEntry *fn_entry = tld_fn->fn_entry; | 9119 | FnTableEntry *fn_entry = tld_fn->fn_entry; |
| 9114 | assert(fn_entry->type_entry); | 9120 | assert(fn_entry->type_entry); |
| 9115 | | 9121 | |
| 9116 | if (fn_entry->type_entry->id == TypeTableEntryIdInvalid) | 9122 | if (type_is_invalid(fn_entry->type_entry)) |
| 9117 | return ira->codegen->builtin_types.entry_invalid; | 9123 | return ira->codegen->builtin_types.entry_invalid; |
| 9118 | | 9124 | |
| 9119 | // TODO instead of allocating this every time, put it in the tld value and we can reference | 9125 | // TODO instead of allocating this every time, put it in the tld value and we can reference |
| ... | @@ -9151,7 +9157,7 @@ static TypeTableEntry *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source | ... | @@ -9151,7 +9157,7 @@ static TypeTableEntry *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source |
| 9151 | | 9157 | |
| 9152 | static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFieldPtr *field_ptr_instruction) { | 9158 | static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFieldPtr *field_ptr_instruction) { |
| 9153 | IrInstruction *container_ptr = field_ptr_instruction->container_ptr->other; | 9159 | IrInstruction *container_ptr = field_ptr_instruction->container_ptr->other; |
| 9154 | if (container_ptr->value.type->id == TypeTableEntryIdInvalid) | 9160 | if (type_is_invalid(container_ptr->value.type)) |
| 9155 | return ira->codegen->builtin_types.entry_invalid; | 9161 | return ira->codegen->builtin_types.entry_invalid; |
| 9156 | | 9162 | |
| 9157 | TypeTableEntry *container_type; | 9163 | TypeTableEntry *container_type; |
| ... | @@ -9166,7 +9172,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -9166,7 +9172,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 9166 | Buf *field_name = field_ptr_instruction->field_name; | 9172 | Buf *field_name = field_ptr_instruction->field_name; |
| 9167 | AstNode *source_node = field_ptr_instruction->base.source_node; | 9173 | AstNode *source_node = field_ptr_instruction->base.source_node; |
| 9168 | | 9174 | |
| 9169 | if (container_type->id == TypeTableEntryIdInvalid) { | 9175 | if (type_is_invalid(container_type)) { |
| 9170 | return container_type; | 9176 | return container_type; |
| 9171 | } else if (is_container_ref(container_type)) { | 9177 | } else if (is_container_ref(container_type)) { |
| 9172 | assert(container_ptr->value.type->id == TypeTableEntryIdPointer); | 9178 | assert(container_ptr->value.type->id == TypeTableEntryIdPointer); |
| ... | @@ -9234,7 +9240,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -9234,7 +9240,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 9234 | zig_unreachable(); | 9240 | zig_unreachable(); |
| 9235 | } | 9241 | } |
| 9236 | | 9242 | |
| 9237 | if (child_type->id == TypeTableEntryIdInvalid) { | 9243 | if (type_is_invalid(child_type)) { |
| 9238 | return ira->codegen->builtin_types.entry_invalid; | 9244 | return ira->codegen->builtin_types.entry_invalid; |
| 9239 | } else if (is_container(child_type)) { | 9245 | } else if (is_container(child_type)) { |
| 9240 | if (child_type->id == TypeTableEntryIdEnum) { | 9246 | if (child_type->id == TypeTableEntryIdEnum) { |
| ... | @@ -9371,11 +9377,11 @@ static TypeTableEntry *ir_analyze_instruction_load_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -9371,11 +9377,11 @@ static TypeTableEntry *ir_analyze_instruction_load_ptr(IrAnalyze *ira, IrInstruc |
| 9371 | | 9377 | |
| 9372 | static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstructionStorePtr *store_ptr_instruction) { | 9378 | static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstructionStorePtr *store_ptr_instruction) { |
| 9373 | IrInstruction *ptr = store_ptr_instruction->ptr->other; | 9379 | IrInstruction *ptr = store_ptr_instruction->ptr->other; |
| 9374 | if (ptr->value.type->id == TypeTableEntryIdInvalid) | 9380 | if (type_is_invalid(ptr->value.type)) |
| 9375 | return ptr->value.type; | 9381 | return ptr->value.type; |
| 9376 | | 9382 | |
| 9377 | IrInstruction *value = store_ptr_instruction->value->other; | 9383 | IrInstruction *value = store_ptr_instruction->value->other; |
| 9378 | if (value->value.type->id == TypeTableEntryIdInvalid) | 9384 | if (type_is_invalid(value->value.type)) |
| 9379 | return value->value.type; | 9385 | return value->value.type; |
| 9380 | | 9386 | |
| 9381 | assert(ptr->value.type->id == TypeTableEntryIdPointer); | 9387 | assert(ptr->value.type->id == TypeTableEntryIdPointer); |
| ... | @@ -9412,9 +9418,11 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru | ... | @@ -9412,9 +9418,11 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru |
| 9412 | static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructionTypeOf *typeof_instruction) { | 9418 | static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructionTypeOf *typeof_instruction) { |
| 9413 | IrInstruction *expr_value = typeof_instruction->value->other; | 9419 | IrInstruction *expr_value = typeof_instruction->value->other; |
| 9414 | TypeTableEntry *type_entry = expr_value->value.type; | 9420 | TypeTableEntry *type_entry = expr_value->value.type; |
| | 9421 | if (type_is_invalid(type_entry)) |
| | 9422 | return ira->codegen->builtin_types.entry_invalid; |
| 9415 | switch (type_entry->id) { | 9423 | switch (type_entry->id) { |
| 9416 | case TypeTableEntryIdInvalid: | 9424 | case TypeTableEntryIdInvalid: |
| 9417 | return type_entry; | 9425 | zig_unreachable(); // handled above |
| 9418 | case TypeTableEntryIdVar: | 9426 | case TypeTableEntryIdVar: |
| 9419 | ir_add_error_node(ira, expr_value->source_node, | 9427 | ir_add_error_node(ira, expr_value->source_node, |
| 9420 | buf_sprintf("type '%s' not eligible for @typeOf", buf_ptr(&type_entry->name))); | 9428 | buf_sprintf("type '%s' not eligible for @typeOf", buf_ptr(&type_entry->name))); |
| ... | @@ -9460,7 +9468,7 @@ static TypeTableEntry *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira, | ... | @@ -9460,7 +9468,7 @@ static TypeTableEntry *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira, |
| 9460 | { | 9468 | { |
| 9461 | IrInstruction *value = to_ptr_type_instruction->value->other; | 9469 | IrInstruction *value = to_ptr_type_instruction->value->other; |
| 9462 | TypeTableEntry *type_entry = value->value.type; | 9470 | TypeTableEntry *type_entry = value->value.type; |
| 9463 | if (type_entry->id == TypeTableEntryIdInvalid) | 9471 | if (type_is_invalid(type_entry)) |
| 9464 | return type_entry; | 9472 | return type_entry; |
| 9465 | | 9473 | |
| 9466 | TypeTableEntry *ptr_type; | 9474 | TypeTableEntry *ptr_type; |
| ... | @@ -9489,7 +9497,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira, | ... | @@ -9489,7 +9497,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira, |
| 9489 | { | 9497 | { |
| 9490 | IrInstruction *type_value = ptr_type_child_instruction->value->other; | 9498 | IrInstruction *type_value = ptr_type_child_instruction->value->other; |
| 9491 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 9499 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); |
| 9492 | if (type_entry->id == TypeTableEntryIdInvalid) | 9500 | if (type_is_invalid(type_entry)) |
| 9493 | return type_entry; | 9501 | return type_entry; |
| 9494 | | 9502 | |
| 9495 | // TODO handle typedefs | 9503 | // TODO handle typedefs |
| ... | @@ -9651,7 +9659,7 @@ static TypeTableEntry *ir_analyze_instruction_set_debug_safety(IrAnalyze *ira, | ... | @@ -9651,7 +9659,7 @@ static TypeTableEntry *ir_analyze_instruction_set_debug_safety(IrAnalyze *ira, |
| 9651 | { | 9659 | { |
| 9652 | IrInstruction *target_instruction = set_debug_safety_instruction->scope_value->other; | 9660 | IrInstruction *target_instruction = set_debug_safety_instruction->scope_value->other; |
| 9653 | TypeTableEntry *target_type = target_instruction->value.type; | 9661 | TypeTableEntry *target_type = target_instruction->value.type; |
| 9654 | if (target_type->id == TypeTableEntryIdInvalid) | 9662 | if (type_is_invalid(target_type)) |
| 9655 | return ira->codegen->builtin_types.entry_invalid; | 9663 | return ira->codegen->builtin_types.entry_invalid; |
| 9656 | ConstExprValue *target_val = ir_resolve_const(ira, target_instruction, UndefBad); | 9664 | ConstExprValue *target_val = ir_resolve_const(ira, target_instruction, UndefBad); |
| 9657 | if (!target_val) | 9665 | if (!target_val) |
| ... | @@ -9719,17 +9727,19 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, | ... | @@ -9719,17 +9727,19 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, |
| 9719 | IrInstructionSliceType *slice_type_instruction) | 9727 | IrInstructionSliceType *slice_type_instruction) |
| 9720 | { | 9728 | { |
| 9721 | IrInstruction *child_type = slice_type_instruction->child_type->other; | 9729 | IrInstruction *child_type = slice_type_instruction->child_type->other; |
| 9722 | if (child_type->value.type->id == TypeTableEntryIdInvalid) | 9730 | if (type_is_invalid(child_type->value.type)) |
| 9723 | return ira->codegen->builtin_types.entry_invalid; | 9731 | return ira->codegen->builtin_types.entry_invalid; |
| 9724 | bool is_const = slice_type_instruction->is_const; | 9732 | bool is_const = slice_type_instruction->is_const; |
| 9725 | | 9733 | |
| 9726 | TypeTableEntry *resolved_child_type = ir_resolve_type(ira, child_type); | 9734 | TypeTableEntry *resolved_child_type = ir_resolve_type(ira, child_type); |
| 9727 | TypeTableEntry *canon_child_type = get_underlying_type(resolved_child_type); | 9735 | TypeTableEntry *canon_child_type = get_underlying_type(resolved_child_type); |
| | 9736 | if (type_is_invalid(canon_child_type)) |
| | 9737 | return ira->codegen->builtin_types.entry_invalid; |
| | 9738 | |
| 9728 | switch (canon_child_type->id) { | 9739 | switch (canon_child_type->id) { |
| 9729 | case TypeTableEntryIdTypeDecl: | 9740 | case TypeTableEntryIdTypeDecl: |
| | 9741 | case TypeTableEntryIdInvalid: // handled above |
| 9730 | zig_unreachable(); | 9742 | zig_unreachable(); |
| 9731 | case TypeTableEntryIdInvalid: | | |
| 9732 | return ira->codegen->builtin_types.entry_invalid; | | |
| 9733 | case TypeTableEntryIdVar: | 9743 | case TypeTableEntryIdVar: |
| 9734 | case TypeTableEntryIdUnreachable: | 9744 | case TypeTableEntryIdUnreachable: |
| 9735 | case TypeTableEntryIdUndefLit: | 9745 | case TypeTableEntryIdUndefLit: |
| ... | @@ -9789,14 +9799,14 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA | ... | @@ -9789,14 +9799,14 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA |
| 9789 | if (asm_output->return_type) { | 9799 | if (asm_output->return_type) { |
| 9790 | output_types[i] = asm_instruction->output_types[i]->other; | 9800 | output_types[i] = asm_instruction->output_types[i]->other; |
| 9791 | return_type = ir_resolve_type(ira, output_types[i]); | 9801 | return_type = ir_resolve_type(ira, output_types[i]); |
| 9792 | if (return_type->id == TypeTableEntryIdInvalid) | 9802 | if (type_is_invalid(return_type)) |
| 9793 | return ira->codegen->builtin_types.entry_invalid; | 9803 | return ira->codegen->builtin_types.entry_invalid; |
| 9794 | } | 9804 | } |
| 9795 | } | 9805 | } |
| 9796 | | 9806 | |
| 9797 | for (size_t i = 0; i < asm_expr->input_list.length; i += 1) { | 9807 | for (size_t i = 0; i < asm_expr->input_list.length; i += 1) { |
| 9798 | input_list[i] = asm_instruction->input_list[i]->other; | 9808 | input_list[i] = asm_instruction->input_list[i]->other; |
| 9799 | if (input_list[i]->value.type->id == TypeTableEntryIdInvalid) | 9809 | if (type_is_invalid(input_list[i]->value.type)) |
| 9800 | return ira->codegen->builtin_types.entry_invalid; | 9810 | return ira->codegen->builtin_types.entry_invalid; |
| 9801 | } | 9811 | } |
| 9802 | | 9812 | |
| ... | @@ -9816,11 +9826,12 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, | ... | @@ -9816,11 +9826,12 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, |
| 9816 | IrInstruction *child_type_value = array_type_instruction->child_type->other; | 9826 | IrInstruction *child_type_value = array_type_instruction->child_type->other; |
| 9817 | TypeTableEntry *child_type = ir_resolve_type(ira, child_type_value); | 9827 | TypeTableEntry *child_type = ir_resolve_type(ira, child_type_value); |
| 9818 | TypeTableEntry *canon_child_type = get_underlying_type(child_type); | 9828 | TypeTableEntry *canon_child_type = get_underlying_type(child_type); |
| | 9829 | if (type_is_invalid(canon_child_type)) |
| | 9830 | return ira->codegen->builtin_types.entry_invalid; |
| 9819 | switch (canon_child_type->id) { | 9831 | switch (canon_child_type->id) { |
| 9820 | case TypeTableEntryIdTypeDecl: | 9832 | case TypeTableEntryIdTypeDecl: |
| | 9833 | case TypeTableEntryIdInvalid: // handled above |
| 9821 | zig_unreachable(); | 9834 | zig_unreachable(); |
| 9822 | case TypeTableEntryIdInvalid: | | |
| 9823 | return ira->codegen->builtin_types.entry_invalid; | | |
| 9824 | case TypeTableEntryIdVar: | 9835 | case TypeTableEntryIdVar: |
| 9825 | case TypeTableEntryIdUnreachable: | 9836 | case TypeTableEntryIdUnreachable: |
| 9826 | case TypeTableEntryIdUndefLit: | 9837 | case TypeTableEntryIdUndefLit: |
| ... | @@ -9906,10 +9917,11 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira, | ... | @@ -9906,10 +9917,11 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira, |
| 9906 | TypeTableEntry *canon_type_entry = get_underlying_type(type_entry); | 9917 | TypeTableEntry *canon_type_entry = get_underlying_type(type_entry); |
| 9907 | | 9918 | |
| 9908 | ensure_complete_type(ira->codegen, type_entry); | 9919 | ensure_complete_type(ira->codegen, type_entry); |
| | 9920 | if (type_is_invalid(canon_type_entry)) |
| | 9921 | return ira->codegen->builtin_types.entry_invalid; |
| 9909 | | 9922 | |
| 9910 | switch (canon_type_entry->id) { | 9923 | switch (canon_type_entry->id) { |
| 9911 | case TypeTableEntryIdInvalid: | 9924 | case TypeTableEntryIdInvalid: // handled above |
| 9912 | return ira->codegen->builtin_types.entry_invalid; | | |
| 9913 | case TypeTableEntryIdTypeDecl: | 9925 | case TypeTableEntryIdTypeDecl: |
| 9914 | zig_unreachable(); | 9926 | zig_unreachable(); |
| 9915 | case TypeTableEntryIdVar: | 9927 | case TypeTableEntryIdVar: |
| ... | @@ -9953,7 +9965,7 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira, | ... | @@ -9953,7 +9965,7 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira, |
| 9953 | | 9965 | |
| 9954 | static TypeTableEntry *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrInstructionTestNonNull *instruction) { | 9966 | static TypeTableEntry *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrInstructionTestNonNull *instruction) { |
| 9955 | IrInstruction *value = instruction->value->other; | 9967 | IrInstruction *value = instruction->value->other; |
| 9956 | if (value->value.type->id == TypeTableEntryIdInvalid) | 9968 | if (type_is_invalid(value->value.type)) |
| 9957 | return ira->codegen->builtin_types.entry_invalid; | 9969 | return ira->codegen->builtin_types.entry_invalid; |
| 9958 | | 9970 | |
| 9959 | TypeTableEntry *type_entry = value->value.type; | 9971 | TypeTableEntry *type_entry = value->value.type; |
| ... | @@ -9986,7 +9998,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, | ... | @@ -9986,7 +9998,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, |
| 9986 | IrInstructionUnwrapMaybe *unwrap_maybe_instruction) | 9998 | IrInstructionUnwrapMaybe *unwrap_maybe_instruction) |
| 9987 | { | 9999 | { |
| 9988 | IrInstruction *value = unwrap_maybe_instruction->value->other; | 10000 | IrInstruction *value = unwrap_maybe_instruction->value->other; |
| 9989 | if (value->value.type->id == TypeTableEntryIdInvalid) | 10001 | if (type_is_invalid(value->value.type)) |
| 9990 | return ira->codegen->builtin_types.entry_invalid; | 10002 | return ira->codegen->builtin_types.entry_invalid; |
| 9991 | | 10003 | |
| 9992 | TypeTableEntry *ptr_type = value->value.type; | 10004 | TypeTableEntry *ptr_type = value->value.type; |
| ... | @@ -10010,7 +10022,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, | ... | @@ -10010,7 +10022,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, |
| 10010 | | 10022 | |
| 10011 | TypeTableEntry *type_entry = ptr_type->data.pointer.child_type; | 10023 | TypeTableEntry *type_entry = ptr_type->data.pointer.child_type; |
| 10012 | // TODO handle typedef | 10024 | // TODO handle typedef |
| 10013 | if (type_entry->id == TypeTableEntryIdInvalid) { | 10025 | if (type_is_invalid(type_entry)) { |
| 10014 | return ira->codegen->builtin_types.entry_invalid; | 10026 | return ira->codegen->builtin_types.entry_invalid; |
| 10015 | } else if (type_entry->id != TypeTableEntryIdMaybe) { | 10027 | } else if (type_entry->id != TypeTableEntryIdMaybe) { |
| 10016 | ir_add_error_node(ira, unwrap_maybe_instruction->value->source_node, | 10028 | ir_add_error_node(ira, unwrap_maybe_instruction->value->source_node, |
| ... | @@ -10047,7 +10059,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, | ... | @@ -10047,7 +10059,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, |
| 10047 | | 10059 | |
| 10048 | static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionCtz *ctz_instruction) { | 10060 | static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionCtz *ctz_instruction) { |
| 10049 | IrInstruction *value = ctz_instruction->value->other; | 10061 | IrInstruction *value = ctz_instruction->value->other; |
| 10050 | if (value->value.type->id == TypeTableEntryIdInvalid) { | 10062 | if (type_is_invalid(value->value.type)) { |
| 10051 | return ira->codegen->builtin_types.entry_invalid; | 10063 | return ira->codegen->builtin_types.entry_invalid; |
| 10052 | } else if (value->value.type->id == TypeTableEntryIdInt) { | 10064 | } else if (value->value.type->id == TypeTableEntryIdInt) { |
| 10053 | if (value->value.special != ConstValSpecialRuntime) { | 10065 | if (value->value.special != ConstValSpecialRuntime) { |
| ... | @@ -10069,7 +10081,7 @@ static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionC | ... | @@ -10069,7 +10081,7 @@ static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionC |
| 10069 | | 10081 | |
| 10070 | static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionClz *clz_instruction) { | 10082 | static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionClz *clz_instruction) { |
| 10071 | IrInstruction *value = clz_instruction->value->other; | 10083 | IrInstruction *value = clz_instruction->value->other; |
| 10072 | if (value->value.type->id == TypeTableEntryIdInvalid) { | 10084 | if (type_is_invalid(value->value.type)) { |
| 10073 | return ira->codegen->builtin_types.entry_invalid; | 10085 | return ira->codegen->builtin_types.entry_invalid; |
| 10074 | } else if (value->value.type->id == TypeTableEntryIdInt) { | 10086 | } else if (value->value.type->id == TypeTableEntryIdInt) { |
| 10075 | if (value->value.special != ConstValSpecialRuntime) { | 10087 | if (value->value.special != ConstValSpecialRuntime) { |
| ... | @@ -10090,7 +10102,7 @@ static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionC | ... | @@ -10090,7 +10102,7 @@ static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionC |
| 10090 | } | 10102 | } |
| 10091 | | 10103 | |
| 10092 | static IrInstruction *ir_analyze_enum_tag(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value) { | 10104 | static IrInstruction *ir_analyze_enum_tag(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value) { |
| 10093 | if (value->value.type->id == TypeTableEntryIdInvalid) | 10105 | if (type_is_invalid(value->value.type)) |
| 10094 | return ira->codegen->invalid_instruction; | 10106 | return ira->codegen->invalid_instruction; |
| 10095 | | 10107 | |
| 10096 | if (value->value.type->id != TypeTableEntryIdEnum) { | 10108 | if (value->value.type->id != TypeTableEntryIdEnum) { |
| ... | @@ -10119,7 +10131,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, | ... | @@ -10119,7 +10131,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 10119 | IrInstructionSwitchBr *switch_br_instruction) | 10131 | IrInstructionSwitchBr *switch_br_instruction) |
| 10120 | { | 10132 | { |
| 10121 | IrInstruction *target_value = switch_br_instruction->target_value->other; | 10133 | IrInstruction *target_value = switch_br_instruction->target_value->other; |
| 10122 | if (target_value->value.type->id == TypeTableEntryIdInvalid) | 10134 | if (type_is_invalid(target_value->value.type)) |
| 10123 | return ir_unreach_error(ira); | 10135 | return ir_unreach_error(ira); |
| 10124 | | 10136 | |
| 10125 | size_t case_count = switch_br_instruction->case_count; | 10137 | size_t case_count = switch_br_instruction->case_count; |
| ... | @@ -10137,17 +10149,17 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, | ... | @@ -10137,17 +10149,17 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 10137 | for (size_t i = 0; i < case_count; i += 1) { | 10149 | for (size_t i = 0; i < case_count; i += 1) { |
| 10138 | IrInstructionSwitchBrCase *old_case = &switch_br_instruction->cases[i]; | 10150 | IrInstructionSwitchBrCase *old_case = &switch_br_instruction->cases[i]; |
| 10139 | IrInstruction *case_value = old_case->value->other; | 10151 | IrInstruction *case_value = old_case->value->other; |
| 10140 | if (case_value->value.type->id == TypeTableEntryIdInvalid) | 10152 | if (type_is_invalid(case_value->value.type)) |
| 10141 | return ir_unreach_error(ira); | 10153 | return ir_unreach_error(ira); |
| 10142 | | 10154 | |
| 10143 | if (case_value->value.type->id == TypeTableEntryIdEnum) { | 10155 | if (case_value->value.type->id == TypeTableEntryIdEnum) { |
| 10144 | case_value = ir_analyze_enum_tag(ira, &switch_br_instruction->base, case_value); | 10156 | case_value = ir_analyze_enum_tag(ira, &switch_br_instruction->base, case_value); |
| 10145 | if (case_value->value.type->id == TypeTableEntryIdInvalid) | 10157 | if (type_is_invalid(case_value->value.type)) |
| 10146 | return ir_unreach_error(ira); | 10158 | return ir_unreach_error(ira); |
| 10147 | } | 10159 | } |
| 10148 | | 10160 | |
| 10149 | IrInstruction *casted_case_value = ir_implicit_cast(ira, case_value, target_value->value.type); | 10161 | IrInstruction *casted_case_value = ir_implicit_cast(ira, case_value, target_value->value.type); |
| 10150 | if (casted_case_value->value.type->id == TypeTableEntryIdInvalid) | 10162 | if (type_is_invalid(casted_case_value->value.type)) |
| 10151 | return ir_unreach_error(ira); | 10163 | return ir_unreach_error(ira); |
| 10152 | | 10164 | |
| 10153 | ConstExprValue *case_val = ir_resolve_const(ira, casted_case_value, UndefBad); | 10165 | ConstExprValue *case_val = ir_resolve_const(ira, casted_case_value, UndefBad); |
| ... | @@ -10184,17 +10196,17 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, | ... | @@ -10184,17 +10196,17 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 10184 | | 10196 | |
| 10185 | IrInstruction *old_value = old_case->value; | 10197 | IrInstruction *old_value = old_case->value; |
| 10186 | IrInstruction *new_value = old_value->other; | 10198 | IrInstruction *new_value = old_value->other; |
| 10187 | if (new_value->value.type->id == TypeTableEntryIdInvalid) | 10199 | if (type_is_invalid(new_value->value.type)) |
| 10188 | continue; | 10200 | continue; |
| 10189 | | 10201 | |
| 10190 | if (new_value->value.type->id == TypeTableEntryIdEnum) { | 10202 | if (new_value->value.type->id == TypeTableEntryIdEnum) { |
| 10191 | new_value = ir_analyze_enum_tag(ira, &switch_br_instruction->base, new_value); | 10203 | new_value = ir_analyze_enum_tag(ira, &switch_br_instruction->base, new_value); |
| 10192 | if (new_value->value.type->id == TypeTableEntryIdInvalid) | 10204 | if (type_is_invalid(new_value->value.type)) |
| 10193 | continue; | 10205 | continue; |
| 10194 | } | 10206 | } |
| 10195 | | 10207 | |
| 10196 | IrInstruction *casted_new_value = ir_implicit_cast(ira, new_value, target_value->value.type); | 10208 | IrInstruction *casted_new_value = ir_implicit_cast(ira, new_value, target_value->value.type); |
| 10197 | if (casted_new_value->value.type->id == TypeTableEntryIdInvalid) | 10209 | if (type_is_invalid(casted_new_value->value.type)) |
| 10198 | continue; | 10210 | continue; |
| 10199 | | 10211 | |
| 10200 | if (!ir_resolve_const(ira, casted_new_value, UndefBad)) | 10212 | if (!ir_resolve_const(ira, casted_new_value, UndefBad)) |
| ... | @@ -10218,7 +10230,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, | ... | @@ -10218,7 +10230,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 10218 | IrInstructionSwitchTarget *switch_target_instruction) | 10230 | IrInstructionSwitchTarget *switch_target_instruction) |
| 10219 | { | 10231 | { |
| 10220 | IrInstruction *target_value_ptr = switch_target_instruction->target_value_ptr->other; | 10232 | IrInstruction *target_value_ptr = switch_target_instruction->target_value_ptr->other; |
| 10221 | if (target_value_ptr->value.type->id == TypeTableEntryIdInvalid) | 10233 | if (type_is_invalid(target_value_ptr->value.type)) |
| 10222 | return ira->codegen->builtin_types.entry_invalid; | 10234 | return ira->codegen->builtin_types.entry_invalid; |
| 10223 | | 10235 | |
| 10224 | assert(target_value_ptr->value.type->id == TypeTableEntryIdPointer); | 10236 | assert(target_value_ptr->value.type->id == TypeTableEntryIdPointer); |
| ... | @@ -10231,6 +10243,8 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, | ... | @@ -10231,6 +10243,8 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 10231 | } | 10243 | } |
| 10232 | TypeTableEntry *canon_target_type = get_underlying_type(target_type); | 10244 | TypeTableEntry *canon_target_type = get_underlying_type(target_type); |
| 10233 | ensure_complete_type(ira->codegen, target_type); | 10245 | ensure_complete_type(ira->codegen, target_type); |
| | 10246 | if (type_is_invalid(canon_target_type)) |
| | 10247 | return ira->codegen->builtin_types.entry_invalid; |
| 10234 | | 10248 | |
| 10235 | switch (canon_target_type->id) { | 10249 | switch (canon_target_type->id) { |
| 10236 | case TypeTableEntryIdInvalid: | 10250 | case TypeTableEntryIdInvalid: |
| ... | @@ -10297,11 +10311,11 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, | ... | @@ -10297,11 +10311,11 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 10297 | | 10311 | |
| 10298 | static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstructionSwitchVar *instruction) { | 10312 | static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstructionSwitchVar *instruction) { |
| 10299 | IrInstruction *target_value_ptr = instruction->target_value_ptr->other; | 10313 | IrInstruction *target_value_ptr = instruction->target_value_ptr->other; |
| 10300 | if (target_value_ptr->value.type->id == TypeTableEntryIdInvalid) | 10314 | if (type_is_invalid(target_value_ptr->value.type)) |
| 10301 | return ira->codegen->builtin_types.entry_invalid; | 10315 | return ira->codegen->builtin_types.entry_invalid; |
| 10302 | | 10316 | |
| 10303 | IrInstruction *prong_value = instruction->prong_value->other; | 10317 | IrInstruction *prong_value = instruction->prong_value->other; |
| 10304 | if (prong_value->value.type->id == TypeTableEntryIdInvalid) | 10318 | if (type_is_invalid(prong_value->value.type)) |
| 10305 | return ira->codegen->builtin_types.entry_invalid; | 10319 | return ira->codegen->builtin_types.entry_invalid; |
| 10306 | | 10320 | |
| 10307 | assert(target_value_ptr->value.type->id == TypeTableEntryIdPointer); | 10321 | assert(target_value_ptr->value.type->id == TypeTableEntryIdPointer); |
| ... | @@ -10357,7 +10371,7 @@ static TypeTableEntry *ir_analyze_instruction_enum_tag(IrAnalyze *ira, IrInstruc | ... | @@ -10357,7 +10371,7 @@ static TypeTableEntry *ir_analyze_instruction_enum_tag(IrAnalyze *ira, IrInstruc |
| 10357 | | 10371 | |
| 10358 | static TypeTableEntry *ir_analyze_instruction_generated_code(IrAnalyze *ira, IrInstructionGeneratedCode *instruction) { | 10372 | static TypeTableEntry *ir_analyze_instruction_generated_code(IrAnalyze *ira, IrInstructionGeneratedCode *instruction) { |
| 10359 | IrInstruction *value = instruction->value->other; | 10373 | IrInstruction *value = instruction->value->other; |
| 10360 | if (value->value.type->id == TypeTableEntryIdInvalid) | 10374 | if (type_is_invalid(value->value.type)) |
| 10361 | return ira->codegen->builtin_types.entry_invalid; | 10375 | return ira->codegen->builtin_types.entry_invalid; |
| 10362 | | 10376 | |
| 10363 | if (instr_is_comptime(value)) { | 10377 | if (instr_is_comptime(value)) { |
| ... | @@ -10452,7 +10466,7 @@ static TypeTableEntry *ir_analyze_instruction_array_len(IrAnalyze *ira, | ... | @@ -10452,7 +10466,7 @@ static TypeTableEntry *ir_analyze_instruction_array_len(IrAnalyze *ira, |
| 10452 | { | 10466 | { |
| 10453 | IrInstruction *array_value = array_len_instruction->array_value->other; | 10467 | IrInstruction *array_value = array_len_instruction->array_value->other; |
| 10454 | TypeTableEntry *canon_type = get_underlying_type(array_value->value.type); | 10468 | TypeTableEntry *canon_type = get_underlying_type(array_value->value.type); |
| 10455 | if (canon_type->id == TypeTableEntryIdInvalid) { | 10469 | if (type_is_invalid(canon_type)) { |
| 10456 | return ira->codegen->builtin_types.entry_invalid; | 10470 | return ira->codegen->builtin_types.entry_invalid; |
| 10457 | } else if (canon_type->id == TypeTableEntryIdArray) { | 10471 | } else if (canon_type->id == TypeTableEntryIdArray) { |
| 10458 | return ir_analyze_const_usize(ira, &array_len_instruction->base, | 10472 | return ir_analyze_const_usize(ira, &array_len_instruction->base, |
| ... | @@ -10515,7 +10529,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru | ... | @@ -10515,7 +10529,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru |
| 10515 | IrInstructionContainerInitFieldsField *field = &fields[i]; | 10529 | IrInstructionContainerInitFieldsField *field = &fields[i]; |
| 10516 | | 10530 | |
| 10517 | IrInstruction *field_value = field->value->other; | 10531 | IrInstruction *field_value = field->value->other; |
| 10518 | if (field_value->value.type->id == TypeTableEntryIdInvalid) | 10532 | if (type_is_invalid(field_value->value.type)) |
| 10519 | return ira->codegen->builtin_types.entry_invalid; | 10533 | return ira->codegen->builtin_types.entry_invalid; |
| 10520 | | 10534 | |
| 10521 | TypeStructField *type_field = find_struct_type_field(container_type, field->name); | 10535 | TypeStructField *type_field = find_struct_type_field(container_type, field->name); |
| ... | @@ -10526,7 +10540,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru | ... | @@ -10526,7 +10540,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru |
| 10526 | return ira->codegen->builtin_types.entry_invalid; | 10540 | return ira->codegen->builtin_types.entry_invalid; |
| 10527 | } | 10541 | } |
| 10528 | | 10542 | |
| 10529 | if (type_field->type_entry->id == TypeTableEntryIdInvalid) | 10543 | if (type_is_invalid(type_field->type_entry)) |
| 10530 | return ira->codegen->builtin_types.entry_invalid; | 10544 | return ira->codegen->builtin_types.entry_invalid; |
| 10531 | | 10545 | |
| 10532 | IrInstruction *casted_field_value = ir_implicit_cast(ira, field_value, type_field->type_entry); | 10546 | IrInstruction *casted_field_value = ir_implicit_cast(ira, field_value, type_field->type_entry); |
| ... | @@ -10593,13 +10607,13 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira | ... | @@ -10593,13 +10607,13 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 10593 | IrInstructionContainerInitList *instruction) | 10607 | IrInstructionContainerInitList *instruction) |
| 10594 | { | 10608 | { |
| 10595 | IrInstruction *container_type_value = instruction->container_type->other; | 10609 | IrInstruction *container_type_value = instruction->container_type->other; |
| 10596 | if (container_type_value->value.type->id == TypeTableEntryIdInvalid) | 10610 | if (type_is_invalid(container_type_value->value.type)) |
| 10597 | return ira->codegen->builtin_types.entry_invalid; | 10611 | return ira->codegen->builtin_types.entry_invalid; |
| 10598 | | 10612 | |
| 10599 | size_t elem_count = instruction->item_count; | 10613 | size_t elem_count = instruction->item_count; |
| 10600 | if (container_type_value->value.type->id == TypeTableEntryIdMetaType) { | 10614 | if (container_type_value->value.type->id == TypeTableEntryIdMetaType) { |
| 10601 | TypeTableEntry *container_type = ir_resolve_type(ira, container_type_value); | 10615 | TypeTableEntry *container_type = ir_resolve_type(ira, container_type_value); |
| 10602 | if (container_type->id == TypeTableEntryIdInvalid) | 10616 | if (type_is_invalid(container_type)) |
| 10603 | return ira->codegen->builtin_types.entry_invalid; | 10617 | return ira->codegen->builtin_types.entry_invalid; |
| 10604 | | 10618 | |
| 10605 | if (container_type->id == TypeTableEntryIdStruct && !is_slice(container_type) && elem_count == 0) { | 10619 | if (container_type->id == TypeTableEntryIdStruct && !is_slice(container_type) && elem_count == 0) { |
| ... | @@ -10624,7 +10638,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira | ... | @@ -10624,7 +10638,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 10624 | | 10638 | |
| 10625 | for (size_t i = 0; i < elem_count; i += 1) { | 10639 | for (size_t i = 0; i < elem_count; i += 1) { |
| 10626 | IrInstruction *arg_value = instruction->items[i]->other; | 10640 | IrInstruction *arg_value = instruction->items[i]->other; |
| 10627 | if (arg_value->value.type->id == TypeTableEntryIdInvalid) | 10641 | if (type_is_invalid(arg_value->value.type)) |
| 10628 | return ira->codegen->builtin_types.entry_invalid; | 10642 | return ira->codegen->builtin_types.entry_invalid; |
| 10629 | | 10643 | |
| 10630 | IrInstruction *casted_arg = ir_implicit_cast(ira, arg_value, child_type); | 10644 | IrInstruction *casted_arg = ir_implicit_cast(ira, arg_value, child_type); |
| ... | @@ -10744,9 +10758,11 @@ static TypeTableEntry *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_ | ... | @@ -10744,9 +10758,11 @@ static TypeTableEntry *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_ |
| 10744 | { | 10758 | { |
| 10745 | TypeTableEntry *target_type = ir_resolve_type(ira, target_type_value); | 10759 | TypeTableEntry *target_type = ir_resolve_type(ira, target_type_value); |
| 10746 | TypeTableEntry *canon_type = get_underlying_type(target_type); | 10760 | TypeTableEntry *canon_type = get_underlying_type(target_type); |
| | 10761 | if (type_is_invalid(canon_type)) |
| | 10762 | return ira->codegen->builtin_types.entry_invalid; |
| 10747 | switch (canon_type->id) { | 10763 | switch (canon_type->id) { |
| 10748 | case TypeTableEntryIdInvalid: | 10764 | case TypeTableEntryIdInvalid: |
| 10749 | return ira->codegen->builtin_types.entry_invalid; | 10765 | zig_unreachable(); |
| 10750 | case TypeTableEntryIdInt: | 10766 | case TypeTableEntryIdInt: |
| 10751 | { | 10767 | { |
| 10752 | ConstExprValue *out_val = ir_build_const_from(ira, source_instruction); | 10768 | ConstExprValue *out_val = ir_build_const_from(ira, source_instruction); |
| ... | @@ -10831,7 +10847,7 @@ static TypeTableEntry *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInst | ... | @@ -10831,7 +10847,7 @@ static TypeTableEntry *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInst |
| 10831 | fprintf(stderr, "| "); | 10847 | fprintf(stderr, "| "); |
| 10832 | for (size_t i = 0; i < instruction->msg_count; i += 1) { | 10848 | for (size_t i = 0; i < instruction->msg_count; i += 1) { |
| 10833 | IrInstruction *msg = instruction->msg_list[i]->other; | 10849 | IrInstruction *msg = instruction->msg_list[i]->other; |
| 10834 | if (msg->value.type->id == TypeTableEntryIdInvalid) | 10850 | if (type_is_invalid(msg->value.type)) |
| 10835 | return ira->codegen->builtin_types.entry_invalid; | 10851 | return ira->codegen->builtin_types.entry_invalid; |
| 10836 | buf_resize(&buf, 0); | 10852 | buf_resize(&buf, 0); |
| 10837 | render_const_value(&buf, &msg->value); | 10853 | render_const_value(&buf, &msg->value); |
| ... | @@ -10848,11 +10864,11 @@ static TypeTableEntry *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInst | ... | @@ -10848,11 +10864,11 @@ static TypeTableEntry *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInst |
| 10848 | | 10864 | |
| 10849 | static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstructionErrName *instruction) { | 10865 | static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstructionErrName *instruction) { |
| 10850 | IrInstruction *value = instruction->value->other; | 10866 | IrInstruction *value = instruction->value->other; |
| 10851 | if (value->value.type->id == TypeTableEntryIdInvalid) | 10867 | if (type_is_invalid(value->value.type)) |
| 10852 | return ira->codegen->builtin_types.entry_invalid; | 10868 | return ira->codegen->builtin_types.entry_invalid; |
| 10853 | | 10869 | |
| 10854 | IrInstruction *casted_value = ir_implicit_cast(ira, value, value->value.type); | 10870 | IrInstruction *casted_value = ir_implicit_cast(ira, value, value->value.type); |
| 10855 | if (casted_value->value.type->id == TypeTableEntryIdInvalid) | 10871 | if (type_is_invalid(casted_value->value.type)) |
| 10856 | return ira->codegen->builtin_types.entry_invalid; | 10872 | return ira->codegen->builtin_types.entry_invalid; |
| 10857 | | 10873 | |
| 10858 | TypeTableEntry *str_type = get_slice_type(ira->codegen, ira->codegen->builtin_types.entry_u8, true); | 10874 | TypeTableEntry *str_type = get_slice_type(ira->codegen, ira->codegen->builtin_types.entry_u8, true); |
| ... | @@ -10875,7 +10891,7 @@ static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstruc | ... | @@ -10875,7 +10891,7 @@ static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstruc |
| 10875 | static TypeTableEntry *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstructionTypeName *instruction) { | 10891 | static TypeTableEntry *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstructionTypeName *instruction) { |
| 10876 | IrInstruction *type_value = instruction->type_value->other; | 10892 | IrInstruction *type_value = instruction->type_value->other; |
| 10877 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 10893 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); |
| 10878 | if (type_entry->id == TypeTableEntryIdInvalid) | 10894 | if (type_is_invalid(type_entry)) |
| 10879 | return ira->codegen->builtin_types.entry_invalid; | 10895 | return ira->codegen->builtin_types.entry_invalid; |
| 10880 | | 10896 | |
| 10881 | if (!type_entry->cached_const_name_val) { | 10897 | if (!type_entry->cached_const_name_val) { |
| ... | @@ -10898,7 +10914,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc | ... | @@ -10898,7 +10914,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc |
| 10898 | IrInstruction *result = ir_eval_const_value(ira->codegen, &cimport_scope->base, block_node, void_type, | 10914 | IrInstruction *result = ir_eval_const_value(ira->codegen, &cimport_scope->base, block_node, void_type, |
| 10899 | ira->new_irb.exec->backward_branch_count, ira->new_irb.exec->backward_branch_quota, nullptr, | 10915 | ira->new_irb.exec->backward_branch_count, ira->new_irb.exec->backward_branch_quota, nullptr, |
| 10900 | &cimport_scope->buf, block_node, nullptr, nullptr); | 10916 | &cimport_scope->buf, block_node, nullptr, nullptr); |
| 10901 | if (result->value.type->id == TypeTableEntryIdInvalid) | 10917 | if (type_is_invalid(result->value.type)) |
| 10902 | return ira->codegen->builtin_types.entry_invalid; | 10918 | return ira->codegen->builtin_types.entry_invalid; |
| 10903 | | 10919 | |
| 10904 | find_libc_include_path(ira->codegen); | 10920 | find_libc_include_path(ira->codegen); |
| ... | @@ -10937,7 +10953,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc | ... | @@ -10937,7 +10953,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc |
| 10937 | | 10953 | |
| 10938 | static TypeTableEntry *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstructionCInclude *instruction) { | 10954 | static TypeTableEntry *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstructionCInclude *instruction) { |
| 10939 | IrInstruction *name_value = instruction->name->other; | 10955 | IrInstruction *name_value = instruction->name->other; |
| 10940 | if (name_value->value.type->id == TypeTableEntryIdInvalid) | 10956 | if (type_is_invalid(name_value->value.type)) |
| 10941 | return ira->codegen->builtin_types.entry_invalid; | 10957 | return ira->codegen->builtin_types.entry_invalid; |
| 10942 | | 10958 | |
| 10943 | Buf *include_name = ir_resolve_str(ira, name_value); | 10959 | Buf *include_name = ir_resolve_str(ira, name_value); |
| ... | @@ -10956,7 +10972,7 @@ static TypeTableEntry *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstru | ... | @@ -10956,7 +10972,7 @@ static TypeTableEntry *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstru |
| 10956 | | 10972 | |
| 10957 | static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstructionCDefine *instruction) { | 10973 | static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstructionCDefine *instruction) { |
| 10958 | IrInstruction *name = instruction->name->other; | 10974 | IrInstruction *name = instruction->name->other; |
| 10959 | if (name->value.type->id == TypeTableEntryIdInvalid) | 10975 | if (type_is_invalid(name->value.type)) |
| 10960 | return ira->codegen->builtin_types.entry_invalid; | 10976 | return ira->codegen->builtin_types.entry_invalid; |
| 10961 | | 10977 | |
| 10962 | Buf *define_name = ir_resolve_str(ira, name); | 10978 | Buf *define_name = ir_resolve_str(ira, name); |
| ... | @@ -10964,7 +10980,7 @@ static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstruc | ... | @@ -10964,7 +10980,7 @@ static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstruc |
| 10964 | return ira->codegen->builtin_types.entry_invalid; | 10980 | return ira->codegen->builtin_types.entry_invalid; |
| 10965 | | 10981 | |
| 10966 | IrInstruction *value = instruction->value->other; | 10982 | IrInstruction *value = instruction->value->other; |
| 10967 | if (value->value.type->id == TypeTableEntryIdInvalid) | 10983 | if (type_is_invalid(value->value.type)) |
| 10968 | return ira->codegen->builtin_types.entry_invalid; | 10984 | return ira->codegen->builtin_types.entry_invalid; |
| 10969 | | 10985 | |
| 10970 | Buf *define_value = ir_resolve_str(ira, value); | 10986 | Buf *define_value = ir_resolve_str(ira, value); |
| ... | @@ -10983,7 +10999,7 @@ static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstruc | ... | @@ -10983,7 +10999,7 @@ static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstruc |
| 10983 | | 10999 | |
| 10984 | static TypeTableEntry *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstructionCUndef *instruction) { | 11000 | static TypeTableEntry *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstructionCUndef *instruction) { |
| 10985 | IrInstruction *name = instruction->name->other; | 11001 | IrInstruction *name = instruction->name->other; |
| 10986 | if (name->value.type->id == TypeTableEntryIdInvalid) | 11002 | if (type_is_invalid(name->value.type)) |
| 10987 | return ira->codegen->builtin_types.entry_invalid; | 11003 | return ira->codegen->builtin_types.entry_invalid; |
| 10988 | | 11004 | |
| 10989 | Buf *undef_name = ir_resolve_str(ira, name); | 11005 | Buf *undef_name = ir_resolve_str(ira, name); |
| ... | @@ -11002,7 +11018,7 @@ static TypeTableEntry *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstruct | ... | @@ -11002,7 +11018,7 @@ static TypeTableEntry *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstruct |
| 11002 | | 11018 | |
| 11003 | static TypeTableEntry *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstructionEmbedFile *instruction) { | 11019 | static TypeTableEntry *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstructionEmbedFile *instruction) { |
| 11004 | IrInstruction *name = instruction->name->other; | 11020 | IrInstruction *name = instruction->name->other; |
| 11005 | if (name->value.type->id == TypeTableEntryIdInvalid) | 11021 | if (type_is_invalid(name->value.type)) |
| 11006 | return ira->codegen->builtin_types.entry_invalid; | 11022 | return ira->codegen->builtin_types.entry_invalid; |
| 11007 | | 11023 | |
| 11008 | Buf *rel_file_path = ir_resolve_str(ira, name); | 11024 | Buf *rel_file_path = ir_resolve_str(ira, name); |
| ... | @@ -11041,19 +11057,19 @@ static TypeTableEntry *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstr | ... | @@ -11041,19 +11057,19 @@ static TypeTableEntry *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstr |
| 11041 | | 11057 | |
| 11042 | static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructionCmpxchg *instruction) { | 11058 | static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructionCmpxchg *instruction) { |
| 11043 | IrInstruction *ptr = instruction->ptr->other; | 11059 | IrInstruction *ptr = instruction->ptr->other; |
| 11044 | if (ptr->value.type->id == TypeTableEntryIdInvalid) | 11060 | if (type_is_invalid(ptr->value.type)) |
| 11045 | return ira->codegen->builtin_types.entry_invalid; | 11061 | return ira->codegen->builtin_types.entry_invalid; |
| 11046 | | 11062 | |
| 11047 | IrInstruction *cmp_value = instruction->cmp_value->other; | 11063 | IrInstruction *cmp_value = instruction->cmp_value->other; |
| 11048 | if (cmp_value->value.type->id == TypeTableEntryIdInvalid) | 11064 | if (type_is_invalid(cmp_value->value.type)) |
| 11049 | return ira->codegen->builtin_types.entry_invalid; | 11065 | return ira->codegen->builtin_types.entry_invalid; |
| 11050 | | 11066 | |
| 11051 | IrInstruction *new_value = instruction->new_value->other; | 11067 | IrInstruction *new_value = instruction->new_value->other; |
| 11052 | if (new_value->value.type->id == TypeTableEntryIdInvalid) | 11068 | if (type_is_invalid(new_value->value.type)) |
| 11053 | return ira->codegen->builtin_types.entry_invalid; | 11069 | return ira->codegen->builtin_types.entry_invalid; |
| 11054 | | 11070 | |
| 11055 | IrInstruction *success_order_value = instruction->success_order_value->other; | 11071 | IrInstruction *success_order_value = instruction->success_order_value->other; |
| 11056 | if (success_order_value->value.type->id == TypeTableEntryIdInvalid) | 11072 | if (type_is_invalid(success_order_value->value.type)) |
| 11057 | return ira->codegen->builtin_types.entry_invalid; | 11073 | return ira->codegen->builtin_types.entry_invalid; |
| 11058 | | 11074 | |
| 11059 | AtomicOrder success_order; | 11075 | AtomicOrder success_order; |
| ... | @@ -11061,7 +11077,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct | ... | @@ -11061,7 +11077,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct |
| 11061 | return ira->codegen->builtin_types.entry_invalid; | 11077 | return ira->codegen->builtin_types.entry_invalid; |
| 11062 | | 11078 | |
| 11063 | IrInstruction *failure_order_value = instruction->failure_order_value->other; | 11079 | IrInstruction *failure_order_value = instruction->failure_order_value->other; |
| 11064 | if (failure_order_value->value.type->id == TypeTableEntryIdInvalid) | 11080 | if (type_is_invalid(failure_order_value->value.type)) |
| 11065 | return ira->codegen->builtin_types.entry_invalid; | 11081 | return ira->codegen->builtin_types.entry_invalid; |
| 11066 | | 11082 | |
| 11067 | AtomicOrder failure_order; | 11083 | AtomicOrder failure_order; |
| ... | @@ -11077,11 +11093,11 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct | ... | @@ -11077,11 +11093,11 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct |
| 11077 | TypeTableEntry *child_type = ptr->value.type->data.pointer.child_type; | 11093 | TypeTableEntry *child_type = ptr->value.type->data.pointer.child_type; |
| 11078 | | 11094 | |
| 11079 | IrInstruction *casted_cmp_value = ir_implicit_cast(ira, cmp_value, child_type); | 11095 | IrInstruction *casted_cmp_value = ir_implicit_cast(ira, cmp_value, child_type); |
| 11080 | if (casted_cmp_value->value.type->id == TypeTableEntryIdInvalid) | 11096 | if (type_is_invalid(casted_cmp_value->value.type)) |
| 11081 | return ira->codegen->builtin_types.entry_invalid; | 11097 | return ira->codegen->builtin_types.entry_invalid; |
| 11082 | | 11098 | |
| 11083 | IrInstruction *casted_new_value = ir_implicit_cast(ira, new_value, child_type); | 11099 | IrInstruction *casted_new_value = ir_implicit_cast(ira, new_value, child_type); |
| 11084 | if (casted_new_value->value.type->id == TypeTableEntryIdInvalid) | 11100 | if (type_is_invalid(casted_new_value->value.type)) |
| 11085 | return ira->codegen->builtin_types.entry_invalid; | 11101 | return ira->codegen->builtin_types.entry_invalid; |
| 11086 | | 11102 | |
| 11087 | if (success_order < AtomicOrderMonotonic) { | 11103 | if (success_order < AtomicOrderMonotonic) { |
| ... | @@ -11112,7 +11128,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct | ... | @@ -11112,7 +11128,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct |
| 11112 | | 11128 | |
| 11113 | static TypeTableEntry *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructionFence *instruction) { | 11129 | static TypeTableEntry *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructionFence *instruction) { |
| 11114 | IrInstruction *order_value = instruction->order_value->other; | 11130 | IrInstruction *order_value = instruction->order_value->other; |
| 11115 | if (order_value->value.type->id == TypeTableEntryIdInvalid) | 11131 | if (type_is_invalid(order_value->value.type)) |
| 11116 | return ira->codegen->builtin_types.entry_invalid; | 11132 | return ira->codegen->builtin_types.entry_invalid; |
| 11117 | | 11133 | |
| 11118 | AtomicOrder order; | 11134 | AtomicOrder order; |
| ... | @@ -11125,18 +11141,18 @@ static TypeTableEntry *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructio | ... | @@ -11125,18 +11141,18 @@ static TypeTableEntry *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructio |
| 11125 | | 11141 | |
| 11126 | static TypeTableEntry *ir_analyze_instruction_div_exact(IrAnalyze *ira, IrInstructionDivExact *instruction) { | 11142 | static TypeTableEntry *ir_analyze_instruction_div_exact(IrAnalyze *ira, IrInstructionDivExact *instruction) { |
| 11127 | IrInstruction *op1 = instruction->op1->other; | 11143 | IrInstruction *op1 = instruction->op1->other; |
| 11128 | if (op1->value.type->id == TypeTableEntryIdInvalid) | 11144 | if (type_is_invalid(op1->value.type)) |
| 11129 | return ira->codegen->builtin_types.entry_invalid; | 11145 | return ira->codegen->builtin_types.entry_invalid; |
| 11130 | | 11146 | |
| 11131 | IrInstruction *op2 = instruction->op2->other; | 11147 | IrInstruction *op2 = instruction->op2->other; |
| 11132 | if (op2->value.type->id == TypeTableEntryIdInvalid) | 11148 | if (type_is_invalid(op2->value.type)) |
| 11133 | return ira->codegen->builtin_types.entry_invalid; | 11149 | return ira->codegen->builtin_types.entry_invalid; |
| 11134 | | 11150 | |
| 11135 | | 11151 | |
| 11136 | IrInstruction *peer_instructions[] = { op1, op2 }; | 11152 | IrInstruction *peer_instructions[] = { op1, op2 }; |
| 11137 | TypeTableEntry *result_type = ir_resolve_peer_types(ira, instruction->base.source_node, peer_instructions, 2); | 11153 | TypeTableEntry *result_type = ir_resolve_peer_types(ira, instruction->base.source_node, peer_instructions, 2); |
| 11138 | | 11154 | |
| 11139 | if (result_type->id == TypeTableEntryIdInvalid) | 11155 | if (type_is_invalid(result_type)) |
| 11140 | return ira->codegen->builtin_types.entry_invalid; | 11156 | return ira->codegen->builtin_types.entry_invalid; |
| 11141 | | 11157 | |
| 11142 | TypeTableEntry *canon_type = get_underlying_type(result_type); | 11158 | TypeTableEntry *canon_type = get_underlying_type(result_type); |
| ... | @@ -11151,11 +11167,11 @@ static TypeTableEntry *ir_analyze_instruction_div_exact(IrAnalyze *ira, IrInstru | ... | @@ -11151,11 +11167,11 @@ static TypeTableEntry *ir_analyze_instruction_div_exact(IrAnalyze *ira, IrInstru |
| 11151 | } | 11167 | } |
| 11152 | | 11168 | |
| 11153 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, result_type); | 11169 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, result_type); |
| 11154 | if (casted_op1->value.type->id == TypeTableEntryIdInvalid) | 11170 | if (type_is_invalid(casted_op1->value.type)) |
| 11155 | return ira->codegen->builtin_types.entry_invalid; | 11171 | return ira->codegen->builtin_types.entry_invalid; |
| 11156 | | 11172 | |
| 11157 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, result_type); | 11173 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, result_type); |
| 11158 | if (casted_op2->value.type->id == TypeTableEntryIdInvalid) | 11174 | if (type_is_invalid(casted_op2->value.type)) |
| 11159 | return ira->codegen->builtin_types.entry_invalid; | 11175 | return ira->codegen->builtin_types.entry_invalid; |
| 11160 | | 11176 | |
| 11161 | if (casted_op1->value.special == ConstValSpecialStatic && | 11177 | if (casted_op1->value.special == ConstValSpecialStatic && |
| ... | @@ -11196,7 +11212,7 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc | ... | @@ -11196,7 +11212,7 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc |
| 11196 | TypeTableEntry *dest_type = ir_resolve_type(ira, dest_type_value); | 11212 | TypeTableEntry *dest_type = ir_resolve_type(ira, dest_type_value); |
| 11197 | TypeTableEntry *canon_dest_type = get_underlying_type(dest_type); | 11213 | TypeTableEntry *canon_dest_type = get_underlying_type(dest_type); |
| 11198 | | 11214 | |
| 11199 | if (canon_dest_type->id == TypeTableEntryIdInvalid) | 11215 | if (type_is_invalid(canon_dest_type)) |
| 11200 | return ira->codegen->builtin_types.entry_invalid; | 11216 | return ira->codegen->builtin_types.entry_invalid; |
| 11201 | | 11217 | |
| 11202 | if (canon_dest_type->id != TypeTableEntryIdInt && | 11218 | if (canon_dest_type->id != TypeTableEntryIdInt && |
| ... | @@ -11210,7 +11226,7 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc | ... | @@ -11210,7 +11226,7 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc |
| 11210 | IrInstruction *target = instruction->target->other; | 11226 | IrInstruction *target = instruction->target->other; |
| 11211 | TypeTableEntry *src_type = target->value.type; | 11227 | TypeTableEntry *src_type = target->value.type; |
| 11212 | TypeTableEntry *canon_src_type = get_underlying_type(src_type); | 11228 | TypeTableEntry *canon_src_type = get_underlying_type(src_type); |
| 11213 | if (canon_src_type->id == TypeTableEntryIdInvalid) | 11229 | if (type_is_invalid(canon_src_type)) |
| 11214 | return ira->codegen->builtin_types.entry_invalid; | 11230 | return ira->codegen->builtin_types.entry_invalid; |
| 11215 | | 11231 | |
| 11216 | if (canon_src_type->id != TypeTableEntryIdInt && | 11232 | if (canon_src_type->id != TypeTableEntryIdInt && |
| ... | @@ -11262,13 +11278,13 @@ static TypeTableEntry *ir_analyze_instruction_int_type(IrAnalyze *ira, IrInstruc | ... | @@ -11262,13 +11278,13 @@ static TypeTableEntry *ir_analyze_instruction_int_type(IrAnalyze *ira, IrInstruc |
| 11262 | | 11278 | |
| 11263 | static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstructionBoolNot *instruction) { | 11279 | static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstructionBoolNot *instruction) { |
| 11264 | IrInstruction *value = instruction->value->other; | 11280 | IrInstruction *value = instruction->value->other; |
| 11265 | if (value->value.type->id == TypeTableEntryIdInvalid) | 11281 | if (type_is_invalid(value->value.type)) |
| 11266 | return ira->codegen->builtin_types.entry_invalid; | 11282 | return ira->codegen->builtin_types.entry_invalid; |
| 11267 | | 11283 | |
| 11268 | TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool; | 11284 | TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool; |
| 11269 | | 11285 | |
| 11270 | IrInstruction *casted_value = ir_implicit_cast(ira, value, bool_type); | 11286 | IrInstruction *casted_value = ir_implicit_cast(ira, value, bool_type); |
| 11271 | if (casted_value->value.type->id == TypeTableEntryIdInvalid) | 11287 | if (type_is_invalid(casted_value->value.type)) |
| 11272 | return ira->codegen->builtin_types.entry_invalid; | 11288 | return ira->codegen->builtin_types.entry_invalid; |
| 11273 | | 11289 | |
| 11274 | if (casted_value->value.special != ConstValSpecialRuntime) { | 11290 | if (casted_value->value.special != ConstValSpecialRuntime) { |
| ... | @@ -11283,11 +11299,11 @@ static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstruc | ... | @@ -11283,11 +11299,11 @@ static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstruc |
| 11283 | | 11299 | |
| 11284 | static TypeTableEntry *ir_analyze_instruction_alloca(IrAnalyze *ira, IrInstructionAlloca *instruction) { | 11300 | static TypeTableEntry *ir_analyze_instruction_alloca(IrAnalyze *ira, IrInstructionAlloca *instruction) { |
| 11285 | IrInstruction *type_value = instruction->type_value->other; | 11301 | IrInstruction *type_value = instruction->type_value->other; |
| 11286 | if (type_value->value.type->id == TypeTableEntryIdInvalid) | 11302 | if (type_is_invalid(type_value->value.type)) |
| 11287 | return ira->codegen->builtin_types.entry_invalid; | 11303 | return ira->codegen->builtin_types.entry_invalid; |
| 11288 | | 11304 | |
| 11289 | IrInstruction *count_value = instruction->count->other; | 11305 | IrInstruction *count_value = instruction->count->other; |
| 11290 | if (count_value->value.type->id == TypeTableEntryIdInvalid) | 11306 | if (type_is_invalid(count_value->value.type)) |
| 11291 | return ira->codegen->builtin_types.entry_invalid; | 11307 | return ira->codegen->builtin_types.entry_invalid; |
| 11292 | | 11308 | |
| 11293 | TypeTableEntry *child_type = ir_resolve_type(ira, type_value); | 11309 | TypeTableEntry *child_type = ir_resolve_type(ira, type_value); |
| ... | @@ -11308,15 +11324,15 @@ static TypeTableEntry *ir_analyze_instruction_alloca(IrAnalyze *ira, IrInstructi | ... | @@ -11308,15 +11324,15 @@ static TypeTableEntry *ir_analyze_instruction_alloca(IrAnalyze *ira, IrInstructi |
| 11308 | | 11324 | |
| 11309 | static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructionMemset *instruction) { | 11325 | static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructionMemset *instruction) { |
| 11310 | IrInstruction *dest_ptr = instruction->dest_ptr->other; | 11326 | IrInstruction *dest_ptr = instruction->dest_ptr->other; |
| 11311 | if (dest_ptr->value.type->id == TypeTableEntryIdInvalid) | 11327 | if (type_is_invalid(dest_ptr->value.type)) |
| 11312 | return ira->codegen->builtin_types.entry_invalid; | 11328 | return ira->codegen->builtin_types.entry_invalid; |
| 11313 | | 11329 | |
| 11314 | IrInstruction *byte_value = instruction->byte->other; | 11330 | IrInstruction *byte_value = instruction->byte->other; |
| 11315 | if (byte_value->value.type->id == TypeTableEntryIdInvalid) | 11331 | if (type_is_invalid(byte_value->value.type)) |
| 11316 | return ira->codegen->builtin_types.entry_invalid; | 11332 | return ira->codegen->builtin_types.entry_invalid; |
| 11317 | | 11333 | |
| 11318 | IrInstruction *count_value = instruction->count->other; | 11334 | IrInstruction *count_value = instruction->count->other; |
| 11319 | if (count_value->value.type->id == TypeTableEntryIdInvalid) | 11335 | if (type_is_invalid(count_value->value.type)) |
| 11320 | return ira->codegen->builtin_types.entry_invalid; | 11336 | return ira->codegen->builtin_types.entry_invalid; |
| 11321 | | 11337 | |
| 11322 | TypeTableEntry *dest_uncasted_type = get_underlying_type(dest_ptr->value.type); | 11338 | TypeTableEntry *dest_uncasted_type = get_underlying_type(dest_ptr->value.type); |
| ... | @@ -11328,15 +11344,15 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi | ... | @@ -11328,15 +11344,15 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi |
| 11328 | TypeTableEntry *u8_ptr = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile, 0, 0); | 11344 | TypeTableEntry *u8_ptr = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile, 0, 0); |
| 11329 | | 11345 | |
| 11330 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr); | 11346 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr); |
| 11331 | if (casted_dest_ptr->value.type->id == TypeTableEntryIdInvalid) | 11347 | if (type_is_invalid(casted_dest_ptr->value.type)) |
| 11332 | return ira->codegen->builtin_types.entry_invalid; | 11348 | return ira->codegen->builtin_types.entry_invalid; |
| 11333 | | 11349 | |
| 11334 | IrInstruction *casted_byte = ir_implicit_cast(ira, byte_value, u8); | 11350 | IrInstruction *casted_byte = ir_implicit_cast(ira, byte_value, u8); |
| 11335 | if (casted_byte->value.type->id == TypeTableEntryIdInvalid) | 11351 | if (type_is_invalid(casted_byte->value.type)) |
| 11336 | return ira->codegen->builtin_types.entry_invalid; | 11352 | return ira->codegen->builtin_types.entry_invalid; |
| 11337 | | 11353 | |
| 11338 | IrInstruction *casted_count = ir_implicit_cast(ira, count_value, usize); | 11354 | IrInstruction *casted_count = ir_implicit_cast(ira, count_value, usize); |
| 11339 | if (casted_count->value.type->id == TypeTableEntryIdInvalid) | 11355 | if (type_is_invalid(casted_count->value.type)) |
| 11340 | return ira->codegen->builtin_types.entry_invalid; | 11356 | return ira->codegen->builtin_types.entry_invalid; |
| 11341 | | 11357 | |
| 11342 | if (casted_dest_ptr->value.special == ConstValSpecialStatic && | 11358 | if (casted_dest_ptr->value.special == ConstValSpecialStatic && |
| ... | @@ -11393,15 +11409,15 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi | ... | @@ -11393,15 +11409,15 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi |
| 11393 | | 11409 | |
| 11394 | static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructionMemcpy *instruction) { | 11410 | static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructionMemcpy *instruction) { |
| 11395 | IrInstruction *dest_ptr = instruction->dest_ptr->other; | 11411 | IrInstruction *dest_ptr = instruction->dest_ptr->other; |
| 11396 | if (dest_ptr->value.type->id == TypeTableEntryIdInvalid) | 11412 | if (type_is_invalid(dest_ptr->value.type)) |
| 11397 | return ira->codegen->builtin_types.entry_invalid; | 11413 | return ira->codegen->builtin_types.entry_invalid; |
| 11398 | | 11414 | |
| 11399 | IrInstruction *src_ptr = instruction->src_ptr->other; | 11415 | IrInstruction *src_ptr = instruction->src_ptr->other; |
| 11400 | if (src_ptr->value.type->id == TypeTableEntryIdInvalid) | 11416 | if (type_is_invalid(src_ptr->value.type)) |
| 11401 | return ira->codegen->builtin_types.entry_invalid; | 11417 | return ira->codegen->builtin_types.entry_invalid; |
| 11402 | | 11418 | |
| 11403 | IrInstruction *count_value = instruction->count->other; | 11419 | IrInstruction *count_value = instruction->count->other; |
| 11404 | if (count_value->value.type->id == TypeTableEntryIdInvalid) | 11420 | if (type_is_invalid(count_value->value.type)) |
| 11405 | return ira->codegen->builtin_types.entry_invalid; | 11421 | return ira->codegen->builtin_types.entry_invalid; |
| 11406 | | 11422 | |
| 11407 | TypeTableEntry *dest_uncasted_type = get_underlying_type(dest_ptr->value.type); | 11423 | TypeTableEntry *dest_uncasted_type = get_underlying_type(dest_ptr->value.type); |
| ... | @@ -11417,15 +11433,15 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi | ... | @@ -11417,15 +11433,15 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi |
| 11417 | TypeTableEntry *u8_ptr_const = get_pointer_to_type_extra(ira->codegen, u8, true, src_is_volatile, 0, 0); | 11433 | TypeTableEntry *u8_ptr_const = get_pointer_to_type_extra(ira->codegen, u8, true, src_is_volatile, 0, 0); |
| 11418 | | 11434 | |
| 11419 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr_mut); | 11435 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr_mut); |
| 11420 | if (casted_dest_ptr->value.type->id == TypeTableEntryIdInvalid) | 11436 | if (type_is_invalid(casted_dest_ptr->value.type)) |
| 11421 | return ira->codegen->builtin_types.entry_invalid; | 11437 | return ira->codegen->builtin_types.entry_invalid; |
| 11422 | | 11438 | |
| 11423 | IrInstruction *casted_src_ptr = ir_implicit_cast(ira, src_ptr, u8_ptr_const); | 11439 | IrInstruction *casted_src_ptr = ir_implicit_cast(ira, src_ptr, u8_ptr_const); |
| 11424 | if (casted_src_ptr->value.type->id == TypeTableEntryIdInvalid) | 11440 | if (type_is_invalid(casted_src_ptr->value.type)) |
| 11425 | return ira->codegen->builtin_types.entry_invalid; | 11441 | return ira->codegen->builtin_types.entry_invalid; |
| 11426 | | 11442 | |
| 11427 | IrInstruction *casted_count = ir_implicit_cast(ira, count_value, usize); | 11443 | IrInstruction *casted_count = ir_implicit_cast(ira, count_value, usize); |
| 11428 | if (casted_count->value.type->id == TypeTableEntryIdInvalid) | 11444 | if (type_is_invalid(casted_count->value.type)) |
| 11429 | return ira->codegen->builtin_types.entry_invalid; | 11445 | return ira->codegen->builtin_types.entry_invalid; |
| 11430 | | 11446 | |
| 11431 | if (casted_dest_ptr->value.special == ConstValSpecialStatic && | 11447 | if (casted_dest_ptr->value.special == ConstValSpecialStatic && |
| ... | @@ -11514,7 +11530,7 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi | ... | @@ -11514,7 +11530,7 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi |
| 11514 | | 11530 | |
| 11515 | static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice *instruction) { | 11531 | static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice *instruction) { |
| 11516 | IrInstruction *ptr_ptr = instruction->ptr->other; | 11532 | IrInstruction *ptr_ptr = instruction->ptr->other; |
| 11517 | if (ptr_ptr->value.type->id == TypeTableEntryIdInvalid) | 11533 | if (type_is_invalid(ptr_ptr->value.type)) |
| 11518 | return ira->codegen->builtin_types.entry_invalid; | 11534 | return ira->codegen->builtin_types.entry_invalid; |
| 11519 | | 11535 | |
| 11520 | TypeTableEntry *ptr_type = ptr_ptr->value.type; | 11536 | TypeTableEntry *ptr_type = ptr_ptr->value.type; |
| ... | @@ -11523,21 +11539,21 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio | ... | @@ -11523,21 +11539,21 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio |
| 11523 | TypeTableEntry *canon_array_type = get_underlying_type(non_canon_array_type); | 11539 | TypeTableEntry *canon_array_type = get_underlying_type(non_canon_array_type); |
| 11524 | | 11540 | |
| 11525 | IrInstruction *start = instruction->start->other; | 11541 | IrInstruction *start = instruction->start->other; |
| 11526 | if (start->value.type->id == TypeTableEntryIdInvalid) | 11542 | if (type_is_invalid(start->value.type)) |
| 11527 | return ira->codegen->builtin_types.entry_invalid; | 11543 | return ira->codegen->builtin_types.entry_invalid; |
| 11528 | | 11544 | |
| 11529 | TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize; | 11545 | TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize; |
| 11530 | IrInstruction *casted_start = ir_implicit_cast(ira, start, usize); | 11546 | IrInstruction *casted_start = ir_implicit_cast(ira, start, usize); |
| 11531 | if (casted_start->value.type->id == TypeTableEntryIdInvalid) | 11547 | if (type_is_invalid(casted_start->value.type)) |
| 11532 | return ira->codegen->builtin_types.entry_invalid; | 11548 | return ira->codegen->builtin_types.entry_invalid; |
| 11533 | | 11549 | |
| 11534 | IrInstruction *end; | 11550 | IrInstruction *end; |
| 11535 | if (instruction->end) { | 11551 | if (instruction->end) { |
| 11536 | end = instruction->end->other; | 11552 | end = instruction->end->other; |
| 11537 | if (end->value.type->id == TypeTableEntryIdInvalid) | 11553 | if (type_is_invalid(end->value.type)) |
| 11538 | return ira->codegen->builtin_types.entry_invalid; | 11554 | return ira->codegen->builtin_types.entry_invalid; |
| 11539 | end = ir_implicit_cast(ira, end, usize); | 11555 | end = ir_implicit_cast(ira, end, usize); |
| 11540 | if (end->value.type->id == TypeTableEntryIdInvalid) | 11556 | if (type_is_invalid(end->value.type)) |
| 11541 | return ira->codegen->builtin_types.entry_invalid; | 11557 | return ira->codegen->builtin_types.entry_invalid; |
| 11542 | } else { | 11558 | } else { |
| 11543 | end = nullptr; | 11559 | end = nullptr; |
| ... | @@ -11692,13 +11708,13 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio | ... | @@ -11692,13 +11708,13 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio |
| 11692 | | 11708 | |
| 11693 | static TypeTableEntry *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstructionMemberCount *instruction) { | 11709 | static TypeTableEntry *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstructionMemberCount *instruction) { |
| 11694 | IrInstruction *container = instruction->container->other; | 11710 | IrInstruction *container = instruction->container->other; |
| 11695 | if (container->value.type->id == TypeTableEntryIdInvalid) | 11711 | if (type_is_invalid(container->value.type)) |
| 11696 | return ira->codegen->builtin_types.entry_invalid; | 11712 | return ira->codegen->builtin_types.entry_invalid; |
| 11697 | TypeTableEntry *container_type = ir_resolve_type(ira, container); | 11713 | TypeTableEntry *container_type = ir_resolve_type(ira, container); |
| 11698 | TypeTableEntry *canon_type = get_underlying_type(container_type); | 11714 | TypeTableEntry *canon_type = get_underlying_type(container_type); |
| 11699 | | 11715 | |
| 11700 | uint64_t result; | 11716 | uint64_t result; |
| 11701 | if (canon_type->id == TypeTableEntryIdInvalid) { | 11717 | if (type_is_invalid(canon_type)) { |
| 11702 | return ira->codegen->builtin_types.entry_invalid; | 11718 | return ira->codegen->builtin_types.entry_invalid; |
| 11703 | } else if (canon_type->id == TypeTableEntryIdEnum) { | 11719 | } else if (canon_type->id == TypeTableEntryIdEnum) { |
| 11704 | result = canon_type->data.enumeration.src_field_count; | 11720 | result = canon_type->data.enumeration.src_field_count; |
| ... | @@ -11739,11 +11755,11 @@ static TypeTableEntry *ir_analyze_instruction_frame_address(IrAnalyze *ira, IrIn | ... | @@ -11739,11 +11755,11 @@ static TypeTableEntry *ir_analyze_instruction_frame_address(IrAnalyze *ira, IrIn |
| 11739 | | 11755 | |
| 11740 | static TypeTableEntry *ir_analyze_instruction_alignof(IrAnalyze *ira, IrInstructionAlignOf *instruction) { | 11756 | static TypeTableEntry *ir_analyze_instruction_alignof(IrAnalyze *ira, IrInstructionAlignOf *instruction) { |
| 11741 | IrInstruction *type_value = instruction->type_value->other; | 11757 | IrInstruction *type_value = instruction->type_value->other; |
| 11742 | if (type_value->value.type->id == TypeTableEntryIdInvalid) | 11758 | if (type_is_invalid(type_value->value.type)) |
| 11743 | return ira->codegen->builtin_types.entry_invalid; | 11759 | return ira->codegen->builtin_types.entry_invalid; |
| 11744 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 11760 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); |
| 11745 | | 11761 | |
| 11746 | if (type_entry->id == TypeTableEntryIdInvalid) { | 11762 | if (type_is_invalid(type_entry)) { |
| 11747 | return ira->codegen->builtin_types.entry_invalid; | 11763 | return ira->codegen->builtin_types.entry_invalid; |
| 11748 | } else if (type_entry->id == TypeTableEntryIdUnreachable) { | 11764 | } else if (type_entry->id == TypeTableEntryIdUnreachable) { |
| 11749 | ir_add_error(ira, instruction->type_value, | 11765 | ir_add_error(ira, instruction->type_value, |
| ... | @@ -11759,11 +11775,11 @@ static TypeTableEntry *ir_analyze_instruction_alignof(IrAnalyze *ira, IrInstruct | ... | @@ -11759,11 +11775,11 @@ static TypeTableEntry *ir_analyze_instruction_alignof(IrAnalyze *ira, IrInstruct |
| 11759 | | 11775 | |
| 11760 | static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstructionOverflowOp *instruction) { | 11776 | static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstructionOverflowOp *instruction) { |
| 11761 | IrInstruction *type_value = instruction->type_value->other; | 11777 | IrInstruction *type_value = instruction->type_value->other; |
| 11762 | if (type_value->value.type->id == TypeTableEntryIdInvalid) | 11778 | if (type_is_invalid(type_value->value.type)) |
| 11763 | return ira->codegen->builtin_types.entry_invalid; | 11779 | return ira->codegen->builtin_types.entry_invalid; |
| 11764 | TypeTableEntry *dest_type = ir_resolve_type(ira, type_value); | 11780 | TypeTableEntry *dest_type = ir_resolve_type(ira, type_value); |
| 11765 | TypeTableEntry *canon_type = get_underlying_type(dest_type); | 11781 | TypeTableEntry *canon_type = get_underlying_type(dest_type); |
| 11766 | if (canon_type->id == TypeTableEntryIdInvalid) | 11782 | if (type_is_invalid(canon_type)) |
| 11767 | return ira->codegen->builtin_types.entry_invalid; | 11783 | return ira->codegen->builtin_types.entry_invalid; |
| 11768 | | 11784 | |
| 11769 | if (canon_type->id != TypeTableEntryIdInt) { | 11785 | if (canon_type->id != TypeTableEntryIdInt) { |
| ... | @@ -11774,28 +11790,28 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst | ... | @@ -11774,28 +11790,28 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst |
| 11774 | } | 11790 | } |
| 11775 | | 11791 | |
| 11776 | IrInstruction *op1 = instruction->op1->other; | 11792 | IrInstruction *op1 = instruction->op1->other; |
| 11777 | if (op1->value.type->id == TypeTableEntryIdInvalid) | 11793 | if (type_is_invalid(op1->value.type)) |
| 11778 | return ira->codegen->builtin_types.entry_invalid; | 11794 | return ira->codegen->builtin_types.entry_invalid; |
| 11779 | | 11795 | |
| 11780 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, dest_type); | 11796 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, dest_type); |
| 11781 | if (casted_op1->value.type->id == TypeTableEntryIdInvalid) | 11797 | if (type_is_invalid(casted_op1->value.type)) |
| 11782 | return ira->codegen->builtin_types.entry_invalid; | 11798 | return ira->codegen->builtin_types.entry_invalid; |
| 11783 | | 11799 | |
| 11784 | IrInstruction *op2 = instruction->op2->other; | 11800 | IrInstruction *op2 = instruction->op2->other; |
| 11785 | if (op2->value.type->id == TypeTableEntryIdInvalid) | 11801 | if (type_is_invalid(op2->value.type)) |
| 11786 | return ira->codegen->builtin_types.entry_invalid; | 11802 | return ira->codegen->builtin_types.entry_invalid; |
| 11787 | | 11803 | |
| 11788 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, dest_type); | 11804 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, dest_type); |
| 11789 | if (casted_op2->value.type->id == TypeTableEntryIdInvalid) | 11805 | if (type_is_invalid(casted_op2->value.type)) |
| 11790 | return ira->codegen->builtin_types.entry_invalid; | 11806 | return ira->codegen->builtin_types.entry_invalid; |
| 11791 | | 11807 | |
| 11792 | IrInstruction *result_ptr = instruction->result_ptr->other; | 11808 | IrInstruction *result_ptr = instruction->result_ptr->other; |
| 11793 | if (result_ptr->value.type->id == TypeTableEntryIdInvalid) | 11809 | if (type_is_invalid(result_ptr->value.type)) |
| 11794 | return ira->codegen->builtin_types.entry_invalid; | 11810 | return ira->codegen->builtin_types.entry_invalid; |
| 11795 | | 11811 | |
| 11796 | TypeTableEntry *expected_ptr_type = get_pointer_to_type(ira->codegen, dest_type, false); | 11812 | TypeTableEntry *expected_ptr_type = get_pointer_to_type(ira->codegen, dest_type, false); |
| 11797 | IrInstruction *casted_result_ptr = ir_implicit_cast(ira, result_ptr, expected_ptr_type); | 11813 | IrInstruction *casted_result_ptr = ir_implicit_cast(ira, result_ptr, expected_ptr_type); |
| 11798 | if (casted_result_ptr->value.type->id == TypeTableEntryIdInvalid) | 11814 | if (type_is_invalid(casted_result_ptr->value.type)) |
| 11799 | return ira->codegen->builtin_types.entry_invalid; | 11815 | return ira->codegen->builtin_types.entry_invalid; |
| 11800 | | 11816 | |
| 11801 | if (casted_op1->value.special == ConstValSpecialStatic && | 11817 | if (casted_op1->value.special == ConstValSpecialStatic && |
| ... | @@ -11838,13 +11854,13 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst | ... | @@ -11838,13 +11854,13 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst |
| 11838 | | 11854 | |
| 11839 | static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstructionTestErr *instruction) { | 11855 | static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstructionTestErr *instruction) { |
| 11840 | IrInstruction *value = instruction->value->other; | 11856 | IrInstruction *value = instruction->value->other; |
| 11841 | if (value->value.type->id == TypeTableEntryIdInvalid) | 11857 | if (type_is_invalid(value->value.type)) |
| 11842 | return ira->codegen->builtin_types.entry_invalid; | 11858 | return ira->codegen->builtin_types.entry_invalid; |
| 11843 | | 11859 | |
| 11844 | TypeTableEntry *non_canon_type = value->value.type; | 11860 | TypeTableEntry *non_canon_type = value->value.type; |
| 11845 | | 11861 | |
| 11846 | TypeTableEntry *canon_type = get_underlying_type(non_canon_type); | 11862 | TypeTableEntry *canon_type = get_underlying_type(non_canon_type); |
| 11847 | if (canon_type->id == TypeTableEntryIdInvalid) { | 11863 | if (type_is_invalid(canon_type)) { |
| 11848 | return ira->codegen->builtin_types.entry_invalid; | 11864 | return ira->codegen->builtin_types.entry_invalid; |
| 11849 | } else if (canon_type->id == TypeTableEntryIdErrorUnion) { | 11865 | } else if (canon_type->id == TypeTableEntryIdErrorUnion) { |
| 11850 | if (instr_is_comptime(value)) { | 11866 | if (instr_is_comptime(value)) { |
| ... | @@ -11876,7 +11892,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, | ... | @@ -11876,7 +11892,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, |
| 11876 | IrInstructionUnwrapErrCode *instruction) | 11892 | IrInstructionUnwrapErrCode *instruction) |
| 11877 | { | 11893 | { |
| 11878 | IrInstruction *value = instruction->value->other; | 11894 | IrInstruction *value = instruction->value->other; |
| 11879 | if (value->value.type->id == TypeTableEntryIdInvalid) | 11895 | if (type_is_invalid(value->value.type)) |
| 11880 | return ira->codegen->builtin_types.entry_invalid; | 11896 | return ira->codegen->builtin_types.entry_invalid; |
| 11881 | TypeTableEntry *ptr_type = value->value.type; | 11897 | TypeTableEntry *ptr_type = value->value.type; |
| 11882 | | 11898 | |
| ... | @@ -11885,7 +11901,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, | ... | @@ -11885,7 +11901,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, |
| 11885 | | 11901 | |
| 11886 | TypeTableEntry *non_canon_type = ptr_type->data.pointer.child_type; | 11902 | TypeTableEntry *non_canon_type = ptr_type->data.pointer.child_type; |
| 11887 | TypeTableEntry *canon_type = get_underlying_type(non_canon_type); | 11903 | TypeTableEntry *canon_type = get_underlying_type(non_canon_type); |
| 11888 | if (canon_type->id == TypeTableEntryIdInvalid) { | 11904 | if (type_is_invalid(canon_type)) { |
| 11889 | return ira->codegen->builtin_types.entry_invalid; | 11905 | return ira->codegen->builtin_types.entry_invalid; |
| 11890 | } else if (canon_type->id == TypeTableEntryIdErrorUnion) { | 11906 | } else if (canon_type->id == TypeTableEntryIdErrorUnion) { |
| 11891 | if (instr_is_comptime(value)) { | 11907 | if (instr_is_comptime(value)) { |
| ... | @@ -11918,7 +11934,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira, | ... | @@ -11918,7 +11934,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira, |
| 11918 | { | 11934 | { |
| 11919 | assert(instruction->value->other); | 11935 | assert(instruction->value->other); |
| 11920 | IrInstruction *value = instruction->value->other; | 11936 | IrInstruction *value = instruction->value->other; |
| 11921 | if (value->value.type->id == TypeTableEntryIdInvalid) | 11937 | if (type_is_invalid(value->value.type)) |
| 11922 | return ira->codegen->builtin_types.entry_invalid; | 11938 | return ira->codegen->builtin_types.entry_invalid; |
| 11923 | TypeTableEntry *ptr_type = value->value.type; | 11939 | TypeTableEntry *ptr_type = value->value.type; |
| 11924 | | 11940 | |
| ... | @@ -11927,7 +11943,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira, | ... | @@ -11927,7 +11943,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira, |
| 11927 | | 11943 | |
| 11928 | TypeTableEntry *non_canon_type = ptr_type->data.pointer.child_type; | 11944 | TypeTableEntry *non_canon_type = ptr_type->data.pointer.child_type; |
| 11929 | TypeTableEntry *canon_type = get_underlying_type(non_canon_type); | 11945 | TypeTableEntry *canon_type = get_underlying_type(non_canon_type); |
| 11930 | if (canon_type->id == TypeTableEntryIdInvalid) { | 11946 | if (type_is_invalid(canon_type)) { |
| 11931 | return ira->codegen->builtin_types.entry_invalid; | 11947 | return ira->codegen->builtin_types.entry_invalid; |
| 11932 | } else if (canon_type->id == TypeTableEntryIdErrorUnion) { | 11948 | } else if (canon_type->id == TypeTableEntryIdErrorUnion) { |
| 11933 | TypeTableEntry *child_type = canon_type->data.error.child_type; | 11949 | TypeTableEntry *child_type = canon_type->data.error.child_type; |
| ... | @@ -11980,13 +11996,13 @@ static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruc | ... | @@ -11980,13 +11996,13 @@ static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruc |
| 11980 | FnTypeParamInfo *param_info = &fn_type_id.param_info[fn_type_id.next_param_index]; | 11996 | FnTypeParamInfo *param_info = &fn_type_id.param_info[fn_type_id.next_param_index]; |
| 11981 | param_info->is_noalias = param_node->data.param_decl.is_noalias; | 11997 | param_info->is_noalias = param_node->data.param_decl.is_noalias; |
| 11982 | param_info->type = ir_resolve_type(ira, param_type_value); | 11998 | param_info->type = ir_resolve_type(ira, param_type_value); |
| 11983 | if (param_info->type->id == TypeTableEntryIdInvalid) | 11999 | if (type_is_invalid(param_info->type)) |
| 11984 | return ira->codegen->builtin_types.entry_invalid; | 12000 | return ira->codegen->builtin_types.entry_invalid; |
| 11985 | } | 12001 | } |
| 11986 | | 12002 | |
| 11987 | IrInstruction *return_type_value = instruction->return_type->other; | 12003 | IrInstruction *return_type_value = instruction->return_type->other; |
| 11988 | fn_type_id.return_type = ir_resolve_type(ira, return_type_value); | 12004 | fn_type_id.return_type = ir_resolve_type(ira, return_type_value); |
| 11989 | if (fn_type_id.return_type->id == TypeTableEntryIdInvalid) | 12005 | if (type_is_invalid(fn_type_id.return_type)) |
| 11990 | return ira->codegen->builtin_types.entry_invalid; | 12006 | return ira->codegen->builtin_types.entry_invalid; |
| 11991 | | 12007 | |
| 11992 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 12008 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| ... | @@ -11996,7 +12012,7 @@ static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruc | ... | @@ -11996,7 +12012,7 @@ static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruc |
| 11996 | | 12012 | |
| 11997 | static TypeTableEntry *ir_analyze_instruction_test_comptime(IrAnalyze *ira, IrInstructionTestComptime *instruction) { | 12013 | static TypeTableEntry *ir_analyze_instruction_test_comptime(IrAnalyze *ira, IrInstructionTestComptime *instruction) { |
| 11998 | IrInstruction *value = instruction->value->other; | 12014 | IrInstruction *value = instruction->value->other; |
| 11999 | if (value->value.type->id == TypeTableEntryIdInvalid) | 12015 | if (type_is_invalid(value->value.type)) |
| 12000 | return ira->codegen->builtin_types.entry_invalid; | 12016 | return ira->codegen->builtin_types.entry_invalid; |
| 12001 | | 12017 | |
| 12002 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 12018 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| ... | @@ -12009,7 +12025,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira | ... | @@ -12009,7 +12025,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira |
| 12009 | { | 12025 | { |
| 12010 | IrInstruction *target_value = instruction->target_value->other; | 12026 | IrInstruction *target_value = instruction->target_value->other; |
| 12011 | TypeTableEntry *switch_type = target_value->value.type; | 12027 | TypeTableEntry *switch_type = target_value->value.type; |
| 12012 | if (switch_type->id == TypeTableEntryIdInvalid) | 12028 | if (type_is_invalid(switch_type)) |
| 12013 | return ira->codegen->builtin_types.entry_invalid; | 12029 | return ira->codegen->builtin_types.entry_invalid; |
| 12014 | | 12030 | |
| 12015 | if (switch_type->id == TypeTableEntryIdEnumTag) { | 12031 | if (switch_type->id == TypeTableEntryIdEnumTag) { |
| ... | @@ -12019,11 +12035,11 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira | ... | @@ -12019,11 +12035,11 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira |
| 12019 | IrInstructionCheckSwitchProngsRange *range = &instruction->ranges[range_i]; | 12035 | IrInstructionCheckSwitchProngsRange *range = &instruction->ranges[range_i]; |
| 12020 | | 12036 | |
| 12021 | IrInstruction *start_value = range->start->other; | 12037 | IrInstruction *start_value = range->start->other; |
| 12022 | if (start_value->value.type->id == TypeTableEntryIdInvalid) | 12038 | if (type_is_invalid(start_value->value.type)) |
| 12023 | return ira->codegen->builtin_types.entry_invalid; | 12039 | return ira->codegen->builtin_types.entry_invalid; |
| 12024 | | 12040 | |
| 12025 | IrInstruction *end_value = range->end->other; | 12041 | IrInstruction *end_value = range->end->other; |
| 12026 | if (end_value->value.type->id == TypeTableEntryIdInvalid) | 12042 | if (type_is_invalid(end_value->value.type)) |
| 12027 | return ira->codegen->builtin_types.entry_invalid; | 12043 | return ira->codegen->builtin_types.entry_invalid; |
| 12028 | | 12044 | |
| 12029 | size_t start_index; | 12045 | size_t start_index; |
| ... | @@ -12070,7 +12086,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira | ... | @@ -12070,7 +12086,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira |
| 12070 | static TypeTableEntry *ir_analyze_instruction_test_type(IrAnalyze *ira, IrInstructionTestType *instruction) { | 12086 | static TypeTableEntry *ir_analyze_instruction_test_type(IrAnalyze *ira, IrInstructionTestType *instruction) { |
| 12071 | IrInstruction *type_value = instruction->type_value->other; | 12087 | IrInstruction *type_value = instruction->type_value->other; |
| 12072 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 12088 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); |
| 12073 | if (type_entry->id == TypeTableEntryIdInvalid) | 12089 | if (type_is_invalid(type_entry)) |
| 12074 | return ira->codegen->builtin_types.entry_invalid; | 12090 | return ira->codegen->builtin_types.entry_invalid; |
| 12075 | | 12091 | |
| 12076 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 12092 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| ... | @@ -12083,11 +12099,11 @@ static TypeTableEntry *ir_analyze_instruction_can_implicit_cast(IrAnalyze *ira, | ... | @@ -12083,11 +12099,11 @@ static TypeTableEntry *ir_analyze_instruction_can_implicit_cast(IrAnalyze *ira, |
| 12083 | { | 12099 | { |
| 12084 | IrInstruction *type_value = instruction->type_value->other; | 12100 | IrInstruction *type_value = instruction->type_value->other; |
| 12085 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 12101 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); |
| 12086 | if (type_entry->id == TypeTableEntryIdInvalid) | 12102 | if (type_is_invalid(type_entry)) |
| 12087 | return ira->codegen->builtin_types.entry_invalid; | 12103 | return ira->codegen->builtin_types.entry_invalid; |
| 12088 | | 12104 | |
| 12089 | IrInstruction *target_value = instruction->target_value->other; | 12105 | IrInstruction *target_value = instruction->target_value->other; |
| 12090 | if (target_value->value.type->id == TypeTableEntryIdInvalid) | 12106 | if (type_is_invalid(target_value->value.type)) |
| 12091 | return ira->codegen->builtin_types.entry_invalid; | 12107 | return ira->codegen->builtin_types.entry_invalid; |
| 12092 | | 12108 | |
| 12093 | ImplicitCastMatchResult result = ir_types_match_with_implicit_cast(ira, type_entry, target_value->value.type, | 12109 | ImplicitCastMatchResult result = ir_types_match_with_implicit_cast(ira, type_entry, target_value->value.type, |