| ... | @@ -33,7 +33,7 @@ struct IrAnalyze { | ... | @@ -33,7 +33,7 @@ struct IrAnalyze { |
| 33 | IrExecContext exec_context; | 33 | IrExecContext exec_context; |
| 34 | size_t old_bb_index; | 34 | size_t old_bb_index; |
| 35 | size_t instruction_index; | 35 | size_t instruction_index; |
| 36 | TypeTableEntry *explicit_return_type; | 36 | ZigType *explicit_return_type; |
| 37 | ZigList<IrInstruction *> src_implicit_return_type_list; | 37 | ZigList<IrInstruction *> src_implicit_return_type_list; |
| 38 | IrBasicBlock *const_predecessor_bb; | 38 | IrBasicBlock *const_predecessor_bb; |
| 39 | }; | 39 | }; |
| ... | @@ -99,38 +99,38 @@ struct ConstCastOnly { | ... | @@ -99,38 +99,38 @@ struct ConstCastOnly { |
| 99 | }; | 99 | }; |
| 100 | | 100 | |
| 101 | struct ConstCastTypeMismatch { | 101 | struct ConstCastTypeMismatch { |
| 102 | TypeTableEntry *wanted_type; | 102 | ZigType *wanted_type; |
| 103 | TypeTableEntry *actual_type; | 103 | ZigType *actual_type; |
| 104 | }; | 104 | }; |
| 105 | | 105 | |
| 106 | struct ConstCastOptionalMismatch { | 106 | struct ConstCastOptionalMismatch { |
| 107 | ConstCastOnly child; | 107 | ConstCastOnly child; |
| 108 | TypeTableEntry *wanted_child; | 108 | ZigType *wanted_child; |
| 109 | TypeTableEntry *actual_child; | 109 | ZigType *actual_child; |
| 110 | }; | 110 | }; |
| 111 | | 111 | |
| 112 | struct ConstCastPointerMismatch { | 112 | struct ConstCastPointerMismatch { |
| 113 | ConstCastOnly child; | 113 | ConstCastOnly child; |
| 114 | TypeTableEntry *wanted_child; | 114 | ZigType *wanted_child; |
| 115 | TypeTableEntry *actual_child; | 115 | ZigType *actual_child; |
| 116 | }; | 116 | }; |
| 117 | | 117 | |
| 118 | struct ConstCastSliceMismatch { | 118 | struct ConstCastSliceMismatch { |
| 119 | ConstCastOnly child; | 119 | ConstCastOnly child; |
| 120 | TypeTableEntry *wanted_child; | 120 | ZigType *wanted_child; |
| 121 | TypeTableEntry *actual_child; | 121 | ZigType *actual_child; |
| 122 | }; | 122 | }; |
| 123 | | 123 | |
| 124 | struct ConstCastErrUnionErrSetMismatch { | 124 | struct ConstCastErrUnionErrSetMismatch { |
| 125 | ConstCastOnly child; | 125 | ConstCastOnly child; |
| 126 | TypeTableEntry *wanted_err_set; | 126 | ZigType *wanted_err_set; |
| 127 | TypeTableEntry *actual_err_set; | 127 | ZigType *actual_err_set; |
| 128 | }; | 128 | }; |
| 129 | | 129 | |
| 130 | struct ConstCastErrUnionPayloadMismatch { | 130 | struct ConstCastErrUnionPayloadMismatch { |
| 131 | ConstCastOnly child; | 131 | ConstCastOnly child; |
| 132 | TypeTableEntry *wanted_payload; | 132 | ZigType *wanted_payload; |
| 133 | TypeTableEntry *actual_payload; | 133 | ZigType *actual_payload; |
| 134 | }; | 134 | }; |
| 135 | | 135 | |
| 136 | struct ConstCastErrSetMismatch { | 136 | struct ConstCastErrSetMismatch { |
| ... | @@ -139,17 +139,17 @@ struct ConstCastErrSetMismatch { | ... | @@ -139,17 +139,17 @@ struct ConstCastErrSetMismatch { |
| 139 | | 139 | |
| 140 | static IrInstruction *ir_gen_node(IrBuilder *irb, AstNode *node, Scope *scope); | 140 | static IrInstruction *ir_gen_node(IrBuilder *irb, AstNode *node, Scope *scope); |
| 141 | static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, Scope *scope, LVal lval); | 141 | static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, Scope *scope, LVal lval); |
| 142 | static TypeTableEntry *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *instruction); | 142 | static ZigType *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *instruction); |
| 143 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, TypeTableEntry *expected_type); | 143 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, ZigType *expected_type); |
| 144 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr); | 144 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr); |
| 145 | static ErrorMsg *exec_add_error_node(CodeGen *codegen, IrExecutable *exec, AstNode *source_node, Buf *msg); | 145 | static ErrorMsg *exec_add_error_node(CodeGen *codegen, IrExecutable *exec, AstNode *source_node, Buf *msg); |
| 146 | static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_name, | 146 | static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_name, |
| 147 | IrInstruction *source_instr, IrInstruction *container_ptr, TypeTableEntry *container_type); | 147 | IrInstruction *source_instr, IrInstruction *container_ptr, ZigType *container_type); |
| 148 | static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, VariableTableEntry *var); | 148 | static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, VariableTableEntry *var); |
| 149 | static TypeTableEntry *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op); | 149 | static ZigType *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op); |
| 150 | static IrInstruction *ir_lval_wrap(IrBuilder *irb, Scope *scope, IrInstruction *value, LVal lval); | 150 | static IrInstruction *ir_lval_wrap(IrBuilder *irb, Scope *scope, IrInstruction *value, LVal lval); |
| 151 | static TypeTableEntry *adjust_ptr_align(CodeGen *g, TypeTableEntry *ptr_type, uint32_t new_align); | 151 | static ZigType *adjust_ptr_align(CodeGen *g, ZigType *ptr_type, uint32_t new_align); |
| 152 | static TypeTableEntry *adjust_slice_align(CodeGen *g, TypeTableEntry *slice_type, uint32_t new_align); | 152 | static ZigType *adjust_slice_align(CodeGen *g, ZigType *slice_type, uint32_t new_align); |
| 153 | static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue *val); | 153 | static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue *val); |
| 154 | static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue *val); | 154 | static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue *val); |
| 155 | | 155 | |
| ... | @@ -183,7 +183,7 @@ static ConstExprValue *const_ptr_pointee_unchecked(CodeGen *g, ConstExprValue *c | ... | @@ -183,7 +183,7 @@ static ConstExprValue *const_ptr_pointee_unchecked(CodeGen *g, ConstExprValue *c |
| 183 | return result; | 183 | return result; |
| 184 | } | 184 | } |
| 185 | | 185 | |
| 186 | static bool types_have_same_zig_comptime_repr(TypeTableEntry *a, TypeTableEntry *b) { | 186 | static bool types_have_same_zig_comptime_repr(ZigType *a, ZigType *b) { |
| 187 | if (a == b) | 187 | if (a == b) |
| 188 | return true; | 188 | return true; |
| 189 | | 189 | |
| ... | @@ -878,7 +878,7 @@ static T *ir_build_instruction(IrBuilder *irb, Scope *scope, AstNode *source_nod | ... | @@ -878,7 +878,7 @@ static T *ir_build_instruction(IrBuilder *irb, Scope *scope, AstNode *source_nod |
| 878 | return special_instruction; | 878 | return special_instruction; |
| 879 | } | 879 | } |
| 880 | | 880 | |
| 881 | static IrInstruction *ir_build_cast(IrBuilder *irb, Scope *scope, AstNode *source_node, TypeTableEntry *dest_type, | 881 | static IrInstruction *ir_build_cast(IrBuilder *irb, Scope *scope, AstNode *source_node, ZigType *dest_type, |
| 882 | IrInstruction *value, CastOp cast_op) | 882 | IrInstruction *value, CastOp cast_op) |
| 883 | { | 883 | { |
| 884 | IrInstructionCast *cast_instruction = ir_build_instruction<IrInstructionCast>(irb, scope, source_node); | 884 | IrInstructionCast *cast_instruction = ir_build_instruction<IrInstructionCast>(irb, scope, source_node); |
| ... | @@ -931,7 +931,7 @@ static IrInstruction *ir_build_return(IrBuilder *irb, Scope *scope, AstNode *sou | ... | @@ -931,7 +931,7 @@ static IrInstruction *ir_build_return(IrBuilder *irb, Scope *scope, AstNode *sou |
| 931 | } | 931 | } |
| 932 | | 932 | |
| 933 | static IrInstruction *ir_create_const(IrBuilder *irb, Scope *scope, AstNode *source_node, | 933 | static IrInstruction *ir_create_const(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 934 | TypeTableEntry *type_entry) | 934 | ZigType *type_entry) |
| 935 | { | 935 | { |
| 936 | assert(type_entry); | 936 | assert(type_entry); |
| 937 | IrInstructionConst *const_instruction = ir_create_instruction<IrInstructionConst>(irb, scope, source_node); | 937 | IrInstructionConst *const_instruction = ir_create_instruction<IrInstructionConst>(irb, scope, source_node); |
| ... | @@ -1002,7 +1002,7 @@ static IrInstruction *ir_build_const_u8(IrBuilder *irb, Scope *scope, AstNode *s | ... | @@ -1002,7 +1002,7 @@ static IrInstruction *ir_build_const_u8(IrBuilder *irb, Scope *scope, AstNode *s |
| 1002 | } | 1002 | } |
| 1003 | | 1003 | |
| 1004 | static IrInstruction *ir_create_const_type(IrBuilder *irb, Scope *scope, AstNode *source_node, | 1004 | static IrInstruction *ir_create_const_type(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 1005 | TypeTableEntry *type_entry) | 1005 | ZigType *type_entry) |
| 1006 | { | 1006 | { |
| 1007 | IrInstructionConst *const_instruction = ir_create_instruction<IrInstructionConst>(irb, scope, source_node); | 1007 | IrInstructionConst *const_instruction = ir_create_instruction<IrInstructionConst>(irb, scope, source_node); |
| 1008 | const_instruction->base.value.type = irb->codegen->builtin_types.entry_type; | 1008 | const_instruction->base.value.type = irb->codegen->builtin_types.entry_type; |
| ... | @@ -1012,7 +1012,7 @@ static IrInstruction *ir_create_const_type(IrBuilder *irb, Scope *scope, AstNode | ... | @@ -1012,7 +1012,7 @@ static IrInstruction *ir_create_const_type(IrBuilder *irb, Scope *scope, AstNode |
| 1012 | } | 1012 | } |
| 1013 | | 1013 | |
| 1014 | static IrInstruction *ir_build_const_type(IrBuilder *irb, Scope *scope, AstNode *source_node, | 1014 | static IrInstruction *ir_build_const_type(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 1015 | TypeTableEntry *type_entry) | 1015 | ZigType *type_entry) |
| 1016 | { | 1016 | { |
| 1017 | IrInstruction *instruction = ir_create_const_type(irb, scope, source_node, type_entry); | 1017 | IrInstruction *instruction = ir_create_const_type(irb, scope, source_node, type_entry); |
| 1018 | ir_instruction_append(irb->current_basic_block, instruction); | 1018 | ir_instruction_append(irb->current_basic_block, instruction); |
| ... | @@ -1376,7 +1376,7 @@ static IrInstruction *ir_build_container_init_fields(IrBuilder *irb, Scope *scop | ... | @@ -1376,7 +1376,7 @@ static IrInstruction *ir_build_container_init_fields(IrBuilder *irb, Scope *scop |
| 1376 | } | 1376 | } |
| 1377 | | 1377 | |
| 1378 | static IrInstruction *ir_build_struct_init(IrBuilder *irb, Scope *scope, AstNode *source_node, | 1378 | static IrInstruction *ir_build_struct_init(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 1379 | TypeTableEntry *struct_type, size_t field_count, IrInstructionStructInitField *fields) | 1379 | ZigType *struct_type, size_t field_count, IrInstructionStructInitField *fields) |
| 1380 | { | 1380 | { |
| 1381 | IrInstructionStructInit *struct_init_instruction = ir_build_instruction<IrInstructionStructInit>(irb, scope, source_node); | 1381 | IrInstructionStructInit *struct_init_instruction = ir_build_instruction<IrInstructionStructInit>(irb, scope, source_node); |
| 1382 | struct_init_instruction->struct_type = struct_type; | 1382 | struct_init_instruction->struct_type = struct_type; |
| ... | @@ -1390,7 +1390,7 @@ static IrInstruction *ir_build_struct_init(IrBuilder *irb, Scope *scope, AstNode | ... | @@ -1390,7 +1390,7 @@ static IrInstruction *ir_build_struct_init(IrBuilder *irb, Scope *scope, AstNode |
| 1390 | } | 1390 | } |
| 1391 | | 1391 | |
| 1392 | static IrInstruction *ir_build_struct_init_from(IrBuilder *irb, IrInstruction *old_instruction, | 1392 | static IrInstruction *ir_build_struct_init_from(IrBuilder *irb, IrInstruction *old_instruction, |
| 1393 | TypeTableEntry *struct_type, size_t field_count, IrInstructionStructInitField *fields) | 1393 | ZigType *struct_type, size_t field_count, IrInstructionStructInitField *fields) |
| 1394 | { | 1394 | { |
| 1395 | IrInstruction *new_instruction = ir_build_struct_init(irb, old_instruction->scope, | 1395 | IrInstruction *new_instruction = ir_build_struct_init(irb, old_instruction->scope, |
| 1396 | old_instruction->source_node, struct_type, field_count, fields); | 1396 | old_instruction->source_node, struct_type, field_count, fields); |
| ... | @@ -1399,7 +1399,7 @@ static IrInstruction *ir_build_struct_init_from(IrBuilder *irb, IrInstruction *o | ... | @@ -1399,7 +1399,7 @@ static IrInstruction *ir_build_struct_init_from(IrBuilder *irb, IrInstruction *o |
| 1399 | } | 1399 | } |
| 1400 | | 1400 | |
| 1401 | static IrInstruction *ir_build_union_init(IrBuilder *irb, Scope *scope, AstNode *source_node, | 1401 | static IrInstruction *ir_build_union_init(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 1402 | TypeTableEntry *union_type, TypeUnionField *field, IrInstruction *init_value) | 1402 | ZigType *union_type, TypeUnionField *field, IrInstruction *init_value) |
| 1403 | { | 1403 | { |
| 1404 | IrInstructionUnionInit *union_init_instruction = ir_build_instruction<IrInstructionUnionInit>(irb, scope, source_node); | 1404 | IrInstructionUnionInit *union_init_instruction = ir_build_instruction<IrInstructionUnionInit>(irb, scope, source_node); |
| 1405 | union_init_instruction->union_type = union_type; | 1405 | union_init_instruction->union_type = union_type; |
| ... | @@ -1412,7 +1412,7 @@ static IrInstruction *ir_build_union_init(IrBuilder *irb, Scope *scope, AstNode | ... | @@ -1412,7 +1412,7 @@ static IrInstruction *ir_build_union_init(IrBuilder *irb, Scope *scope, AstNode |
| 1412 | } | 1412 | } |
| 1413 | | 1413 | |
| 1414 | static IrInstruction *ir_build_union_init_from(IrBuilder *irb, IrInstruction *old_instruction, | 1414 | static IrInstruction *ir_build_union_init_from(IrBuilder *irb, IrInstruction *old_instruction, |
| 1415 | TypeTableEntry *union_type, TypeUnionField *field, IrInstruction *init_value) | 1415 | ZigType *union_type, TypeUnionField *field, IrInstruction *init_value) |
| 1416 | { | 1416 | { |
| 1417 | IrInstruction *new_instruction = ir_build_union_init(irb, old_instruction->scope, | 1417 | IrInstruction *new_instruction = ir_build_union_init(irb, old_instruction->scope, |
| 1418 | old_instruction->source_node, union_type, field, init_value); | 1418 | old_instruction->source_node, union_type, field, init_value); |
| ... | @@ -1973,7 +1973,7 @@ static IrInstruction *ir_build_cmpxchg(IrBuilder *irb, Scope *scope, AstNode *so | ... | @@ -1973,7 +1973,7 @@ static IrInstruction *ir_build_cmpxchg(IrBuilder *irb, Scope *scope, AstNode *so |
| 1973 | IrInstruction *ptr, IrInstruction *cmp_value, IrInstruction *new_value, | 1973 | IrInstruction *ptr, IrInstruction *cmp_value, IrInstruction *new_value, |
| 1974 | IrInstruction *success_order_value, IrInstruction *failure_order_value, | 1974 | IrInstruction *success_order_value, IrInstruction *failure_order_value, |
| 1975 | bool is_weak, | 1975 | bool is_weak, |
| 1976 | TypeTableEntry *type, AtomicOrder success_order, AtomicOrder failure_order) | 1976 | ZigType *type, AtomicOrder success_order, AtomicOrder failure_order) |
| 1977 | { | 1977 | { |
| 1978 | IrInstructionCmpxchg *instruction = ir_build_instruction<IrInstructionCmpxchg>(irb, scope, source_node); | 1978 | IrInstructionCmpxchg *instruction = ir_build_instruction<IrInstructionCmpxchg>(irb, scope, source_node); |
| 1979 | instruction->type_value = type_value; | 1979 | instruction->type_value = type_value; |
| ... | @@ -2286,7 +2286,7 @@ static IrInstruction *ir_build_handle_from(IrBuilder *irb, IrInstruction *old_in | ... | @@ -2286,7 +2286,7 @@ static IrInstruction *ir_build_handle_from(IrBuilder *irb, IrInstruction *old_in |
| 2286 | | 2286 | |
| 2287 | static IrInstruction *ir_build_overflow_op(IrBuilder *irb, Scope *scope, AstNode *source_node, | 2287 | static IrInstruction *ir_build_overflow_op(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 2288 | IrOverflowOp op, IrInstruction *type_value, IrInstruction *op1, IrInstruction *op2, | 2288 | IrOverflowOp op, IrInstruction *type_value, IrInstruction *op1, IrInstruction *op2, |
| 2289 | IrInstruction *result_ptr, TypeTableEntry *result_ptr_type) | 2289 | IrInstruction *result_ptr, ZigType *result_ptr_type) |
| 2290 | { | 2290 | { |
| 2291 | IrInstructionOverflowOp *instruction = ir_build_instruction<IrInstructionOverflowOp>(irb, scope, source_node); | 2291 | IrInstructionOverflowOp *instruction = ir_build_instruction<IrInstructionOverflowOp>(irb, scope, source_node); |
| 2292 | instruction->op = op; | 2292 | instruction->op = op; |
| ... | @@ -2306,7 +2306,7 @@ static IrInstruction *ir_build_overflow_op(IrBuilder *irb, Scope *scope, AstNode | ... | @@ -2306,7 +2306,7 @@ static IrInstruction *ir_build_overflow_op(IrBuilder *irb, Scope *scope, AstNode |
| 2306 | | 2306 | |
| 2307 | static IrInstruction *ir_build_overflow_op_from(IrBuilder *irb, IrInstruction *old_instruction, | 2307 | static IrInstruction *ir_build_overflow_op_from(IrBuilder *irb, IrInstruction *old_instruction, |
| 2308 | IrOverflowOp op, IrInstruction *type_value, IrInstruction *op1, IrInstruction *op2, | 2308 | IrOverflowOp op, IrInstruction *type_value, IrInstruction *op1, IrInstruction *op2, |
| 2309 | IrInstruction *result_ptr, TypeTableEntry *result_ptr_type) | 2309 | IrInstruction *result_ptr, ZigType *result_ptr_type) |
| 2310 | { | 2310 | { |
| 2311 | IrInstruction *new_instruction = ir_build_overflow_op(irb, old_instruction->scope, old_instruction->source_node, | 2311 | IrInstruction *new_instruction = ir_build_overflow_op(irb, old_instruction->scope, old_instruction->source_node, |
| 2312 | op, type_value, op1, op2, result_ptr, result_ptr_type); | 2312 | op, type_value, op1, op2, result_ptr, result_ptr_type); |
| ... | @@ -3343,7 +3343,7 @@ static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Sco | ... | @@ -3343,7 +3343,7 @@ static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Sco |
| 3343 | add_error_note(codegen, msg, existing_var->decl_node, buf_sprintf("previous declaration is here")); | 3343 | add_error_note(codegen, msg, existing_var->decl_node, buf_sprintf("previous declaration is here")); |
| 3344 | variable_entry->value->type = codegen->builtin_types.entry_invalid; | 3344 | variable_entry->value->type = codegen->builtin_types.entry_invalid; |
| 3345 | } else { | 3345 | } else { |
| 3346 | TypeTableEntry *type = get_primitive_type(codegen, name); | 3346 | ZigType *type = get_primitive_type(codegen, name); |
| 3347 | if (type != nullptr) { | 3347 | if (type != nullptr) { |
| 3348 | add_node_error(codegen, node, | 3348 | add_node_error(codegen, node, |
| 3349 | buf_sprintf("variable shadows type '%s'", buf_ptr(&type->name))); | 3349 | buf_sprintf("variable shadows type '%s'", buf_ptr(&type->name))); |
| ... | @@ -3789,7 +3789,7 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node, | ... | @@ -3789,7 +3789,7 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node, |
| 3789 | return &const_instruction->base; | 3789 | return &const_instruction->base; |
| 3790 | } | 3790 | } |
| 3791 | | 3791 | |
| 3792 | TypeTableEntry *primitive_type = get_primitive_type(irb->codegen, variable_name); | 3792 | ZigType *primitive_type = get_primitive_type(irb->codegen, variable_name); |
| 3793 | if (primitive_type != nullptr) { | 3793 | if (primitive_type != nullptr) { |
| 3794 | IrInstruction *value = ir_build_const_type(irb, scope, node, primitive_type); | 3794 | IrInstruction *value = ir_build_const_type(irb, scope, node, primitive_type); |
| 3795 | if (lval == LValPtr) { | 3795 | if (lval == LValPtr) { |
| ... | @@ -5696,7 +5696,7 @@ static IrInstruction *ir_gen_this_literal(IrBuilder *irb, Scope *scope, AstNode | ... | @@ -5696,7 +5696,7 @@ static IrInstruction *ir_gen_this_literal(IrBuilder *irb, Scope *scope, AstNode |
| 5696 | | 5696 | |
| 5697 | if (scope->id == ScopeIdDecls) { | 5697 | if (scope->id == ScopeIdDecls) { |
| 5698 | ScopeDecls *decls_scope = (ScopeDecls *)scope; | 5698 | ScopeDecls *decls_scope = (ScopeDecls *)scope; |
| 5699 | TypeTableEntry *container_type = decls_scope->container_type; | 5699 | ZigType *container_type = decls_scope->container_type; |
| 5700 | assert(container_type); | 5700 | assert(container_type); |
| 5701 | return ir_build_const_type(irb, scope, node, container_type); | 5701 | return ir_build_const_type(irb, scope, node, container_type); |
| 5702 | } | 5702 | } |
| ... | @@ -6566,7 +6566,7 @@ static IrInstruction *ir_gen_container_decl(IrBuilder *irb, Scope *parent_scope, | ... | @@ -6566,7 +6566,7 @@ static IrInstruction *ir_gen_container_decl(IrBuilder *irb, Scope *parent_scope, |
| 6566 | init_tld(&tld_container->base, TldIdContainer, name, visib_mod, node, parent_scope); | 6566 | init_tld(&tld_container->base, TldIdContainer, name, visib_mod, node, parent_scope); |
| 6567 | | 6567 | |
| 6568 | ContainerLayout layout = node->data.container_decl.layout; | 6568 | ContainerLayout layout = node->data.container_decl.layout; |
| 6569 | TypeTableEntry *container_type = get_partial_container_type(irb->codegen, parent_scope, | 6569 | ZigType *container_type = get_partial_container_type(irb->codegen, parent_scope, |
| 6570 | kind, node, buf_ptr(name), layout); | 6570 | kind, node, buf_ptr(name), layout); |
| 6571 | ScopeDecls *child_scope = get_container_scope(container_type); | 6571 | ScopeDecls *child_scope = get_container_scope(container_type); |
| 6572 | | 6572 | |
| ... | @@ -6586,11 +6586,11 @@ static IrInstruction *ir_gen_container_decl(IrBuilder *irb, Scope *parent_scope, | ... | @@ -6586,11 +6586,11 @@ static IrInstruction *ir_gen_container_decl(IrBuilder *irb, Scope *parent_scope, |
| 6586 | } | 6586 | } |
| 6587 | | 6587 | |
| 6588 | // errors should be populated with set1's values | 6588 | // errors should be populated with set1's values |
| 6589 | static TypeTableEntry *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, TypeTableEntry *set1, TypeTableEntry *set2) { | 6589 | static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigType *set1, ZigType *set2) { |
| 6590 | assert(set1->id == TypeTableEntryIdErrorSet); | 6590 | assert(set1->id == TypeTableEntryIdErrorSet); |
| 6591 | assert(set2->id == TypeTableEntryIdErrorSet); | 6591 | assert(set2->id == TypeTableEntryIdErrorSet); |
| 6592 | | 6592 | |
| 6593 | TypeTableEntry *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet); | 6593 | ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet); |
| 6594 | buf_resize(&err_set_type->name, 0); | 6594 | buf_resize(&err_set_type->name, 0); |
| 6595 | buf_appendf(&err_set_type->name, "error{"); | 6595 | buf_appendf(&err_set_type->name, "error{"); |
| 6596 | | 6596 | |
| ... | @@ -6639,10 +6639,10 @@ static TypeTableEntry *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, | ... | @@ -6639,10 +6639,10 @@ static TypeTableEntry *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, |
| 6639 | | 6639 | |
| 6640 | } | 6640 | } |
| 6641 | | 6641 | |
| 6642 | static TypeTableEntry *make_err_set_with_one_item(CodeGen *g, Scope *parent_scope, AstNode *node, | 6642 | static ZigType *make_err_set_with_one_item(CodeGen *g, Scope *parent_scope, AstNode *node, |
| 6643 | ErrorTableEntry *err_entry) | 6643 | ErrorTableEntry *err_entry) |
| 6644 | { | 6644 | { |
| 6645 | TypeTableEntry *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet); | 6645 | ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet); |
| 6646 | buf_resize(&err_set_type->name, 0); | 6646 | buf_resize(&err_set_type->name, 0); |
| 6647 | buf_appendf(&err_set_type->name, "error{%s}", buf_ptr(&err_entry->name)); | 6647 | buf_appendf(&err_set_type->name, "error{%s}", buf_ptr(&err_entry->name)); |
| 6648 | err_set_type->is_copyable = true; | 6648 | err_set_type->is_copyable = true; |
| ... | @@ -6664,7 +6664,7 @@ static IrInstruction *ir_gen_err_set_decl(IrBuilder *irb, Scope *parent_scope, A | ... | @@ -6664,7 +6664,7 @@ static IrInstruction *ir_gen_err_set_decl(IrBuilder *irb, Scope *parent_scope, A |
| 6664 | uint32_t err_count = node->data.err_set_decl.decls.length; | 6664 | uint32_t err_count = node->data.err_set_decl.decls.length; |
| 6665 | | 6665 | |
| 6666 | Buf *type_name = get_anon_type_name(irb->codegen, irb->exec, "error set", node); | 6666 | Buf *type_name = get_anon_type_name(irb->codegen, irb->exec, "error set", node); |
| 6667 | TypeTableEntry *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet); | 6667 | ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet); |
| 6668 | buf_init_from_buf(&err_set_type->name, type_name); | 6668 | buf_init_from_buf(&err_set_type->name, type_name); |
| 6669 | err_set_type->is_copyable = true; | 6669 | err_set_type->is_copyable = true; |
| 6670 | err_set_type->data.error_set.err_count = err_count; | 6670 | err_set_type->data.error_set.err_count = err_count; |
| ... | @@ -7386,7 +7386,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec | ... | @@ -7386,7 +7386,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec |
| 7386 | IrInstruction *const_bool_false; | 7386 | IrInstruction *const_bool_false; |
| 7387 | IrInstruction *coro_promise_ptr; | 7387 | IrInstruction *coro_promise_ptr; |
| 7388 | IrInstruction *err_ret_trace_ptr; | 7388 | IrInstruction *err_ret_trace_ptr; |
| 7389 | TypeTableEntry *return_type; | 7389 | ZigType *return_type; |
| 7390 | Buf *result_ptr_field_name; | 7390 | Buf *result_ptr_field_name; |
| 7391 | VariableTableEntry *coro_size_var; | 7391 | VariableTableEntry *coro_size_var; |
| 7392 | if (is_async) { | 7392 | if (is_async) { |
| ... | @@ -7397,7 +7397,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec | ... | @@ -7397,7 +7397,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec |
| 7397 | | 7397 | |
| 7398 | return_type = fn_entry->type_entry->data.fn.fn_type_id.return_type; | 7398 | return_type = fn_entry->type_entry->data.fn.fn_type_id.return_type; |
| 7399 | IrInstruction *undef = ir_build_const_undefined(irb, coro_scope, node); | 7399 | IrInstruction *undef = ir_build_const_undefined(irb, coro_scope, node); |
| 7400 | TypeTableEntry *coro_frame_type = get_promise_frame_type(irb->codegen, return_type); | 7400 | ZigType *coro_frame_type = get_promise_frame_type(irb->codegen, return_type); |
| 7401 | IrInstruction *coro_frame_type_value = ir_build_const_type(irb, coro_scope, node, coro_frame_type); | 7401 | IrInstruction *coro_frame_type_value = ir_build_const_type(irb, coro_scope, node, coro_frame_type); |
| 7402 | // TODO mark this var decl as "no safety" e.g. disable initializing the undef value to 0xaa | 7402 | // TODO mark this var decl as "no safety" e.g. disable initializing the undef value to 0xaa |
| 7403 | ir_build_var_decl(irb, coro_scope, node, promise_var, coro_frame_type_value, nullptr, undef); | 7403 | ir_build_var_decl(irb, coro_scope, node, promise_var, coro_frame_type_value, nullptr, undef); |
| ... | @@ -7629,7 +7629,7 @@ static ConstExprValue *ir_const_ptr_pointee(IrAnalyze *ira, ConstExprValue *cons | ... | @@ -7629,7 +7629,7 @@ static ConstExprValue *ir_const_ptr_pointee(IrAnalyze *ira, ConstExprValue *cons |
| 7629 | ConstExprValue *val = const_ptr_pointee_unchecked(ira->codegen, const_val); | 7629 | ConstExprValue *val = const_ptr_pointee_unchecked(ira->codegen, const_val); |
| 7630 | assert(val != nullptr); | 7630 | assert(val != nullptr); |
| 7631 | assert(const_val->type->id == TypeTableEntryIdPointer); | 7631 | assert(const_val->type->id == TypeTableEntryIdPointer); |
| 7632 | TypeTableEntry *expected_type = const_val->type->data.pointer.child_type; | 7632 | ZigType *expected_type = const_val->type->data.pointer.child_type; |
| 7633 | if (!types_have_same_zig_comptime_repr(val->type, expected_type)) { | 7633 | if (!types_have_same_zig_comptime_repr(val->type, expected_type)) { |
| 7634 | ir_add_error_node(ira, source_node, | 7634 | ir_add_error_node(ira, source_node, |
| 7635 | buf_sprintf("TODO handle comptime reinterpreted pointer. See https://github.com/ziglang/zig/issues/955")); | 7635 | buf_sprintf("TODO handle comptime reinterpreted pointer. See https://github.com/ziglang/zig/issues/955")); |
| ... | @@ -7668,7 +7668,7 @@ static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *so | ... | @@ -7668,7 +7668,7 @@ static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *so |
| 7668 | return true; | 7668 | return true; |
| 7669 | } | 7669 | } |
| 7670 | | 7670 | |
| 7671 | static bool const_val_fits_in_num_lit(ConstExprValue *const_val, TypeTableEntry *num_lit_type) { | 7671 | static bool const_val_fits_in_num_lit(ConstExprValue *const_val, ZigType *num_lit_type) { |
| 7672 | return ((num_lit_type->id == TypeTableEntryIdComptimeFloat && | 7672 | return ((num_lit_type->id == TypeTableEntryIdComptimeFloat && |
| 7673 | (const_val->type->id == TypeTableEntryIdFloat || const_val->type->id == TypeTableEntryIdComptimeFloat)) || | 7673 | (const_val->type->id == TypeTableEntryIdFloat || const_val->type->id == TypeTableEntryIdComptimeFloat)) || |
| 7674 | (num_lit_type->id == TypeTableEntryIdComptimeInt && | 7674 | (num_lit_type->id == TypeTableEntryIdComptimeInt && |
| ... | @@ -8365,7 +8365,7 @@ void float_read_ieee597(ConstExprValue *val, uint8_t *buf, bool is_big_endian) { | ... | @@ -8365,7 +8365,7 @@ void float_read_ieee597(ConstExprValue *val, uint8_t *buf, bool is_big_endian) { |
| 8365 | } | 8365 | } |
| 8366 | } | 8366 | } |
| 8367 | | 8367 | |
| 8368 | static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruction, TypeTableEntry *other_type, | 8368 | static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruction, ZigType *other_type, |
| 8369 | bool explicit_cast) | 8369 | bool explicit_cast) |
| 8370 | { | 8370 | { |
| 8371 | if (type_is_invalid(other_type)) { | 8371 | if (type_is_invalid(other_type)) { |
| ... | @@ -8399,7 +8399,7 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc | ... | @@ -8399,7 +8399,7 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc |
| 8399 | } else if (const_val_fits_in_num_lit(const_val, other_type)) { | 8399 | } else if (const_val_fits_in_num_lit(const_val, other_type)) { |
| 8400 | return true; | 8400 | return true; |
| 8401 | } else if (other_type->id == TypeTableEntryIdOptional) { | 8401 | } else if (other_type->id == TypeTableEntryIdOptional) { |
| 8402 | TypeTableEntry *child_type = other_type->data.maybe.child_type; | 8402 | ZigType *child_type = other_type->data.maybe.child_type; |
| 8403 | if (const_val_fits_in_num_lit(const_val, child_type)) { | 8403 | if (const_val_fits_in_num_lit(const_val, child_type)) { |
| 8404 | return true; | 8404 | return true; |
| 8405 | } else if (child_type->id == TypeTableEntryIdInt && const_val_is_int) { | 8405 | } else if (child_type->id == TypeTableEntryIdInt && const_val_is_int) { |
| ... | @@ -8467,16 +8467,16 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc | ... | @@ -8467,16 +8467,16 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc |
| 8467 | return false; | 8467 | return false; |
| 8468 | } | 8468 | } |
| 8469 | | 8469 | |
| 8470 | static bool is_slice(TypeTableEntry *type) { | 8470 | static bool is_slice(ZigType *type) { |
| 8471 | return type->id == TypeTableEntryIdStruct && type->data.structure.is_slice; | 8471 | return type->id == TypeTableEntryIdStruct && type->data.structure.is_slice; |
| 8472 | } | 8472 | } |
| 8473 | | 8473 | |
| 8474 | static bool slice_is_const(TypeTableEntry *type) { | 8474 | static bool slice_is_const(ZigType *type) { |
| 8475 | assert(is_slice(type)); | 8475 | assert(is_slice(type)); |
| 8476 | return type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const; | 8476 | return type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const; |
| 8477 | } | 8477 | } |
| 8478 | | 8478 | |
| 8479 | static TypeTableEntry *get_error_set_intersection(IrAnalyze *ira, TypeTableEntry *set1, TypeTableEntry *set2, | 8479 | static ZigType *get_error_set_intersection(IrAnalyze *ira, ZigType *set1, ZigType *set2, |
| 8480 | AstNode *source_node) | 8480 | AstNode *source_node) |
| 8481 | { | 8481 | { |
| 8482 | assert(set1->id == TypeTableEntryIdErrorSet); | 8482 | assert(set1->id == TypeTableEntryIdErrorSet); |
| ... | @@ -8502,7 +8502,7 @@ static TypeTableEntry *get_error_set_intersection(IrAnalyze *ira, TypeTableEntry | ... | @@ -8502,7 +8502,7 @@ static TypeTableEntry *get_error_set_intersection(IrAnalyze *ira, TypeTableEntry |
| 8502 | } | 8502 | } |
| 8503 | ZigList<ErrorTableEntry *> intersection_list = {}; | 8503 | ZigList<ErrorTableEntry *> intersection_list = {}; |
| 8504 | | 8504 | |
| 8505 | TypeTableEntry *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet); | 8505 | ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet); |
| 8506 | buf_resize(&err_set_type->name, 0); | 8506 | buf_resize(&err_set_type->name, 0); |
| 8507 | buf_appendf(&err_set_type->name, "error{"); | 8507 | buf_appendf(&err_set_type->name, "error{"); |
| 8508 | | 8508 | |
| ... | @@ -8531,8 +8531,8 @@ static TypeTableEntry *get_error_set_intersection(IrAnalyze *ira, TypeTableEntry | ... | @@ -8531,8 +8531,8 @@ static TypeTableEntry *get_error_set_intersection(IrAnalyze *ira, TypeTableEntry |
| 8531 | } | 8531 | } |
| 8532 | | 8532 | |
| 8533 | | 8533 | |
| 8534 | static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, TypeTableEntry *wanted_type, | 8534 | static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted_type, |
| 8535 | TypeTableEntry *actual_type, AstNode *source_node, bool wanted_is_mutable) | 8535 | ZigType *actual_type, AstNode *source_node, bool wanted_is_mutable) |
| 8536 | { | 8536 | { |
| 8537 | CodeGen *g = ira->codegen; | 8537 | CodeGen *g = ira->codegen; |
| 8538 | ConstCastOnly result = {}; | 8538 | ConstCastOnly result = {}; |
| ... | @@ -8595,8 +8595,8 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, TypeTableEntry | ... | @@ -8595,8 +8595,8 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, TypeTableEntry |
| 8595 | | 8595 | |
| 8596 | // slice const | 8596 | // slice const |
| 8597 | if (is_slice(wanted_type) && is_slice(actual_type)) { | 8597 | if (is_slice(wanted_type) && is_slice(actual_type)) { |
| 8598 | TypeTableEntry *actual_ptr_type = actual_type->data.structure.fields[slice_ptr_index].type_entry; | 8598 | ZigType *actual_ptr_type = actual_type->data.structure.fields[slice_ptr_index].type_entry; |
| 8599 | TypeTableEntry *wanted_ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; | 8599 | ZigType *wanted_ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; |
| 8600 | if ((!actual_ptr_type->data.pointer.is_const || wanted_ptr_type->data.pointer.is_const) && | 8600 | if ((!actual_ptr_type->data.pointer.is_const || wanted_ptr_type->data.pointer.is_const) && |
| 8601 | (!actual_ptr_type->data.pointer.is_volatile || wanted_ptr_type->data.pointer.is_volatile) && | 8601 | (!actual_ptr_type->data.pointer.is_volatile || wanted_ptr_type->data.pointer.is_volatile) && |
| 8602 | actual_ptr_type->data.pointer.bit_offset == wanted_ptr_type->data.pointer.bit_offset && | 8602 | actual_ptr_type->data.pointer.bit_offset == wanted_ptr_type->data.pointer.bit_offset && |
| ... | @@ -8657,8 +8657,8 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, TypeTableEntry | ... | @@ -8657,8 +8657,8 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, TypeTableEntry |
| 8657 | | 8657 | |
| 8658 | // error set | 8658 | // error set |
| 8659 | if (wanted_type->id == TypeTableEntryIdErrorSet && actual_type->id == TypeTableEntryIdErrorSet) { | 8659 | if (wanted_type->id == TypeTableEntryIdErrorSet && actual_type->id == TypeTableEntryIdErrorSet) { |
| 8660 | TypeTableEntry *contained_set = actual_type; | 8660 | ZigType *contained_set = actual_type; |
| 8661 | TypeTableEntry *container_set = wanted_type; | 8661 | ZigType *container_set = wanted_type; |
| 8662 | | 8662 | |
| 8663 | // if the container set is inferred, then this will always work. | 8663 | // if the container set is inferred, then this will always work. |
| 8664 | if (container_set->data.error_set.infer_fn != nullptr) { | 8664 | if (container_set->data.error_set.infer_fn != nullptr) { |
| ... | @@ -8797,7 +8797,7 @@ static void update_errors_helper(CodeGen *g, ErrorTableEntry ***errors, size_t * | ... | @@ -8797,7 +8797,7 @@ static void update_errors_helper(CodeGen *g, ErrorTableEntry ***errors, size_t * |
| 8797 | *errors = reallocate(*errors, old_errors_count, *errors_count); | 8797 | *errors = reallocate(*errors, old_errors_count, *errors_count); |
| 8798 | } | 8798 | } |
| 8799 | | 8799 | |
| 8800 | static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, TypeTableEntry *expected_type, IrInstruction **instructions, size_t instruction_count) { | 8800 | static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigType *expected_type, IrInstruction **instructions, size_t instruction_count) { |
| 8801 | Error err; | 8801 | Error err; |
| 8802 | assert(instruction_count >= 1); | 8802 | assert(instruction_count >= 1); |
| 8803 | IrInstruction *prev_inst = instructions[0]; | 8803 | IrInstruction *prev_inst = instructions[0]; |
| ... | @@ -8806,7 +8806,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod | ... | @@ -8806,7 +8806,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 8806 | } | 8806 | } |
| 8807 | ErrorTableEntry **errors = nullptr; | 8807 | ErrorTableEntry **errors = nullptr; |
| 8808 | size_t errors_count = 0; | 8808 | size_t errors_count = 0; |
| 8809 | TypeTableEntry *err_set_type = nullptr; | 8809 | ZigType *err_set_type = nullptr; |
| 8810 | if (prev_inst->value.type->id == TypeTableEntryIdErrorSet) { | 8810 | if (prev_inst->value.type->id == TypeTableEntryIdErrorSet) { |
| 8811 | if (type_is_global_error_set(prev_inst->value.type)) { | 8811 | if (type_is_global_error_set(prev_inst->value.type)) { |
| 8812 | err_set_type = ira->codegen->builtin_types.entry_global_error_set; | 8812 | err_set_type = ira->codegen->builtin_types.entry_global_error_set; |
| ... | @@ -8829,8 +8829,8 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod | ... | @@ -8829,8 +8829,8 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 8829 | bool convert_to_const_slice = false; | 8829 | bool convert_to_const_slice = false; |
| 8830 | for (size_t i = 1; i < instruction_count; i += 1) { | 8830 | for (size_t i = 1; i < instruction_count; i += 1) { |
| 8831 | IrInstruction *cur_inst = instructions[i]; | 8831 | IrInstruction *cur_inst = instructions[i]; |
| 8832 | TypeTableEntry *cur_type = cur_inst->value.type; | 8832 | ZigType *cur_type = cur_inst->value.type; |
| 8833 | TypeTableEntry *prev_type = prev_inst->value.type; | 8833 | ZigType *prev_type = prev_inst->value.type; |
| 8834 | | 8834 | |
| 8835 | if (type_is_invalid(cur_type)) { | 8835 | if (type_is_invalid(cur_type)) { |
| 8836 | return cur_type; | 8836 | return cur_type; |
| ... | @@ -8916,7 +8916,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod | ... | @@ -8916,7 +8916,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 8916 | prev_inst = cur_inst; | 8916 | prev_inst = cur_inst; |
| 8917 | continue; | 8917 | continue; |
| 8918 | } | 8918 | } |
| 8919 | TypeTableEntry *cur_err_set_type = cur_type->data.error_union.err_set_type; | 8919 | ZigType *cur_err_set_type = cur_type->data.error_union.err_set_type; |
| 8920 | if (!resolve_inferred_error_set(ira->codegen, cur_err_set_type, cur_inst->source_node)) { | 8920 | if (!resolve_inferred_error_set(ira->codegen, cur_err_set_type, cur_inst->source_node)) { |
| 8921 | return ira->codegen->builtin_types.entry_invalid; | 8921 | return ira->codegen->builtin_types.entry_invalid; |
| 8922 | } | 8922 | } |
| ... | @@ -9021,8 +9021,8 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod | ... | @@ -9021,8 +9021,8 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 9021 | } | 9021 | } |
| 9022 | | 9022 | |
| 9023 | if (prev_type->id == TypeTableEntryIdErrorUnion && cur_type->id == TypeTableEntryIdErrorUnion) { | 9023 | if (prev_type->id == TypeTableEntryIdErrorUnion && cur_type->id == TypeTableEntryIdErrorUnion) { |
| 9024 | TypeTableEntry *prev_payload_type = prev_type->data.error_union.payload_type; | 9024 | ZigType *prev_payload_type = prev_type->data.error_union.payload_type; |
| 9025 | TypeTableEntry *cur_payload_type = cur_type->data.error_union.payload_type; | 9025 | ZigType *cur_payload_type = cur_type->data.error_union.payload_type; |
| 9026 | | 9026 | |
| 9027 | bool const_cast_prev = types_match_const_cast_only(ira, prev_payload_type, cur_payload_type, | 9027 | bool const_cast_prev = types_match_const_cast_only(ira, prev_payload_type, cur_payload_type, |
| 9028 | source_node, false).id == ConstCastResultIdOk; | 9028 | source_node, false).id == ConstCastResultIdOk; |
| ... | @@ -9034,8 +9034,8 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod | ... | @@ -9034,8 +9034,8 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 9034 | prev_inst = cur_inst; | 9034 | prev_inst = cur_inst; |
| 9035 | } | 9035 | } |
| 9036 | | 9036 | |
| 9037 | TypeTableEntry *prev_err_set_type = (err_set_type == nullptr) ? prev_type->data.error_union.err_set_type : err_set_type; | 9037 | ZigType *prev_err_set_type = (err_set_type == nullptr) ? prev_type->data.error_union.err_set_type : err_set_type; |
| 9038 | TypeTableEntry *cur_err_set_type = cur_type->data.error_union.err_set_type; | 9038 | ZigType *cur_err_set_type = cur_type->data.error_union.err_set_type; |
| 9039 | | 9039 | |
| 9040 | if (!resolve_inferred_error_set(ira->codegen, prev_err_set_type, cur_inst->source_node)) { | 9040 | if (!resolve_inferred_error_set(ira->codegen, prev_err_set_type, cur_inst->source_node)) { |
| 9041 | return ira->codegen->builtin_types.entry_invalid; | 9041 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -9152,7 +9152,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod | ... | @@ -9152,7 +9152,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 9152 | source_node, false).id == ConstCastResultIdOk) | 9152 | source_node, false).id == ConstCastResultIdOk) |
| 9153 | { | 9153 | { |
| 9154 | if (err_set_type != nullptr) { | 9154 | if (err_set_type != nullptr) { |
| 9155 | TypeTableEntry *cur_err_set_type = cur_type->data.error_union.err_set_type; | 9155 | ZigType *cur_err_set_type = cur_type->data.error_union.err_set_type; |
| 9156 | if (!resolve_inferred_error_set(ira->codegen, cur_err_set_type, cur_inst->source_node)) { | 9156 | if (!resolve_inferred_error_set(ira->codegen, cur_err_set_type, cur_inst->source_node)) { |
| 9157 | return ira->codegen->builtin_types.entry_invalid; | 9157 | return ira->codegen->builtin_types.entry_invalid; |
| 9158 | } | 9158 | } |
| ... | @@ -9293,12 +9293,12 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod | ... | @@ -9293,12 +9293,12 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 9293 | | 9293 | |
| 9294 | if (convert_to_const_slice) { | 9294 | if (convert_to_const_slice) { |
| 9295 | assert(prev_inst->value.type->id == TypeTableEntryIdArray); | 9295 | assert(prev_inst->value.type->id == TypeTableEntryIdArray); |
| 9296 | TypeTableEntry *ptr_type = get_pointer_to_type_extra( | 9296 | ZigType *ptr_type = get_pointer_to_type_extra( |
| 9297 | ira->codegen, prev_inst->value.type->data.array.child_type, | 9297 | ira->codegen, prev_inst->value.type->data.array.child_type, |
| 9298 | true, false, PtrLenUnknown, | 9298 | true, false, PtrLenUnknown, |
| 9299 | get_abi_alignment(ira->codegen, prev_inst->value.type->data.array.child_type), | 9299 | get_abi_alignment(ira->codegen, prev_inst->value.type->data.array.child_type), |
| 9300 | 0, 0); | 9300 | 0, 0); |
| 9301 | TypeTableEntry *slice_type = get_slice_type(ira->codegen, ptr_type); | 9301 | ZigType *slice_type = get_slice_type(ira->codegen, ptr_type); |
| 9302 | if (err_set_type != nullptr) { | 9302 | if (err_set_type != nullptr) { |
| 9303 | return get_error_union_type(ira->codegen, err_set_type, slice_type); | 9303 | return get_error_union_type(ira->codegen, err_set_type, slice_type); |
| 9304 | } else { | 9304 | } else { |
| ... | @@ -9343,7 +9343,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod | ... | @@ -9343,7 +9343,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 9343 | } | 9343 | } |
| 9344 | } | 9344 | } |
| 9345 | | 9345 | |
| 9346 | static void ir_add_alloca(IrAnalyze *ira, IrInstruction *instruction, TypeTableEntry *type_entry) { | 9346 | static void ir_add_alloca(IrAnalyze *ira, IrInstruction *instruction, ZigType *type_entry) { |
| 9347 | if (type_has_bits(type_entry) && handle_is_ptr(type_entry)) { | 9347 | if (type_has_bits(type_entry) && handle_is_ptr(type_entry)) { |
| 9348 | FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec); | 9348 | FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec); |
| 9349 | if (fn_entry != nullptr) { | 9349 | if (fn_entry != nullptr) { |
| ... | @@ -9366,8 +9366,8 @@ static void copy_const_val(ConstExprValue *dest, ConstExprValue *src, bool same_ | ... | @@ -9366,8 +9366,8 @@ static void copy_const_val(ConstExprValue *dest, ConstExprValue *src, bool same_ |
| 9366 | | 9366 | |
| 9367 | static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_instr, | 9367 | static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_instr, |
| 9368 | CastOp cast_op, | 9368 | CastOp cast_op, |
| 9369 | ConstExprValue *other_val, TypeTableEntry *other_type, | 9369 | ConstExprValue *other_val, ZigType *other_type, |
| 9370 | ConstExprValue *const_val, TypeTableEntry *new_type) | 9370 | ConstExprValue *const_val, ZigType *new_type) |
| 9371 | { | 9371 | { |
| 9372 | const_val->special = other_val->special; | 9372 | const_val->special = other_val->special; |
| 9373 | | 9373 | |
| ... | @@ -9467,7 +9467,7 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_ | ... | @@ -9467,7 +9467,7 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_ |
| 9467 | return true; | 9467 | return true; |
| 9468 | } | 9468 | } |
| 9469 | static IrInstruction *ir_resolve_cast(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, | 9469 | static IrInstruction *ir_resolve_cast(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, |
| 9470 | TypeTableEntry *wanted_type, CastOp cast_op, bool need_alloca) | 9470 | ZigType *wanted_type, CastOp cast_op, bool need_alloca) |
| 9471 | { | 9471 | { |
| 9472 | if ((instr_is_comptime(value) || !type_has_bits(wanted_type)) && | 9472 | if ((instr_is_comptime(value) || !type_has_bits(wanted_type)) && |
| 9473 | cast_op != CastOpResizeSlice && cast_op != CastOpBytesToSlice) | 9473 | cast_op != CastOpResizeSlice && cast_op != CastOpBytesToSlice) |
| ... | @@ -9491,7 +9491,7 @@ static IrInstruction *ir_resolve_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -9491,7 +9491,7 @@ static IrInstruction *ir_resolve_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 9491 | } | 9491 | } |
| 9492 | | 9492 | |
| 9493 | static IrInstruction *ir_resolve_ptr_of_array_to_unknown_len_ptr(IrAnalyze *ira, IrInstruction *source_instr, | 9493 | static IrInstruction *ir_resolve_ptr_of_array_to_unknown_len_ptr(IrAnalyze *ira, IrInstruction *source_instr, |
| 9494 | IrInstruction *value, TypeTableEntry *wanted_type) | 9494 | IrInstruction *value, ZigType *wanted_type) |
| 9495 | { | 9495 | { |
| 9496 | assert(value->value.type->id == TypeTableEntryIdPointer); | 9496 | assert(value->value.type->id == TypeTableEntryIdPointer); |
| 9497 | wanted_type = adjust_ptr_align(ira->codegen, wanted_type, value->value.type->data.pointer.alignment); | 9497 | wanted_type = adjust_ptr_align(ira->codegen, wanted_type, value->value.type->data.pointer.alignment); |
| ... | @@ -9520,7 +9520,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_unknown_len_ptr(IrAnalyze *ira, | ... | @@ -9520,7 +9520,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_unknown_len_ptr(IrAnalyze *ira, |
| 9520 | } | 9520 | } |
| 9521 | | 9521 | |
| 9522 | static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruction *source_instr, | 9522 | static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruction *source_instr, |
| 9523 | IrInstruction *value, TypeTableEntry *wanted_type) | 9523 | IrInstruction *value, ZigType *wanted_type) |
| 9524 | { | 9524 | { |
| 9525 | wanted_type = adjust_slice_align(ira->codegen, wanted_type, value->value.type->data.pointer.alignment); | 9525 | wanted_type = adjust_slice_align(ira->codegen, wanted_type, value->value.type->data.pointer.alignment); |
| 9526 | | 9526 | |
| ... | @@ -9530,7 +9530,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc | ... | @@ -9530,7 +9530,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc |
| 9530 | return ira->codegen->invalid_instruction; | 9530 | return ira->codegen->invalid_instruction; |
| 9531 | if (pointee->special != ConstValSpecialRuntime) { | 9531 | if (pointee->special != ConstValSpecialRuntime) { |
| 9532 | assert(value->value.type->id == TypeTableEntryIdPointer); | 9532 | assert(value->value.type->id == TypeTableEntryIdPointer); |
| 9533 | TypeTableEntry *array_type = value->value.type->data.pointer.child_type; | 9533 | ZigType *array_type = value->value.type->data.pointer.child_type; |
| 9534 | assert(is_slice(wanted_type)); | 9534 | assert(is_slice(wanted_type)); |
| 9535 | bool is_const = wanted_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const; | 9535 | bool is_const = wanted_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const; |
| 9536 | | 9536 | |
| ... | @@ -9551,7 +9551,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc | ... | @@ -9551,7 +9551,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc |
| 9551 | return result; | 9551 | return result; |
| 9552 | } | 9552 | } |
| 9553 | | 9553 | |
| 9554 | static bool is_container(TypeTableEntry *type) { | 9554 | static bool is_container(ZigType *type) { |
| 9555 | return type->id == TypeTableEntryIdStruct || | 9555 | return type->id == TypeTableEntryIdStruct || |
| 9556 | type->id == TypeTableEntryIdEnum || | 9556 | type->id == TypeTableEntryIdEnum || |
| 9557 | type->id == TypeTableEntryIdUnion; | 9557 | type->id == TypeTableEntryIdUnion; |
| ... | @@ -9630,7 +9630,7 @@ static void ir_finish_bb(IrAnalyze *ira) { | ... | @@ -9630,7 +9630,7 @@ static void ir_finish_bb(IrAnalyze *ira) { |
| 9630 | } | 9630 | } |
| 9631 | } | 9631 | } |
| 9632 | | 9632 | |
| 9633 | static TypeTableEntry *ir_unreach_error(IrAnalyze *ira) { | 9633 | static ZigType *ir_unreach_error(IrAnalyze *ira) { |
| 9634 | ira->old_bb_index = SIZE_MAX; | 9634 | ira->old_bb_index = SIZE_MAX; |
| 9635 | ira->new_irb.exec->invalid = true; | 9635 | ira->new_irb.exec->invalid = true; |
| 9636 | return ira->codegen->builtin_types.entry_unreachable; | 9636 | return ira->codegen->builtin_types.entry_unreachable; |
| ... | @@ -9653,7 +9653,7 @@ static bool ir_emit_backward_branch(IrAnalyze *ira, IrInstruction *source_instru | ... | @@ -9653,7 +9653,7 @@ static bool ir_emit_backward_branch(IrAnalyze *ira, IrInstruction *source_instru |
| 9653 | return true; | 9653 | return true; |
| 9654 | } | 9654 | } |
| 9655 | | 9655 | |
| 9656 | static TypeTableEntry *ir_inline_bb(IrAnalyze *ira, IrInstruction *source_instruction, IrBasicBlock *old_bb) { | 9656 | static ZigType *ir_inline_bb(IrAnalyze *ira, IrInstruction *source_instruction, IrBasicBlock *old_bb) { |
| 9657 | if (old_bb->debug_id <= ira->old_irb.current_basic_block->debug_id) { | 9657 | if (old_bb->debug_id <= ira->old_irb.current_basic_block->debug_id) { |
| 9658 | if (!ir_emit_backward_branch(ira, source_instruction)) | 9658 | if (!ir_emit_backward_branch(ira, source_instruction)) |
| 9659 | return ir_unreach_error(ira); | 9659 | return ir_unreach_error(ira); |
| ... | @@ -9664,7 +9664,7 @@ static TypeTableEntry *ir_inline_bb(IrAnalyze *ira, IrInstruction *source_instru | ... | @@ -9664,7 +9664,7 @@ static TypeTableEntry *ir_inline_bb(IrAnalyze *ira, IrInstruction *source_instru |
| 9664 | return ira->codegen->builtin_types.entry_unreachable; | 9664 | return ira->codegen->builtin_types.entry_unreachable; |
| 9665 | } | 9665 | } |
| 9666 | | 9666 | |
| 9667 | static TypeTableEntry *ir_finish_anal(IrAnalyze *ira, TypeTableEntry *result_type) { | 9667 | static ZigType *ir_finish_anal(IrAnalyze *ira, ZigType *result_type) { |
| 9668 | if (result_type->id == TypeTableEntryIdUnreachable) | 9668 | if (result_type->id == TypeTableEntryIdUnreachable) |
| 9669 | ir_finish_bb(ira); | 9669 | ir_finish_bb(ira); |
| 9670 | return result_type; | 9670 | return result_type; |
| ... | @@ -9684,16 +9684,16 @@ static ConstExprValue *ir_build_const_from(IrAnalyze *ira, IrInstruction *old_in | ... | @@ -9684,16 +9684,16 @@ static ConstExprValue *ir_build_const_from(IrAnalyze *ira, IrInstruction *old_in |
| 9684 | return &new_instruction->value; | 9684 | return &new_instruction->value; |
| 9685 | } | 9685 | } |
| 9686 | | 9686 | |
| 9687 | static TypeTableEntry *ir_analyze_void(IrAnalyze *ira, IrInstruction *instruction) { | 9687 | static ZigType *ir_analyze_void(IrAnalyze *ira, IrInstruction *instruction) { |
| 9688 | ir_build_const_from(ira, instruction); | 9688 | ir_build_const_from(ira, instruction); |
| 9689 | return ira->codegen->builtin_types.entry_void; | 9689 | return ira->codegen->builtin_types.entry_void; |
| 9690 | } | 9690 | } |
| 9691 | | 9691 | |
| 9692 | static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instruction, | 9692 | static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instruction, |
| 9693 | ConstExprValue *pointee, TypeTableEntry *pointee_type, | 9693 | ConstExprValue *pointee, ZigType *pointee_type, |
| 9694 | ConstPtrMut ptr_mut, bool ptr_is_const, bool ptr_is_volatile, uint32_t ptr_align) | 9694 | ConstPtrMut ptr_mut, bool ptr_is_const, bool ptr_is_volatile, uint32_t ptr_align) |
| 9695 | { | 9695 | { |
| 9696 | TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, pointee_type, | 9696 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, pointee_type, |
| 9697 | ptr_is_const, ptr_is_volatile, PtrLenSingle, ptr_align, 0, 0); | 9697 | ptr_is_const, ptr_is_volatile, PtrLenSingle, ptr_align, 0, 0); |
| 9698 | IrInstruction *const_instr = ir_get_const(ira, instruction); | 9698 | IrInstruction *const_instr = ir_get_const(ira, instruction); |
| 9699 | ConstExprValue *const_val = &const_instr->value; | 9699 | ConstExprValue *const_val = &const_instr->value; |
| ... | @@ -9704,8 +9704,8 @@ static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instructio | ... | @@ -9704,8 +9704,8 @@ static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instructio |
| 9704 | return const_instr; | 9704 | return const_instr; |
| 9705 | } | 9705 | } |
| 9706 | | 9706 | |
| 9707 | static TypeTableEntry *ir_analyze_const_ptr(IrAnalyze *ira, IrInstruction *instruction, | 9707 | static ZigType *ir_analyze_const_ptr(IrAnalyze *ira, IrInstruction *instruction, |
| 9708 | ConstExprValue *pointee, TypeTableEntry *pointee_type, | 9708 | ConstExprValue *pointee, ZigType *pointee_type, |
| 9709 | ConstPtrMut ptr_mut, bool ptr_is_const, bool ptr_is_volatile) | 9709 | ConstPtrMut ptr_mut, bool ptr_is_const, bool ptr_is_volatile) |
| 9710 | { | 9710 | { |
| 9711 | IrInstruction *const_instr = ir_get_const_ptr(ira, instruction, pointee, | 9711 | IrInstruction *const_instr = ir_get_const_ptr(ira, instruction, pointee, |
| ... | @@ -9715,7 +9715,7 @@ static TypeTableEntry *ir_analyze_const_ptr(IrAnalyze *ira, IrInstruction *instr | ... | @@ -9715,7 +9715,7 @@ static TypeTableEntry *ir_analyze_const_ptr(IrAnalyze *ira, IrInstruction *instr |
| 9715 | return const_instr->value.type; | 9715 | return const_instr->value.type; |
| 9716 | } | 9716 | } |
| 9717 | | 9717 | |
| 9718 | static TypeTableEntry *ir_analyze_const_usize(IrAnalyze *ira, IrInstruction *instruction, uint64_t value) { | 9718 | static ZigType *ir_analyze_const_usize(IrAnalyze *ira, IrInstruction *instruction, uint64_t value) { |
| 9719 | ConstExprValue *const_val = ir_build_const_from(ira, instruction); | 9719 | ConstExprValue *const_val = ir_build_const_from(ira, instruction); |
| 9720 | bigint_init_unsigned(&const_val->data.x_bigint, value); | 9720 | bigint_init_unsigned(&const_val->data.x_bigint, value); |
| 9721 | return ira->codegen->builtin_types.entry_usize; | 9721 | return ira->codegen->builtin_types.entry_usize; |
| ... | @@ -9748,7 +9748,7 @@ static ConstExprValue *ir_resolve_const(IrAnalyze *ira, IrInstruction *value, Un | ... | @@ -9748,7 +9748,7 @@ static ConstExprValue *ir_resolve_const(IrAnalyze *ira, IrInstruction *value, Un |
| 9748 | } | 9748 | } |
| 9749 | | 9749 | |
| 9750 | IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node, | 9750 | IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node, |
| 9751 | TypeTableEntry *expected_type, size_t *backward_branch_count, size_t backward_branch_quota, | 9751 | ZigType *expected_type, size_t *backward_branch_count, size_t backward_branch_quota, |
| 9752 | FnTableEntry *fn_entry, Buf *c_import_buf, AstNode *source_node, Buf *exec_name, | 9752 | FnTableEntry *fn_entry, Buf *c_import_buf, AstNode *source_node, Buf *exec_name, |
| 9753 | IrExecutable *parent_exec) | 9753 | IrExecutable *parent_exec) |
| 9754 | { | 9754 | { |
| ... | @@ -9786,7 +9786,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node | ... | @@ -9786,7 +9786,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node |
| 9786 | analyzed_executable->backward_branch_count = backward_branch_count; | 9786 | analyzed_executable->backward_branch_count = backward_branch_count; |
| 9787 | analyzed_executable->backward_branch_quota = backward_branch_quota; | 9787 | analyzed_executable->backward_branch_quota = backward_branch_quota; |
| 9788 | analyzed_executable->begin_scope = scope; | 9788 | analyzed_executable->begin_scope = scope; |
| 9789 | TypeTableEntry *result_type = ir_analyze(codegen, ir_executable, analyzed_executable, expected_type, node); | 9789 | ZigType *result_type = ir_analyze(codegen, ir_executable, analyzed_executable, expected_type, node); |
| 9790 | if (type_is_invalid(result_type)) | 9790 | if (type_is_invalid(result_type)) |
| 9791 | return codegen->invalid_instruction; | 9791 | return codegen->invalid_instruction; |
| 9792 | | 9792 | |
| ... | @@ -9799,7 +9799,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node | ... | @@ -9799,7 +9799,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node |
| 9799 | return ir_exec_const_result(codegen, analyzed_executable); | 9799 | return ir_exec_const_result(codegen, analyzed_executable); |
| 9800 | } | 9800 | } |
| 9801 | | 9801 | |
| 9802 | static TypeTableEntry *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) { | 9802 | static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) { |
| 9803 | if (type_is_invalid(type_value->value.type)) | 9803 | if (type_is_invalid(type_value->value.type)) |
| 9804 | return ira->codegen->builtin_types.entry_invalid; | 9804 | return ira->codegen->builtin_types.entry_invalid; |
| 9805 | | 9805 | |
| ... | @@ -9837,11 +9837,11 @@ static FnTableEntry *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) { | ... | @@ -9837,11 +9837,11 @@ static FnTableEntry *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) { |
| 9837 | return const_val->data.x_ptr.data.fn.fn_entry; | 9837 | return const_val->data.x_ptr.data.fn.fn_entry; |
| 9838 | } | 9838 | } |
| 9839 | | 9839 | |
| 9840 | static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, TypeTableEntry *wanted_type) { | 9840 | static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, ZigType *wanted_type) { |
| 9841 | assert(wanted_type->id == TypeTableEntryIdOptional); | 9841 | assert(wanted_type->id == TypeTableEntryIdOptional); |
| 9842 | | 9842 | |
| 9843 | if (instr_is_comptime(value)) { | 9843 | if (instr_is_comptime(value)) { |
| 9844 | TypeTableEntry *payload_type = wanted_type->data.maybe.child_type; | 9844 | ZigType *payload_type = wanted_type->data.maybe.child_type; |
| 9845 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); | 9845 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); |
| 9846 | if (type_is_invalid(casted_payload->value.type)) | 9846 | if (type_is_invalid(casted_payload->value.type)) |
| 9847 | return ira->codegen->invalid_instruction; | 9847 | return ira->codegen->invalid_instruction; |
| ... | @@ -9870,12 +9870,12 @@ static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *sourc | ... | @@ -9870,12 +9870,12 @@ static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *sourc |
| 9870 | } | 9870 | } |
| 9871 | | 9871 | |
| 9872 | static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction *source_instr, | 9872 | static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction *source_instr, |
| 9873 | IrInstruction *value, TypeTableEntry *wanted_type) | 9873 | IrInstruction *value, ZigType *wanted_type) |
| 9874 | { | 9874 | { |
| 9875 | assert(wanted_type->id == TypeTableEntryIdErrorUnion); | 9875 | assert(wanted_type->id == TypeTableEntryIdErrorUnion); |
| 9876 | | 9876 | |
| 9877 | if (instr_is_comptime(value)) { | 9877 | if (instr_is_comptime(value)) { |
| 9878 | TypeTableEntry *payload_type = wanted_type->data.error_union.payload_type; | 9878 | ZigType *payload_type = wanted_type->data.error_union.payload_type; |
| 9879 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); | 9879 | IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type); |
| 9880 | if (type_is_invalid(casted_payload->value.type)) | 9880 | if (type_is_invalid(casted_payload->value.type)) |
| 9881 | return ira->codegen->invalid_instruction; | 9881 | return ira->codegen->invalid_instruction; |
| ... | @@ -9901,7 +9901,7 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction | ... | @@ -9901,7 +9901,7 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction |
| 9901 | } | 9901 | } |
| 9902 | | 9902 | |
| 9903 | static IrInstruction *ir_analyze_err_set_cast(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, | 9903 | static IrInstruction *ir_analyze_err_set_cast(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, |
| 9904 | TypeTableEntry *wanted_type) | 9904 | ZigType *wanted_type) |
| 9905 | { | 9905 | { |
| 9906 | assert(value->value.type->id == TypeTableEntryIdErrorSet); | 9906 | assert(value->value.type->id == TypeTableEntryIdErrorSet); |
| 9907 | assert(wanted_type->id == TypeTableEntryIdErrorSet); | 9907 | assert(wanted_type->id == TypeTableEntryIdErrorSet); |
| ... | @@ -9943,7 +9943,7 @@ static IrInstruction *ir_analyze_err_set_cast(IrAnalyze *ira, IrInstruction *sou | ... | @@ -9943,7 +9943,7 @@ static IrInstruction *ir_analyze_err_set_cast(IrAnalyze *ira, IrInstruction *sou |
| 9943 | return result; | 9943 | return result; |
| 9944 | } | 9944 | } |
| 9945 | | 9945 | |
| 9946 | static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, TypeTableEntry *wanted_type) { | 9946 | static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, ZigType *wanted_type) { |
| 9947 | assert(wanted_type->id == TypeTableEntryIdErrorUnion); | 9947 | assert(wanted_type->id == TypeTableEntryIdErrorUnion); |
| 9948 | | 9948 | |
| 9949 | IrInstruction *casted_value = ir_implicit_cast(ira, value, wanted_type->data.error_union.err_set_type); | 9949 | IrInstruction *casted_value = ir_implicit_cast(ira, value, wanted_type->data.error_union.err_set_type); |
| ... | @@ -9970,7 +9970,7 @@ static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *so | ... | @@ -9970,7 +9970,7 @@ static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *so |
| 9970 | } | 9970 | } |
| 9971 | | 9971 | |
| 9972 | static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_instr, | 9972 | static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_instr, |
| 9973 | IrInstruction *value, TypeTableEntry *wanted_type) | 9973 | IrInstruction *value, ZigType *wanted_type) |
| 9974 | { | 9974 | { |
| 9975 | if (instr_is_comptime(value)) { | 9975 | if (instr_is_comptime(value)) { |
| 9976 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); | 9976 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); |
| ... | @@ -9994,7 +9994,7 @@ static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_ | ... | @@ -9994,7 +9994,7 @@ static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_ |
| 9994 | source_instr->source_node, value, true, false); | 9994 | source_instr->source_node, value, true, false); |
| 9995 | new_instruction->value.type = wanted_type; | 9995 | new_instruction->value.type = wanted_type; |
| 9996 | | 9996 | |
| 9997 | TypeTableEntry *child_type = wanted_type->data.pointer.child_type; | 9997 | ZigType *child_type = wanted_type->data.pointer.child_type; |
| 9998 | if (type_has_bits(child_type)) { | 9998 | if (type_has_bits(child_type)) { |
| 9999 | FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec); | 9999 | FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec); |
| 10000 | assert(fn_entry); | 10000 | assert(fn_entry); |
| ... | @@ -10005,7 +10005,7 @@ static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_ | ... | @@ -10005,7 +10005,7 @@ static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_ |
| 10005 | } | 10005 | } |
| 10006 | } | 10006 | } |
| 10007 | | 10007 | |
| 10008 | static IrInstruction *ir_analyze_null_to_maybe(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, TypeTableEntry *wanted_type) { | 10008 | static IrInstruction *ir_analyze_null_to_maybe(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, ZigType *wanted_type) { |
| 10009 | assert(wanted_type->id == TypeTableEntryIdOptional); | 10009 | assert(wanted_type->id == TypeTableEntryIdOptional); |
| 10010 | assert(instr_is_comptime(value)); | 10010 | assert(instr_is_comptime(value)); |
| 10011 | | 10011 | |
| ... | @@ -10039,7 +10039,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi | ... | @@ -10039,7 +10039,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi |
| 10039 | get_abi_alignment(ira->codegen, value->value.type)); | 10039 | get_abi_alignment(ira->codegen, value->value.type)); |
| 10040 | } | 10040 | } |
| 10041 | | 10041 | |
| 10042 | TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, value->value.type, | 10042 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, value->value.type, |
| 10043 | is_const, is_volatile, PtrLenSingle, get_abi_alignment(ira->codegen, value->value.type), 0, 0); | 10043 | is_const, is_volatile, PtrLenSingle, get_abi_alignment(ira->codegen, value->value.type), 0, 0); |
| 10044 | IrInstruction *new_instruction = ir_build_ref(&ira->new_irb, source_instruction->scope, | 10044 | IrInstruction *new_instruction = ir_build_ref(&ira->new_irb, source_instruction->scope, |
| 10045 | source_instruction->source_node, value, is_const, is_volatile); | 10045 | source_instruction->source_node, value, is_const, is_volatile); |
| ... | @@ -10054,7 +10054,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi | ... | @@ -10054,7 +10054,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi |
| 10054 | } | 10054 | } |
| 10055 | | 10055 | |
| 10056 | static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *source_instr, | 10056 | static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *source_instr, |
| 10057 | IrInstruction *array_arg, TypeTableEntry *wanted_type) | 10057 | IrInstruction *array_arg, ZigType *wanted_type) |
| 10058 | { | 10058 | { |
| 10059 | assert(is_slice(wanted_type)); | 10059 | assert(is_slice(wanted_type)); |
| 10060 | // In this function we honor the const-ness of wanted_type, because | 10060 | // In this function we honor the const-ness of wanted_type, because |
| ... | @@ -10068,7 +10068,7 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s | ... | @@ -10068,7 +10068,7 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s |
| 10068 | } else { | 10068 | } else { |
| 10069 | array = array_arg; | 10069 | array = array_arg; |
| 10070 | } | 10070 | } |
| 10071 | TypeTableEntry *array_type = array->value.type; | 10071 | ZigType *array_type = array->value.type; |
| 10072 | assert(array_type->id == TypeTableEntryIdArray); | 10072 | assert(array_type->id == TypeTableEntryIdArray); |
| 10073 | | 10073 | |
| 10074 | if (instr_is_comptime(array)) { | 10074 | if (instr_is_comptime(array)) { |
| ... | @@ -10100,12 +10100,12 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s | ... | @@ -10100,12 +10100,12 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s |
| 10100 | } | 10100 | } |
| 10101 | | 10101 | |
| 10102 | static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *source_instr, | 10102 | static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *source_instr, |
| 10103 | IrInstruction *target, TypeTableEntry *wanted_type) | 10103 | IrInstruction *target, ZigType *wanted_type) |
| 10104 | { | 10104 | { |
| 10105 | Error err; | 10105 | Error err; |
| 10106 | assert(wanted_type->id == TypeTableEntryIdInt); | 10106 | assert(wanted_type->id == TypeTableEntryIdInt); |
| 10107 | | 10107 | |
| 10108 | TypeTableEntry *actual_type = target->value.type; | 10108 | ZigType *actual_type = target->value.type; |
| 10109 | if ((err = ensure_complete_type(ira->codegen, actual_type))) | 10109 | if ((err = ensure_complete_type(ira->codegen, actual_type))) |
| 10110 | return ira->codegen->invalid_instruction; | 10110 | return ira->codegen->invalid_instruction; |
| 10111 | | 10111 | |
| ... | @@ -10136,7 +10136,7 @@ static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *sour | ... | @@ -10136,7 +10136,7 @@ static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *sour |
| 10136 | } | 10136 | } |
| 10137 | | 10137 | |
| 10138 | static IrInstruction *ir_analyze_union_to_tag(IrAnalyze *ira, IrInstruction *source_instr, | 10138 | static IrInstruction *ir_analyze_union_to_tag(IrAnalyze *ira, IrInstruction *source_instr, |
| 10139 | IrInstruction *target, TypeTableEntry *wanted_type) | 10139 | IrInstruction *target, ZigType *wanted_type) |
| 10140 | { | 10140 | { |
| 10141 | assert(target->value.type->id == TypeTableEntryIdUnion); | 10141 | assert(target->value.type->id == TypeTableEntryIdUnion); |
| 10142 | assert(wanted_type->id == TypeTableEntryIdEnum); | 10142 | assert(wanted_type->id == TypeTableEntryIdEnum); |
| ... | @@ -10161,7 +10161,7 @@ static IrInstruction *ir_analyze_union_to_tag(IrAnalyze *ira, IrInstruction *sou | ... | @@ -10161,7 +10161,7 @@ static IrInstruction *ir_analyze_union_to_tag(IrAnalyze *ira, IrInstruction *sou |
| 10161 | } | 10161 | } |
| 10162 | | 10162 | |
| 10163 | static IrInstruction *ir_analyze_undefined_to_anything(IrAnalyze *ira, IrInstruction *source_instr, | 10163 | static IrInstruction *ir_analyze_undefined_to_anything(IrAnalyze *ira, IrInstruction *source_instr, |
| 10164 | IrInstruction *target, TypeTableEntry *wanted_type) | 10164 | IrInstruction *target, ZigType *wanted_type) |
| 10165 | { | 10165 | { |
| 10166 | IrInstruction *result = ir_create_const(&ira->new_irb, source_instr->scope, | 10166 | IrInstruction *result = ir_create_const(&ira->new_irb, source_instr->scope, |
| 10167 | source_instr->source_node, wanted_type); | 10167 | source_instr->source_node, wanted_type); |
| ... | @@ -10170,7 +10170,7 @@ static IrInstruction *ir_analyze_undefined_to_anything(IrAnalyze *ira, IrInstruc | ... | @@ -10170,7 +10170,7 @@ static IrInstruction *ir_analyze_undefined_to_anything(IrAnalyze *ira, IrInstruc |
| 10170 | } | 10170 | } |
| 10171 | | 10171 | |
| 10172 | static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *source_instr, | 10172 | static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *source_instr, |
| 10173 | IrInstruction *target, TypeTableEntry *wanted_type) | 10173 | IrInstruction *target, ZigType *wanted_type) |
| 10174 | { | 10174 | { |
| 10175 | Error err; | 10175 | Error err; |
| 10176 | assert(wanted_type->id == TypeTableEntryIdUnion); | 10176 | assert(wanted_type->id == TypeTableEntryIdUnion); |
| ... | @@ -10229,7 +10229,7 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so | ... | @@ -10229,7 +10229,7 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so |
| 10229 | } | 10229 | } |
| 10230 | | 10230 | |
| 10231 | static IrInstruction *ir_analyze_widen_or_shorten(IrAnalyze *ira, IrInstruction *source_instr, | 10231 | static IrInstruction *ir_analyze_widen_or_shorten(IrAnalyze *ira, IrInstruction *source_instr, |
| 10232 | IrInstruction *target, TypeTableEntry *wanted_type) | 10232 | IrInstruction *target, ZigType *wanted_type) |
| 10233 | { | 10233 | { |
| 10234 | assert(wanted_type->id == TypeTableEntryIdInt || wanted_type->id == TypeTableEntryIdFloat); | 10234 | assert(wanted_type->id == TypeTableEntryIdInt || wanted_type->id == TypeTableEntryIdFloat); |
| 10235 | | 10235 | |
| ... | @@ -10270,12 +10270,12 @@ static IrInstruction *ir_analyze_widen_or_shorten(IrAnalyze *ira, IrInstruction | ... | @@ -10270,12 +10270,12 @@ static IrInstruction *ir_analyze_widen_or_shorten(IrAnalyze *ira, IrInstruction |
| 10270 | } | 10270 | } |
| 10271 | | 10271 | |
| 10272 | static IrInstruction *ir_analyze_int_to_enum(IrAnalyze *ira, IrInstruction *source_instr, | 10272 | static IrInstruction *ir_analyze_int_to_enum(IrAnalyze *ira, IrInstruction *source_instr, |
| 10273 | IrInstruction *target, TypeTableEntry *wanted_type) | 10273 | IrInstruction *target, ZigType *wanted_type) |
| 10274 | { | 10274 | { |
| 10275 | Error err; | 10275 | Error err; |
| 10276 | assert(wanted_type->id == TypeTableEntryIdEnum); | 10276 | assert(wanted_type->id == TypeTableEntryIdEnum); |
| 10277 | | 10277 | |
| 10278 | TypeTableEntry *actual_type = target->value.type; | 10278 | ZigType *actual_type = target->value.type; |
| 10279 | | 10279 | |
| 10280 | if ((err = ensure_complete_type(ira->codegen, wanted_type))) | 10280 | if ((err = ensure_complete_type(ira->codegen, wanted_type))) |
| 10281 | return ira->codegen->invalid_instruction; | 10281 | return ira->codegen->invalid_instruction; |
| ... | @@ -10320,7 +10320,7 @@ static IrInstruction *ir_analyze_int_to_enum(IrAnalyze *ira, IrInstruction *sour | ... | @@ -10320,7 +10320,7 @@ static IrInstruction *ir_analyze_int_to_enum(IrAnalyze *ira, IrInstruction *sour |
| 10320 | } | 10320 | } |
| 10321 | | 10321 | |
| 10322 | static IrInstruction *ir_analyze_number_to_literal(IrAnalyze *ira, IrInstruction *source_instr, | 10322 | static IrInstruction *ir_analyze_number_to_literal(IrAnalyze *ira, IrInstruction *source_instr, |
| 10323 | IrInstruction *target, TypeTableEntry *wanted_type) | 10323 | IrInstruction *target, ZigType *wanted_type) |
| 10324 | { | 10324 | { |
| 10325 | ConstExprValue *val = ir_resolve_const(ira, target, UndefBad); | 10325 | ConstExprValue *val = ir_resolve_const(ira, target, UndefBad); |
| 10326 | if (!val) | 10326 | if (!val) |
| ... | @@ -10339,7 +10339,7 @@ static IrInstruction *ir_analyze_number_to_literal(IrAnalyze *ira, IrInstruction | ... | @@ -10339,7 +10339,7 @@ static IrInstruction *ir_analyze_number_to_literal(IrAnalyze *ira, IrInstruction |
| 10339 | } | 10339 | } |
| 10340 | | 10340 | |
| 10341 | static IrInstruction *ir_analyze_int_to_err(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target, | 10341 | static IrInstruction *ir_analyze_int_to_err(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target, |
| 10342 | TypeTableEntry *wanted_type) | 10342 | ZigType *wanted_type) |
| 10343 | { | 10343 | { |
| 10344 | assert(target->value.type->id == TypeTableEntryIdInt); | 10344 | assert(target->value.type->id == TypeTableEntryIdInt); |
| 10345 | assert(!target->value.type->data.integral.is_signed); | 10345 | assert(!target->value.type->data.integral.is_signed); |
| ... | @@ -10404,11 +10404,11 @@ static IrInstruction *ir_analyze_int_to_err(IrAnalyze *ira, IrInstruction *sourc | ... | @@ -10404,11 +10404,11 @@ static IrInstruction *ir_analyze_int_to_err(IrAnalyze *ira, IrInstruction *sourc |
| 10404 | } | 10404 | } |
| 10405 | | 10405 | |
| 10406 | static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target, | 10406 | static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target, |
| 10407 | TypeTableEntry *wanted_type) | 10407 | ZigType *wanted_type) |
| 10408 | { | 10408 | { |
| 10409 | assert(wanted_type->id == TypeTableEntryIdInt); | 10409 | assert(wanted_type->id == TypeTableEntryIdInt); |
| 10410 | | 10410 | |
| 10411 | TypeTableEntry *err_type = target->value.type; | 10411 | ZigType *err_type = target->value.type; |
| 10412 | | 10412 | |
| 10413 | if (instr_is_comptime(target)) { | 10413 | if (instr_is_comptime(target)) { |
| 10414 | ConstExprValue *val = ir_resolve_const(ira, target, UndefBad); | 10414 | ConstExprValue *val = ir_resolve_const(ira, target, UndefBad); |
| ... | @@ -10442,7 +10442,7 @@ static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *sourc | ... | @@ -10442,7 +10442,7 @@ static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *sourc |
| 10442 | return result; | 10442 | return result; |
| 10443 | } | 10443 | } |
| 10444 | | 10444 | |
| 10445 | TypeTableEntry *err_set_type; | 10445 | ZigType *err_set_type; |
| 10446 | if (err_type->id == TypeTableEntryIdErrorUnion) { | 10446 | if (err_type->id == TypeTableEntryIdErrorUnion) { |
| 10447 | err_set_type = err_type->data.error_union.err_set_type; | 10447 | err_set_type = err_type->data.error_union.err_set_type; |
| 10448 | } else if (err_type->id == TypeTableEntryIdErrorSet) { | 10448 | } else if (err_type->id == TypeTableEntryIdErrorSet) { |
| ... | @@ -10484,11 +10484,11 @@ static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *sourc | ... | @@ -10484,11 +10484,11 @@ static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *sourc |
| 10484 | } | 10484 | } |
| 10485 | | 10485 | |
| 10486 | static IrInstruction *ir_analyze_ptr_to_array(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target, | 10486 | static IrInstruction *ir_analyze_ptr_to_array(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target, |
| 10487 | TypeTableEntry *wanted_type) | 10487 | ZigType *wanted_type) |
| 10488 | { | 10488 | { |
| 10489 | assert(wanted_type->id == TypeTableEntryIdPointer); | 10489 | assert(wanted_type->id == TypeTableEntryIdPointer); |
| 10490 | wanted_type = adjust_ptr_align(ira->codegen, wanted_type, target->value.type->data.pointer.alignment); | 10490 | wanted_type = adjust_ptr_align(ira->codegen, wanted_type, target->value.type->data.pointer.alignment); |
| 10491 | TypeTableEntry *array_type = wanted_type->data.pointer.child_type; | 10491 | ZigType *array_type = wanted_type->data.pointer.child_type; |
| 10492 | assert(array_type->id == TypeTableEntryIdArray); | 10492 | assert(array_type->id == TypeTableEntryIdArray); |
| 10493 | assert(array_type->data.array.len == 1); | 10493 | assert(array_type->data.array.len == 1); |
| 10494 | | 10494 | |
| ... | @@ -10620,10 +10620,10 @@ static void report_recursive_error(IrAnalyze *ira, AstNode *source_node, ConstCa | ... | @@ -10620,10 +10620,10 @@ static void report_recursive_error(IrAnalyze *ira, AstNode *source_node, ConstCa |
| 10620 | } | 10620 | } |
| 10621 | | 10621 | |
| 10622 | static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_instr, | 10622 | static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_instr, |
| 10623 | TypeTableEntry *wanted_type, IrInstruction *value) | 10623 | ZigType *wanted_type, IrInstruction *value) |
| 10624 | { | 10624 | { |
| 10625 | Error err; | 10625 | Error err; |
| 10626 | TypeTableEntry *actual_type = value->value.type; | 10626 | ZigType *actual_type = value->value.type; |
| 10627 | AstNode *source_node = source_instr->source_node; | 10627 | AstNode *source_node = source_instr->source_node; |
| 10628 | | 10628 | |
| 10629 | if (type_is_invalid(wanted_type) || type_is_invalid(actual_type)) { | 10629 | if (type_is_invalid(wanted_type) || type_is_invalid(actual_type)) { |
| ... | @@ -10665,7 +10665,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10665,7 +10665,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10665 | | 10665 | |
| 10666 | // cast from [N]T to []const T | 10666 | // cast from [N]T to []const T |
| 10667 | if (is_slice(wanted_type) && actual_type->id == TypeTableEntryIdArray) { | 10667 | if (is_slice(wanted_type) && actual_type->id == TypeTableEntryIdArray) { |
| 10668 | TypeTableEntry *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; | 10668 | ZigType *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; |
| 10669 | assert(ptr_type->id == TypeTableEntryIdPointer); | 10669 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 10670 | if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) && | 10670 | if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) && |
| 10671 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type, | 10671 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type, |
| ... | @@ -10681,10 +10681,10 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10681,10 +10681,10 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10681 | actual_type->data.pointer.is_const && | 10681 | actual_type->data.pointer.is_const && |
| 10682 | actual_type->data.pointer.child_type->id == TypeTableEntryIdArray) | 10682 | actual_type->data.pointer.child_type->id == TypeTableEntryIdArray) |
| 10683 | { | 10683 | { |
| 10684 | TypeTableEntry *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; | 10684 | ZigType *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; |
| 10685 | assert(ptr_type->id == TypeTableEntryIdPointer); | 10685 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 10686 | | 10686 | |
| 10687 | TypeTableEntry *array_type = actual_type->data.pointer.child_type; | 10687 | ZigType *array_type = actual_type->data.pointer.child_type; |
| 10688 | | 10688 | |
| 10689 | if ((ptr_type->data.pointer.is_const || array_type->data.array.len == 0) && | 10689 | if ((ptr_type->data.pointer.is_const || array_type->data.array.len == 0) && |
| 10690 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, array_type->data.array.child_type, | 10690 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, array_type->data.array.child_type, |
| ... | @@ -10700,7 +10700,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10700,7 +10700,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10700 | is_slice(wanted_type->data.pointer.child_type) && | 10700 | is_slice(wanted_type->data.pointer.child_type) && |
| 10701 | actual_type->id == TypeTableEntryIdArray) | 10701 | actual_type->id == TypeTableEntryIdArray) |
| 10702 | { | 10702 | { |
| 10703 | TypeTableEntry *ptr_type = | 10703 | ZigType *ptr_type = |
| 10704 | wanted_type->data.pointer.child_type->data.structure.fields[slice_ptr_index].type_entry; | 10704 | wanted_type->data.pointer.child_type->data.structure.fields[slice_ptr_index].type_entry; |
| 10705 | assert(ptr_type->id == TypeTableEntryIdPointer); | 10705 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 10706 | if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) && | 10706 | if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) && |
| ... | @@ -10724,7 +10724,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10724,7 +10724,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10724 | is_slice(wanted_type->data.maybe.child_type) && | 10724 | is_slice(wanted_type->data.maybe.child_type) && |
| 10725 | actual_type->id == TypeTableEntryIdArray) | 10725 | actual_type->id == TypeTableEntryIdArray) |
| 10726 | { | 10726 | { |
| 10727 | TypeTableEntry *ptr_type = | 10727 | ZigType *ptr_type = |
| 10728 | wanted_type->data.maybe.child_type->data.structure.fields[slice_ptr_index].type_entry; | 10728 | wanted_type->data.maybe.child_type->data.structure.fields[slice_ptr_index].type_entry; |
| 10729 | assert(ptr_type->id == TypeTableEntryIdPointer); | 10729 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 10730 | if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) && | 10730 | if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) && |
| ... | @@ -10763,7 +10763,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10763,7 +10763,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10763 | actual_type->data.pointer.ptr_len == PtrLenSingle && | 10763 | actual_type->data.pointer.ptr_len == PtrLenSingle && |
| 10764 | actual_type->data.pointer.child_type->id == TypeTableEntryIdArray) | 10764 | actual_type->data.pointer.child_type->id == TypeTableEntryIdArray) |
| 10765 | { | 10765 | { |
| 10766 | TypeTableEntry *slice_ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; | 10766 | ZigType *slice_ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; |
| 10767 | assert(slice_ptr_type->id == TypeTableEntryIdPointer); | 10767 | assert(slice_ptr_type->id == TypeTableEntryIdPointer); |
| 10768 | if (types_match_const_cast_only(ira, slice_ptr_type->data.pointer.child_type, | 10768 | if (types_match_const_cast_only(ira, slice_ptr_type->data.pointer.child_type, |
| 10769 | actual_type->data.pointer.child_type->data.array.child_type, source_node, | 10769 | actual_type->data.pointer.child_type->data.array.child_type, source_node, |
| ... | @@ -10777,7 +10777,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10777,7 +10777,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10777 | // cast from T to ?T | 10777 | // cast from T to ?T |
| 10778 | // note that the *T to ?*T case is handled via the "ConstCastOnly" mechanism | 10778 | // note that the *T to ?*T case is handled via the "ConstCastOnly" mechanism |
| 10779 | if (wanted_type->id == TypeTableEntryIdOptional) { | 10779 | if (wanted_type->id == TypeTableEntryIdOptional) { |
| 10780 | TypeTableEntry *wanted_child_type = wanted_type->data.maybe.child_type; | 10780 | ZigType *wanted_child_type = wanted_type->data.maybe.child_type; |
| 10781 | if (types_match_const_cast_only(ira, wanted_child_type, actual_type, source_node, | 10781 | if (types_match_const_cast_only(ira, wanted_child_type, actual_type, source_node, |
| 10782 | false).id == ConstCastResultIdOk) | 10782 | false).id == ConstCastResultIdOk) |
| 10783 | { | 10783 | { |
| ... | @@ -10850,7 +10850,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10850,7 +10850,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10850 | is_slice(wanted_type->data.error_union.payload_type) && | 10850 | is_slice(wanted_type->data.error_union.payload_type) && |
| 10851 | actual_type->id == TypeTableEntryIdArray) | 10851 | actual_type->id == TypeTableEntryIdArray) |
| 10852 | { | 10852 | { |
| 10853 | TypeTableEntry *ptr_type = | 10853 | ZigType *ptr_type = |
| 10854 | wanted_type->data.error_union.payload_type->data.structure.fields[slice_ptr_index].type_entry; | 10854 | wanted_type->data.error_union.payload_type->data.structure.fields[slice_ptr_index].type_entry; |
| 10855 | assert(ptr_type->id == TypeTableEntryIdPointer); | 10855 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 10856 | if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) && | 10856 | if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) && |
| ... | @@ -10881,7 +10881,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10881,7 +10881,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10881 | wanted_type->data.error_union.payload_type->id == TypeTableEntryIdOptional && | 10881 | wanted_type->data.error_union.payload_type->id == TypeTableEntryIdOptional && |
| 10882 | actual_type->id != TypeTableEntryIdOptional) | 10882 | actual_type->id != TypeTableEntryIdOptional) |
| 10883 | { | 10883 | { |
| 10884 | TypeTableEntry *wanted_child_type = wanted_type->data.error_union.payload_type->data.maybe.child_type; | 10884 | ZigType *wanted_child_type = wanted_type->data.error_union.payload_type->data.maybe.child_type; |
| 10885 | if (types_match_const_cast_only(ira, wanted_child_type, actual_type, source_node, false).id == ConstCastResultIdOk || | 10885 | if (types_match_const_cast_only(ira, wanted_child_type, actual_type, source_node, false).id == ConstCastResultIdOk || |
| 10886 | actual_type->id == TypeTableEntryIdNull || | 10886 | actual_type->id == TypeTableEntryIdNull || |
| 10887 | actual_type->id == TypeTableEntryIdComptimeInt || | 10887 | actual_type->id == TypeTableEntryIdComptimeInt || |
| ... | @@ -10983,7 +10983,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10983,7 +10983,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10983 | | 10983 | |
| 10984 | // enum to &const union which has the enum as the tag type | 10984 | // enum to &const union which has the enum as the tag type |
| 10985 | if (actual_type->id == TypeTableEntryIdEnum && wanted_type->id == TypeTableEntryIdPointer) { | 10985 | if (actual_type->id == TypeTableEntryIdEnum && wanted_type->id == TypeTableEntryIdPointer) { |
| 10986 | TypeTableEntry *union_type = wanted_type->data.pointer.child_type; | 10986 | ZigType *union_type = wanted_type->data.pointer.child_type; |
| 10987 | if (union_type->data.unionation.decl_node->data.container_decl.auto_enum || | 10987 | if (union_type->data.unionation.decl_node->data.container_decl.auto_enum || |
| 10988 | union_type->data.unionation.decl_node->data.container_decl.init_arg_expr != nullptr) | 10988 | union_type->data.unionation.decl_node->data.container_decl.init_arg_expr != nullptr) |
| 10989 | { | 10989 | { |
| ... | @@ -11008,7 +11008,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -11008,7 +11008,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 11008 | if (wanted_type->id == TypeTableEntryIdPointer && wanted_type->data.pointer.ptr_len == PtrLenSingle && | 11008 | if (wanted_type->id == TypeTableEntryIdPointer && wanted_type->data.pointer.ptr_len == PtrLenSingle && |
| 11009 | actual_type->id == TypeTableEntryIdPointer && actual_type->data.pointer.ptr_len == PtrLenSingle) | 11009 | actual_type->id == TypeTableEntryIdPointer && actual_type->data.pointer.ptr_len == PtrLenSingle) |
| 11010 | { | 11010 | { |
| 11011 | TypeTableEntry *array_type = wanted_type->data.pointer.child_type; | 11011 | ZigType *array_type = wanted_type->data.pointer.child_type; |
| 11012 | if (array_type->id == TypeTableEntryIdArray && array_type->data.array.len == 1 && | 11012 | if (array_type->id == TypeTableEntryIdArray && array_type->data.array.len == 1 && |
| 11013 | types_match_const_cast_only(ira, array_type->data.array.child_type, | 11013 | types_match_const_cast_only(ira, array_type->data.array.child_type, |
| 11014 | actual_type->data.pointer.child_type, source_node, | 11014 | actual_type->data.pointer.child_type, source_node, |
| ... | @@ -11049,7 +11049,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -11049,7 +11049,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 11049 | | 11049 | |
| 11050 | // cast from something to const pointer of it | 11050 | // cast from something to const pointer of it |
| 11051 | if (!type_requires_comptime(actual_type)) { | 11051 | if (!type_requires_comptime(actual_type)) { |
| 11052 | TypeTableEntry *const_ptr_actual = get_pointer_to_type(ira->codegen, actual_type, true); | 11052 | ZigType *const_ptr_actual = get_pointer_to_type(ira->codegen, actual_type, true); |
| 11053 | if (types_match_const_cast_only(ira, wanted_type, const_ptr_actual, source_node, false).id == ConstCastResultIdOk) { | 11053 | if (types_match_const_cast_only(ira, wanted_type, const_ptr_actual, source_node, false).id == ConstCastResultIdOk) { |
| 11054 | return ir_analyze_cast_ref(ira, source_instr, value, wanted_type); | 11054 | return ir_analyze_cast_ref(ira, source_instr, value, wanted_type); |
| 11055 | } | 11055 | } |
| ... | @@ -11063,7 +11063,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -11063,7 +11063,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 11063 | return ira->codegen->invalid_instruction; | 11063 | return ira->codegen->invalid_instruction; |
| 11064 | } | 11064 | } |
| 11065 | | 11065 | |
| 11066 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, TypeTableEntry *expected_type) { | 11066 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, ZigType *expected_type) { |
| 11067 | assert(value); | 11067 | assert(value); |
| 11068 | assert(value != ira->codegen->invalid_instruction); | 11068 | assert(value != ira->codegen->invalid_instruction); |
| 11069 | assert(!expected_type || !type_is_invalid(expected_type)); | 11069 | assert(!expected_type || !type_is_invalid(expected_type)); |
| ... | @@ -11080,11 +11080,11 @@ static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, Typ | ... | @@ -11080,11 +11080,11 @@ static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, Typ |
| 11080 | } | 11080 | } |
| 11081 | | 11081 | |
| 11082 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr) { | 11082 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr) { |
| 11083 | TypeTableEntry *type_entry = ptr->value.type; | 11083 | ZigType *type_entry = ptr->value.type; |
| 11084 | if (type_is_invalid(type_entry)) { | 11084 | if (type_is_invalid(type_entry)) { |
| 11085 | return ira->codegen->invalid_instruction; | 11085 | return ira->codegen->invalid_instruction; |
| 11086 | } else if (type_entry->id == TypeTableEntryIdPointer) { | 11086 | } else if (type_entry->id == TypeTableEntryIdPointer) { |
| 11087 | TypeTableEntry *child_type = type_entry->data.pointer.child_type; | 11087 | ZigType *child_type = type_entry->data.pointer.child_type; |
| 11088 | if (instr_is_comptime(ptr)) { | 11088 | if (instr_is_comptime(ptr)) { |
| 11089 | if (ptr->value.data.x_ptr.mut == ConstPtrMutComptimeConst || | 11089 | if (ptr->value.data.x_ptr.mut == ConstPtrMutComptimeConst || |
| 11090 | ptr->value.data.x_ptr.mut == ConstPtrMutComptimeVar) | 11090 | ptr->value.data.x_ptr.mut == ConstPtrMutComptimeVar) |
| ... | @@ -11114,7 +11114,7 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc | ... | @@ -11114,7 +11114,7 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc |
| 11114 | } | 11114 | } |
| 11115 | } | 11115 | } |
| 11116 | | 11116 | |
| 11117 | static TypeTableEntry *ir_analyze_ref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *value, | 11117 | static ZigType *ir_analyze_ref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *value, |
| 11118 | bool is_const, bool is_volatile) | 11118 | bool is_const, bool is_volatile) |
| 11119 | { | 11119 | { |
| 11120 | IrInstruction *result = ir_get_ref(ira, source_instruction, value, is_const, is_volatile); | 11120 | IrInstruction *result = ir_get_ref(ira, source_instruction, value, is_const, is_volatile); |
| ... | @@ -11149,7 +11149,7 @@ static bool ir_resolve_align(IrAnalyze *ira, IrInstruction *value, uint32_t *out | ... | @@ -11149,7 +11149,7 @@ static bool ir_resolve_align(IrAnalyze *ira, IrInstruction *value, uint32_t *out |
| 11149 | return true; | 11149 | return true; |
| 11150 | } | 11150 | } |
| 11151 | | 11151 | |
| 11152 | static bool ir_resolve_unsigned(IrAnalyze *ira, IrInstruction *value, TypeTableEntry *int_type, uint64_t *out) { | 11152 | static bool ir_resolve_unsigned(IrAnalyze *ira, IrInstruction *value, ZigType *int_type, uint64_t *out) { |
| 11153 | if (type_is_invalid(value->value.type)) | 11153 | if (type_is_invalid(value->value.type)) |
| 11154 | return false; | 11154 | return false; |
| 11155 | | 11155 | |
| ... | @@ -11199,7 +11199,7 @@ static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, Atomic | ... | @@ -11199,7 +11199,7 @@ static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, Atomic |
| 11199 | | 11199 | |
| 11200 | ConstExprValue *atomic_order_val = get_builtin_value(ira->codegen, "AtomicOrder"); | 11200 | ConstExprValue *atomic_order_val = get_builtin_value(ira->codegen, "AtomicOrder"); |
| 11201 | assert(atomic_order_val->type->id == TypeTableEntryIdMetaType); | 11201 | assert(atomic_order_val->type->id == TypeTableEntryIdMetaType); |
| 11202 | TypeTableEntry *atomic_order_type = atomic_order_val->data.x_type; | 11202 | ZigType *atomic_order_type = atomic_order_val->data.x_type; |
| 11203 | | 11203 | |
| 11204 | IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_order_type); | 11204 | IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_order_type); |
| 11205 | if (type_is_invalid(casted_value->value.type)) | 11205 | if (type_is_invalid(casted_value->value.type)) |
| ... | @@ -11219,7 +11219,7 @@ static bool ir_resolve_atomic_rmw_op(IrAnalyze *ira, IrInstruction *value, Atomi | ... | @@ -11219,7 +11219,7 @@ static bool ir_resolve_atomic_rmw_op(IrAnalyze *ira, IrInstruction *value, Atomi |
| 11219 | | 11219 | |
| 11220 | ConstExprValue *atomic_rmw_op_val = get_builtin_value(ira->codegen, "AtomicRmwOp"); | 11220 | ConstExprValue *atomic_rmw_op_val = get_builtin_value(ira->codegen, "AtomicRmwOp"); |
| 11221 | assert(atomic_rmw_op_val->type->id == TypeTableEntryIdMetaType); | 11221 | assert(atomic_rmw_op_val->type->id == TypeTableEntryIdMetaType); |
| 11222 | TypeTableEntry *atomic_rmw_op_type = atomic_rmw_op_val->data.x_type; | 11222 | ZigType *atomic_rmw_op_type = atomic_rmw_op_val->data.x_type; |
| 11223 | | 11223 | |
| 11224 | IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_rmw_op_type); | 11224 | IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_rmw_op_type); |
| 11225 | if (type_is_invalid(casted_value->value.type)) | 11225 | if (type_is_invalid(casted_value->value.type)) |
| ... | @@ -11239,7 +11239,7 @@ static bool ir_resolve_global_linkage(IrAnalyze *ira, IrInstruction *value, Glob | ... | @@ -11239,7 +11239,7 @@ static bool ir_resolve_global_linkage(IrAnalyze *ira, IrInstruction *value, Glob |
| 11239 | | 11239 | |
| 11240 | ConstExprValue *global_linkage_val = get_builtin_value(ira->codegen, "GlobalLinkage"); | 11240 | ConstExprValue *global_linkage_val = get_builtin_value(ira->codegen, "GlobalLinkage"); |
| 11241 | assert(global_linkage_val->type->id == TypeTableEntryIdMetaType); | 11241 | assert(global_linkage_val->type->id == TypeTableEntryIdMetaType); |
| 11242 | TypeTableEntry *global_linkage_type = global_linkage_val->data.x_type; | 11242 | ZigType *global_linkage_type = global_linkage_val->data.x_type; |
| 11243 | | 11243 | |
| 11244 | IrInstruction *casted_value = ir_implicit_cast(ira, value, global_linkage_type); | 11244 | IrInstruction *casted_value = ir_implicit_cast(ira, value, global_linkage_type); |
| 11245 | if (type_is_invalid(casted_value->value.type)) | 11245 | if (type_is_invalid(casted_value->value.type)) |
| ... | @@ -11259,7 +11259,7 @@ static bool ir_resolve_float_mode(IrAnalyze *ira, IrInstruction *value, FloatMod | ... | @@ -11259,7 +11259,7 @@ static bool ir_resolve_float_mode(IrAnalyze *ira, IrInstruction *value, FloatMod |
| 11259 | | 11259 | |
| 11260 | ConstExprValue *float_mode_val = get_builtin_value(ira->codegen, "FloatMode"); | 11260 | ConstExprValue *float_mode_val = get_builtin_value(ira->codegen, "FloatMode"); |
| 11261 | assert(float_mode_val->type->id == TypeTableEntryIdMetaType); | 11261 | assert(float_mode_val->type->id == TypeTableEntryIdMetaType); |
| 11262 | TypeTableEntry *float_mode_type = float_mode_val->data.x_type; | 11262 | ZigType *float_mode_type = float_mode_val->data.x_type; |
| 11263 | | 11263 | |
| 11264 | IrInstruction *casted_value = ir_implicit_cast(ira, value, float_mode_type); | 11264 | IrInstruction *casted_value = ir_implicit_cast(ira, value, float_mode_type); |
| 11265 | if (type_is_invalid(casted_value->value.type)) | 11265 | if (type_is_invalid(casted_value->value.type)) |
| ... | @@ -11278,10 +11278,10 @@ static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) { | ... | @@ -11278,10 +11278,10 @@ static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) { |
| 11278 | if (type_is_invalid(value->value.type)) | 11278 | if (type_is_invalid(value->value.type)) |
| 11279 | return nullptr; | 11279 | return nullptr; |
| 11280 | | 11280 | |
| 11281 | TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, | 11281 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 11282 | true, false, PtrLenUnknown, | 11282 | true, false, PtrLenUnknown, |
| 11283 | get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), 0, 0); | 11283 | get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), 0, 0); |
| 11284 | TypeTableEntry *str_type = get_slice_type(ira->codegen, ptr_type); | 11284 | ZigType *str_type = get_slice_type(ira->codegen, ptr_type); |
| 11285 | IrInstruction *casted_value = ir_implicit_cast(ira, value, str_type); | 11285 | IrInstruction *casted_value = ir_implicit_cast(ira, value, str_type); |
| 11286 | if (type_is_invalid(casted_value->value.type)) | 11286 | if (type_is_invalid(casted_value->value.type)) |
| 11287 | return nullptr; | 11287 | return nullptr; |
| ... | @@ -11314,7 +11314,7 @@ static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) { | ... | @@ -11314,7 +11314,7 @@ static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) { |
| 11314 | return result; | 11314 | return result; |
| 11315 | } | 11315 | } |
| 11316 | | 11316 | |
| 11317 | static TypeTableEntry *ir_analyze_instruction_add_implicit_return_type(IrAnalyze *ira, | 11317 | static ZigType *ir_analyze_instruction_add_implicit_return_type(IrAnalyze *ira, |
| 11318 | IrInstructionAddImplicitReturnType *instruction) | 11318 | IrInstructionAddImplicitReturnType *instruction) |
| 11319 | { | 11319 | { |
| 11320 | IrInstruction *value = instruction->value->other; | 11320 | IrInstruction *value = instruction->value->other; |
| ... | @@ -11328,7 +11328,7 @@ static TypeTableEntry *ir_analyze_instruction_add_implicit_return_type(IrAnalyze | ... | @@ -11328,7 +11328,7 @@ static TypeTableEntry *ir_analyze_instruction_add_implicit_return_type(IrAnalyze |
| 11328 | return out_val->type; | 11328 | return out_val->type; |
| 11329 | } | 11329 | } |
| 11330 | | 11330 | |
| 11331 | static TypeTableEntry *ir_analyze_instruction_return(IrAnalyze *ira, | 11331 | static ZigType *ir_analyze_instruction_return(IrAnalyze *ira, |
| 11332 | IrInstructionReturn *return_instruction) | 11332 | IrInstructionReturn *return_instruction) |
| 11333 | { | 11333 | { |
| 11334 | IrInstruction *value = return_instruction->value->other; | 11334 | IrInstruction *value = return_instruction->value->other; |
| ... | @@ -11353,13 +11353,13 @@ static TypeTableEntry *ir_analyze_instruction_return(IrAnalyze *ira, | ... | @@ -11353,13 +11353,13 @@ static TypeTableEntry *ir_analyze_instruction_return(IrAnalyze *ira, |
| 11353 | return ir_finish_anal(ira, result->value.type); | 11353 | return ir_finish_anal(ira, result->value.type); |
| 11354 | } | 11354 | } |
| 11355 | | 11355 | |
| 11356 | static TypeTableEntry *ir_analyze_instruction_const(IrAnalyze *ira, IrInstructionConst *const_instruction) { | 11356 | static ZigType *ir_analyze_instruction_const(IrAnalyze *ira, IrInstructionConst *const_instruction) { |
| 11357 | ConstExprValue *out_val = ir_build_const_from(ira, &const_instruction->base); | 11357 | ConstExprValue *out_val = ir_build_const_from(ira, &const_instruction->base); |
| 11358 | *out_val = const_instruction->base.value; | 11358 | *out_val = const_instruction->base.value; |
| 11359 | return const_instruction->base.value.type; | 11359 | return const_instruction->base.value.type; |
| 11360 | } | 11360 | } |
| 11361 | | 11361 | |
| 11362 | static TypeTableEntry *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { | 11362 | static ZigType *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { |
| 11363 | IrInstruction *op1 = bin_op_instruction->op1->other; | 11363 | IrInstruction *op1 = bin_op_instruction->op1->other; |
| 11364 | if (type_is_invalid(op1->value.type)) | 11364 | if (type_is_invalid(op1->value.type)) |
| 11365 | return ira->codegen->builtin_types.entry_invalid; | 11365 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -11368,7 +11368,7 @@ static TypeTableEntry *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11368,7 +11368,7 @@ static TypeTableEntry *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp |
| 11368 | if (type_is_invalid(op2->value.type)) | 11368 | if (type_is_invalid(op2->value.type)) |
| 11369 | return ira->codegen->builtin_types.entry_invalid; | 11369 | return ira->codegen->builtin_types.entry_invalid; |
| 11370 | | 11370 | |
| 11371 | TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool; | 11371 | ZigType *bool_type = ira->codegen->builtin_types.entry_bool; |
| 11372 | | 11372 | |
| 11373 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, bool_type); | 11373 | IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, bool_type); |
| 11374 | if (casted_op1 == ira->codegen->invalid_instruction) | 11374 | if (casted_op1 == ira->codegen->invalid_instruction) |
| ... | @@ -11433,7 +11433,7 @@ static bool optional_value_is_null(ConstExprValue *val) { | ... | @@ -11433,7 +11433,7 @@ static bool optional_value_is_null(ConstExprValue *val) { |
| 11433 | } | 11433 | } |
| 11434 | } | 11434 | } |
| 11435 | | 11435 | |
| 11436 | static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { | 11436 | static ZigType *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { |
| 11437 | Error err; | 11437 | Error err; |
| 11438 | IrInstruction *op1 = bin_op_instruction->op1->other; | 11438 | IrInstruction *op1 = bin_op_instruction->op1->other; |
| 11439 | IrInstruction *op2 = bin_op_instruction->op2->other; | 11439 | IrInstruction *op2 = bin_op_instruction->op2->other; |
| ... | @@ -11486,7 +11486,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11486,7 +11486,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 11486 | ir_add_error_node(ira, source_node, buf_sprintf("operator not allowed for errors")); | 11486 | ir_add_error_node(ira, source_node, buf_sprintf("operator not allowed for errors")); |
| 11487 | return ira->codegen->builtin_types.entry_invalid; | 11487 | return ira->codegen->builtin_types.entry_invalid; |
| 11488 | } | 11488 | } |
| 11489 | TypeTableEntry *intersect_type = get_error_set_intersection(ira, op1->value.type, op2->value.type, source_node); | 11489 | ZigType *intersect_type = get_error_set_intersection(ira, op1->value.type, op2->value.type, source_node); |
| 11490 | if (type_is_invalid(intersect_type)) { | 11490 | if (type_is_invalid(intersect_type)) { |
| 11491 | return ira->codegen->builtin_types.entry_invalid; | 11491 | return ira->codegen->builtin_types.entry_invalid; |
| 11492 | } | 11492 | } |
| ... | @@ -11567,7 +11567,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11567,7 +11567,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 11567 | } | 11567 | } |
| 11568 | | 11568 | |
| 11569 | IrInstruction *instructions[] = {op1, op2}; | 11569 | IrInstruction *instructions[] = {op1, op2}; |
| 11570 | TypeTableEntry *resolved_type = ir_resolve_peer_types(ira, source_node, nullptr, instructions, 2); | 11570 | ZigType *resolved_type = ir_resolve_peer_types(ira, source_node, nullptr, instructions, 2); |
| 11571 | if (type_is_invalid(resolved_type)) | 11571 | if (type_is_invalid(resolved_type)) |
| 11572 | return resolved_type; | 11572 | return resolved_type; |
| 11573 | if ((err = type_ensure_zero_bits_known(ira->codegen, resolved_type))) | 11573 | if ((err = type_ensure_zero_bits_known(ira->codegen, resolved_type))) |
| ... | @@ -11705,7 +11705,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11705,7 +11705,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 11705 | return ira->codegen->builtin_types.entry_bool; | 11705 | return ira->codegen->builtin_types.entry_bool; |
| 11706 | } | 11706 | } |
| 11707 | | 11707 | |
| 11708 | static int ir_eval_math_op(TypeTableEntry *type_entry, ConstExprValue *op1_val, | 11708 | static int ir_eval_math_op(ZigType *type_entry, ConstExprValue *op1_val, |
| 11709 | IrBinOp op_id, ConstExprValue *op2_val, ConstExprValue *out_val) | 11709 | IrBinOp op_id, ConstExprValue *op2_val, ConstExprValue *out_val) |
| 11710 | { | 11710 | { |
| 11711 | bool is_int; | 11711 | bool is_int; |
| ... | @@ -11885,7 +11885,7 @@ static int ir_eval_math_op(TypeTableEntry *type_entry, ConstExprValue *op1_val, | ... | @@ -11885,7 +11885,7 @@ static int ir_eval_math_op(TypeTableEntry *type_entry, ConstExprValue *op1_val, |
| 11885 | return 0; | 11885 | return 0; |
| 11886 | } | 11886 | } |
| 11887 | | 11887 | |
| 11888 | static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { | 11888 | static ZigType *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { |
| 11889 | IrInstruction *op1 = bin_op_instruction->op1->other; | 11889 | IrInstruction *op1 = bin_op_instruction->op1->other; |
| 11890 | if (type_is_invalid(op1->value.type)) | 11890 | if (type_is_invalid(op1->value.type)) |
| 11891 | return ira->codegen->builtin_types.entry_invalid; | 11891 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -11917,7 +11917,7 @@ static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -11917,7 +11917,7 @@ static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp * |
| 11917 | return ira->codegen->builtin_types.entry_invalid; | 11917 | return ira->codegen->builtin_types.entry_invalid; |
| 11918 | } | 11918 | } |
| 11919 | } else { | 11919 | } else { |
| 11920 | TypeTableEntry *shift_amt_type = get_smallest_unsigned_int_type(ira->codegen, | 11920 | ZigType *shift_amt_type = get_smallest_unsigned_int_type(ira->codegen, |
| 11921 | op1->value.type->data.integral.bit_count - 1); | 11921 | op1->value.type->data.integral.bit_count - 1); |
| 11922 | if (bin_op_instruction->op_id == IrBinOpBitShiftLeftLossy && | 11922 | if (bin_op_instruction->op_id == IrBinOpBitShiftLeftLossy && |
| 11923 | op2->value.type->id == TypeTableEntryIdComptimeInt) { | 11923 | op2->value.type->id == TypeTableEntryIdComptimeInt) { |
| ... | @@ -11985,7 +11985,7 @@ static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -11985,7 +11985,7 @@ static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp * |
| 11985 | return op1->value.type; | 11985 | return op1->value.type; |
| 11986 | } | 11986 | } |
| 11987 | | 11987 | |
| 11988 | static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { | 11988 | static ZigType *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { |
| 11989 | IrInstruction *op1 = bin_op_instruction->op1->other; | 11989 | IrInstruction *op1 = bin_op_instruction->op1->other; |
| 11990 | if (type_is_invalid(op1->value.type)) | 11990 | if (type_is_invalid(op1->value.type)) |
| 11991 | return ira->codegen->builtin_types.entry_invalid; | 11991 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -12012,7 +12012,7 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -12012,7 +12012,7 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 12012 | } | 12012 | } |
| 12013 | | 12013 | |
| 12014 | IrInstruction *instructions[] = {op1, op2}; | 12014 | IrInstruction *instructions[] = {op1, op2}; |
| 12015 | TypeTableEntry *resolved_type = ir_resolve_peer_types(ira, bin_op_instruction->base.source_node, nullptr, instructions, 2); | 12015 | ZigType *resolved_type = ir_resolve_peer_types(ira, bin_op_instruction->base.source_node, nullptr, instructions, 2); |
| 12016 | if (type_is_invalid(resolved_type)) | 12016 | if (type_is_invalid(resolved_type)) |
| 12017 | return resolved_type; | 12017 | return resolved_type; |
| 12018 | | 12018 | |
| ... | @@ -12206,14 +12206,14 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -12206,14 +12206,14 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 12206 | } | 12206 | } |
| 12207 | | 12207 | |
| 12208 | | 12208 | |
| 12209 | static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruction) { | 12209 | static ZigType *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruction) { |
| 12210 | IrInstruction *op1 = instruction->op1->other; | 12210 | IrInstruction *op1 = instruction->op1->other; |
| 12211 | TypeTableEntry *op1_type = op1->value.type; | 12211 | ZigType *op1_type = op1->value.type; |
| 12212 | if (type_is_invalid(op1_type)) | 12212 | if (type_is_invalid(op1_type)) |
| 12213 | return ira->codegen->builtin_types.entry_invalid; | 12213 | return ira->codegen->builtin_types.entry_invalid; |
| 12214 | | 12214 | |
| 12215 | IrInstruction *op2 = instruction->op2->other; | 12215 | IrInstruction *op2 = instruction->op2->other; |
| 12216 | TypeTableEntry *op2_type = op2->value.type; | 12216 | ZigType *op2_type = op2->value.type; |
| 12217 | if (type_is_invalid(op2_type)) | 12217 | if (type_is_invalid(op2_type)) |
| 12218 | return ira->codegen->builtin_types.entry_invalid; | 12218 | return ira->codegen->builtin_types.entry_invalid; |
| 12219 | | 12219 | |
| ... | @@ -12228,7 +12228,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -12228,7 +12228,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 12228 | ConstExprValue *op1_array_val; | 12228 | ConstExprValue *op1_array_val; |
| 12229 | size_t op1_array_index; | 12229 | size_t op1_array_index; |
| 12230 | size_t op1_array_end; | 12230 | size_t op1_array_end; |
| 12231 | TypeTableEntry *child_type; | 12231 | ZigType *child_type; |
| 12232 | if (op1_type->id == TypeTableEntryIdArray) { | 12232 | if (op1_type->id == TypeTableEntryIdArray) { |
| 12233 | child_type = op1_type->data.array.child_type; | 12233 | child_type = op1_type->data.array.child_type; |
| 12234 | op1_array_val = op1_val; | 12234 | op1_array_val = op1_val; |
| ... | @@ -12244,7 +12244,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -12244,7 +12244,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 12244 | op1_array_index = op1_val->data.x_ptr.data.base_array.elem_index; | 12244 | op1_array_index = op1_val->data.x_ptr.data.base_array.elem_index; |
| 12245 | op1_array_end = op1_array_val->type->data.array.len - 1; | 12245 | op1_array_end = op1_array_val->type->data.array.len - 1; |
| 12246 | } else if (is_slice(op1_type)) { | 12246 | } else if (is_slice(op1_type)) { |
| 12247 | TypeTableEntry *ptr_type = op1_type->data.structure.fields[slice_ptr_index].type_entry; | 12247 | ZigType *ptr_type = op1_type->data.structure.fields[slice_ptr_index].type_entry; |
| 12248 | child_type = ptr_type->data.pointer.child_type; | 12248 | child_type = ptr_type->data.pointer.child_type; |
| 12249 | ConstExprValue *ptr_val = &op1_val->data.x_struct.fields[slice_ptr_index]; | 12249 | ConstExprValue *ptr_val = &op1_val->data.x_struct.fields[slice_ptr_index]; |
| 12250 | assert(ptr_val->data.x_ptr.special == ConstPtrSpecialBaseArray); | 12250 | assert(ptr_val->data.x_ptr.special == ConstPtrSpecialBaseArray); |
| ... | @@ -12285,7 +12285,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -12285,7 +12285,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 12285 | op2_array_index = op2_val->data.x_ptr.data.base_array.elem_index; | 12285 | op2_array_index = op2_val->data.x_ptr.data.base_array.elem_index; |
| 12286 | op2_array_end = op2_array_val->type->data.array.len - 1; | 12286 | op2_array_end = op2_array_val->type->data.array.len - 1; |
| 12287 | } else if (is_slice(op2_type)) { | 12287 | } else if (is_slice(op2_type)) { |
| 12288 | TypeTableEntry *ptr_type = op2_type->data.structure.fields[slice_ptr_index].type_entry; | 12288 | ZigType *ptr_type = op2_type->data.structure.fields[slice_ptr_index].type_entry; |
| 12289 | if (ptr_type->data.pointer.child_type != child_type) { | 12289 | if (ptr_type->data.pointer.child_type != child_type) { |
| 12290 | ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'", | 12290 | ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'", |
| 12291 | buf_ptr(&child_type->name), | 12291 | buf_ptr(&child_type->name), |
| ... | @@ -12305,7 +12305,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -12305,7 +12305,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 12305 | | 12305 | |
| 12306 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 12306 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 12307 | | 12307 | |
| 12308 | TypeTableEntry *result_type; | 12308 | ZigType *result_type; |
| 12309 | ConstExprValue *out_array_val; | 12309 | ConstExprValue *out_array_val; |
| 12310 | size_t new_len = (op1_array_end - op1_array_index) + (op2_array_end - op2_array_index); | 12310 | size_t new_len = (op1_array_end - op1_array_index) + (op2_array_end - op2_array_index); |
| 12311 | if (op1_type->id == TypeTableEntryIdArray || op2_type->id == TypeTableEntryIdArray) { | 12311 | if (op1_type->id == TypeTableEntryIdArray || op2_type->id == TypeTableEntryIdArray) { |
| ... | @@ -12313,7 +12313,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -12313,7 +12313,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 12313 | | 12313 | |
| 12314 | out_array_val = out_val; | 12314 | out_array_val = out_val; |
| 12315 | } else if (is_slice(op1_type) || is_slice(op2_type)) { | 12315 | } else if (is_slice(op1_type) || is_slice(op2_type)) { |
| 12316 | TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, child_type, | 12316 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, child_type, |
| 12317 | true, false, PtrLenUnknown, get_abi_alignment(ira->codegen, child_type), 0, 0); | 12317 | true, false, PtrLenUnknown, get_abi_alignment(ira->codegen, child_type), 0, 0); |
| 12318 | result_type = get_slice_type(ira->codegen, ptr_type); | 12318 | result_type = get_slice_type(ira->codegen, ptr_type); |
| 12319 | out_array_val = create_const_vals(1); | 12319 | out_array_val = create_const_vals(1); |
| ... | @@ -12374,7 +12374,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -12374,7 +12374,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 12374 | return result_type; | 12374 | return result_type; |
| 12375 | } | 12375 | } |
| 12376 | | 12376 | |
| 12377 | static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp *instruction) { | 12377 | static ZigType *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp *instruction) { |
| 12378 | IrInstruction *op1 = instruction->op1->other; | 12378 | IrInstruction *op1 = instruction->op1->other; |
| 12379 | if (type_is_invalid(op1->value.type)) | 12379 | if (type_is_invalid(op1->value.type)) |
| 12380 | return ira->codegen->builtin_types.entry_invalid; | 12380 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -12391,7 +12391,7 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -12391,7 +12391,7 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp |
| 12391 | if (!ir_resolve_usize(ira, op2, &mult_amt)) | 12391 | if (!ir_resolve_usize(ira, op2, &mult_amt)) |
| 12392 | return ira->codegen->builtin_types.entry_invalid; | 12392 | return ira->codegen->builtin_types.entry_invalid; |
| 12393 | | 12393 | |
| 12394 | TypeTableEntry *array_type = op1->value.type; | 12394 | ZigType *array_type = op1->value.type; |
| 12395 | if (array_type->id != TypeTableEntryIdArray) { | 12395 | if (array_type->id != TypeTableEntryIdArray) { |
| 12396 | ir_add_error(ira, op1, buf_sprintf("expected array type, found '%s'", buf_ptr(&op1->value.type->name))); | 12396 | ir_add_error(ira, op1, buf_sprintf("expected array type, found '%s'", buf_ptr(&op1->value.type->name))); |
| 12397 | return ira->codegen->builtin_types.entry_invalid; | 12397 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -12410,7 +12410,7 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -12410,7 +12410,7 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp |
| 12410 | if (array_val->data.x_array.special == ConstArraySpecialUndef) { | 12410 | if (array_val->data.x_array.special == ConstArraySpecialUndef) { |
| 12411 | out_val->data.x_array.special = ConstArraySpecialUndef; | 12411 | out_val->data.x_array.special = ConstArraySpecialUndef; |
| 12412 | | 12412 | |
| 12413 | TypeTableEntry *child_type = array_type->data.array.child_type; | 12413 | ZigType *child_type = array_type->data.array.child_type; |
| 12414 | return get_array_type(ira->codegen, child_type, new_array_len); | 12414 | return get_array_type(ira->codegen, child_type, new_array_len); |
| 12415 | } | 12415 | } |
| 12416 | | 12416 | |
| ... | @@ -12425,16 +12425,16 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -12425,16 +12425,16 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp |
| 12425 | } | 12425 | } |
| 12426 | assert(i == new_array_len); | 12426 | assert(i == new_array_len); |
| 12427 | | 12427 | |
| 12428 | TypeTableEntry *child_type = array_type->data.array.child_type; | 12428 | ZigType *child_type = array_type->data.array.child_type; |
| 12429 | return get_array_type(ira->codegen, child_type, new_array_len); | 12429 | return get_array_type(ira->codegen, child_type, new_array_len); |
| 12430 | } | 12430 | } |
| 12431 | | 12431 | |
| 12432 | static TypeTableEntry *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstructionBinOp *instruction) { | 12432 | static ZigType *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstructionBinOp *instruction) { |
| 12433 | TypeTableEntry *op1_type = ir_resolve_type(ira, instruction->op1->other); | 12433 | ZigType *op1_type = ir_resolve_type(ira, instruction->op1->other); |
| 12434 | if (type_is_invalid(op1_type)) | 12434 | if (type_is_invalid(op1_type)) |
| 12435 | return ira->codegen->builtin_types.entry_invalid; | 12435 | return ira->codegen->builtin_types.entry_invalid; |
| 12436 | | 12436 | |
| 12437 | TypeTableEntry *op2_type = ir_resolve_type(ira, instruction->op2->other); | 12437 | ZigType *op2_type = ir_resolve_type(ira, instruction->op2->other); |
| 12438 | if (type_is_invalid(op2_type)) | 12438 | if (type_is_invalid(op2_type)) |
| 12439 | return ira->codegen->builtin_types.entry_invalid; | 12439 | return ira->codegen->builtin_types.entry_invalid; |
| 12440 | | 12440 | |
| ... | @@ -12460,7 +12460,7 @@ static TypeTableEntry *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstruction | ... | @@ -12460,7 +12460,7 @@ static TypeTableEntry *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstruction |
| 12460 | assert(errors[error_entry->value] == nullptr); | 12460 | assert(errors[error_entry->value] == nullptr); |
| 12461 | errors[error_entry->value] = error_entry; | 12461 | errors[error_entry->value] = error_entry; |
| 12462 | } | 12462 | } |
| 12463 | TypeTableEntry *result_type = get_error_set_union(ira->codegen, errors, op1_type, op2_type); | 12463 | ZigType *result_type = get_error_set_union(ira->codegen, errors, op1_type, op2_type); |
| 12464 | free(errors); | 12464 | free(errors); |
| 12465 | | 12465 | |
| 12466 | | 12466 | |
| ... | @@ -12469,7 +12469,7 @@ static TypeTableEntry *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstruction | ... | @@ -12469,7 +12469,7 @@ static TypeTableEntry *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstruction |
| 12469 | return ira->codegen->builtin_types.entry_type; | 12469 | return ira->codegen->builtin_types.entry_type; |
| 12470 | } | 12470 | } |
| 12471 | | 12471 | |
| 12472 | static TypeTableEntry *ir_analyze_instruction_bin_op(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { | 12472 | static ZigType *ir_analyze_instruction_bin_op(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) { |
| 12473 | IrBinOp op_id = bin_op_instruction->op_id; | 12473 | IrBinOp op_id = bin_op_instruction->op_id; |
| 12474 | switch (op_id) { | 12474 | switch (op_id) { |
| 12475 | case IrBinOpInvalid: | 12475 | case IrBinOpInvalid: |
| ... | @@ -12516,7 +12516,7 @@ static TypeTableEntry *ir_analyze_instruction_bin_op(IrAnalyze *ira, IrInstructi | ... | @@ -12516,7 +12516,7 @@ static TypeTableEntry *ir_analyze_instruction_bin_op(IrAnalyze *ira, IrInstructi |
| 12516 | zig_unreachable(); | 12516 | zig_unreachable(); |
| 12517 | } | 12517 | } |
| 12518 | | 12518 | |
| 12519 | static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDeclVar *decl_var_instruction) { | 12519 | static ZigType *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDeclVar *decl_var_instruction) { |
| 12520 | Error err; | 12520 | Error err; |
| 12521 | VariableTableEntry *var = decl_var_instruction->var; | 12521 | VariableTableEntry *var = decl_var_instruction->var; |
| 12522 | | 12522 | |
| ... | @@ -12526,11 +12526,11 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc | ... | @@ -12526,11 +12526,11 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 12526 | return var->value->type; | 12526 | return var->value->type; |
| 12527 | } | 12527 | } |
| 12528 | | 12528 | |
| 12529 | TypeTableEntry *explicit_type = nullptr; | 12529 | ZigType *explicit_type = nullptr; |
| 12530 | IrInstruction *var_type = nullptr; | 12530 | IrInstruction *var_type = nullptr; |
| 12531 | if (decl_var_instruction->var_type != nullptr) { | 12531 | if (decl_var_instruction->var_type != nullptr) { |
| 12532 | var_type = decl_var_instruction->var_type->other; | 12532 | var_type = decl_var_instruction->var_type->other; |
| 12533 | TypeTableEntry *proposed_type = ir_resolve_type(ira, var_type); | 12533 | ZigType *proposed_type = ir_resolve_type(ira, var_type); |
| 12534 | explicit_type = validate_var_type(ira->codegen, var_type->source_node, proposed_type); | 12534 | explicit_type = validate_var_type(ira->codegen, var_type->source_node, proposed_type); |
| 12535 | if (type_is_invalid(explicit_type)) { | 12535 | if (type_is_invalid(explicit_type)) { |
| 12536 | var->value->type = ira->codegen->builtin_types.entry_invalid; | 12536 | var->value->type = ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -12545,7 +12545,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc | ... | @@ -12545,7 +12545,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 12545 | | 12545 | |
| 12546 | bool var_class_requires_const = false; | 12546 | bool var_class_requires_const = false; |
| 12547 | | 12547 | |
| 12548 | TypeTableEntry *result_type = casted_init_value->value.type; | 12548 | ZigType *result_type = casted_init_value->value.type; |
| 12549 | if (type_is_invalid(result_type)) { | 12549 | if (type_is_invalid(result_type)) { |
| 12550 | result_type = ira->codegen->builtin_types.entry_invalid; | 12550 | result_type = ira->codegen->builtin_types.entry_invalid; |
| 12551 | } else { | 12551 | } else { |
| ... | @@ -12651,7 +12651,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc | ... | @@ -12651,7 +12651,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 12651 | return ira->codegen->builtin_types.entry_void; | 12651 | return ira->codegen->builtin_types.entry_void; |
| 12652 | } | 12652 | } |
| 12653 | | 12653 | |
| 12654 | static TypeTableEntry *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructionExport *instruction) { | 12654 | static ZigType *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructionExport *instruction) { |
| 12655 | IrInstruction *name = instruction->name->other; | 12655 | IrInstruction *name = instruction->name->other; |
| 12656 | Buf *symbol_name = ir_resolve_str(ira, name); | 12656 | Buf *symbol_name = ir_resolve_str(ira, name); |
| 12657 | if (symbol_name == nullptr) { | 12657 | if (symbol_name == nullptr) { |
| ... | @@ -12731,7 +12731,7 @@ static TypeTableEntry *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructi | ... | @@ -12731,7 +12731,7 @@ static TypeTableEntry *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructi |
| 12731 | } | 12731 | } |
| 12732 | break; | 12732 | break; |
| 12733 | case TypeTableEntryIdMetaType: { | 12733 | case TypeTableEntryIdMetaType: { |
| 12734 | TypeTableEntry *type_value = target->value.data.x_type; | 12734 | ZigType *type_value = target->value.data.x_type; |
| 12735 | switch (type_value->id) { | 12735 | switch (type_value->id) { |
| 12736 | case TypeTableEntryIdInvalid: | 12736 | case TypeTableEntryIdInvalid: |
| 12737 | zig_unreachable(); | 12737 | zig_unreachable(); |
| ... | @@ -12826,12 +12826,12 @@ static bool exec_has_err_ret_trace(CodeGen *g, IrExecutable *exec) { | ... | @@ -12826,12 +12826,12 @@ static bool exec_has_err_ret_trace(CodeGen *g, IrExecutable *exec) { |
| 12826 | return fn_entry != nullptr && fn_entry->calls_or_awaits_errorable_fn && g->have_err_ret_tracing; | 12826 | return fn_entry != nullptr && fn_entry->calls_or_awaits_errorable_fn && g->have_err_ret_tracing; |
| 12827 | } | 12827 | } |
| 12828 | | 12828 | |
| 12829 | static TypeTableEntry *ir_analyze_instruction_error_return_trace(IrAnalyze *ira, | 12829 | static ZigType *ir_analyze_instruction_error_return_trace(IrAnalyze *ira, |
| 12830 | IrInstructionErrorReturnTrace *instruction) | 12830 | IrInstructionErrorReturnTrace *instruction) |
| 12831 | { | 12831 | { |
| 12832 | if (instruction->optional == IrInstructionErrorReturnTrace::Null) { | 12832 | if (instruction->optional == IrInstructionErrorReturnTrace::Null) { |
| 12833 | TypeTableEntry *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(ira->codegen); | 12833 | ZigType *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(ira->codegen); |
| 12834 | TypeTableEntry *optional_type = get_optional_type(ira->codegen, ptr_to_stack_trace_type); | 12834 | ZigType *optional_type = get_optional_type(ira->codegen, ptr_to_stack_trace_type); |
| 12835 | if (!exec_has_err_ret_trace(ira->codegen, ira->new_irb.exec)) { | 12835 | if (!exec_has_err_ret_trace(ira->codegen, ira->new_irb.exec)) { |
| 12836 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 12836 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 12837 | assert(get_codegen_ptr_type(optional_type) != nullptr); | 12837 | assert(get_codegen_ptr_type(optional_type) != nullptr); |
| ... | @@ -12852,14 +12852,14 @@ static TypeTableEntry *ir_analyze_instruction_error_return_trace(IrAnalyze *ira, | ... | @@ -12852,14 +12852,14 @@ static TypeTableEntry *ir_analyze_instruction_error_return_trace(IrAnalyze *ira, |
| 12852 | } | 12852 | } |
| 12853 | } | 12853 | } |
| 12854 | | 12854 | |
| 12855 | static TypeTableEntry *ir_analyze_instruction_error_union(IrAnalyze *ira, | 12855 | static ZigType *ir_analyze_instruction_error_union(IrAnalyze *ira, |
| 12856 | IrInstructionErrorUnion *instruction) | 12856 | IrInstructionErrorUnion *instruction) |
| 12857 | { | 12857 | { |
| 12858 | TypeTableEntry *err_set_type = ir_resolve_type(ira, instruction->err_set->other); | 12858 | ZigType *err_set_type = ir_resolve_type(ira, instruction->err_set->other); |
| 12859 | if (type_is_invalid(err_set_type)) | 12859 | if (type_is_invalid(err_set_type)) |
| 12860 | return ira->codegen->builtin_types.entry_invalid; | 12860 | return ira->codegen->builtin_types.entry_invalid; |
| 12861 | | 12861 | |
| 12862 | TypeTableEntry *payload_type = ir_resolve_type(ira, instruction->payload->other); | 12862 | ZigType *payload_type = ir_resolve_type(ira, instruction->payload->other); |
| 12863 | if (type_is_invalid(payload_type)) | 12863 | if (type_is_invalid(payload_type)) |
| 12864 | return ira->codegen->builtin_types.entry_invalid; | 12864 | return ira->codegen->builtin_types.entry_invalid; |
| 12865 | | 12865 | |
| ... | @@ -12870,7 +12870,7 @@ static TypeTableEntry *ir_analyze_instruction_error_union(IrAnalyze *ira, | ... | @@ -12870,7 +12870,7 @@ static TypeTableEntry *ir_analyze_instruction_error_union(IrAnalyze *ira, |
| 12870 | return ira->codegen->builtin_types.entry_invalid; | 12870 | return ira->codegen->builtin_types.entry_invalid; |
| 12871 | } | 12871 | } |
| 12872 | | 12872 | |
| 12873 | TypeTableEntry *result_type = get_error_union_type(ira->codegen, err_set_type, payload_type); | 12873 | ZigType *result_type = get_error_union_type(ira->codegen, err_set_type, payload_type); |
| 12874 | | 12874 | |
| 12875 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 12875 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 12876 | out_val->data.x_type = result_type; | 12876 | out_val->data.x_type = result_type; |
| ... | @@ -12913,38 +12913,38 @@ IrInstruction *ir_get_implicit_allocator(IrAnalyze *ira, IrInstruction *source_i | ... | @@ -12913,38 +12913,38 @@ IrInstruction *ir_get_implicit_allocator(IrAnalyze *ira, IrInstruction *source_i |
| 12913 | zig_unreachable(); | 12913 | zig_unreachable(); |
| 12914 | } | 12914 | } |
| 12915 | | 12915 | |
| 12916 | static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCall *call_instruction, FnTableEntry *fn_entry, TypeTableEntry *fn_type, | 12916 | static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCall *call_instruction, FnTableEntry *fn_entry, ZigType *fn_type, |
| 12917 | IrInstruction *fn_ref, IrInstruction **casted_args, size_t arg_count, IrInstruction *async_allocator_inst) | 12917 | IrInstruction *fn_ref, IrInstruction **casted_args, size_t arg_count, IrInstruction *async_allocator_inst) |
| 12918 | { | 12918 | { |
| 12919 | Buf *alloc_field_name = buf_create_from_str(ASYNC_ALLOC_FIELD_NAME); | 12919 | Buf *alloc_field_name = buf_create_from_str(ASYNC_ALLOC_FIELD_NAME); |
| 12920 | //Buf *free_field_name = buf_create_from_str("freeFn"); | 12920 | //Buf *free_field_name = buf_create_from_str("freeFn"); |
| 12921 | assert(async_allocator_inst->value.type->id == TypeTableEntryIdPointer); | 12921 | assert(async_allocator_inst->value.type->id == TypeTableEntryIdPointer); |
| 12922 | TypeTableEntry *container_type = async_allocator_inst->value.type->data.pointer.child_type; | 12922 | ZigType *container_type = async_allocator_inst->value.type->data.pointer.child_type; |
| 12923 | IrInstruction *field_ptr_inst = ir_analyze_container_field_ptr(ira, alloc_field_name, &call_instruction->base, | 12923 | IrInstruction *field_ptr_inst = ir_analyze_container_field_ptr(ira, alloc_field_name, &call_instruction->base, |
| 12924 | async_allocator_inst, container_type); | 12924 | async_allocator_inst, container_type); |
| 12925 | if (type_is_invalid(field_ptr_inst->value.type)) { | 12925 | if (type_is_invalid(field_ptr_inst->value.type)) { |
| 12926 | return ira->codegen->invalid_instruction; | 12926 | return ira->codegen->invalid_instruction; |
| 12927 | } | 12927 | } |
| 12928 | TypeTableEntry *ptr_to_alloc_fn_type = field_ptr_inst->value.type; | 12928 | ZigType *ptr_to_alloc_fn_type = field_ptr_inst->value.type; |
| 12929 | assert(ptr_to_alloc_fn_type->id == TypeTableEntryIdPointer); | 12929 | assert(ptr_to_alloc_fn_type->id == TypeTableEntryIdPointer); |
| 12930 | | 12930 | |
| 12931 | TypeTableEntry *alloc_fn_type = ptr_to_alloc_fn_type->data.pointer.child_type; | 12931 | ZigType *alloc_fn_type = ptr_to_alloc_fn_type->data.pointer.child_type; |
| 12932 | if (alloc_fn_type->id != TypeTableEntryIdFn) { | 12932 | if (alloc_fn_type->id != TypeTableEntryIdFn) { |
| 12933 | ir_add_error(ira, &call_instruction->base, | 12933 | ir_add_error(ira, &call_instruction->base, |
| 12934 | buf_sprintf("expected allocation function, found '%s'", buf_ptr(&alloc_fn_type->name))); | 12934 | buf_sprintf("expected allocation function, found '%s'", buf_ptr(&alloc_fn_type->name))); |
| 12935 | return ira->codegen->invalid_instruction; | 12935 | return ira->codegen->invalid_instruction; |
| 12936 | } | 12936 | } |
| 12937 | | 12937 | |
| 12938 | TypeTableEntry *alloc_fn_return_type = alloc_fn_type->data.fn.fn_type_id.return_type; | 12938 | ZigType *alloc_fn_return_type = alloc_fn_type->data.fn.fn_type_id.return_type; |
| 12939 | if (alloc_fn_return_type->id != TypeTableEntryIdErrorUnion) { | 12939 | if (alloc_fn_return_type->id != TypeTableEntryIdErrorUnion) { |
| 12940 | ir_add_error(ira, fn_ref, | 12940 | ir_add_error(ira, fn_ref, |
| 12941 | buf_sprintf("expected allocation function to return error union, but it returns '%s'", buf_ptr(&alloc_fn_return_type->name))); | 12941 | buf_sprintf("expected allocation function to return error union, but it returns '%s'", buf_ptr(&alloc_fn_return_type->name))); |
| 12942 | return ira->codegen->invalid_instruction; | 12942 | return ira->codegen->invalid_instruction; |
| 12943 | } | 12943 | } |
| 12944 | TypeTableEntry *alloc_fn_error_set_type = alloc_fn_return_type->data.error_union.err_set_type; | 12944 | ZigType *alloc_fn_error_set_type = alloc_fn_return_type->data.error_union.err_set_type; |
| 12945 | TypeTableEntry *return_type = fn_type->data.fn.fn_type_id.return_type; | 12945 | ZigType *return_type = fn_type->data.fn.fn_type_id.return_type; |
| 12946 | TypeTableEntry *promise_type = get_promise_type(ira->codegen, return_type); | 12946 | ZigType *promise_type = get_promise_type(ira->codegen, return_type); |
| 12947 | TypeTableEntry *async_return_type = get_error_union_type(ira->codegen, alloc_fn_error_set_type, promise_type); | 12947 | ZigType *async_return_type = get_error_union_type(ira->codegen, alloc_fn_error_set_type, promise_type); |
| 12948 | | 12948 | |
| 12949 | IrInstruction *result = ir_build_call(&ira->new_irb, call_instruction->base.scope, call_instruction->base.source_node, | 12949 | IrInstruction *result = ir_build_call(&ira->new_irb, call_instruction->base.scope, call_instruction->base.source_node, |
| 12950 | fn_entry, fn_ref, arg_count, casted_args, false, FnInlineAuto, true, async_allocator_inst, nullptr); | 12950 | fn_entry, fn_ref, arg_count, casted_args, false, FnInlineAuto, true, async_allocator_inst, nullptr); |
| ... | @@ -12961,7 +12961,7 @@ static bool ir_analyze_fn_call_inline_arg(IrAnalyze *ira, AstNode *fn_proto_node | ... | @@ -12961,7 +12961,7 @@ static bool ir_analyze_fn_call_inline_arg(IrAnalyze *ira, AstNode *fn_proto_node |
| 12961 | IrInstruction *casted_arg; | 12961 | IrInstruction *casted_arg; |
| 12962 | if (param_decl_node->data.param_decl.var_token == nullptr) { | 12962 | if (param_decl_node->data.param_decl.var_token == nullptr) { |
| 12963 | AstNode *param_type_node = param_decl_node->data.param_decl.type; | 12963 | AstNode *param_type_node = param_decl_node->data.param_decl.type; |
| 12964 | TypeTableEntry *param_type = analyze_type_expr(ira->codegen, *exec_scope, param_type_node); | 12964 | ZigType *param_type = analyze_type_expr(ira->codegen, *exec_scope, param_type_node); |
| 12965 | if (type_is_invalid(param_type)) | 12965 | if (type_is_invalid(param_type)) |
| 12966 | return false; | 12966 | return false; |
| 12967 | | 12967 | |
| ... | @@ -13001,7 +13001,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod | ... | @@ -13001,7 +13001,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod |
| 13001 | } else { | 13001 | } else { |
| 13002 | if (param_decl_node->data.param_decl.var_token == nullptr) { | 13002 | if (param_decl_node->data.param_decl.var_token == nullptr) { |
| 13003 | AstNode *param_type_node = param_decl_node->data.param_decl.type; | 13003 | AstNode *param_type_node = param_decl_node->data.param_decl.type; |
| 13004 | TypeTableEntry *param_type = analyze_type_expr(ira->codegen, *child_scope, param_type_node); | 13004 | ZigType *param_type = analyze_type_expr(ira->codegen, *child_scope, param_type_node); |
| 13005 | if (type_is_invalid(param_type)) | 13005 | if (type_is_invalid(param_type)) |
| 13006 | return false; | 13006 | return false; |
| 13007 | | 13007 | |
| ... | @@ -13156,8 +13156,8 @@ no_mem_slot: | ... | @@ -13156,8 +13156,8 @@ no_mem_slot: |
| 13156 | return var_ptr_instruction; | 13156 | return var_ptr_instruction; |
| 13157 | } | 13157 | } |
| 13158 | | 13158 | |
| 13159 | static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instruction, | 13159 | static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instruction, |
| 13160 | FnTableEntry *fn_entry, TypeTableEntry *fn_type, IrInstruction *fn_ref, | 13160 | FnTableEntry *fn_entry, ZigType *fn_type, IrInstruction *fn_ref, |
| 13161 | IrInstruction *first_arg_ptr, bool comptime_fn_call, FnInline fn_inline) | 13161 | IrInstruction *first_arg_ptr, bool comptime_fn_call, FnInline fn_inline) |
| 13162 | { | 13162 | { |
| 13163 | Error err; | 13163 | Error err; |
| ... | @@ -13249,7 +13249,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13249,7 +13249,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13249 | | 13249 | |
| 13250 | bool first_arg_known_bare = false; | 13250 | bool first_arg_known_bare = false; |
| 13251 | if (fn_type_id->next_param_index >= 1) { | 13251 | if (fn_type_id->next_param_index >= 1) { |
| 13252 | TypeTableEntry *param_type = fn_type_id->param_info[next_proto_i].type; | 13252 | ZigType *param_type = fn_type_id->param_info[next_proto_i].type; |
| 13253 | if (type_is_invalid(param_type)) | 13253 | if (type_is_invalid(param_type)) |
| 13254 | return ira->codegen->builtin_types.entry_invalid; | 13254 | return ira->codegen->builtin_types.entry_invalid; |
| 13255 | first_arg_known_bare = param_type->id != TypeTableEntryIdPointer; | 13255 | first_arg_known_bare = param_type->id != TypeTableEntryIdPointer; |
| ... | @@ -13285,11 +13285,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13285,11 +13285,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13285 | } | 13285 | } |
| 13286 | | 13286 | |
| 13287 | AstNode *return_type_node = fn_proto_node->data.fn_proto.return_type; | 13287 | AstNode *return_type_node = fn_proto_node->data.fn_proto.return_type; |
| 13288 | TypeTableEntry *specified_return_type = analyze_type_expr(ira->codegen, exec_scope, return_type_node); | 13288 | ZigType *specified_return_type = analyze_type_expr(ira->codegen, exec_scope, return_type_node); |
| 13289 | if (type_is_invalid(specified_return_type)) | 13289 | if (type_is_invalid(specified_return_type)) |
| 13290 | return ira->codegen->builtin_types.entry_invalid; | 13290 | return ira->codegen->builtin_types.entry_invalid; |
| 13291 | TypeTableEntry *return_type; | 13291 | ZigType *return_type; |
| 13292 | TypeTableEntry *inferred_err_set_type = nullptr; | 13292 | ZigType *inferred_err_set_type = nullptr; |
| 13293 | if (fn_proto_node->data.fn_proto.auto_err_set) { | 13293 | if (fn_proto_node->data.fn_proto.auto_err_set) { |
| 13294 | inferred_err_set_type = get_auto_err_set_type(ira->codegen, fn_entry); | 13294 | inferred_err_set_type = get_auto_err_set_type(ira->codegen, fn_entry); |
| 13295 | return_type = get_error_union_type(ira->codegen, inferred_err_set_type, specified_return_type); | 13295 | return_type = get_error_union_type(ira->codegen, inferred_err_set_type, specified_return_type); |
| ... | @@ -13320,7 +13320,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13320,7 +13320,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13320 | inferred_err_set_type->data.error_set.errors = allocate<ErrorTableEntry *>(1); | 13320 | inferred_err_set_type->data.error_set.errors = allocate<ErrorTableEntry *>(1); |
| 13321 | inferred_err_set_type->data.error_set.errors[0] = result->value.data.x_err_union.err; | 13321 | inferred_err_set_type->data.error_set.errors[0] = result->value.data.x_err_union.err; |
| 13322 | } | 13322 | } |
| 13323 | TypeTableEntry *fn_inferred_err_set_type = result->value.type->data.error_union.err_set_type; | 13323 | ZigType *fn_inferred_err_set_type = result->value.type->data.error_union.err_set_type; |
| 13324 | inferred_err_set_type->data.error_set.err_count = fn_inferred_err_set_type->data.error_set.err_count; | 13324 | inferred_err_set_type->data.error_set.err_count = fn_inferred_err_set_type->data.error_set.err_count; |
| 13325 | inferred_err_set_type->data.error_set.errors = fn_inferred_err_set_type->data.error_set.errors; | 13325 | inferred_err_set_type->data.error_set.errors = fn_inferred_err_set_type->data.error_set.errors; |
| 13326 | } else if (result->value.type->id == TypeTableEntryIdErrorSet) { | 13326 | } else if (result->value.type->id == TypeTableEntryIdErrorSet) { |
| ... | @@ -13344,10 +13344,10 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13344,10 +13344,10 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13344 | | 13344 | |
| 13345 | IrInstruction *casted_new_stack = nullptr; | 13345 | IrInstruction *casted_new_stack = nullptr; |
| 13346 | if (call_instruction->new_stack != nullptr) { | 13346 | if (call_instruction->new_stack != nullptr) { |
| 13347 | TypeTableEntry *u8_ptr = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, | 13347 | ZigType *u8_ptr = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 13348 | false, false, PtrLenUnknown, | 13348 | false, false, PtrLenUnknown, |
| 13349 | get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), 0, 0); | 13349 | get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), 0, 0); |
| 13350 | TypeTableEntry *u8_slice = get_slice_type(ira->codegen, u8_ptr); | 13350 | ZigType *u8_slice = get_slice_type(ira->codegen, u8_ptr); |
| 13351 | IrInstruction *new_stack = call_instruction->new_stack->other; | 13351 | IrInstruction *new_stack = call_instruction->new_stack->other; |
| 13352 | if (type_is_invalid(new_stack->value.type)) | 13352 | if (type_is_invalid(new_stack->value.type)) |
| 13353 | return ira->codegen->builtin_types.entry_invalid; | 13353 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -13405,7 +13405,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13405,7 +13405,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13405 | | 13405 | |
| 13406 | bool first_arg_known_bare = false; | 13406 | bool first_arg_known_bare = false; |
| 13407 | if (fn_type_id->next_param_index >= 1) { | 13407 | if (fn_type_id->next_param_index >= 1) { |
| 13408 | TypeTableEntry *param_type = fn_type_id->param_info[next_proto_i].type; | 13408 | ZigType *param_type = fn_type_id->param_info[next_proto_i].type; |
| 13409 | if (type_is_invalid(param_type)) | 13409 | if (type_is_invalid(param_type)) |
| 13410 | return ira->codegen->builtin_types.entry_invalid; | 13410 | return ira->codegen->builtin_types.entry_invalid; |
| 13411 | first_arg_known_bare = param_type->id != TypeTableEntryIdPointer; | 13411 | first_arg_known_bare = param_type->id != TypeTableEntryIdPointer; |
| ... | @@ -13515,11 +13515,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13515,11 +13515,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13515 | | 13515 | |
| 13516 | if (fn_proto_node->data.fn_proto.return_var_token == nullptr) { | 13516 | if (fn_proto_node->data.fn_proto.return_var_token == nullptr) { |
| 13517 | AstNode *return_type_node = fn_proto_node->data.fn_proto.return_type; | 13517 | AstNode *return_type_node = fn_proto_node->data.fn_proto.return_type; |
| 13518 | TypeTableEntry *specified_return_type = analyze_type_expr(ira->codegen, impl_fn->child_scope, return_type_node); | 13518 | ZigType *specified_return_type = analyze_type_expr(ira->codegen, impl_fn->child_scope, return_type_node); |
| 13519 | if (type_is_invalid(specified_return_type)) | 13519 | if (type_is_invalid(specified_return_type)) |
| 13520 | return ira->codegen->builtin_types.entry_invalid; | 13520 | return ira->codegen->builtin_types.entry_invalid; |
| 13521 | if (fn_proto_node->data.fn_proto.auto_err_set) { | 13521 | if (fn_proto_node->data.fn_proto.auto_err_set) { |
| 13522 | TypeTableEntry *inferred_err_set_type = get_auto_err_set_type(ira->codegen, impl_fn); | 13522 | ZigType *inferred_err_set_type = get_auto_err_set_type(ira->codegen, impl_fn); |
| 13523 | inst_fn_type_id.return_type = get_error_union_type(ira->codegen, inferred_err_set_type, specified_return_type); | 13523 | inst_fn_type_id.return_type = get_error_union_type(ira->codegen, inferred_err_set_type, specified_return_type); |
| 13524 | } else { | 13524 | } else { |
| 13525 | inst_fn_type_id.return_type = specified_return_type; | 13525 | inst_fn_type_id.return_type = specified_return_type; |
| ... | @@ -13537,7 +13537,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13537,7 +13537,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13537 | if (call_instruction->is_async) { | 13537 | if (call_instruction->is_async) { |
| 13538 | AstNode *async_allocator_type_node = fn_proto_node->data.fn_proto.async_allocator_type; | 13538 | AstNode *async_allocator_type_node = fn_proto_node->data.fn_proto.async_allocator_type; |
| 13539 | if (async_allocator_type_node != nullptr) { | 13539 | if (async_allocator_type_node != nullptr) { |
| 13540 | TypeTableEntry *async_allocator_type = analyze_type_expr(ira->codegen, impl_fn->child_scope, async_allocator_type_node); | 13540 | ZigType *async_allocator_type = analyze_type_expr(ira->codegen, impl_fn->child_scope, async_allocator_type_node); |
| 13541 | if (type_is_invalid(async_allocator_type)) | 13541 | if (type_is_invalid(async_allocator_type)) |
| 13542 | return ira->codegen->builtin_types.entry_invalid; | 13542 | return ira->codegen->builtin_types.entry_invalid; |
| 13543 | inst_fn_type_id.async_allocator_type = async_allocator_type; | 13543 | inst_fn_type_id.async_allocator_type = async_allocator_type; |
| ... | @@ -13581,7 +13581,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13581,7 +13581,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13581 | ira->codegen->fn_defs.append(impl_fn); | 13581 | ira->codegen->fn_defs.append(impl_fn); |
| 13582 | } | 13582 | } |
| 13583 | | 13583 | |
| 13584 | TypeTableEntry *return_type = impl_fn->type_entry->data.fn.fn_type_id.return_type; | 13584 | ZigType *return_type = impl_fn->type_entry->data.fn.fn_type_id.return_type; |
| 13585 | if (fn_type_can_fail(&impl_fn->type_entry->data.fn.fn_type_id)) { | 13585 | if (fn_type_can_fail(&impl_fn->type_entry->data.fn.fn_type_id)) { |
| 13586 | parent_fn_entry->calls_or_awaits_errorable_fn = true; | 13586 | parent_fn_entry->calls_or_awaits_errorable_fn = true; |
| 13587 | } | 13587 | } |
| ... | @@ -13618,7 +13618,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13618,7 +13618,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13618 | if (first_arg_ptr) { | 13618 | if (first_arg_ptr) { |
| 13619 | assert(first_arg_ptr->value.type->id == TypeTableEntryIdPointer); | 13619 | assert(first_arg_ptr->value.type->id == TypeTableEntryIdPointer); |
| 13620 | | 13620 | |
| 13621 | TypeTableEntry *param_type = fn_type_id->param_info[next_arg_index].type; | 13621 | ZigType *param_type = fn_type_id->param_info[next_arg_index].type; |
| 13622 | if (type_is_invalid(param_type)) | 13622 | if (type_is_invalid(param_type)) |
| 13623 | return ira->codegen->builtin_types.entry_invalid; | 13623 | return ira->codegen->builtin_types.entry_invalid; |
| 13624 | | 13624 | |
| ... | @@ -13646,7 +13646,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13646,7 +13646,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13646 | return ira->codegen->builtin_types.entry_invalid; | 13646 | return ira->codegen->builtin_types.entry_invalid; |
| 13647 | IrInstruction *casted_arg; | 13647 | IrInstruction *casted_arg; |
| 13648 | if (next_arg_index < src_param_count) { | 13648 | if (next_arg_index < src_param_count) { |
| 13649 | TypeTableEntry *param_type = fn_type_id->param_info[next_arg_index].type; | 13649 | ZigType *param_type = fn_type_id->param_info[next_arg_index].type; |
| 13650 | if (type_is_invalid(param_type)) | 13650 | if (type_is_invalid(param_type)) |
| 13651 | return ira->codegen->builtin_types.entry_invalid; | 13651 | return ira->codegen->builtin_types.entry_invalid; |
| 13652 | casted_arg = ir_implicit_cast(ira, old_arg, param_type); | 13652 | casted_arg = ir_implicit_cast(ira, old_arg, param_type); |
| ... | @@ -13662,7 +13662,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13662,7 +13662,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13662 | | 13662 | |
| 13663 | assert(next_arg_index == call_param_count); | 13663 | assert(next_arg_index == call_param_count); |
| 13664 | | 13664 | |
| 13665 | TypeTableEntry *return_type = fn_type_id->return_type; | 13665 | ZigType *return_type = fn_type_id->return_type; |
| 13666 | if (type_is_invalid(return_type)) | 13666 | if (type_is_invalid(return_type)) |
| 13667 | return ira->codegen->builtin_types.entry_invalid; | 13667 | return ira->codegen->builtin_types.entry_invalid; |
| 13668 | | 13668 | |
| ... | @@ -13703,7 +13703,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -13703,7 +13703,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 13703 | return ir_finish_anal(ira, return_type); | 13703 | return ir_finish_anal(ira, return_type); |
| 13704 | } | 13704 | } |
| 13705 | | 13705 | |
| 13706 | static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionCall *call_instruction) { | 13706 | static ZigType *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionCall *call_instruction) { |
| 13707 | IrInstruction *fn_ref = call_instruction->fn_ref->other; | 13707 | IrInstruction *fn_ref = call_instruction->fn_ref->other; |
| 13708 | if (type_is_invalid(fn_ref->value.type)) | 13708 | if (type_is_invalid(fn_ref->value.type)) |
| 13709 | return ira->codegen->builtin_types.entry_invalid; | 13709 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -13713,7 +13713,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction | ... | @@ -13713,7 +13713,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction |
| 13713 | | 13713 | |
| 13714 | if (is_comptime || instr_is_comptime(fn_ref)) { | 13714 | if (is_comptime || instr_is_comptime(fn_ref)) { |
| 13715 | if (fn_ref->value.type->id == TypeTableEntryIdMetaType) { | 13715 | if (fn_ref->value.type->id == TypeTableEntryIdMetaType) { |
| 13716 | TypeTableEntry *dest_type = ir_resolve_type(ira, fn_ref); | 13716 | ZigType *dest_type = ir_resolve_type(ira, fn_ref); |
| 13717 | if (type_is_invalid(dest_type)) | 13717 | if (type_is_invalid(dest_type)) |
| 13718 | return ira->codegen->builtin_types.entry_invalid; | 13718 | return ira->codegen->builtin_types.entry_invalid; |
| 13719 | | 13719 | |
| ... | @@ -13793,12 +13793,12 @@ static Error ir_read_const_ptr(IrAnalyze *ira, AstNode *source_node, | ... | @@ -13793,12 +13793,12 @@ static Error ir_read_const_ptr(IrAnalyze *ira, AstNode *source_node, |
| 13793 | return ErrorNone; | 13793 | return ErrorNone; |
| 13794 | } | 13794 | } |
| 13795 | | 13795 | |
| 13796 | static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { | 13796 | static ZigType *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { |
| 13797 | Error err; | 13797 | Error err; |
| 13798 | IrInstruction *value = un_op_instruction->value->other; | 13798 | IrInstruction *value = un_op_instruction->value->other; |
| 13799 | | 13799 | |
| 13800 | TypeTableEntry *ptr_type = value->value.type; | 13800 | ZigType *ptr_type = value->value.type; |
| 13801 | TypeTableEntry *child_type; | 13801 | ZigType *child_type; |
| 13802 | if (type_is_invalid(ptr_type)) { | 13802 | if (type_is_invalid(ptr_type)) { |
| 13803 | return ira->codegen->builtin_types.entry_invalid; | 13803 | return ira->codegen->builtin_types.entry_invalid; |
| 13804 | } else if (ptr_type->id == TypeTableEntryIdPointer) { | 13804 | } else if (ptr_type->id == TypeTableEntryIdPointer) { |
| ... | @@ -13835,10 +13835,10 @@ static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp | ... | @@ -13835,10 +13835,10 @@ static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp |
| 13835 | return child_type; | 13835 | return child_type; |
| 13836 | } | 13836 | } |
| 13837 | | 13837 | |
| 13838 | static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { | 13838 | static ZigType *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { |
| 13839 | Error err; | 13839 | Error err; |
| 13840 | IrInstruction *value = un_op_instruction->value->other; | 13840 | IrInstruction *value = un_op_instruction->value->other; |
| 13841 | TypeTableEntry *type_entry = ir_resolve_type(ira, value); | 13841 | ZigType *type_entry = ir_resolve_type(ira, value); |
| 13842 | if (type_is_invalid(type_entry)) | 13842 | if (type_is_invalid(type_entry)) |
| 13843 | return ira->codegen->builtin_types.entry_invalid; | 13843 | return ira->codegen->builtin_types.entry_invalid; |
| 13844 | if ((err = ensure_complete_type(ira->codegen, type_entry))) | 13844 | if ((err = ensure_complete_type(ira->codegen, type_entry))) |
| ... | @@ -13884,9 +13884,9 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op | ... | @@ -13884,9 +13884,9 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op |
| 13884 | zig_unreachable(); | 13884 | zig_unreachable(); |
| 13885 | } | 13885 | } |
| 13886 | | 13886 | |
| 13887 | static TypeTableEntry *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { | 13887 | static ZigType *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { |
| 13888 | IrInstruction *value = un_op_instruction->value->other; | 13888 | IrInstruction *value = un_op_instruction->value->other; |
| 13889 | TypeTableEntry *expr_type = value->value.type; | 13889 | ZigType *expr_type = value->value.type; |
| 13890 | if (type_is_invalid(expr_type)) | 13890 | if (type_is_invalid(expr_type)) |
| 13891 | return ira->codegen->builtin_types.entry_invalid; | 13891 | return ira->codegen->builtin_types.entry_invalid; |
| 13892 | | 13892 | |
| ... | @@ -13931,9 +13931,9 @@ static TypeTableEntry *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un | ... | @@ -13931,9 +13931,9 @@ static TypeTableEntry *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un |
| 13931 | return ira->codegen->builtin_types.entry_invalid; | 13931 | return ira->codegen->builtin_types.entry_invalid; |
| 13932 | } | 13932 | } |
| 13933 | | 13933 | |
| 13934 | static TypeTableEntry *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *instruction) { | 13934 | static ZigType *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *instruction) { |
| 13935 | IrInstruction *value = instruction->value->other; | 13935 | IrInstruction *value = instruction->value->other; |
| 13936 | TypeTableEntry *expr_type = value->value.type; | 13936 | ZigType *expr_type = value->value.type; |
| 13937 | if (type_is_invalid(expr_type)) | 13937 | if (type_is_invalid(expr_type)) |
| 13938 | return ira->codegen->builtin_types.entry_invalid; | 13938 | return ira->codegen->builtin_types.entry_invalid; |
| 13939 | | 13939 | |
| ... | @@ -13958,7 +13958,7 @@ static TypeTableEntry *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *ins | ... | @@ -13958,7 +13958,7 @@ static TypeTableEntry *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *ins |
| 13958 | return ira->codegen->builtin_types.entry_invalid; | 13958 | return ira->codegen->builtin_types.entry_invalid; |
| 13959 | } | 13959 | } |
| 13960 | | 13960 | |
| 13961 | static TypeTableEntry *ir_analyze_instruction_un_op(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { | 13961 | static ZigType *ir_analyze_instruction_un_op(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) { |
| 13962 | IrUnOp op_id = un_op_instruction->op_id; | 13962 | IrUnOp op_id = un_op_instruction->op_id; |
| 13963 | switch (op_id) { | 13963 | switch (op_id) { |
| 13964 | case IrUnOpInvalid: | 13964 | case IrUnOpInvalid: |
| ... | @@ -13976,7 +13976,7 @@ static TypeTableEntry *ir_analyze_instruction_un_op(IrAnalyze *ira, IrInstructio | ... | @@ -13976,7 +13976,7 @@ static TypeTableEntry *ir_analyze_instruction_un_op(IrAnalyze *ira, IrInstructio |
| 13976 | zig_unreachable(); | 13976 | zig_unreachable(); |
| 13977 | } | 13977 | } |
| 13978 | | 13978 | |
| 13979 | static TypeTableEntry *ir_analyze_instruction_br(IrAnalyze *ira, IrInstructionBr *br_instruction) { | 13979 | static ZigType *ir_analyze_instruction_br(IrAnalyze *ira, IrInstructionBr *br_instruction) { |
| 13980 | IrBasicBlock *old_dest_block = br_instruction->dest_block; | 13980 | IrBasicBlock *old_dest_block = br_instruction->dest_block; |
| 13981 | | 13981 | |
| 13982 | bool is_comptime; | 13982 | bool is_comptime; |
| ... | @@ -13994,7 +13994,7 @@ static TypeTableEntry *ir_analyze_instruction_br(IrAnalyze *ira, IrInstructionBr | ... | @@ -13994,7 +13994,7 @@ static TypeTableEntry *ir_analyze_instruction_br(IrAnalyze *ira, IrInstructionBr |
| 13994 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); | 13994 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); |
| 13995 | } | 13995 | } |
| 13996 | | 13996 | |
| 13997 | static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstructionCondBr *cond_br_instruction) { | 13997 | static ZigType *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstructionCondBr *cond_br_instruction) { |
| 13998 | IrInstruction *condition = cond_br_instruction->condition->other; | 13998 | IrInstruction *condition = cond_br_instruction->condition->other; |
| 13999 | if (type_is_invalid(condition->value.type)) | 13999 | if (type_is_invalid(condition->value.type)) |
| 14000 | return ir_unreach_error(ira); | 14000 | return ir_unreach_error(ira); |
| ... | @@ -14022,7 +14022,7 @@ static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstruct | ... | @@ -14022,7 +14022,7 @@ static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstruct |
| 14022 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); | 14022 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); |
| 14023 | } | 14023 | } |
| 14024 | | 14024 | |
| 14025 | TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool; | 14025 | ZigType *bool_type = ira->codegen->builtin_types.entry_bool; |
| 14026 | IrInstruction *casted_condition = ir_implicit_cast(ira, condition, bool_type); | 14026 | IrInstruction *casted_condition = ir_implicit_cast(ira, condition, bool_type); |
| 14027 | if (casted_condition == ira->codegen->invalid_instruction) | 14027 | if (casted_condition == ira->codegen->invalid_instruction) |
| 14028 | return ir_unreach_error(ira); | 14028 | return ir_unreach_error(ira); |
| ... | @@ -14041,14 +14041,14 @@ static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstruct | ... | @@ -14041,14 +14041,14 @@ static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstruct |
| 14041 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); | 14041 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); |
| 14042 | } | 14042 | } |
| 14043 | | 14043 | |
| 14044 | static TypeTableEntry *ir_analyze_instruction_unreachable(IrAnalyze *ira, | 14044 | static ZigType *ir_analyze_instruction_unreachable(IrAnalyze *ira, |
| 14045 | IrInstructionUnreachable *unreachable_instruction) | 14045 | IrInstructionUnreachable *unreachable_instruction) |
| 14046 | { | 14046 | { |
| 14047 | ir_build_unreachable_from(&ira->new_irb, &unreachable_instruction->base); | 14047 | ir_build_unreachable_from(&ira->new_irb, &unreachable_instruction->base); |
| 14048 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); | 14048 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); |
| 14049 | } | 14049 | } |
| 14050 | | 14050 | |
| 14051 | static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPhi *phi_instruction) { | 14051 | static ZigType *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPhi *phi_instruction) { |
| 14052 | if (ira->const_predecessor_bb) { | 14052 | if (ira->const_predecessor_bb) { |
| 14053 | for (size_t i = 0; i < phi_instruction->incoming_count; i += 1) { | 14053 | for (size_t i = 0; i < phi_instruction->incoming_count; i += 1) { |
| 14054 | IrBasicBlock *predecessor = phi_instruction->incoming_blocks[i]; | 14054 | IrBasicBlock *predecessor = phi_instruction->incoming_blocks[i]; |
| ... | @@ -14105,7 +14105,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP | ... | @@ -14105,7 +14105,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP |
| 14105 | return first_value->value.type; | 14105 | return first_value->value.type; |
| 14106 | } | 14106 | } |
| 14107 | | 14107 | |
| 14108 | TypeTableEntry *resolved_type = ir_resolve_peer_types(ira, phi_instruction->base.source_node, nullptr, | 14108 | ZigType *resolved_type = ir_resolve_peer_types(ira, phi_instruction->base.source_node, nullptr, |
| 14109 | new_incoming_values.items, new_incoming_values.length); | 14109 | new_incoming_values.items, new_incoming_values.length); |
| 14110 | if (type_is_invalid(resolved_type)) | 14110 | if (type_is_invalid(resolved_type)) |
| 14111 | return resolved_type; | 14111 | return resolved_type; |
| ... | @@ -14157,7 +14157,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP | ... | @@ -14157,7 +14157,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP |
| 14157 | return resolved_type; | 14157 | return resolved_type; |
| 14158 | } | 14158 | } |
| 14159 | | 14159 | |
| 14160 | static TypeTableEntry *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruction, | 14160 | static ZigType *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruction, |
| 14161 | VariableTableEntry *var) | 14161 | VariableTableEntry *var) |
| 14162 | { | 14162 | { |
| 14163 | IrInstruction *result = ir_get_var_ptr(ira, instruction, var); | 14163 | IrInstruction *result = ir_get_var_ptr(ira, instruction, var); |
| ... | @@ -14165,12 +14165,12 @@ static TypeTableEntry *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruc | ... | @@ -14165,12 +14165,12 @@ static TypeTableEntry *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruc |
| 14165 | return result->value.type; | 14165 | return result->value.type; |
| 14166 | } | 14166 | } |
| 14167 | | 14167 | |
| 14168 | static TypeTableEntry *ir_analyze_instruction_var_ptr(IrAnalyze *ira, IrInstructionVarPtr *var_ptr_instruction) { | 14168 | static ZigType *ir_analyze_instruction_var_ptr(IrAnalyze *ira, IrInstructionVarPtr *var_ptr_instruction) { |
| 14169 | VariableTableEntry *var = var_ptr_instruction->var; | 14169 | VariableTableEntry *var = var_ptr_instruction->var; |
| 14170 | return ir_analyze_var_ptr(ira, &var_ptr_instruction->base, var); | 14170 | return ir_analyze_var_ptr(ira, &var_ptr_instruction->base, var); |
| 14171 | } | 14171 | } |
| 14172 | | 14172 | |
| 14173 | static TypeTableEntry *adjust_ptr_align(CodeGen *g, TypeTableEntry *ptr_type, uint32_t new_align) { | 14173 | static ZigType *adjust_ptr_align(CodeGen *g, ZigType *ptr_type, uint32_t new_align) { |
| 14174 | assert(ptr_type->id == TypeTableEntryIdPointer); | 14174 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 14175 | return get_pointer_to_type_extra(g, | 14175 | return get_pointer_to_type_extra(g, |
| 14176 | ptr_type->data.pointer.child_type, | 14176 | ptr_type->data.pointer.child_type, |
| ... | @@ -14180,14 +14180,14 @@ static TypeTableEntry *adjust_ptr_align(CodeGen *g, TypeTableEntry *ptr_type, ui | ... | @@ -14180,14 +14180,14 @@ static TypeTableEntry *adjust_ptr_align(CodeGen *g, TypeTableEntry *ptr_type, ui |
| 14180 | ptr_type->data.pointer.bit_offset, ptr_type->data.pointer.unaligned_bit_count); | 14180 | ptr_type->data.pointer.bit_offset, ptr_type->data.pointer.unaligned_bit_count); |
| 14181 | } | 14181 | } |
| 14182 | | 14182 | |
| 14183 | static TypeTableEntry *adjust_slice_align(CodeGen *g, TypeTableEntry *slice_type, uint32_t new_align) { | 14183 | static ZigType *adjust_slice_align(CodeGen *g, ZigType *slice_type, uint32_t new_align) { |
| 14184 | assert(is_slice(slice_type)); | 14184 | assert(is_slice(slice_type)); |
| 14185 | TypeTableEntry *ptr_type = adjust_ptr_align(g, slice_type->data.structure.fields[slice_ptr_index].type_entry, | 14185 | ZigType *ptr_type = adjust_ptr_align(g, slice_type->data.structure.fields[slice_ptr_index].type_entry, |
| 14186 | new_align); | 14186 | new_align); |
| 14187 | return get_slice_type(g, ptr_type); | 14187 | return get_slice_type(g, ptr_type); |
| 14188 | } | 14188 | } |
| 14189 | | 14189 | |
| 14190 | static TypeTableEntry *adjust_ptr_len(CodeGen *g, TypeTableEntry *ptr_type, PtrLen ptr_len) { | 14190 | static ZigType *adjust_ptr_len(CodeGen *g, ZigType *ptr_type, PtrLen ptr_len) { |
| 14191 | assert(ptr_type->id == TypeTableEntryIdPointer); | 14191 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 14192 | return get_pointer_to_type_extra(g, | 14192 | return get_pointer_to_type_extra(g, |
| 14193 | ptr_type->data.pointer.child_type, | 14193 | ptr_type->data.pointer.child_type, |
| ... | @@ -14197,7 +14197,7 @@ static TypeTableEntry *adjust_ptr_len(CodeGen *g, TypeTableEntry *ptr_type, PtrL | ... | @@ -14197,7 +14197,7 @@ static TypeTableEntry *adjust_ptr_len(CodeGen *g, TypeTableEntry *ptr_type, PtrL |
| 14197 | ptr_type->data.pointer.bit_offset, ptr_type->data.pointer.unaligned_bit_count); | 14197 | ptr_type->data.pointer.bit_offset, ptr_type->data.pointer.unaligned_bit_count); |
| 14198 | } | 14198 | } |
| 14199 | | 14199 | |
| 14200 | static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionElemPtr *elem_ptr_instruction) { | 14200 | static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionElemPtr *elem_ptr_instruction) { |
| 14201 | Error err; | 14201 | Error err; |
| 14202 | IrInstruction *array_ptr = elem_ptr_instruction->array_ptr->other; | 14202 | IrInstruction *array_ptr = elem_ptr_instruction->array_ptr->other; |
| 14203 | if (type_is_invalid(array_ptr->value.type)) | 14203 | if (type_is_invalid(array_ptr->value.type)) |
| ... | @@ -14209,14 +14209,14 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -14209,14 +14209,14 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 14209 | if (type_is_invalid(elem_index->value.type)) | 14209 | if (type_is_invalid(elem_index->value.type)) |
| 14210 | return ira->codegen->builtin_types.entry_invalid; | 14210 | return ira->codegen->builtin_types.entry_invalid; |
| 14211 | | 14211 | |
| 14212 | TypeTableEntry *ptr_type = orig_array_ptr_val->type; | 14212 | ZigType *ptr_type = orig_array_ptr_val->type; |
| 14213 | assert(ptr_type->id == TypeTableEntryIdPointer); | 14213 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 14214 | | 14214 | |
| 14215 | TypeTableEntry *array_type = ptr_type->data.pointer.child_type; | 14215 | ZigType *array_type = ptr_type->data.pointer.child_type; |
| 14216 | | 14216 | |
| 14217 | // At first return_type will be the pointer type we want to return, except with an optimistic alignment. | 14217 | // At first return_type will be the pointer type we want to return, except with an optimistic alignment. |
| 14218 | // We will adjust return_type's alignment before returning it. | 14218 | // We will adjust return_type's alignment before returning it. |
| 14219 | TypeTableEntry *return_type; | 14219 | ZigType *return_type; |
| 14220 | | 14220 | |
| 14221 | if (type_is_invalid(array_type)) { | 14221 | if (type_is_invalid(array_type)) { |
| 14222 | return array_type; | 14222 | return array_type; |
| ... | @@ -14240,7 +14240,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -14240,7 +14240,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 14240 | buf_sprintf("index 0 outside array of size 0")); | 14240 | buf_sprintf("index 0 outside array of size 0")); |
| 14241 | return ira->codegen->builtin_types.entry_invalid; | 14241 | return ira->codegen->builtin_types.entry_invalid; |
| 14242 | } | 14242 | } |
| 14243 | TypeTableEntry *child_type = array_type->data.array.child_type; | 14243 | ZigType *child_type = array_type->data.array.child_type; |
| 14244 | if (ptr_type->data.pointer.unaligned_bit_count == 0) { | 14244 | if (ptr_type->data.pointer.unaligned_bit_count == 0) { |
| 14245 | return_type = get_pointer_to_type_extra(ira->codegen, child_type, | 14245 | return_type = get_pointer_to_type_extra(ira->codegen, child_type, |
| 14246 | ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile, | 14246 | ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile, |
| ... | @@ -14306,7 +14306,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -14306,7 +14306,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 14306 | return ira->codegen->builtin_types.entry_invalid; | 14306 | return ira->codegen->builtin_types.entry_invalid; |
| 14307 | } | 14307 | } |
| 14308 | | 14308 | |
| 14309 | TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize; | 14309 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 14310 | IrInstruction *casted_elem_index = ir_implicit_cast(ira, elem_index, usize); | 14310 | IrInstruction *casted_elem_index = ir_implicit_cast(ira, elem_index, usize); |
| 14311 | if (casted_elem_index == ira->codegen->invalid_instruction) | 14311 | if (casted_elem_index == ira->codegen->invalid_instruction) |
| 14312 | return ira->codegen->builtin_types.entry_invalid; | 14312 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -14496,8 +14496,8 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -14496,8 +14496,8 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 14496 | } | 14496 | } |
| 14497 | | 14497 | |
| 14498 | static IrInstruction *ir_analyze_container_member_access_inner(IrAnalyze *ira, | 14498 | static IrInstruction *ir_analyze_container_member_access_inner(IrAnalyze *ira, |
| 14499 | TypeTableEntry *bare_struct_type, Buf *field_name, IrInstruction *source_instr, | 14499 | ZigType *bare_struct_type, Buf *field_name, IrInstruction *source_instr, |
| 14500 | IrInstruction *container_ptr, TypeTableEntry *container_type) | 14500 | IrInstruction *container_ptr, ZigType *container_type) |
| 14501 | { | 14501 | { |
| 14502 | if (!is_slice(bare_struct_type)) { | 14502 | if (!is_slice(bare_struct_type)) { |
| 14503 | ScopeDecls *container_scope = get_container_scope(bare_struct_type); | 14503 | ScopeDecls *container_scope = get_container_scope(bare_struct_type); |
| ... | @@ -14536,11 +14536,11 @@ static IrInstruction *ir_analyze_container_member_access_inner(IrAnalyze *ira, | ... | @@ -14536,11 +14536,11 @@ static IrInstruction *ir_analyze_container_member_access_inner(IrAnalyze *ira, |
| 14536 | } | 14536 | } |
| 14537 | | 14537 | |
| 14538 | static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_name, | 14538 | static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_name, |
| 14539 | IrInstruction *source_instr, IrInstruction *container_ptr, TypeTableEntry *container_type) | 14539 | IrInstruction *source_instr, IrInstruction *container_ptr, ZigType *container_type) |
| 14540 | { | 14540 | { |
| 14541 | Error err; | 14541 | Error err; |
| 14542 | | 14542 | |
| 14543 | TypeTableEntry *bare_type = container_ref_type(container_type); | 14543 | ZigType *bare_type = container_ref_type(container_type); |
| 14544 | if ((err = ensure_complete_type(ira->codegen, bare_type))) | 14544 | if ((err = ensure_complete_type(ira->codegen, bare_type))) |
| 14545 | return ira->codegen->invalid_instruction; | 14545 | return ira->codegen->invalid_instruction; |
| 14546 | | 14546 | |
| ... | @@ -14568,7 +14568,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ | ... | @@ -14568,7 +14568,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ |
| 14568 | if (type_is_invalid(struct_val->type)) | 14568 | if (type_is_invalid(struct_val->type)) |
| 14569 | return ira->codegen->invalid_instruction; | 14569 | return ira->codegen->invalid_instruction; |
| 14570 | ConstExprValue *field_val = &struct_val->data.x_struct.fields[field->src_index]; | 14570 | ConstExprValue *field_val = &struct_val->data.x_struct.fields[field->src_index]; |
| 14571 | TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, field_val->type, | 14571 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, field_val->type, |
| 14572 | is_const, is_volatile, PtrLenSingle, align_bytes, | 14572 | is_const, is_volatile, PtrLenSingle, align_bytes, |
| 14573 | (uint32_t)(ptr_bit_offset + field->packed_bits_offset), | 14573 | (uint32_t)(ptr_bit_offset + field->packed_bits_offset), |
| 14574 | (uint32_t)unaligned_bit_count_for_result_type); | 14574 | (uint32_t)unaligned_bit_count_for_result_type); |
| ... | @@ -14625,7 +14625,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ | ... | @@ -14625,7 +14625,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ |
| 14625 | | 14625 | |
| 14626 | ConstExprValue *payload_val = union_val->data.x_union.payload; | 14626 | ConstExprValue *payload_val = union_val->data.x_union.payload; |
| 14627 | | 14627 | |
| 14628 | TypeTableEntry *field_type = field->type_entry; | 14628 | ZigType *field_type = field->type_entry; |
| 14629 | if (field_type->id == TypeTableEntryIdVoid) { | 14629 | if (field_type->id == TypeTableEntryIdVoid) { |
| 14630 | assert(payload_val == nullptr); | 14630 | assert(payload_val == nullptr); |
| 14631 | payload_val = create_const_vals(1); | 14631 | payload_val = create_const_vals(1); |
| ... | @@ -14633,7 +14633,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ | ... | @@ -14633,7 +14633,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ |
| 14633 | payload_val->type = field_type; | 14633 | payload_val->type = field_type; |
| 14634 | } | 14634 | } |
| 14635 | | 14635 | |
| 14636 | TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, field_type, | 14636 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, field_type, |
| 14637 | is_const, is_volatile, | 14637 | is_const, is_volatile, |
| 14638 | PtrLenSingle, | 14638 | PtrLenSingle, |
| 14639 | get_abi_alignment(ira->codegen, field_type), 0, 0); | 14639 | get_abi_alignment(ira->codegen, field_type), 0, 0); |
| ... | @@ -14680,7 +14680,7 @@ static void add_link_lib_symbol(IrAnalyze *ira, Buf *lib_name, Buf *symbol_name, | ... | @@ -14680,7 +14680,7 @@ static void add_link_lib_symbol(IrAnalyze *ira, Buf *lib_name, Buf *symbol_name, |
| 14680 | } | 14680 | } |
| 14681 | | 14681 | |
| 14682 | | 14682 | |
| 14683 | static TypeTableEntry *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source_instruction, Tld *tld) { | 14683 | static ZigType *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source_instruction, Tld *tld) { |
| 14684 | bool pointer_only = false; | 14684 | bool pointer_only = false; |
| 14685 | resolve_top_level_decl(ira->codegen, tld, pointer_only, source_instruction->source_node); | 14685 | resolve_top_level_decl(ira->codegen, tld, pointer_only, source_instruction->source_node); |
| 14686 | if (tld->resolution == TldResolutionInvalid) | 14686 | if (tld->resolution == TldResolutionInvalid) |
| ... | @@ -14731,7 +14731,7 @@ static TypeTableEntry *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source | ... | @@ -14731,7 +14731,7 @@ static TypeTableEntry *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source |
| 14731 | zig_unreachable(); | 14731 | zig_unreachable(); |
| 14732 | } | 14732 | } |
| 14733 | | 14733 | |
| 14734 | static ErrorTableEntry *find_err_table_entry(TypeTableEntry *err_set_type, Buf *field_name) { | 14734 | static ErrorTableEntry *find_err_table_entry(ZigType *err_set_type, Buf *field_name) { |
| 14735 | assert(err_set_type->id == TypeTableEntryIdErrorSet); | 14735 | assert(err_set_type->id == TypeTableEntryIdErrorSet); |
| 14736 | for (uint32_t i = 0; i < err_set_type->data.error_set.err_count; i += 1) { | 14736 | for (uint32_t i = 0; i < err_set_type->data.error_set.err_count; i += 1) { |
| 14737 | ErrorTableEntry *err_table_entry = err_set_type->data.error_set.errors[i]; | 14737 | ErrorTableEntry *err_table_entry = err_set_type->data.error_set.errors[i]; |
| ... | @@ -14742,13 +14742,13 @@ static ErrorTableEntry *find_err_table_entry(TypeTableEntry *err_set_type, Buf * | ... | @@ -14742,13 +14742,13 @@ static ErrorTableEntry *find_err_table_entry(TypeTableEntry *err_set_type, Buf * |
| 14742 | return nullptr; | 14742 | return nullptr; |
| 14743 | } | 14743 | } |
| 14744 | | 14744 | |
| 14745 | static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFieldPtr *field_ptr_instruction) { | 14745 | static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFieldPtr *field_ptr_instruction) { |
| 14746 | Error err; | 14746 | Error err; |
| 14747 | IrInstruction *container_ptr = field_ptr_instruction->container_ptr->other; | 14747 | IrInstruction *container_ptr = field_ptr_instruction->container_ptr->other; |
| 14748 | if (type_is_invalid(container_ptr->value.type)) | 14748 | if (type_is_invalid(container_ptr->value.type)) |
| 14749 | return ira->codegen->builtin_types.entry_invalid; | 14749 | return ira->codegen->builtin_types.entry_invalid; |
| 14750 | | 14750 | |
| 14751 | TypeTableEntry *container_type = container_ptr->value.type->data.pointer.child_type; | 14751 | ZigType *container_type = container_ptr->value.type->data.pointer.child_type; |
| 14752 | assert(container_ptr->value.type->id == TypeTableEntryIdPointer); | 14752 | assert(container_ptr->value.type->id == TypeTableEntryIdPointer); |
| 14753 | | 14753 | |
| 14754 | Buf *field_name = field_ptr_instruction->field_name_buffer; | 14754 | Buf *field_name = field_ptr_instruction->field_name_buffer; |
| ... | @@ -14767,7 +14767,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -14767,7 +14767,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 14767 | } else if (is_container_ref(container_type)) { | 14767 | } else if (is_container_ref(container_type)) { |
| 14768 | assert(container_ptr->value.type->id == TypeTableEntryIdPointer); | 14768 | assert(container_ptr->value.type->id == TypeTableEntryIdPointer); |
| 14769 | if (container_type->id == TypeTableEntryIdPointer) { | 14769 | if (container_type->id == TypeTableEntryIdPointer) { |
| 14770 | TypeTableEntry *bare_type = container_ref_type(container_type); | 14770 | ZigType *bare_type = container_ref_type(container_type); |
| 14771 | IrInstruction *container_child = ir_get_deref(ira, &field_ptr_instruction->base, container_ptr); | 14771 | IrInstruction *container_child = ir_get_deref(ira, &field_ptr_instruction->base, container_ptr); |
| 14772 | IrInstruction *result = ir_analyze_container_field_ptr(ira, field_name, &field_ptr_instruction->base, container_child, bare_type); | 14772 | IrInstruction *result = ir_analyze_container_field_ptr(ira, field_name, &field_ptr_instruction->base, container_child, bare_type); |
| 14773 | ir_link_new_instruction(result, &field_ptr_instruction->base); | 14773 | ir_link_new_instruction(result, &field_ptr_instruction->base); |
| ... | @@ -14786,7 +14786,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -14786,7 +14786,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 14786 | init_const_usize(ira->codegen, len_val, container_type->data.array.len); | 14786 | init_const_usize(ira->codegen, len_val, container_type->data.array.len); |
| 14787 | } | 14787 | } |
| 14788 | | 14788 | |
| 14789 | TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize; | 14789 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 14790 | bool ptr_is_const = true; | 14790 | bool ptr_is_const = true; |
| 14791 | bool ptr_is_volatile = false; | 14791 | bool ptr_is_volatile = false; |
| 14792 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, len_val, | 14792 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, len_val, |
| ... | @@ -14812,7 +14812,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -14812,7 +14812,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 14812 | size_t len = child_val->data.x_arg_tuple.end_index - child_val->data.x_arg_tuple.start_index; | 14812 | size_t len = child_val->data.x_arg_tuple.end_index - child_val->data.x_arg_tuple.start_index; |
| 14813 | init_const_usize(ira->codegen, len_val, len); | 14813 | init_const_usize(ira->codegen, len_val, len); |
| 14814 | | 14814 | |
| 14815 | TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize; | 14815 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 14816 | bool ptr_is_const = true; | 14816 | bool ptr_is_const = true; |
| 14817 | bool ptr_is_volatile = false; | 14817 | bool ptr_is_volatile = false; |
| 14818 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, len_val, | 14818 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, len_val, |
| ... | @@ -14832,7 +14832,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -14832,7 +14832,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 14832 | ConstExprValue *child_val = ir_const_ptr_pointee(ira, container_ptr_val, source_node); | 14832 | ConstExprValue *child_val = ir_const_ptr_pointee(ira, container_ptr_val, source_node); |
| 14833 | if (child_val == nullptr) | 14833 | if (child_val == nullptr) |
| 14834 | return ira->codegen->builtin_types.entry_invalid; | 14834 | return ira->codegen->builtin_types.entry_invalid; |
| 14835 | TypeTableEntry *child_type = child_val->data.x_type; | 14835 | ZigType *child_type = child_val->data.x_type; |
| 14836 | | 14836 | |
| 14837 | if (type_is_invalid(child_type)) { | 14837 | if (type_is_invalid(child_type)) { |
| 14838 | return ira->codegen->builtin_types.entry_invalid; | 14838 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -14842,7 +14842,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -14842,7 +14842,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 14842 | bool ptr_is_volatile = false; | 14842 | bool ptr_is_volatile = false; |
| 14843 | TypeStructField *ptr_field = &child_type->data.structure.fields[slice_ptr_index]; | 14843 | TypeStructField *ptr_field = &child_type->data.structure.fields[slice_ptr_index]; |
| 14844 | assert(ptr_field->type_entry->id == TypeTableEntryIdPointer); | 14844 | assert(ptr_field->type_entry->id == TypeTableEntryIdPointer); |
| 14845 | TypeTableEntry *child_type = ptr_field->type_entry->data.pointer.child_type; | 14845 | ZigType *child_type = ptr_field->type_entry->data.pointer.child_type; |
| 14846 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, | 14846 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, |
| 14847 | create_const_type(ira->codegen, child_type), | 14847 | create_const_type(ira->codegen, child_type), |
| 14848 | ira->codegen->builtin_types.entry_type, | 14848 | ira->codegen->builtin_types.entry_type, |
| ... | @@ -14877,7 +14877,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -14877,7 +14877,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 14877 | return ira->codegen->builtin_types.entry_invalid; | 14877 | return ira->codegen->builtin_types.entry_invalid; |
| 14878 | TypeUnionField *field = find_union_type_field(child_type, field_name); | 14878 | TypeUnionField *field = find_union_type_field(child_type, field_name); |
| 14879 | if (field) { | 14879 | if (field) { |
| 14880 | TypeTableEntry *enum_type = child_type->data.unionation.tag_type; | 14880 | ZigType *enum_type = child_type->data.unionation.tag_type; |
| 14881 | bool ptr_is_const = true; | 14881 | bool ptr_is_const = true; |
| 14882 | bool ptr_is_volatile = false; | 14882 | bool ptr_is_volatile = false; |
| 14883 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, | 14883 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, |
| ... | @@ -14891,7 +14891,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -14891,7 +14891,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 14891 | return ira->codegen->builtin_types.entry_invalid; | 14891 | return ira->codegen->builtin_types.entry_invalid; |
| 14892 | } else if (child_type->id == TypeTableEntryIdErrorSet) { | 14892 | } else if (child_type->id == TypeTableEntryIdErrorSet) { |
| 14893 | ErrorTableEntry *err_entry; | 14893 | ErrorTableEntry *err_entry; |
| 14894 | TypeTableEntry *err_set_type; | 14894 | ZigType *err_set_type; |
| 14895 | if (type_is_global_error_set(child_type)) { | 14895 | if (type_is_global_error_set(child_type)) { |
| 14896 | auto existing_entry = ira->codegen->error_table.maybe_get(field_name); | 14896 | auto existing_entry = ira->codegen->error_table.maybe_get(field_name); |
| 14897 | if (existing_entry) { | 14897 | if (existing_entry) { |
| ... | @@ -15131,7 +15131,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -15131,7 +15131,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 15131 | } | 15131 | } |
| 15132 | } | 15132 | } |
| 15133 | | 15133 | |
| 15134 | static TypeTableEntry *ir_analyze_instruction_load_ptr(IrAnalyze *ira, IrInstructionLoadPtr *load_ptr_instruction) { | 15134 | static ZigType *ir_analyze_instruction_load_ptr(IrAnalyze *ira, IrInstructionLoadPtr *load_ptr_instruction) { |
| 15135 | IrInstruction *ptr = load_ptr_instruction->ptr->other; | 15135 | IrInstruction *ptr = load_ptr_instruction->ptr->other; |
| 15136 | if (type_is_invalid(ptr->value.type)) | 15136 | if (type_is_invalid(ptr->value.type)) |
| 15137 | return ira->codegen->builtin_types.entry_invalid; | 15137 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -15142,7 +15142,7 @@ static TypeTableEntry *ir_analyze_instruction_load_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -15142,7 +15142,7 @@ static TypeTableEntry *ir_analyze_instruction_load_ptr(IrAnalyze *ira, IrInstruc |
| 15142 | return result->value.type; | 15142 | return result->value.type; |
| 15143 | } | 15143 | } |
| 15144 | | 15144 | |
| 15145 | static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstructionStorePtr *store_ptr_instruction) { | 15145 | static ZigType *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstructionStorePtr *store_ptr_instruction) { |
| 15146 | IrInstruction *ptr = store_ptr_instruction->ptr->other; | 15146 | IrInstruction *ptr = store_ptr_instruction->ptr->other; |
| 15147 | if (type_is_invalid(ptr->value.type)) | 15147 | if (type_is_invalid(ptr->value.type)) |
| 15148 | return ptr->value.type; | 15148 | return ptr->value.type; |
| ... | @@ -15166,7 +15166,7 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru | ... | @@ -15166,7 +15166,7 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru |
| 15166 | return ira->codegen->builtin_types.entry_invalid; | 15166 | return ira->codegen->builtin_types.entry_invalid; |
| 15167 | } | 15167 | } |
| 15168 | | 15168 | |
| 15169 | TypeTableEntry *child_type = ptr->value.type->data.pointer.child_type; | 15169 | ZigType *child_type = ptr->value.type->data.pointer.child_type; |
| 15170 | IrInstruction *casted_value = ir_implicit_cast(ira, value, child_type); | 15170 | IrInstruction *casted_value = ir_implicit_cast(ira, value, child_type); |
| 15171 | if (casted_value == ira->codegen->invalid_instruction) | 15171 | if (casted_value == ira->codegen->invalid_instruction) |
| 15172 | return ira->codegen->builtin_types.entry_invalid; | 15172 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -15202,9 +15202,9 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru | ... | @@ -15202,9 +15202,9 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru |
| 15202 | return ira->codegen->builtin_types.entry_void; | 15202 | return ira->codegen->builtin_types.entry_void; |
| 15203 | } | 15203 | } |
| 15204 | | 15204 | |
| 15205 | static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructionTypeOf *typeof_instruction) { | 15205 | static ZigType *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructionTypeOf *typeof_instruction) { |
| 15206 | IrInstruction *expr_value = typeof_instruction->value->other; | 15206 | IrInstruction *expr_value = typeof_instruction->value->other; |
| 15207 | TypeTableEntry *type_entry = expr_value->value.type; | 15207 | ZigType *type_entry = expr_value->value.type; |
| 15208 | if (type_is_invalid(type_entry)) | 15208 | if (type_is_invalid(type_entry)) |
| 15209 | return ira->codegen->builtin_types.entry_invalid; | 15209 | return ira->codegen->builtin_types.entry_invalid; |
| 15210 | switch (type_entry->id) { | 15210 | switch (type_entry->id) { |
| ... | @@ -15246,15 +15246,15 @@ static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructi | ... | @@ -15246,15 +15246,15 @@ static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructi |
| 15246 | zig_unreachable(); | 15246 | zig_unreachable(); |
| 15247 | } | 15247 | } |
| 15248 | | 15248 | |
| 15249 | static TypeTableEntry *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira, | 15249 | static ZigType *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira, |
| 15250 | IrInstructionToPtrType *to_ptr_type_instruction) | 15250 | IrInstructionToPtrType *to_ptr_type_instruction) |
| 15251 | { | 15251 | { |
| 15252 | IrInstruction *value = to_ptr_type_instruction->value->other; | 15252 | IrInstruction *value = to_ptr_type_instruction->value->other; |
| 15253 | TypeTableEntry *type_entry = value->value.type; | 15253 | ZigType *type_entry = value->value.type; |
| 15254 | if (type_is_invalid(type_entry)) | 15254 | if (type_is_invalid(type_entry)) |
| 15255 | return type_entry; | 15255 | return type_entry; |
| 15256 | | 15256 | |
| 15257 | TypeTableEntry *ptr_type; | 15257 | ZigType *ptr_type; |
| 15258 | if (type_entry->id == TypeTableEntryIdArray) { | 15258 | if (type_entry->id == TypeTableEntryIdArray) { |
| 15259 | ptr_type = get_pointer_to_type(ira->codegen, type_entry->data.array.child_type, false); | 15259 | ptr_type = get_pointer_to_type(ira->codegen, type_entry->data.array.child_type, false); |
| 15260 | } else if (is_slice(type_entry)) { | 15260 | } else if (is_slice(type_entry)) { |
| ... | @@ -15275,11 +15275,11 @@ static TypeTableEntry *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira, | ... | @@ -15275,11 +15275,11 @@ static TypeTableEntry *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira, |
| 15275 | return ira->codegen->builtin_types.entry_type; | 15275 | return ira->codegen->builtin_types.entry_type; |
| 15276 | } | 15276 | } |
| 15277 | | 15277 | |
| 15278 | static TypeTableEntry *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira, | 15278 | static ZigType *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira, |
| 15279 | IrInstructionPtrTypeChild *ptr_type_child_instruction) | 15279 | IrInstructionPtrTypeChild *ptr_type_child_instruction) |
| 15280 | { | 15280 | { |
| 15281 | IrInstruction *type_value = ptr_type_child_instruction->value->other; | 15281 | IrInstruction *type_value = ptr_type_child_instruction->value->other; |
| 15282 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 15282 | ZigType *type_entry = ir_resolve_type(ira, type_value); |
| 15283 | if (type_is_invalid(type_entry)) | 15283 | if (type_is_invalid(type_entry)) |
| 15284 | return type_entry; | 15284 | return type_entry; |
| 15285 | | 15285 | |
| ... | @@ -15294,7 +15294,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira, | ... | @@ -15294,7 +15294,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira, |
| 15294 | return ira->codegen->builtin_types.entry_type; | 15294 | return ira->codegen->builtin_types.entry_type; |
| 15295 | } | 15295 | } |
| 15296 | | 15296 | |
| 15297 | static TypeTableEntry *ir_analyze_instruction_set_cold(IrAnalyze *ira, IrInstructionSetCold *instruction) { | 15297 | static ZigType *ir_analyze_instruction_set_cold(IrAnalyze *ira, IrInstructionSetCold *instruction) { |
| 15298 | if (ira->new_irb.exec->is_inline) { | 15298 | if (ira->new_irb.exec->is_inline) { |
| 15299 | // ignore setCold when running functions at compile time | 15299 | // ignore setCold when running functions at compile time |
| 15300 | ir_build_const_from(ira, &instruction->base); | 15300 | ir_build_const_from(ira, &instruction->base); |
| ... | @@ -15324,7 +15324,7 @@ static TypeTableEntry *ir_analyze_instruction_set_cold(IrAnalyze *ira, IrInstruc | ... | @@ -15324,7 +15324,7 @@ static TypeTableEntry *ir_analyze_instruction_set_cold(IrAnalyze *ira, IrInstruc |
| 15324 | ir_build_const_from(ira, &instruction->base); | 15324 | ir_build_const_from(ira, &instruction->base); |
| 15325 | return ira->codegen->builtin_types.entry_void; | 15325 | return ira->codegen->builtin_types.entry_void; |
| 15326 | } | 15326 | } |
| 15327 | static TypeTableEntry *ir_analyze_instruction_set_runtime_safety(IrAnalyze *ira, | 15327 | static ZigType *ir_analyze_instruction_set_runtime_safety(IrAnalyze *ira, |
| 15328 | IrInstructionSetRuntimeSafety *set_runtime_safety_instruction) | 15328 | IrInstructionSetRuntimeSafety *set_runtime_safety_instruction) |
| 15329 | { | 15329 | { |
| 15330 | if (ira->new_irb.exec->is_inline) { | 15330 | if (ira->new_irb.exec->is_inline) { |
| ... | @@ -15381,11 +15381,11 @@ static TypeTableEntry *ir_analyze_instruction_set_runtime_safety(IrAnalyze *ira, | ... | @@ -15381,11 +15381,11 @@ static TypeTableEntry *ir_analyze_instruction_set_runtime_safety(IrAnalyze *ira, |
| 15381 | return ira->codegen->builtin_types.entry_void; | 15381 | return ira->codegen->builtin_types.entry_void; |
| 15382 | } | 15382 | } |
| 15383 | | 15383 | |
| 15384 | static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira, | 15384 | static ZigType *ir_analyze_instruction_set_float_mode(IrAnalyze *ira, |
| 15385 | IrInstructionSetFloatMode *instruction) | 15385 | IrInstructionSetFloatMode *instruction) |
| 15386 | { | 15386 | { |
| 15387 | IrInstruction *target_instruction = instruction->scope_value->other; | 15387 | IrInstruction *target_instruction = instruction->scope_value->other; |
| 15388 | TypeTableEntry *target_type = target_instruction->value.type; | 15388 | ZigType *target_type = target_instruction->value.type; |
| 15389 | if (type_is_invalid(target_type)) | 15389 | if (type_is_invalid(target_type)) |
| 15390 | return ira->codegen->builtin_types.entry_invalid; | 15390 | return ira->codegen->builtin_types.entry_invalid; |
| 15391 | ConstExprValue *target_val = ir_resolve_const(ira, target_instruction, UndefBad); | 15391 | ConstExprValue *target_val = ir_resolve_const(ira, target_instruction, UndefBad); |
| ... | @@ -15412,7 +15412,7 @@ static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira, | ... | @@ -15412,7 +15412,7 @@ static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira, |
| 15412 | fast_math_set_node_ptr = &target_fn->def_scope->fast_math_set_node; | 15412 | fast_math_set_node_ptr = &target_fn->def_scope->fast_math_set_node; |
| 15413 | } else if (target_type->id == TypeTableEntryIdMetaType) { | 15413 | } else if (target_type->id == TypeTableEntryIdMetaType) { |
| 15414 | ScopeDecls *decls_scope; | 15414 | ScopeDecls *decls_scope; |
| 15415 | TypeTableEntry *type_arg = target_val->data.x_type; | 15415 | ZigType *type_arg = target_val->data.x_type; |
| 15416 | if (type_arg->id == TypeTableEntryIdStruct) { | 15416 | if (type_arg->id == TypeTableEntryIdStruct) { |
| 15417 | decls_scope = type_arg->data.structure.decls_scope; | 15417 | decls_scope = type_arg->data.structure.decls_scope; |
| 15418 | } else if (type_arg->id == TypeTableEntryIdEnum) { | 15418 | } else if (type_arg->id == TypeTableEntryIdEnum) { |
| ... | @@ -15452,7 +15452,7 @@ static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira, | ... | @@ -15452,7 +15452,7 @@ static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira, |
| 15452 | return ira->codegen->builtin_types.entry_void; | 15452 | return ira->codegen->builtin_types.entry_void; |
| 15453 | } | 15453 | } |
| 15454 | | 15454 | |
| 15455 | static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, | 15455 | static ZigType *ir_analyze_instruction_slice_type(IrAnalyze *ira, |
| 15456 | IrInstructionSliceType *slice_type_instruction) | 15456 | IrInstructionSliceType *slice_type_instruction) |
| 15457 | { | 15457 | { |
| 15458 | Error err; | 15458 | Error err; |
| ... | @@ -15462,7 +15462,7 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, | ... | @@ -15462,7 +15462,7 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, |
| 15462 | return ira->codegen->builtin_types.entry_invalid; | 15462 | return ira->codegen->builtin_types.entry_invalid; |
| 15463 | } | 15463 | } |
| 15464 | | 15464 | |
| 15465 | TypeTableEntry *child_type = ir_resolve_type(ira, slice_type_instruction->child_type->other); | 15465 | ZigType *child_type = ir_resolve_type(ira, slice_type_instruction->child_type->other); |
| 15466 | if (type_is_invalid(child_type)) | 15466 | if (type_is_invalid(child_type)) |
| 15467 | return ira->codegen->builtin_types.entry_invalid; | 15467 | return ira->codegen->builtin_types.entry_invalid; |
| 15468 | | 15468 | |
| ... | @@ -15509,9 +15509,9 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, | ... | @@ -15509,9 +15509,9 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, |
| 15509 | { | 15509 | { |
| 15510 | if ((err = type_ensure_zero_bits_known(ira->codegen, child_type))) | 15510 | if ((err = type_ensure_zero_bits_known(ira->codegen, child_type))) |
| 15511 | return ira->codegen->builtin_types.entry_invalid; | 15511 | return ira->codegen->builtin_types.entry_invalid; |
| 15512 | TypeTableEntry *slice_ptr_type = get_pointer_to_type_extra(ira->codegen, child_type, | 15512 | ZigType *slice_ptr_type = get_pointer_to_type_extra(ira->codegen, child_type, |
| 15513 | is_const, is_volatile, PtrLenUnknown, align_bytes, 0, 0); | 15513 | is_const, is_volatile, PtrLenUnknown, align_bytes, 0, 0); |
| 15514 | TypeTableEntry *result_type = get_slice_type(ira->codegen, slice_ptr_type); | 15514 | ZigType *result_type = get_slice_type(ira->codegen, slice_ptr_type); |
| 15515 | ConstExprValue *out_val = ir_build_const_from(ira, &slice_type_instruction->base); | 15515 | ConstExprValue *out_val = ir_build_const_from(ira, &slice_type_instruction->base); |
| 15516 | out_val->data.x_type = result_type; | 15516 | out_val->data.x_type = result_type; |
| 15517 | return ira->codegen->builtin_types.entry_type; | 15517 | return ira->codegen->builtin_types.entry_type; |
| ... | @@ -15520,7 +15520,7 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, | ... | @@ -15520,7 +15520,7 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, |
| 15520 | zig_unreachable(); | 15520 | zig_unreachable(); |
| 15521 | } | 15521 | } |
| 15522 | | 15522 | |
| 15523 | static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionAsm *asm_instruction) { | 15523 | static ZigType *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionAsm *asm_instruction) { |
| 15524 | assert(asm_instruction->base.source_node->type == NodeTypeAsmExpr); | 15524 | assert(asm_instruction->base.source_node->type == NodeTypeAsmExpr); |
| 15525 | | 15525 | |
| 15526 | AstNodeAsmExpr *asm_expr = &asm_instruction->base.source_node->data.asm_expr; | 15526 | AstNodeAsmExpr *asm_expr = &asm_instruction->base.source_node->data.asm_expr; |
| ... | @@ -15550,7 +15550,7 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA | ... | @@ -15550,7 +15550,7 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA |
| 15550 | IrInstruction **input_list = allocate<IrInstruction *>(asm_expr->input_list.length); | 15550 | IrInstruction **input_list = allocate<IrInstruction *>(asm_expr->input_list.length); |
| 15551 | IrInstruction **output_types = allocate<IrInstruction *>(asm_expr->output_list.length); | 15551 | IrInstruction **output_types = allocate<IrInstruction *>(asm_expr->output_list.length); |
| 15552 | | 15552 | |
| 15553 | TypeTableEntry *return_type = ira->codegen->builtin_types.entry_void; | 15553 | ZigType *return_type = ira->codegen->builtin_types.entry_void; |
| 15554 | for (size_t i = 0; i < asm_expr->output_list.length; i += 1) { | 15554 | for (size_t i = 0; i < asm_expr->output_list.length; i += 1) { |
| 15555 | AsmOutput *asm_output = asm_expr->output_list.at(i); | 15555 | AsmOutput *asm_output = asm_expr->output_list.at(i); |
| 15556 | if (asm_output->return_type) { | 15556 | if (asm_output->return_type) { |
| ... | @@ -15572,7 +15572,7 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA | ... | @@ -15572,7 +15572,7 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA |
| 15572 | return return_type; | 15572 | return return_type; |
| 15573 | } | 15573 | } |
| 15574 | | 15574 | |
| 15575 | static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, | 15575 | static ZigType *ir_analyze_instruction_array_type(IrAnalyze *ira, |
| 15576 | IrInstructionArrayType *array_type_instruction) | 15576 | IrInstructionArrayType *array_type_instruction) |
| 15577 | { | 15577 | { |
| 15578 | Error err; | 15578 | Error err; |
| ... | @@ -15583,7 +15583,7 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, | ... | @@ -15583,7 +15583,7 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, |
| 15583 | return ira->codegen->builtin_types.entry_invalid; | 15583 | return ira->codegen->builtin_types.entry_invalid; |
| 15584 | | 15584 | |
| 15585 | IrInstruction *child_type_value = array_type_instruction->child_type->other; | 15585 | IrInstruction *child_type_value = array_type_instruction->child_type->other; |
| 15586 | TypeTableEntry *child_type = ir_resolve_type(ira, child_type_value); | 15586 | ZigType *child_type = ir_resolve_type(ira, child_type_value); |
| 15587 | if (type_is_invalid(child_type)) | 15587 | if (type_is_invalid(child_type)) |
| 15588 | return ira->codegen->builtin_types.entry_invalid; | 15588 | return ira->codegen->builtin_types.entry_invalid; |
| 15589 | switch (child_type->id) { | 15589 | switch (child_type->id) { |
| ... | @@ -15620,7 +15620,7 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, | ... | @@ -15620,7 +15620,7 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, |
| 15620 | { | 15620 | { |
| 15621 | if ((err = ensure_complete_type(ira->codegen, child_type))) | 15621 | if ((err = ensure_complete_type(ira->codegen, child_type))) |
| 15622 | return ira->codegen->builtin_types.entry_invalid; | 15622 | return ira->codegen->builtin_types.entry_invalid; |
| 15623 | TypeTableEntry *result_type = get_array_type(ira->codegen, child_type, size); | 15623 | ZigType *result_type = get_array_type(ira->codegen, child_type, size); |
| 15624 | ConstExprValue *out_val = ir_build_const_from(ira, &array_type_instruction->base); | 15624 | ConstExprValue *out_val = ir_build_const_from(ira, &array_type_instruction->base); |
| 15625 | out_val->data.x_type = result_type; | 15625 | out_val->data.x_type = result_type; |
| 15626 | return ira->codegen->builtin_types.entry_type; | 15626 | return ira->codegen->builtin_types.entry_type; |
| ... | @@ -15629,13 +15629,13 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, | ... | @@ -15629,13 +15629,13 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, |
| 15629 | zig_unreachable(); | 15629 | zig_unreachable(); |
| 15630 | } | 15630 | } |
| 15631 | | 15631 | |
| 15632 | static TypeTableEntry *ir_analyze_instruction_promise_type(IrAnalyze *ira, IrInstructionPromiseType *instruction) { | 15632 | static ZigType *ir_analyze_instruction_promise_type(IrAnalyze *ira, IrInstructionPromiseType *instruction) { |
| 15633 | TypeTableEntry *promise_type; | 15633 | ZigType *promise_type; |
| 15634 | | 15634 | |
| 15635 | if (instruction->payload_type == nullptr) { | 15635 | if (instruction->payload_type == nullptr) { |
| 15636 | promise_type = ira->codegen->builtin_types.entry_promise; | 15636 | promise_type = ira->codegen->builtin_types.entry_promise; |
| 15637 | } else { | 15637 | } else { |
| 15638 | TypeTableEntry *payload_type = ir_resolve_type(ira, instruction->payload_type->other); | 15638 | ZigType *payload_type = ir_resolve_type(ira, instruction->payload_type->other); |
| 15639 | if (type_is_invalid(payload_type)) | 15639 | if (type_is_invalid(payload_type)) |
| 15640 | return ira->codegen->builtin_types.entry_invalid; | 15640 | return ira->codegen->builtin_types.entry_invalid; |
| 15641 | | 15641 | |
| ... | @@ -15647,12 +15647,12 @@ static TypeTableEntry *ir_analyze_instruction_promise_type(IrAnalyze *ira, IrIns | ... | @@ -15647,12 +15647,12 @@ static TypeTableEntry *ir_analyze_instruction_promise_type(IrAnalyze *ira, IrIns |
| 15647 | return ira->codegen->builtin_types.entry_type; | 15647 | return ira->codegen->builtin_types.entry_type; |
| 15648 | } | 15648 | } |
| 15649 | | 15649 | |
| 15650 | static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira, | 15650 | static ZigType *ir_analyze_instruction_size_of(IrAnalyze *ira, |
| 15651 | IrInstructionSizeOf *size_of_instruction) | 15651 | IrInstructionSizeOf *size_of_instruction) |
| 15652 | { | 15652 | { |
| 15653 | Error err; | 15653 | Error err; |
| 15654 | IrInstruction *type_value = size_of_instruction->type_value->other; | 15654 | IrInstruction *type_value = size_of_instruction->type_value->other; |
| 15655 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 15655 | ZigType *type_entry = ir_resolve_type(ira, type_value); |
| 15656 | | 15656 | |
| 15657 | if ((err = ensure_complete_type(ira->codegen, type_entry))) | 15657 | if ((err = ensure_complete_type(ira->codegen, type_entry))) |
| 15658 | return ira->codegen->builtin_types.entry_invalid; | 15658 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -15698,12 +15698,12 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira, | ... | @@ -15698,12 +15698,12 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira, |
| 15698 | zig_unreachable(); | 15698 | zig_unreachable(); |
| 15699 | } | 15699 | } |
| 15700 | | 15700 | |
| 15701 | static TypeTableEntry *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrInstructionTestNonNull *instruction) { | 15701 | static ZigType *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrInstructionTestNonNull *instruction) { |
| 15702 | IrInstruction *value = instruction->value->other; | 15702 | IrInstruction *value = instruction->value->other; |
| 15703 | if (type_is_invalid(value->value.type)) | 15703 | if (type_is_invalid(value->value.type)) |
| 15704 | return ira->codegen->builtin_types.entry_invalid; | 15704 | return ira->codegen->builtin_types.entry_invalid; |
| 15705 | | 15705 | |
| 15706 | TypeTableEntry *type_entry = value->value.type; | 15706 | ZigType *type_entry = value->value.type; |
| 15707 | | 15707 | |
| 15708 | if (type_entry->id == TypeTableEntryIdOptional) { | 15708 | if (type_entry->id == TypeTableEntryIdOptional) { |
| 15709 | if (instr_is_comptime(value)) { | 15709 | if (instr_is_comptime(value)) { |
| ... | @@ -15729,17 +15729,17 @@ static TypeTableEntry *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrIn | ... | @@ -15729,17 +15729,17 @@ static TypeTableEntry *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrIn |
| 15729 | } | 15729 | } |
| 15730 | } | 15730 | } |
| 15731 | | 15731 | |
| 15732 | static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, | 15732 | static ZigType *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, |
| 15733 | IrInstructionUnwrapOptional *unwrap_maybe_instruction) | 15733 | IrInstructionUnwrapOptional *unwrap_maybe_instruction) |
| 15734 | { | 15734 | { |
| 15735 | IrInstruction *value = unwrap_maybe_instruction->value->other; | 15735 | IrInstruction *value = unwrap_maybe_instruction->value->other; |
| 15736 | if (type_is_invalid(value->value.type)) | 15736 | if (type_is_invalid(value->value.type)) |
| 15737 | return ira->codegen->builtin_types.entry_invalid; | 15737 | return ira->codegen->builtin_types.entry_invalid; |
| 15738 | | 15738 | |
| 15739 | TypeTableEntry *ptr_type = value->value.type; | 15739 | ZigType *ptr_type = value->value.type; |
| 15740 | assert(ptr_type->id == TypeTableEntryIdPointer); | 15740 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 15741 | | 15741 | |
| 15742 | TypeTableEntry *type_entry = ptr_type->data.pointer.child_type; | 15742 | ZigType *type_entry = ptr_type->data.pointer.child_type; |
| 15743 | if (type_is_invalid(type_entry)) { | 15743 | if (type_is_invalid(type_entry)) { |
| 15744 | return ira->codegen->builtin_types.entry_invalid; | 15744 | return ira->codegen->builtin_types.entry_invalid; |
| 15745 | } else if (type_entry->id != TypeTableEntryIdOptional) { | 15745 | } else if (type_entry->id != TypeTableEntryIdOptional) { |
| ... | @@ -15747,8 +15747,8 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, | ... | @@ -15747,8 +15747,8 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, |
| 15747 | buf_sprintf("expected optional type, found '%s'", buf_ptr(&type_entry->name))); | 15747 | buf_sprintf("expected optional type, found '%s'", buf_ptr(&type_entry->name))); |
| 15748 | return ira->codegen->builtin_types.entry_invalid; | 15748 | return ira->codegen->builtin_types.entry_invalid; |
| 15749 | } | 15749 | } |
| 15750 | TypeTableEntry *child_type = type_entry->data.maybe.child_type; | 15750 | ZigType *child_type = type_entry->data.maybe.child_type; |
| 15751 | TypeTableEntry *result_type = get_pointer_to_type_extra(ira->codegen, child_type, | 15751 | ZigType *result_type = get_pointer_to_type_extra(ira->codegen, child_type, |
| 15752 | ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile, | 15752 | ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile, |
| 15753 | PtrLenSingle, | 15753 | PtrLenSingle, |
| 15754 | get_abi_alignment(ira->codegen, child_type), 0, 0); | 15754 | get_abi_alignment(ira->codegen, child_type), 0, 0); |
| ... | @@ -15783,12 +15783,12 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, | ... | @@ -15783,12 +15783,12 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, |
| 15783 | return result_type; | 15783 | return result_type; |
| 15784 | } | 15784 | } |
| 15785 | | 15785 | |
| 15786 | static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionCtz *ctz_instruction) { | 15786 | static ZigType *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionCtz *ctz_instruction) { |
| 15787 | IrInstruction *value = ctz_instruction->value->other; | 15787 | IrInstruction *value = ctz_instruction->value->other; |
| 15788 | if (type_is_invalid(value->value.type)) { | 15788 | if (type_is_invalid(value->value.type)) { |
| 15789 | return ira->codegen->builtin_types.entry_invalid; | 15789 | return ira->codegen->builtin_types.entry_invalid; |
| 15790 | } else if (value->value.type->id == TypeTableEntryIdInt) { | 15790 | } else if (value->value.type->id == TypeTableEntryIdInt) { |
| 15791 | TypeTableEntry *return_type = get_smallest_unsigned_int_type(ira->codegen, | 15791 | ZigType *return_type = get_smallest_unsigned_int_type(ira->codegen, |
| 15792 | value->value.type->data.integral.bit_count); | 15792 | value->value.type->data.integral.bit_count); |
| 15793 | if (value->value.special != ConstValSpecialRuntime) { | 15793 | if (value->value.special != ConstValSpecialRuntime) { |
| 15794 | size_t result = bigint_ctz(&value->value.data.x_bigint, | 15794 | size_t result = bigint_ctz(&value->value.data.x_bigint, |
| ... | @@ -15807,12 +15807,12 @@ static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionC | ... | @@ -15807,12 +15807,12 @@ static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionC |
| 15807 | } | 15807 | } |
| 15808 | } | 15808 | } |
| 15809 | | 15809 | |
| 15810 | static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionClz *clz_instruction) { | 15810 | static ZigType *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionClz *clz_instruction) { |
| 15811 | IrInstruction *value = clz_instruction->value->other; | 15811 | IrInstruction *value = clz_instruction->value->other; |
| 15812 | if (type_is_invalid(value->value.type)) { | 15812 | if (type_is_invalid(value->value.type)) { |
| 15813 | return ira->codegen->builtin_types.entry_invalid; | 15813 | return ira->codegen->builtin_types.entry_invalid; |
| 15814 | } else if (value->value.type->id == TypeTableEntryIdInt) { | 15814 | } else if (value->value.type->id == TypeTableEntryIdInt) { |
| 15815 | TypeTableEntry *return_type = get_smallest_unsigned_int_type(ira->codegen, | 15815 | ZigType *return_type = get_smallest_unsigned_int_type(ira->codegen, |
| 15816 | value->value.type->data.integral.bit_count); | 15816 | value->value.type->data.integral.bit_count); |
| 15817 | if (value->value.special != ConstValSpecialRuntime) { | 15817 | if (value->value.special != ConstValSpecialRuntime) { |
| 15818 | size_t result = bigint_clz(&value->value.data.x_bigint, | 15818 | size_t result = bigint_clz(&value->value.data.x_bigint, |
| ... | @@ -15831,7 +15831,7 @@ static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionC | ... | @@ -15831,7 +15831,7 @@ static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionC |
| 15831 | } | 15831 | } |
| 15832 | } | 15832 | } |
| 15833 | | 15833 | |
| 15834 | static TypeTableEntry *ir_analyze_instruction_pop_count(IrAnalyze *ira, IrInstructionPopCount *instruction) { | 15834 | static ZigType *ir_analyze_instruction_pop_count(IrAnalyze *ira, IrInstructionPopCount *instruction) { |
| 15835 | IrInstruction *value = instruction->value->other; | 15835 | IrInstruction *value = instruction->value->other; |
| 15836 | if (type_is_invalid(value->value.type)) | 15836 | if (type_is_invalid(value->value.type)) |
| 15837 | return ira->codegen->builtin_types.entry_invalid; | 15837 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -15895,7 +15895,7 @@ static IrInstruction *ir_analyze_union_tag(IrAnalyze *ira, IrInstruction *source | ... | @@ -15895,7 +15895,7 @@ static IrInstruction *ir_analyze_union_tag(IrAnalyze *ira, IrInstruction *source |
| 15895 | return ira->codegen->invalid_instruction; | 15895 | return ira->codegen->invalid_instruction; |
| 15896 | } | 15896 | } |
| 15897 | | 15897 | |
| 15898 | TypeTableEntry *tag_type = value->value.type->data.unionation.tag_type; | 15898 | ZigType *tag_type = value->value.type->data.unionation.tag_type; |
| 15899 | assert(tag_type->id == TypeTableEntryIdEnum); | 15899 | assert(tag_type->id == TypeTableEntryIdEnum); |
| 15900 | | 15900 | |
| 15901 | if (instr_is_comptime(value)) { | 15901 | if (instr_is_comptime(value)) { |
| ... | @@ -15916,7 +15916,7 @@ static IrInstruction *ir_analyze_union_tag(IrAnalyze *ira, IrInstruction *source | ... | @@ -15916,7 +15916,7 @@ static IrInstruction *ir_analyze_union_tag(IrAnalyze *ira, IrInstruction *source |
| 15916 | return result; | 15916 | return result; |
| 15917 | } | 15917 | } |
| 15918 | | 15918 | |
| 15919 | static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, | 15919 | static ZigType *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 15920 | IrInstructionSwitchBr *switch_br_instruction) | 15920 | IrInstructionSwitchBr *switch_br_instruction) |
| 15921 | { | 15921 | { |
| 15922 | IrInstruction *target_value = switch_br_instruction->target_value->other; | 15922 | IrInstruction *target_value = switch_br_instruction->target_value->other; |
| ... | @@ -16024,7 +16024,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, | ... | @@ -16024,7 +16024,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 16024 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); | 16024 | return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable); |
| 16025 | } | 16025 | } |
| 16026 | | 16026 | |
| 16027 | static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, | 16027 | static ZigType *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 16028 | IrInstructionSwitchTarget *switch_target_instruction) | 16028 | IrInstructionSwitchTarget *switch_target_instruction) |
| 16029 | { | 16029 | { |
| 16030 | Error err; | 16030 | Error err; |
| ... | @@ -16034,7 +16034,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, | ... | @@ -16034,7 +16034,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 16034 | | 16034 | |
| 16035 | if (target_value_ptr->value.type->id == TypeTableEntryIdMetaType) { | 16035 | if (target_value_ptr->value.type->id == TypeTableEntryIdMetaType) { |
| 16036 | assert(instr_is_comptime(target_value_ptr)); | 16036 | assert(instr_is_comptime(target_value_ptr)); |
| 16037 | TypeTableEntry *ptr_type = target_value_ptr->value.data.x_type; | 16037 | ZigType *ptr_type = target_value_ptr->value.data.x_type; |
| 16038 | assert(ptr_type->id == TypeTableEntryIdPointer); | 16038 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 16039 | ConstExprValue *out_val = ir_build_const_from(ira, &switch_target_instruction->base); | 16039 | ConstExprValue *out_val = ir_build_const_from(ira, &switch_target_instruction->base); |
| 16040 | out_val->type = ira->codegen->builtin_types.entry_type; | 16040 | out_val->type = ira->codegen->builtin_types.entry_type; |
| ... | @@ -16047,7 +16047,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, | ... | @@ -16047,7 +16047,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 16047 | return ira->codegen->builtin_types.entry_invalid; | 16047 | return ira->codegen->builtin_types.entry_invalid; |
| 16048 | } | 16048 | } |
| 16049 | | 16049 | |
| 16050 | TypeTableEntry *target_type = target_value_ptr->value.type->data.pointer.child_type; | 16050 | ZigType *target_type = target_value_ptr->value.type->data.pointer.child_type; |
| 16051 | ConstExprValue *pointee_val = nullptr; | 16051 | ConstExprValue *pointee_val = nullptr; |
| 16052 | if (instr_is_comptime(target_value_ptr)) { | 16052 | if (instr_is_comptime(target_value_ptr)) { |
| 16053 | pointee_val = ir_const_ptr_pointee(ira, &target_value_ptr->value, target_value_ptr->source_node); | 16053 | pointee_val = ir_const_ptr_pointee(ira, &target_value_ptr->value, target_value_ptr->source_node); |
| ... | @@ -16095,7 +16095,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, | ... | @@ -16095,7 +16095,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 16095 | buf_sprintf("consider 'union(enum)' here")); | 16095 | buf_sprintf("consider 'union(enum)' here")); |
| 16096 | return ira->codegen->builtin_types.entry_invalid; | 16096 | return ira->codegen->builtin_types.entry_invalid; |
| 16097 | } | 16097 | } |
| 16098 | TypeTableEntry *tag_type = target_type->data.unionation.tag_type; | 16098 | ZigType *tag_type = target_type->data.unionation.tag_type; |
| 16099 | assert(tag_type != nullptr); | 16099 | assert(tag_type != nullptr); |
| 16100 | assert(tag_type->id == TypeTableEntryIdEnum); | 16100 | assert(tag_type->id == TypeTableEntryIdEnum); |
| 16101 | if (pointee_val) { | 16101 | if (pointee_val) { |
| ... | @@ -16160,7 +16160,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, | ... | @@ -16160,7 +16160,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 16160 | zig_unreachable(); | 16160 | zig_unreachable(); |
| 16161 | } | 16161 | } |
| 16162 | | 16162 | |
| 16163 | static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstructionSwitchVar *instruction) { | 16163 | static ZigType *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstructionSwitchVar *instruction) { |
| 16164 | IrInstruction *target_value_ptr = instruction->target_value_ptr->other; | 16164 | IrInstruction *target_value_ptr = instruction->target_value_ptr->other; |
| 16165 | if (type_is_invalid(target_value_ptr->value.type)) | 16165 | if (type_is_invalid(target_value_ptr->value.type)) |
| 16166 | return ira->codegen->builtin_types.entry_invalid; | 16166 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -16170,7 +16170,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstr | ... | @@ -16170,7 +16170,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstr |
| 16170 | return ira->codegen->builtin_types.entry_invalid; | 16170 | return ira->codegen->builtin_types.entry_invalid; |
| 16171 | | 16171 | |
| 16172 | assert(target_value_ptr->value.type->id == TypeTableEntryIdPointer); | 16172 | assert(target_value_ptr->value.type->id == TypeTableEntryIdPointer); |
| 16173 | TypeTableEntry *target_type = target_value_ptr->value.type->data.pointer.child_type; | 16173 | ZigType *target_type = target_value_ptr->value.type->data.pointer.child_type; |
| 16174 | if (target_type->id == TypeTableEntryIdUnion) { | 16174 | if (target_type->id == TypeTableEntryIdUnion) { |
| 16175 | ConstExprValue *prong_val = ir_resolve_const(ira, prong_value, UndefBad); | 16175 | ConstExprValue *prong_val = ir_resolve_const(ira, prong_value, UndefBad); |
| 16176 | if (!prong_val) | 16176 | if (!prong_val) |
| ... | @@ -16205,14 +16205,14 @@ static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstr | ... | @@ -16205,14 +16205,14 @@ static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstr |
| 16205 | } | 16205 | } |
| 16206 | } | 16206 | } |
| 16207 | | 16207 | |
| 16208 | static TypeTableEntry *ir_analyze_instruction_union_tag(IrAnalyze *ira, IrInstructionUnionTag *instruction) { | 16208 | static ZigType *ir_analyze_instruction_union_tag(IrAnalyze *ira, IrInstructionUnionTag *instruction) { |
| 16209 | IrInstruction *value = instruction->value->other; | 16209 | IrInstruction *value = instruction->value->other; |
| 16210 | IrInstruction *new_instruction = ir_analyze_union_tag(ira, &instruction->base, value); | 16210 | IrInstruction *new_instruction = ir_analyze_union_tag(ira, &instruction->base, value); |
| 16211 | ir_link_new_instruction(new_instruction, &instruction->base); | 16211 | ir_link_new_instruction(new_instruction, &instruction->base); |
| 16212 | return new_instruction->value.type; | 16212 | return new_instruction->value.type; |
| 16213 | } | 16213 | } |
| 16214 | | 16214 | |
| 16215 | static TypeTableEntry *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructionImport *import_instruction) { | 16215 | static ZigType *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructionImport *import_instruction) { |
| 16216 | IrInstruction *name_value = import_instruction->name->other; | 16216 | IrInstruction *name_value = import_instruction->name->other; |
| 16217 | Buf *import_target_str = ir_resolve_str(ira, name_value); | 16217 | Buf *import_target_str = ir_resolve_str(ira, name_value); |
| 16218 | if (!import_target_str) | 16218 | if (!import_target_str) |
| ... | @@ -16278,11 +16278,11 @@ static TypeTableEntry *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructi | ... | @@ -16278,11 +16278,11 @@ static TypeTableEntry *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructi |
| 16278 | | 16278 | |
| 16279 | } | 16279 | } |
| 16280 | | 16280 | |
| 16281 | static TypeTableEntry *ir_analyze_instruction_array_len(IrAnalyze *ira, | 16281 | static ZigType *ir_analyze_instruction_array_len(IrAnalyze *ira, |
| 16282 | IrInstructionArrayLen *array_len_instruction) | 16282 | IrInstructionArrayLen *array_len_instruction) |
| 16283 | { | 16283 | { |
| 16284 | IrInstruction *array_value = array_len_instruction->array_value->other; | 16284 | IrInstruction *array_value = array_len_instruction->array_value->other; |
| 16285 | TypeTableEntry *type_entry = array_value->value.type; | 16285 | ZigType *type_entry = array_value->value.type; |
| 16286 | if (type_is_invalid(type_entry)) { | 16286 | if (type_is_invalid(type_entry)) { |
| 16287 | return ira->codegen->builtin_types.entry_invalid; | 16287 | return ira->codegen->builtin_types.entry_invalid; |
| 16288 | } else if (type_entry->id == TypeTableEntryIdArray) { | 16288 | } else if (type_entry->id == TypeTableEntryIdArray) { |
| ... | @@ -16309,13 +16309,13 @@ static TypeTableEntry *ir_analyze_instruction_array_len(IrAnalyze *ira, | ... | @@ -16309,13 +16309,13 @@ static TypeTableEntry *ir_analyze_instruction_array_len(IrAnalyze *ira, |
| 16309 | } | 16309 | } |
| 16310 | } | 16310 | } |
| 16311 | | 16311 | |
| 16312 | static TypeTableEntry *ir_analyze_instruction_ref(IrAnalyze *ira, IrInstructionRef *ref_instruction) { | 16312 | static ZigType *ir_analyze_instruction_ref(IrAnalyze *ira, IrInstructionRef *ref_instruction) { |
| 16313 | IrInstruction *value = ref_instruction->value->other; | 16313 | IrInstruction *value = ref_instruction->value->other; |
| 16314 | return ir_analyze_ref(ira, &ref_instruction->base, value, ref_instruction->is_const, ref_instruction->is_volatile); | 16314 | return ir_analyze_ref(ira, &ref_instruction->base, value, ref_instruction->is_const, ref_instruction->is_volatile); |
| 16315 | } | 16315 | } |
| 16316 | | 16316 | |
| 16317 | static TypeTableEntry *ir_analyze_container_init_fields_union(IrAnalyze *ira, IrInstruction *instruction, | 16317 | static ZigType *ir_analyze_container_init_fields_union(IrAnalyze *ira, IrInstruction *instruction, |
| 16318 | TypeTableEntry *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields) | 16318 | ZigType *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields) |
| 16319 | { | 16319 | { |
| 16320 | Error err; | 16320 | Error err; |
| 16321 | assert(container_type->id == TypeTableEntryIdUnion); | 16321 | assert(container_type->id == TypeTableEntryIdUnion); |
| ... | @@ -16380,8 +16380,8 @@ static TypeTableEntry *ir_analyze_container_init_fields_union(IrAnalyze *ira, Ir | ... | @@ -16380,8 +16380,8 @@ static TypeTableEntry *ir_analyze_container_init_fields_union(IrAnalyze *ira, Ir |
| 16380 | return container_type; | 16380 | return container_type; |
| 16381 | } | 16381 | } |
| 16382 | | 16382 | |
| 16383 | static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstruction *instruction, | 16383 | static ZigType *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstruction *instruction, |
| 16384 | TypeTableEntry *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields) | 16384 | ZigType *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields) |
| 16385 | { | 16385 | { |
| 16386 | Error err; | 16386 | Error err; |
| 16387 | if (container_type->id == TypeTableEntryIdUnion) { | 16387 | if (container_type->id == TypeTableEntryIdUnion) { |
| ... | @@ -16500,7 +16500,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru | ... | @@ -16500,7 +16500,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru |
| 16500 | return container_type; | 16500 | return container_type; |
| 16501 | } | 16501 | } |
| 16502 | | 16502 | |
| 16503 | static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira, | 16503 | static ZigType *ir_analyze_instruction_container_init_list(IrAnalyze *ira, |
| 16504 | IrInstructionContainerInitList *instruction) | 16504 | IrInstructionContainerInitList *instruction) |
| 16505 | { | 16505 | { |
| 16506 | IrInstruction *container_type_value = instruction->container_type->other; | 16506 | IrInstruction *container_type_value = instruction->container_type->other; |
| ... | @@ -16509,7 +16509,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira | ... | @@ -16509,7 +16509,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 16509 | | 16509 | |
| 16510 | size_t elem_count = instruction->item_count; | 16510 | size_t elem_count = instruction->item_count; |
| 16511 | if (container_type_value->value.type->id == TypeTableEntryIdMetaType) { | 16511 | if (container_type_value->value.type->id == TypeTableEntryIdMetaType) { |
| 16512 | TypeTableEntry *container_type = ir_resolve_type(ira, container_type_value); | 16512 | ZigType *container_type = ir_resolve_type(ira, container_type_value); |
| 16513 | if (type_is_invalid(container_type)) | 16513 | if (type_is_invalid(container_type)) |
| 16514 | return ira->codegen->builtin_types.entry_invalid; | 16514 | return ira->codegen->builtin_types.entry_invalid; |
| 16515 | | 16515 | |
| ... | @@ -16518,11 +16518,11 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira | ... | @@ -16518,11 +16518,11 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 16518 | 0, nullptr); | 16518 | 0, nullptr); |
| 16519 | } else if (is_slice(container_type) || container_type->id == TypeTableEntryIdArray) { | 16519 | } else if (is_slice(container_type) || container_type->id == TypeTableEntryIdArray) { |
| 16520 | // array is same as slice init but we make a compile error if the length is wrong | 16520 | // array is same as slice init but we make a compile error if the length is wrong |
| 16521 | TypeTableEntry *child_type; | 16521 | ZigType *child_type; |
| 16522 | if (container_type->id == TypeTableEntryIdArray) { | 16522 | if (container_type->id == TypeTableEntryIdArray) { |
| 16523 | child_type = container_type->data.array.child_type; | 16523 | child_type = container_type->data.array.child_type; |
| 16524 | if (container_type->data.array.len != elem_count) { | 16524 | if (container_type->data.array.len != elem_count) { |
| 16525 | TypeTableEntry *literal_type = get_array_type(ira->codegen, child_type, elem_count); | 16525 | ZigType *literal_type = get_array_type(ira->codegen, child_type, elem_count); |
| 16526 | | 16526 | |
| 16527 | ir_add_error(ira, &instruction->base, | 16527 | ir_add_error(ira, &instruction->base, |
| 16528 | buf_sprintf("expected %s literal, found %s literal", | 16528 | buf_sprintf("expected %s literal, found %s literal", |
| ... | @@ -16530,12 +16530,12 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira | ... | @@ -16530,12 +16530,12 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 16530 | return ira->codegen->builtin_types.entry_invalid; | 16530 | return ira->codegen->builtin_types.entry_invalid; |
| 16531 | } | 16531 | } |
| 16532 | } else { | 16532 | } else { |
| 16533 | TypeTableEntry *pointer_type = container_type->data.structure.fields[slice_ptr_index].type_entry; | 16533 | ZigType *pointer_type = container_type->data.structure.fields[slice_ptr_index].type_entry; |
| 16534 | assert(pointer_type->id == TypeTableEntryIdPointer); | 16534 | assert(pointer_type->id == TypeTableEntryIdPointer); |
| 16535 | child_type = pointer_type->data.pointer.child_type; | 16535 | child_type = pointer_type->data.pointer.child_type; |
| 16536 | } | 16536 | } |
| 16537 | | 16537 | |
| 16538 | TypeTableEntry *fixed_size_array_type = get_array_type(ira->codegen, child_type, elem_count); | 16538 | ZigType *fixed_size_array_type = get_array_type(ira->codegen, child_type, elem_count); |
| 16539 | | 16539 | |
| 16540 | ConstExprValue const_val = {}; | 16540 | ConstExprValue const_val = {}; |
| 16541 | const_val.special = ConstValSpecialStatic; | 16541 | const_val.special = ConstValSpecialStatic; |
| ... | @@ -16618,9 +16618,9 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira | ... | @@ -16618,9 +16618,9 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 16618 | } | 16618 | } |
| 16619 | } | 16619 | } |
| 16620 | | 16620 | |
| 16621 | static TypeTableEntry *ir_analyze_instruction_container_init_fields(IrAnalyze *ira, IrInstructionContainerInitFields *instruction) { | 16621 | static ZigType *ir_analyze_instruction_container_init_fields(IrAnalyze *ira, IrInstructionContainerInitFields *instruction) { |
| 16622 | IrInstruction *container_type_value = instruction->container_type->other; | 16622 | IrInstruction *container_type_value = instruction->container_type->other; |
| 16623 | TypeTableEntry *container_type = ir_resolve_type(ira, container_type_value); | 16623 | ZigType *container_type = ir_resolve_type(ira, container_type_value); |
| 16624 | if (type_is_invalid(container_type)) | 16624 | if (type_is_invalid(container_type)) |
| 16625 | return ira->codegen->builtin_types.entry_invalid; | 16625 | return ira->codegen->builtin_types.entry_invalid; |
| 16626 | | 16626 | |
| ... | @@ -16628,10 +16628,10 @@ static TypeTableEntry *ir_analyze_instruction_container_init_fields(IrAnalyze *i | ... | @@ -16628,10 +16628,10 @@ static TypeTableEntry *ir_analyze_instruction_container_init_fields(IrAnalyze *i |
| 16628 | instruction->field_count, instruction->fields); | 16628 | instruction->field_count, instruction->fields); |
| 16629 | } | 16629 | } |
| 16630 | | 16630 | |
| 16631 | static TypeTableEntry *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_instruction, | 16631 | static ZigType *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_instruction, |
| 16632 | IrInstruction *target_type_value, bool is_max) | 16632 | IrInstruction *target_type_value, bool is_max) |
| 16633 | { | 16633 | { |
| 16634 | TypeTableEntry *target_type = ir_resolve_type(ira, target_type_value); | 16634 | ZigType *target_type = ir_resolve_type(ira, target_type_value); |
| 16635 | if (type_is_invalid(target_type)) | 16635 | if (type_is_invalid(target_type)) |
| 16636 | return ira->codegen->builtin_types.entry_invalid; | 16636 | return ira->codegen->builtin_types.entry_invalid; |
| 16637 | switch (target_type->id) { | 16637 | switch (target_type->id) { |
| ... | @@ -16684,19 +16684,19 @@ static TypeTableEntry *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_ | ... | @@ -16684,19 +16684,19 @@ static TypeTableEntry *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_ |
| 16684 | zig_unreachable(); | 16684 | zig_unreachable(); |
| 16685 | } | 16685 | } |
| 16686 | | 16686 | |
| 16687 | static TypeTableEntry *ir_analyze_instruction_min_value(IrAnalyze *ira, | 16687 | static ZigType *ir_analyze_instruction_min_value(IrAnalyze *ira, |
| 16688 | IrInstructionMinValue *instruction) | 16688 | IrInstructionMinValue *instruction) |
| 16689 | { | 16689 | { |
| 16690 | return ir_analyze_min_max(ira, &instruction->base, instruction->value->other, false); | 16690 | return ir_analyze_min_max(ira, &instruction->base, instruction->value->other, false); |
| 16691 | } | 16691 | } |
| 16692 | | 16692 | |
| 16693 | static TypeTableEntry *ir_analyze_instruction_max_value(IrAnalyze *ira, | 16693 | static ZigType *ir_analyze_instruction_max_value(IrAnalyze *ira, |
| 16694 | IrInstructionMaxValue *instruction) | 16694 | IrInstructionMaxValue *instruction) |
| 16695 | { | 16695 | { |
| 16696 | return ir_analyze_min_max(ira, &instruction->base, instruction->value->other, true); | 16696 | return ir_analyze_min_max(ira, &instruction->base, instruction->value->other, true); |
| 16697 | } | 16697 | } |
| 16698 | | 16698 | |
| 16699 | static TypeTableEntry *ir_analyze_instruction_compile_err(IrAnalyze *ira, | 16699 | static ZigType *ir_analyze_instruction_compile_err(IrAnalyze *ira, |
| 16700 | IrInstructionCompileErr *instruction) | 16700 | IrInstructionCompileErr *instruction) |
| 16701 | { | 16701 | { |
| 16702 | IrInstruction *msg_value = instruction->msg->other; | 16702 | IrInstruction *msg_value = instruction->msg->other; |
| ... | @@ -16720,7 +16720,7 @@ static TypeTableEntry *ir_analyze_instruction_compile_err(IrAnalyze *ira, | ... | @@ -16720,7 +16720,7 @@ static TypeTableEntry *ir_analyze_instruction_compile_err(IrAnalyze *ira, |
| 16720 | return ira->codegen->builtin_types.entry_invalid; | 16720 | return ira->codegen->builtin_types.entry_invalid; |
| 16721 | } | 16721 | } |
| 16722 | | 16722 | |
| 16723 | static TypeTableEntry *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInstructionCompileLog *instruction) { | 16723 | static ZigType *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInstructionCompileLog *instruction) { |
| 16724 | Buf buf = BUF_INIT; | 16724 | Buf buf = BUF_INIT; |
| 16725 | fprintf(stderr, "| "); | 16725 | fprintf(stderr, "| "); |
| 16726 | for (size_t i = 0; i < instruction->msg_count; i += 1) { | 16726 | for (size_t i = 0; i < instruction->msg_count; i += 1) { |
| ... | @@ -16740,7 +16740,7 @@ static TypeTableEntry *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInst | ... | @@ -16740,7 +16740,7 @@ static TypeTableEntry *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInst |
| 16740 | return ira->codegen->builtin_types.entry_void; | 16740 | return ira->codegen->builtin_types.entry_void; |
| 16741 | } | 16741 | } |
| 16742 | | 16742 | |
| 16743 | static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstructionErrName *instruction) { | 16743 | static ZigType *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstructionErrName *instruction) { |
| 16744 | IrInstruction *value = instruction->value->other; | 16744 | IrInstruction *value = instruction->value->other; |
| 16745 | if (type_is_invalid(value->value.type)) | 16745 | if (type_is_invalid(value->value.type)) |
| 16746 | return ira->codegen->builtin_types.entry_invalid; | 16746 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -16749,9 +16749,9 @@ static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstruc | ... | @@ -16749,9 +16749,9 @@ static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstruc |
| 16749 | if (type_is_invalid(casted_value->value.type)) | 16749 | if (type_is_invalid(casted_value->value.type)) |
| 16750 | return ira->codegen->builtin_types.entry_invalid; | 16750 | return ira->codegen->builtin_types.entry_invalid; |
| 16751 | | 16751 | |
| 16752 | TypeTableEntry *u8_ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, | 16752 | ZigType *u8_ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 16753 | true, false, PtrLenUnknown, get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), 0, 0); | 16753 | true, false, PtrLenUnknown, get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), 0, 0); |
| 16754 | TypeTableEntry *str_type = get_slice_type(ira->codegen, u8_ptr_type); | 16754 | ZigType *str_type = get_slice_type(ira->codegen, u8_ptr_type); |
| 16755 | if (casted_value->value.special == ConstValSpecialStatic) { | 16755 | if (casted_value->value.special == ConstValSpecialStatic) { |
| 16756 | ErrorTableEntry *err = casted_value->value.data.x_err_set; | 16756 | ErrorTableEntry *err = casted_value->value.data.x_err_set; |
| 16757 | if (!err->cached_error_name_val) { | 16757 | if (!err->cached_error_name_val) { |
| ... | @@ -16768,7 +16768,7 @@ static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstruc | ... | @@ -16768,7 +16768,7 @@ static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstruc |
| 16768 | return str_type; | 16768 | return str_type; |
| 16769 | } | 16769 | } |
| 16770 | | 16770 | |
| 16771 | static TypeTableEntry *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrInstructionTagName *instruction) { | 16771 | static ZigType *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrInstructionTagName *instruction) { |
| 16772 | Error err; | 16772 | Error err; |
| 16773 | IrInstruction *target = instruction->target->other; | 16773 | IrInstruction *target = instruction->target->other; |
| 16774 | if (type_is_invalid(target->value.type)) | 16774 | if (type_is_invalid(target->value.type)) |
| ... | @@ -16789,7 +16789,7 @@ static TypeTableEntry *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrIn | ... | @@ -16789,7 +16789,7 @@ static TypeTableEntry *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrIn |
| 16789 | IrInstruction *result = ir_build_tag_name(&ira->new_irb, instruction->base.scope, | 16789 | IrInstruction *result = ir_build_tag_name(&ira->new_irb, instruction->base.scope, |
| 16790 | instruction->base.source_node, target); | 16790 | instruction->base.source_node, target); |
| 16791 | ir_link_new_instruction(result, &instruction->base); | 16791 | ir_link_new_instruction(result, &instruction->base); |
| 16792 | TypeTableEntry *u8_ptr_type = get_pointer_to_type_extra( | 16792 | ZigType *u8_ptr_type = get_pointer_to_type_extra( |
| 16793 | ira->codegen, ira->codegen->builtin_types.entry_u8, | 16793 | ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 16794 | true, false, PtrLenUnknown, | 16794 | true, false, PtrLenUnknown, |
| 16795 | get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), | 16795 | get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), |
| ... | @@ -16798,12 +16798,12 @@ static TypeTableEntry *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrIn | ... | @@ -16798,12 +16798,12 @@ static TypeTableEntry *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrIn |
| 16798 | return result->value.type; | 16798 | return result->value.type; |
| 16799 | } | 16799 | } |
| 16800 | | 16800 | |
| 16801 | static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira, | 16801 | static ZigType *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira, |
| 16802 | IrInstructionFieldParentPtr *instruction) | 16802 | IrInstructionFieldParentPtr *instruction) |
| 16803 | { | 16803 | { |
| 16804 | Error err; | 16804 | Error err; |
| 16805 | IrInstruction *type_value = instruction->type_value->other; | 16805 | IrInstruction *type_value = instruction->type_value->other; |
| 16806 | TypeTableEntry *container_type = ir_resolve_type(ira, type_value); | 16806 | ZigType *container_type = ir_resolve_type(ira, type_value); |
| 16807 | if (type_is_invalid(container_type)) | 16807 | if (type_is_invalid(container_type)) |
| 16808 | return ira->codegen->builtin_types.entry_invalid; | 16808 | return ira->codegen->builtin_types.entry_invalid; |
| 16809 | | 16809 | |
| ... | @@ -16843,7 +16843,7 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira, | ... | @@ -16843,7 +16843,7 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira, |
| 16843 | uint32_t field_ptr_align = is_packed ? 1 : get_abi_alignment(ira->codegen, field->type_entry); | 16843 | uint32_t field_ptr_align = is_packed ? 1 : get_abi_alignment(ira->codegen, field->type_entry); |
| 16844 | uint32_t parent_ptr_align = is_packed ? 1 : get_abi_alignment(ira->codegen, container_type); | 16844 | uint32_t parent_ptr_align = is_packed ? 1 : get_abi_alignment(ira->codegen, container_type); |
| 16845 | | 16845 | |
| 16846 | TypeTableEntry *field_ptr_type = get_pointer_to_type_extra(ira->codegen, field->type_entry, | 16846 | ZigType *field_ptr_type = get_pointer_to_type_extra(ira->codegen, field->type_entry, |
| 16847 | field_ptr->value.type->data.pointer.is_const, | 16847 | field_ptr->value.type->data.pointer.is_const, |
| 16848 | field_ptr->value.type->data.pointer.is_volatile, | 16848 | field_ptr->value.type->data.pointer.is_volatile, |
| 16849 | PtrLenSingle, | 16849 | PtrLenSingle, |
| ... | @@ -16852,7 +16852,7 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira, | ... | @@ -16852,7 +16852,7 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira, |
| 16852 | if (type_is_invalid(casted_field_ptr->value.type)) | 16852 | if (type_is_invalid(casted_field_ptr->value.type)) |
| 16853 | return ira->codegen->builtin_types.entry_invalid; | 16853 | return ira->codegen->builtin_types.entry_invalid; |
| 16854 | | 16854 | |
| 16855 | TypeTableEntry *result_type = get_pointer_to_type_extra(ira->codegen, container_type, | 16855 | ZigType *result_type = get_pointer_to_type_extra(ira->codegen, container_type, |
| 16856 | casted_field_ptr->value.type->data.pointer.is_const, | 16856 | casted_field_ptr->value.type->data.pointer.is_const, |
| 16857 | casted_field_ptr->value.type->data.pointer.is_volatile, | 16857 | casted_field_ptr->value.type->data.pointer.is_volatile, |
| 16858 | PtrLenSingle, | 16858 | PtrLenSingle, |
| ... | @@ -16891,12 +16891,12 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira, | ... | @@ -16891,12 +16891,12 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira, |
| 16891 | return result_type; | 16891 | return result_type; |
| 16892 | } | 16892 | } |
| 16893 | | 16893 | |
| 16894 | static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira, | 16894 | static ZigType *ir_analyze_instruction_offset_of(IrAnalyze *ira, |
| 16895 | IrInstructionOffsetOf *instruction) | 16895 | IrInstructionOffsetOf *instruction) |
| 16896 | { | 16896 | { |
| 16897 | Error err; | 16897 | Error err; |
| 16898 | IrInstruction *type_value = instruction->type_value->other; | 16898 | IrInstruction *type_value = instruction->type_value->other; |
| 16899 | TypeTableEntry *container_type = ir_resolve_type(ira, type_value); | 16899 | ZigType *container_type = ir_resolve_type(ira, type_value); |
| 16900 | if (type_is_invalid(container_type)) | 16900 | if (type_is_invalid(container_type)) |
| 16901 | return ira->codegen->builtin_types.entry_invalid; | 16901 | return ira->codegen->builtin_types.entry_invalid; |
| 16902 | | 16902 | |
| ... | @@ -16934,7 +16934,7 @@ static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira, | ... | @@ -16934,7 +16934,7 @@ static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira, |
| 16934 | return ira->codegen->builtin_types.entry_num_lit_int; | 16934 | return ira->codegen->builtin_types.entry_num_lit_int; |
| 16935 | } | 16935 | } |
| 16936 | | 16936 | |
| 16937 | static void ensure_field_index(TypeTableEntry *type, const char *field_name, size_t index) | 16937 | static void ensure_field_index(ZigType *type, const char *field_name, size_t index) |
| 16938 | { | 16938 | { |
| 16939 | Buf *field_name_buf; | 16939 | Buf *field_name_buf; |
| 16940 | | 16940 | |
| ... | @@ -16945,10 +16945,10 @@ static void ensure_field_index(TypeTableEntry *type, const char *field_name, siz | ... | @@ -16945,10 +16945,10 @@ static void ensure_field_index(TypeTableEntry *type, const char *field_name, siz |
| 16945 | (buf_deinit(field_name_buf), true)); | 16945 | (buf_deinit(field_name_buf), true)); |
| 16946 | } | 16946 | } |
| 16947 | | 16947 | |
| 16948 | static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, TypeTableEntry *root) { | 16948 | static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, ZigType *root) { |
| 16949 | Error err; | 16949 | Error err; |
| 16950 | static ConstExprValue *type_info_var = nullptr; | 16950 | static ConstExprValue *type_info_var = nullptr; |
| 16951 | static TypeTableEntry *type_info_type = nullptr; | 16951 | static ZigType *type_info_type = nullptr; |
| 16952 | if (type_info_var == nullptr) { | 16952 | if (type_info_var == nullptr) { |
| 16953 | type_info_var = get_builtin_value(ira->codegen, "TypeInfo"); | 16953 | type_info_var = get_builtin_value(ira->codegen, "TypeInfo"); |
| 16954 | assert(type_info_var->type->id == TypeTableEntryIdMetaType); | 16954 | assert(type_info_var->type->id == TypeTableEntryIdMetaType); |
| ... | @@ -16963,7 +16963,7 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na | ... | @@ -16963,7 +16963,7 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na |
| 16963 | else if (type_name == nullptr) | 16963 | else if (type_name == nullptr) |
| 16964 | return root; | 16964 | return root; |
| 16965 | | 16965 | |
| 16966 | TypeTableEntry *root_type = (root == nullptr) ? type_info_type : root; | 16966 | ZigType *root_type = (root == nullptr) ? type_info_type : root; |
| 16967 | | 16967 | |
| 16968 | ScopeDecls *type_info_scope = get_container_scope(root_type); | 16968 | ScopeDecls *type_info_scope = get_container_scope(root_type); |
| 16969 | assert(type_info_scope != nullptr); | 16969 | assert(type_info_scope != nullptr); |
| ... | @@ -16986,7 +16986,7 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na | ... | @@ -16986,7 +16986,7 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na |
| 16986 | | 16986 | |
| 16987 | static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, ScopeDecls *decls_scope) { | 16987 | static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, ScopeDecls *decls_scope) { |
| 16988 | Error err; | 16988 | Error err; |
| 16989 | TypeTableEntry *type_info_definition_type = ir_type_info_get_type(ira, "Definition", nullptr); | 16989 | ZigType *type_info_definition_type = ir_type_info_get_type(ira, "Definition", nullptr); |
| 16990 | if ((err = ensure_complete_type(ira->codegen, type_info_definition_type))) | 16990 | if ((err = ensure_complete_type(ira->codegen, type_info_definition_type))) |
| 16991 | return err; | 16991 | return err; |
| 16992 | | 16992 | |
| ... | @@ -16994,15 +16994,15 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco | ... | @@ -16994,15 +16994,15 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco |
| 16994 | ensure_field_index(type_info_definition_type, "is_pub", 1); | 16994 | ensure_field_index(type_info_definition_type, "is_pub", 1); |
| 16995 | ensure_field_index(type_info_definition_type, "data", 2); | 16995 | ensure_field_index(type_info_definition_type, "data", 2); |
| 16996 | | 16996 | |
| 16997 | TypeTableEntry *type_info_definition_data_type = ir_type_info_get_type(ira, "Data", type_info_definition_type); | 16997 | ZigType *type_info_definition_data_type = ir_type_info_get_type(ira, "Data", type_info_definition_type); |
| 16998 | if ((err = ensure_complete_type(ira->codegen, type_info_definition_data_type))) | 16998 | if ((err = ensure_complete_type(ira->codegen, type_info_definition_data_type))) |
| 16999 | return err; | 16999 | return err; |
| 17000 | | 17000 | |
| 17001 | TypeTableEntry *type_info_fn_def_type = ir_type_info_get_type(ira, "FnDef", type_info_definition_data_type); | 17001 | ZigType *type_info_fn_def_type = ir_type_info_get_type(ira, "FnDef", type_info_definition_data_type); |
| 17002 | if ((err = ensure_complete_type(ira->codegen, type_info_fn_def_type))) | 17002 | if ((err = ensure_complete_type(ira->codegen, type_info_fn_def_type))) |
| 17003 | return err; | 17003 | return err; |
| 17004 | | 17004 | |
| 17005 | TypeTableEntry *type_info_fn_def_inline_type = ir_type_info_get_type(ira, "Inline", type_info_fn_def_type); | 17005 | ZigType *type_info_fn_def_inline_type = ir_type_info_get_type(ira, "Inline", type_info_fn_def_type); |
| 17006 | if ((err = ensure_complete_type(ira->codegen, type_info_fn_def_inline_type))) | 17006 | if ((err = ensure_complete_type(ira->codegen, type_info_fn_def_inline_type))) |
| 17007 | return err; | 17007 | return err; |
| 17008 | | 17008 | |
| ... | @@ -17153,7 +17153,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco | ... | @@ -17153,7 +17153,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco |
| 17153 | // lib_name: ?[]const u8 | 17153 | // lib_name: ?[]const u8 |
| 17154 | ensure_field_index(fn_def_val->type, "lib_name", 6); | 17154 | ensure_field_index(fn_def_val->type, "lib_name", 6); |
| 17155 | fn_def_fields[6].special = ConstValSpecialStatic; | 17155 | fn_def_fields[6].special = ConstValSpecialStatic; |
| 17156 | TypeTableEntry *u8_ptr = get_pointer_to_type_extra( | 17156 | ZigType *u8_ptr = get_pointer_to_type_extra( |
| 17157 | ira->codegen, ira->codegen->builtin_types.entry_u8, | 17157 | ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 17158 | true, false, PtrLenUnknown, | 17158 | true, false, PtrLenUnknown, |
| 17159 | get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), | 17159 | get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), |
| ... | @@ -17205,7 +17205,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco | ... | @@ -17205,7 +17205,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco |
| 17205 | } | 17205 | } |
| 17206 | case TldIdContainer: | 17206 | case TldIdContainer: |
| 17207 | { | 17207 | { |
| 17208 | TypeTableEntry *type_entry = ((TldContainer *)curr_entry->value)->type_entry; | 17208 | ZigType *type_entry = ((TldContainer *)curr_entry->value)->type_entry; |
| 17209 | if ((err = ensure_complete_type(ira->codegen, type_entry))) | 17209 | if ((err = ensure_complete_type(ira->codegen, type_entry))) |
| 17210 | return ErrorSemanticAnalyzeFail; | 17210 | return ErrorSemanticAnalyzeFail; |
| 17211 | | 17211 | |
| ... | @@ -17232,8 +17232,8 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco | ... | @@ -17232,8 +17232,8 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco |
| 17232 | return ErrorNone; | 17232 | return ErrorNone; |
| 17233 | } | 17233 | } |
| 17234 | | 17234 | |
| 17235 | static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry *ptr_type_entry) { | 17235 | static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, ZigType *ptr_type_entry) { |
| 17236 | TypeTableEntry *attrs_type; | 17236 | ZigType *attrs_type; |
| 17237 | uint32_t size_enum_index; | 17237 | uint32_t size_enum_index; |
| 17238 | if (is_slice(ptr_type_entry)) { | 17238 | if (is_slice(ptr_type_entry)) { |
| 17239 | attrs_type = ptr_type_entry->data.structure.fields[slice_ptr_index].type_entry; | 17239 | attrs_type = ptr_type_entry->data.structure.fields[slice_ptr_index].type_entry; |
| ... | @@ -17245,7 +17245,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry | ... | @@ -17245,7 +17245,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry |
| 17245 | zig_unreachable(); | 17245 | zig_unreachable(); |
| 17246 | } | 17246 | } |
| 17247 | | 17247 | |
| 17248 | TypeTableEntry *type_info_pointer_type = ir_type_info_get_type(ira, "Pointer", nullptr); | 17248 | ZigType *type_info_pointer_type = ir_type_info_get_type(ira, "Pointer", nullptr); |
| 17249 | assertNoError(ensure_complete_type(ira->codegen, type_info_pointer_type)); | 17249 | assertNoError(ensure_complete_type(ira->codegen, type_info_pointer_type)); |
| 17250 | | 17250 | |
| 17251 | ConstExprValue *result = create_const_vals(1); | 17251 | ConstExprValue *result = create_const_vals(1); |
| ... | @@ -17257,7 +17257,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry | ... | @@ -17257,7 +17257,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry |
| 17257 | | 17257 | |
| 17258 | // size: Size | 17258 | // size: Size |
| 17259 | ensure_field_index(result->type, "size", 0); | 17259 | ensure_field_index(result->type, "size", 0); |
| 17260 | TypeTableEntry *type_info_pointer_size_type = ir_type_info_get_type(ira, "Size", type_info_pointer_type); | 17260 | ZigType *type_info_pointer_size_type = ir_type_info_get_type(ira, "Size", type_info_pointer_type); |
| 17261 | assertNoError(ensure_complete_type(ira->codegen, type_info_pointer_size_type)); | 17261 | assertNoError(ensure_complete_type(ira->codegen, type_info_pointer_size_type)); |
| 17262 | fields[0].special = ConstValSpecialStatic; | 17262 | fields[0].special = ConstValSpecialStatic; |
| 17263 | fields[0].type = type_info_pointer_size_type; | 17263 | fields[0].type = type_info_pointer_size_type; |
| ... | @@ -17288,7 +17288,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry | ... | @@ -17288,7 +17288,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry |
| 17288 | }; | 17288 | }; |
| 17289 | | 17289 | |
| 17290 | static void make_enum_field_val(IrAnalyze *ira, ConstExprValue *enum_field_val, TypeEnumField *enum_field, | 17290 | static void make_enum_field_val(IrAnalyze *ira, ConstExprValue *enum_field_val, TypeEnumField *enum_field, |
| 17291 | TypeTableEntry *type_info_enum_field_type) | 17291 | ZigType *type_info_enum_field_type) |
| 17292 | { | 17292 | { |
| 17293 | enum_field_val->special = ConstValSpecialStatic; | 17293 | enum_field_val->special = ConstValSpecialStatic; |
| 17294 | enum_field_val->type = type_info_enum_field_type; | 17294 | enum_field_val->type = type_info_enum_field_type; |
| ... | @@ -17305,7 +17305,7 @@ static void make_enum_field_val(IrAnalyze *ira, ConstExprValue *enum_field_val, | ... | @@ -17305,7 +17305,7 @@ static void make_enum_field_val(IrAnalyze *ira, ConstExprValue *enum_field_val, |
| 17305 | enum_field_val->data.x_struct.fields = inner_fields; | 17305 | enum_field_val->data.x_struct.fields = inner_fields; |
| 17306 | } | 17306 | } |
| 17307 | | 17307 | |
| 17308 | static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, ConstExprValue **out) { | 17308 | static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstExprValue **out) { |
| 17309 | Error err; | 17309 | Error err; |
| 17310 | assert(type_entry != nullptr); | 17310 | assert(type_entry != nullptr); |
| 17311 | assert(!type_is_invalid(type_entry)); | 17311 | assert(!type_is_invalid(type_entry)); |
| ... | @@ -17478,7 +17478,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, | ... | @@ -17478,7 +17478,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, |
| 17478 | // fields: []TypeInfo.EnumField | 17478 | // fields: []TypeInfo.EnumField |
| 17479 | ensure_field_index(result->type, "fields", 2); | 17479 | ensure_field_index(result->type, "fields", 2); |
| 17480 | | 17480 | |
| 17481 | TypeTableEntry *type_info_enum_field_type = ir_type_info_get_type(ira, "EnumField", nullptr); | 17481 | ZigType *type_info_enum_field_type = ir_type_info_get_type(ira, "EnumField", nullptr); |
| 17482 | uint32_t enum_field_count = type_entry->data.enumeration.src_field_count; | 17482 | uint32_t enum_field_count = type_entry->data.enumeration.src_field_count; |
| 17483 | | 17483 | |
| 17484 | ConstExprValue *enum_field_array = create_const_vals(1); | 17484 | ConstExprValue *enum_field_array = create_const_vals(1); |
| ... | @@ -17518,7 +17518,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, | ... | @@ -17518,7 +17518,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, |
| 17518 | // errors: []TypeInfo.Error | 17518 | // errors: []TypeInfo.Error |
| 17519 | ensure_field_index(result->type, "errors", 0); | 17519 | ensure_field_index(result->type, "errors", 0); |
| 17520 | | 17520 | |
| 17521 | TypeTableEntry *type_info_error_type = ir_type_info_get_type(ira, "Error", nullptr); | 17521 | ZigType *type_info_error_type = ir_type_info_get_type(ira, "Error", nullptr); |
| 17522 | uint32_t error_count = type_entry->data.error_set.err_count; | 17522 | uint32_t error_count = type_entry->data.error_set.err_count; |
| 17523 | ConstExprValue *error_array = create_const_vals(1); | 17523 | ConstExprValue *error_array = create_const_vals(1); |
| 17524 | error_array->special = ConstValSpecialStatic; | 17524 | error_array->special = ConstValSpecialStatic; |
| ... | @@ -17612,7 +17612,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, | ... | @@ -17612,7 +17612,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, |
| 17612 | // fields: []TypeInfo.UnionField | 17612 | // fields: []TypeInfo.UnionField |
| 17613 | ensure_field_index(result->type, "fields", 2); | 17613 | ensure_field_index(result->type, "fields", 2); |
| 17614 | | 17614 | |
| 17615 | TypeTableEntry *type_info_union_field_type = ir_type_info_get_type(ira, "UnionField", nullptr); | 17615 | ZigType *type_info_union_field_type = ir_type_info_get_type(ira, "UnionField", nullptr); |
| 17616 | uint32_t union_field_count = type_entry->data.unionation.src_field_count; | 17616 | uint32_t union_field_count = type_entry->data.unionation.src_field_count; |
| 17617 | | 17617 | |
| 17618 | ConstExprValue *union_field_array = create_const_vals(1); | 17618 | ConstExprValue *union_field_array = create_const_vals(1); |
| ... | @@ -17624,7 +17624,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, | ... | @@ -17624,7 +17624,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, |
| 17624 | | 17624 | |
| 17625 | init_const_slice(ira->codegen, &fields[2], union_field_array, 0, union_field_count, false); | 17625 | init_const_slice(ira->codegen, &fields[2], union_field_array, 0, union_field_count, false); |
| 17626 | | 17626 | |
| 17627 | TypeTableEntry *type_info_enum_field_type = ir_type_info_get_type(ira, "EnumField", nullptr); | 17627 | ZigType *type_info_enum_field_type = ir_type_info_get_type(ira, "EnumField", nullptr); |
| 17628 | | 17628 | |
| 17629 | for (uint32_t union_field_index = 0; union_field_index < union_field_count; union_field_index++) { | 17629 | for (uint32_t union_field_index = 0; union_field_index < union_field_count; union_field_index++) { |
| 17630 | TypeUnionField *union_field = &type_entry->data.unionation.fields[union_field_index]; | 17630 | TypeUnionField *union_field = &type_entry->data.unionation.fields[union_field_index]; |
| ... | @@ -17685,7 +17685,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, | ... | @@ -17685,7 +17685,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, |
| 17685 | // fields: []TypeInfo.StructField | 17685 | // fields: []TypeInfo.StructField |
| 17686 | ensure_field_index(result->type, "fields", 1); | 17686 | ensure_field_index(result->type, "fields", 1); |
| 17687 | | 17687 | |
| 17688 | TypeTableEntry *type_info_struct_field_type = ir_type_info_get_type(ira, "StructField", nullptr); | 17688 | ZigType *type_info_struct_field_type = ir_type_info_get_type(ira, "StructField", nullptr); |
| 17689 | uint32_t struct_field_count = type_entry->data.structure.src_field_count; | 17689 | uint32_t struct_field_count = type_entry->data.structure.src_field_count; |
| 17690 | | 17690 | |
| 17691 | ConstExprValue *struct_field_array = create_const_vals(1); | 17691 | ConstExprValue *struct_field_array = create_const_vals(1); |
| ... | @@ -17790,7 +17790,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, | ... | @@ -17790,7 +17790,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, |
| 17790 | fields[4].data.x_optional = async_alloc_type; | 17790 | fields[4].data.x_optional = async_alloc_type; |
| 17791 | } | 17791 | } |
| 17792 | // args: []TypeInfo.FnArg | 17792 | // args: []TypeInfo.FnArg |
| 17793 | TypeTableEntry *type_info_fn_arg_type = ir_type_info_get_type(ira, "FnArg", nullptr); | 17793 | ZigType *type_info_fn_arg_type = ir_type_info_get_type(ira, "FnArg", nullptr); |
| 17794 | size_t fn_arg_count = type_entry->data.fn.fn_type_id.param_count - | 17794 | size_t fn_arg_count = type_entry->data.fn.fn_type_id.param_count - |
| 17795 | (is_varargs && type_entry->data.fn.fn_type_id.cc != CallingConventionC); | 17795 | (is_varargs && type_entry->data.fn.fn_type_id.cc != CallingConventionC); |
| 17796 | | 17796 | |
| ... | @@ -17844,7 +17844,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, | ... | @@ -17844,7 +17844,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, |
| 17844 | } | 17844 | } |
| 17845 | case TypeTableEntryIdBoundFn: | 17845 | case TypeTableEntryIdBoundFn: |
| 17846 | { | 17846 | { |
| 17847 | TypeTableEntry *fn_type = type_entry->data.bound_fn.fn_type; | 17847 | ZigType *fn_type = type_entry->data.bound_fn.fn_type; |
| 17848 | assert(fn_type->id == TypeTableEntryIdFn); | 17848 | assert(fn_type->id == TypeTableEntryIdFn); |
| 17849 | if ((err = ir_make_type_info_value(ira, fn_type, &result))) | 17849 | if ((err = ir_make_type_info_value(ira, fn_type, &result))) |
| 17850 | return err; | 17850 | return err; |
| ... | @@ -17859,16 +17859,16 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, | ... | @@ -17859,16 +17859,16 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, |
| 17859 | return ErrorNone; | 17859 | return ErrorNone; |
| 17860 | } | 17860 | } |
| 17861 | | 17861 | |
| 17862 | static TypeTableEntry *ir_analyze_instruction_type_info(IrAnalyze *ira, | 17862 | static ZigType *ir_analyze_instruction_type_info(IrAnalyze *ira, |
| 17863 | IrInstructionTypeInfo *instruction) | 17863 | IrInstructionTypeInfo *instruction) |
| 17864 | { | 17864 | { |
| 17865 | Error err; | 17865 | Error err; |
| 17866 | IrInstruction *type_value = instruction->type_value->other; | 17866 | IrInstruction *type_value = instruction->type_value->other; |
| 17867 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 17867 | ZigType *type_entry = ir_resolve_type(ira, type_value); |
| 17868 | if (type_is_invalid(type_entry)) | 17868 | if (type_is_invalid(type_entry)) |
| 17869 | return ira->codegen->builtin_types.entry_invalid; | 17869 | return ira->codegen->builtin_types.entry_invalid; |
| 17870 | | 17870 | |
| 17871 | TypeTableEntry *result_type = ir_type_info_get_type(ira, nullptr, nullptr); | 17871 | ZigType *result_type = ir_type_info_get_type(ira, nullptr, nullptr); |
| 17872 | | 17872 | |
| 17873 | ConstExprValue *payload; | 17873 | ConstExprValue *payload; |
| 17874 | if ((err = ir_make_type_info_value(ira, type_entry, &payload))) | 17874 | if ((err = ir_make_type_info_value(ira, type_entry, &payload))) |
| ... | @@ -17888,24 +17888,24 @@ static TypeTableEntry *ir_analyze_instruction_type_info(IrAnalyze *ira, | ... | @@ -17888,24 +17888,24 @@ static TypeTableEntry *ir_analyze_instruction_type_info(IrAnalyze *ira, |
| 17888 | return result_type; | 17888 | return result_type; |
| 17889 | } | 17889 | } |
| 17890 | | 17890 | |
| 17891 | static TypeTableEntry *ir_analyze_instruction_type_id(IrAnalyze *ira, | 17891 | static ZigType *ir_analyze_instruction_type_id(IrAnalyze *ira, |
| 17892 | IrInstructionTypeId *instruction) | 17892 | IrInstructionTypeId *instruction) |
| 17893 | { | 17893 | { |
| 17894 | IrInstruction *type_value = instruction->type_value->other; | 17894 | IrInstruction *type_value = instruction->type_value->other; |
| 17895 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 17895 | ZigType *type_entry = ir_resolve_type(ira, type_value); |
| 17896 | if (type_is_invalid(type_entry)) | 17896 | if (type_is_invalid(type_entry)) |
| 17897 | return ira->codegen->builtin_types.entry_invalid; | 17897 | return ira->codegen->builtin_types.entry_invalid; |
| 17898 | | 17898 | |
| 17899 | ConstExprValue *var_value = get_builtin_value(ira->codegen, "TypeId"); | 17899 | ConstExprValue *var_value = get_builtin_value(ira->codegen, "TypeId"); |
| 17900 | assert(var_value->type->id == TypeTableEntryIdMetaType); | 17900 | assert(var_value->type->id == TypeTableEntryIdMetaType); |
| 17901 | TypeTableEntry *result_type = var_value->data.x_type; | 17901 | ZigType *result_type = var_value->data.x_type; |
| 17902 | | 17902 | |
| 17903 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 17903 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 17904 | bigint_init_unsigned(&out_val->data.x_enum_tag, type_id_index(type_entry)); | 17904 | bigint_init_unsigned(&out_val->data.x_enum_tag, type_id_index(type_entry)); |
| 17905 | return result_type; | 17905 | return result_type; |
| 17906 | } | 17906 | } |
| 17907 | | 17907 | |
| 17908 | static TypeTableEntry *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ira, | 17908 | static ZigType *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ira, |
| 17909 | IrInstructionSetEvalBranchQuota *instruction) | 17909 | IrInstructionSetEvalBranchQuota *instruction) |
| 17910 | { | 17910 | { |
| 17911 | if (ira->new_irb.exec->parent_exec != nullptr && !ira->new_irb.exec->is_generic_instantiation) { | 17911 | if (ira->new_irb.exec->parent_exec != nullptr && !ira->new_irb.exec->is_generic_instantiation) { |
| ... | @@ -17926,9 +17926,9 @@ static TypeTableEntry *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *i | ... | @@ -17926,9 +17926,9 @@ static TypeTableEntry *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *i |
| 17926 | return ira->codegen->builtin_types.entry_void; | 17926 | return ira->codegen->builtin_types.entry_void; |
| 17927 | } | 17927 | } |
| 17928 | | 17928 | |
| 17929 | static TypeTableEntry *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstructionTypeName *instruction) { | 17929 | static ZigType *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstructionTypeName *instruction) { |
| 17930 | IrInstruction *type_value = instruction->type_value->other; | 17930 | IrInstruction *type_value = instruction->type_value->other; |
| 17931 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 17931 | ZigType *type_entry = ir_resolve_type(ira, type_value); |
| 17932 | if (type_is_invalid(type_entry)) | 17932 | if (type_is_invalid(type_entry)) |
| 17933 | return ira->codegen->builtin_types.entry_invalid; | 17933 | return ira->codegen->builtin_types.entry_invalid; |
| 17934 | | 17934 | |
| ... | @@ -17940,7 +17940,7 @@ static TypeTableEntry *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstru | ... | @@ -17940,7 +17940,7 @@ static TypeTableEntry *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstru |
| 17940 | return out_val->type; | 17940 | return out_val->type; |
| 17941 | } | 17941 | } |
| 17942 | | 17942 | |
| 17943 | static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstructionCImport *instruction) { | 17943 | static ZigType *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstructionCImport *instruction) { |
| 17944 | AstNode *node = instruction->base.source_node; | 17944 | AstNode *node = instruction->base.source_node; |
| 17945 | assert(node->type == NodeTypeFnCallExpr); | 17945 | assert(node->type == NodeTypeFnCallExpr); |
| 17946 | AstNode *block_node = node->data.fn_call_expr.params.at(0); | 17946 | AstNode *block_node = node->data.fn_call_expr.params.at(0); |
| ... | @@ -17948,7 +17948,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc | ... | @@ -17948,7 +17948,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc |
| 17948 | ScopeCImport *cimport_scope = create_cimport_scope(node, instruction->base.scope); | 17948 | ScopeCImport *cimport_scope = create_cimport_scope(node, instruction->base.scope); |
| 17949 | | 17949 | |
| 17950 | // Execute the C import block like an inline function | 17950 | // Execute the C import block like an inline function |
| 17951 | TypeTableEntry *void_type = ira->codegen->builtin_types.entry_void; | 17951 | ZigType *void_type = ira->codegen->builtin_types.entry_void; |
| 17952 | IrInstruction *result = ir_eval_const_value(ira->codegen, &cimport_scope->base, block_node, void_type, | 17952 | IrInstruction *result = ir_eval_const_value(ira->codegen, &cimport_scope->base, block_node, void_type, |
| 17953 | ira->new_irb.exec->backward_branch_count, ira->new_irb.exec->backward_branch_quota, nullptr, | 17953 | ira->new_irb.exec->backward_branch_count, ira->new_irb.exec->backward_branch_quota, nullptr, |
| 17954 | &cimport_scope->buf, block_node, nullptr, nullptr); | 17954 | &cimport_scope->buf, block_node, nullptr, nullptr); |
| ... | @@ -17999,7 +17999,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc | ... | @@ -17999,7 +17999,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc |
| 17999 | return ira->codegen->builtin_types.entry_namespace; | 17999 | return ira->codegen->builtin_types.entry_namespace; |
| 18000 | } | 18000 | } |
| 18001 | | 18001 | |
| 18002 | static TypeTableEntry *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstructionCInclude *instruction) { | 18002 | static ZigType *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstructionCInclude *instruction) { |
| 18003 | IrInstruction *name_value = instruction->name->other; | 18003 | IrInstruction *name_value = instruction->name->other; |
| 18004 | if (type_is_invalid(name_value->value.type)) | 18004 | if (type_is_invalid(name_value->value.type)) |
| 18005 | return ira->codegen->builtin_types.entry_invalid; | 18005 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18018,7 +18018,7 @@ static TypeTableEntry *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstru | ... | @@ -18018,7 +18018,7 @@ static TypeTableEntry *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstru |
| 18018 | return ira->codegen->builtin_types.entry_void; | 18018 | return ira->codegen->builtin_types.entry_void; |
| 18019 | } | 18019 | } |
| 18020 | | 18020 | |
| 18021 | static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstructionCDefine *instruction) { | 18021 | static ZigType *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstructionCDefine *instruction) { |
| 18022 | IrInstruction *name = instruction->name->other; | 18022 | IrInstruction *name = instruction->name->other; |
| 18023 | if (type_is_invalid(name->value.type)) | 18023 | if (type_is_invalid(name->value.type)) |
| 18024 | return ira->codegen->builtin_types.entry_invalid; | 18024 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18045,7 +18045,7 @@ static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstruc | ... | @@ -18045,7 +18045,7 @@ static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstruc |
| 18045 | return ira->codegen->builtin_types.entry_void; | 18045 | return ira->codegen->builtin_types.entry_void; |
| 18046 | } | 18046 | } |
| 18047 | | 18047 | |
| 18048 | static TypeTableEntry *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstructionCUndef *instruction) { | 18048 | static ZigType *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstructionCUndef *instruction) { |
| 18049 | IrInstruction *name = instruction->name->other; | 18049 | IrInstruction *name = instruction->name->other; |
| 18050 | if (type_is_invalid(name->value.type)) | 18050 | if (type_is_invalid(name->value.type)) |
| 18051 | return ira->codegen->builtin_types.entry_invalid; | 18051 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18064,7 +18064,7 @@ static TypeTableEntry *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstruct | ... | @@ -18064,7 +18064,7 @@ static TypeTableEntry *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstruct |
| 18064 | return ira->codegen->builtin_types.entry_void; | 18064 | return ira->codegen->builtin_types.entry_void; |
| 18065 | } | 18065 | } |
| 18066 | | 18066 | |
| 18067 | static TypeTableEntry *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstructionEmbedFile *instruction) { | 18067 | static ZigType *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstructionEmbedFile *instruction) { |
| 18068 | IrInstruction *name = instruction->name->other; | 18068 | IrInstruction *name = instruction->name->other; |
| 18069 | if (type_is_invalid(name->value.type)) | 18069 | if (type_is_invalid(name->value.type)) |
| 18070 | return ira->codegen->builtin_types.entry_invalid; | 18070 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18106,8 +18106,8 @@ static TypeTableEntry *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstr | ... | @@ -18106,8 +18106,8 @@ static TypeTableEntry *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstr |
| 18106 | return get_array_type(ira->codegen, ira->codegen->builtin_types.entry_u8, buf_len(file_contents)); | 18106 | return get_array_type(ira->codegen, ira->codegen->builtin_types.entry_u8, buf_len(file_contents)); |
| 18107 | } | 18107 | } |
| 18108 | | 18108 | |
| 18109 | static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructionCmpxchg *instruction) { | 18109 | static ZigType *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructionCmpxchg *instruction) { |
| 18110 | TypeTableEntry *operand_type = ir_resolve_atomic_operand_type(ira, instruction->type_value->other); | 18110 | ZigType *operand_type = ir_resolve_atomic_operand_type(ira, instruction->type_value->other); |
| 18111 | if (type_is_invalid(operand_type)) | 18111 | if (type_is_invalid(operand_type)) |
| 18112 | return ira->codegen->builtin_types.entry_invalid; | 18112 | return ira->codegen->builtin_types.entry_invalid; |
| 18113 | | 18113 | |
| ... | @@ -18116,7 +18116,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct | ... | @@ -18116,7 +18116,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct |
| 18116 | return ira->codegen->builtin_types.entry_invalid; | 18116 | return ira->codegen->builtin_types.entry_invalid; |
| 18117 | | 18117 | |
| 18118 | // TODO let this be volatile | 18118 | // TODO let this be volatile |
| 18119 | TypeTableEntry *ptr_type = get_pointer_to_type(ira->codegen, operand_type, false); | 18119 | ZigType *ptr_type = get_pointer_to_type(ira->codegen, operand_type, false); |
| 18120 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr, ptr_type); | 18120 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr, ptr_type); |
| 18121 | if (type_is_invalid(casted_ptr->value.type)) | 18121 | if (type_is_invalid(casted_ptr->value.type)) |
| 18122 | return ira->codegen->builtin_types.entry_invalid; | 18122 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18187,7 +18187,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct | ... | @@ -18187,7 +18187,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct |
| 18187 | return result->value.type; | 18187 | return result->value.type; |
| 18188 | } | 18188 | } |
| 18189 | | 18189 | |
| 18190 | static TypeTableEntry *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructionFence *instruction) { | 18190 | static ZigType *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructionFence *instruction) { |
| 18191 | IrInstruction *order_value = instruction->order_value->other; | 18191 | IrInstruction *order_value = instruction->order_value->other; |
| 18192 | if (type_is_invalid(order_value->value.type)) | 18192 | if (type_is_invalid(order_value->value.type)) |
| 18193 | return ira->codegen->builtin_types.entry_invalid; | 18193 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18200,9 +18200,9 @@ static TypeTableEntry *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructio | ... | @@ -18200,9 +18200,9 @@ static TypeTableEntry *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructio |
| 18200 | return ira->codegen->builtin_types.entry_void; | 18200 | return ira->codegen->builtin_types.entry_void; |
| 18201 | } | 18201 | } |
| 18202 | | 18202 | |
| 18203 | static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstructionTruncate *instruction) { | 18203 | static ZigType *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstructionTruncate *instruction) { |
| 18204 | IrInstruction *dest_type_value = instruction->dest_type->other; | 18204 | IrInstruction *dest_type_value = instruction->dest_type->other; |
| 18205 | TypeTableEntry *dest_type = ir_resolve_type(ira, dest_type_value); | 18205 | ZigType *dest_type = ir_resolve_type(ira, dest_type_value); |
| 18206 | if (type_is_invalid(dest_type)) | 18206 | if (type_is_invalid(dest_type)) |
| 18207 | return ira->codegen->builtin_types.entry_invalid; | 18207 | return ira->codegen->builtin_types.entry_invalid; |
| 18208 | | 18208 | |
| ... | @@ -18214,7 +18214,7 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc | ... | @@ -18214,7 +18214,7 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc |
| 18214 | } | 18214 | } |
| 18215 | | 18215 | |
| 18216 | IrInstruction *target = instruction->target->other; | 18216 | IrInstruction *target = instruction->target->other; |
| 18217 | TypeTableEntry *src_type = target->value.type; | 18217 | ZigType *src_type = target->value.type; |
| 18218 | if (type_is_invalid(src_type)) | 18218 | if (type_is_invalid(src_type)) |
| 18219 | return ira->codegen->builtin_types.entry_invalid; | 18219 | return ira->codegen->builtin_types.entry_invalid; |
| 18220 | | 18220 | |
| ... | @@ -18248,8 +18248,8 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc | ... | @@ -18248,8 +18248,8 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc |
| 18248 | return dest_type; | 18248 | return dest_type; |
| 18249 | } | 18249 | } |
| 18250 | | 18250 | |
| 18251 | static TypeTableEntry *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstructionIntCast *instruction) { | 18251 | static ZigType *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstructionIntCast *instruction) { |
| 18252 | TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other); | 18252 | ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other); |
| 18253 | if (type_is_invalid(dest_type)) | 18253 | if (type_is_invalid(dest_type)) |
| 18254 | return ira->codegen->builtin_types.entry_invalid; | 18254 | return ira->codegen->builtin_types.entry_invalid; |
| 18255 | | 18255 | |
| ... | @@ -18289,8 +18289,8 @@ static TypeTableEntry *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstruc | ... | @@ -18289,8 +18289,8 @@ static TypeTableEntry *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstruc |
| 18289 | return dest_type; | 18289 | return dest_type; |
| 18290 | } | 18290 | } |
| 18291 | | 18291 | |
| 18292 | static TypeTableEntry *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstructionFloatCast *instruction) { | 18292 | static ZigType *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstructionFloatCast *instruction) { |
| 18293 | TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other); | 18293 | ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other); |
| 18294 | if (type_is_invalid(dest_type)) | 18294 | if (type_is_invalid(dest_type)) |
| 18295 | return ira->codegen->builtin_types.entry_invalid; | 18295 | return ira->codegen->builtin_types.entry_invalid; |
| 18296 | | 18296 | |
| ... | @@ -18337,8 +18337,8 @@ static TypeTableEntry *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstr | ... | @@ -18337,8 +18337,8 @@ static TypeTableEntry *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstr |
| 18337 | return dest_type; | 18337 | return dest_type; |
| 18338 | } | 18338 | } |
| 18339 | | 18339 | |
| 18340 | static TypeTableEntry *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrInstructionErrSetCast *instruction) { | 18340 | static ZigType *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrInstructionErrSetCast *instruction) { |
| 18341 | TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other); | 18341 | ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other); |
| 18342 | if (type_is_invalid(dest_type)) | 18342 | if (type_is_invalid(dest_type)) |
| 18343 | return ira->codegen->builtin_types.entry_invalid; | 18343 | return ira->codegen->builtin_types.entry_invalid; |
| 18344 | | 18344 | |
| ... | @@ -18365,8 +18365,8 @@ static TypeTableEntry *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrIns | ... | @@ -18365,8 +18365,8 @@ static TypeTableEntry *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrIns |
| 18365 | return dest_type; | 18365 | return dest_type; |
| 18366 | } | 18366 | } |
| 18367 | | 18367 | |
| 18368 | static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstructionFromBytes *instruction) { | 18368 | static ZigType *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstructionFromBytes *instruction) { |
| 18369 | TypeTableEntry *dest_child_type = ir_resolve_type(ira, instruction->dest_child_type->other); | 18369 | ZigType *dest_child_type = ir_resolve_type(ira, instruction->dest_child_type->other); |
| 18370 | if (type_is_invalid(dest_child_type)) | 18370 | if (type_is_invalid(dest_child_type)) |
| 18371 | return ira->codegen->builtin_types.entry_invalid; | 18371 | return ira->codegen->builtin_types.entry_invalid; |
| 18372 | | 18372 | |
| ... | @@ -18382,7 +18382,7 @@ static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstr | ... | @@ -18382,7 +18382,7 @@ static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstr |
| 18382 | src_ptr_volatile = target->value.type->data.pointer.is_volatile; | 18382 | src_ptr_volatile = target->value.type->data.pointer.is_volatile; |
| 18383 | src_ptr_align = target->value.type->data.pointer.alignment; | 18383 | src_ptr_align = target->value.type->data.pointer.alignment; |
| 18384 | } else if (is_slice(target->value.type)) { | 18384 | } else if (is_slice(target->value.type)) { |
| 18385 | TypeTableEntry *src_ptr_type = target->value.type->data.structure.fields[slice_ptr_index].type_entry; | 18385 | ZigType *src_ptr_type = target->value.type->data.structure.fields[slice_ptr_index].type_entry; |
| 18386 | src_ptr_const = src_ptr_type->data.pointer.is_const; | 18386 | src_ptr_const = src_ptr_type->data.pointer.is_const; |
| 18387 | src_ptr_volatile = src_ptr_type->data.pointer.is_volatile; | 18387 | src_ptr_volatile = src_ptr_type->data.pointer.is_volatile; |
| 18388 | src_ptr_align = src_ptr_type->data.pointer.alignment; | 18388 | src_ptr_align = src_ptr_type->data.pointer.alignment; |
| ... | @@ -18392,15 +18392,15 @@ static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstr | ... | @@ -18392,15 +18392,15 @@ static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstr |
| 18392 | src_ptr_align = get_abi_alignment(ira->codegen, target->value.type); | 18392 | src_ptr_align = get_abi_alignment(ira->codegen, target->value.type); |
| 18393 | } | 18393 | } |
| 18394 | | 18394 | |
| 18395 | TypeTableEntry *dest_ptr_type = get_pointer_to_type_extra(ira->codegen, dest_child_type, | 18395 | ZigType *dest_ptr_type = get_pointer_to_type_extra(ira->codegen, dest_child_type, |
| 18396 | src_ptr_const, src_ptr_volatile, PtrLenUnknown, | 18396 | src_ptr_const, src_ptr_volatile, PtrLenUnknown, |
| 18397 | src_ptr_align, 0, 0); | 18397 | src_ptr_align, 0, 0); |
| 18398 | TypeTableEntry *dest_slice_type = get_slice_type(ira->codegen, dest_ptr_type); | 18398 | ZigType *dest_slice_type = get_slice_type(ira->codegen, dest_ptr_type); |
| 18399 | | 18399 | |
| 18400 | TypeTableEntry *u8_ptr = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, | 18400 | ZigType *u8_ptr = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 18401 | src_ptr_const, src_ptr_volatile, PtrLenUnknown, | 18401 | src_ptr_const, src_ptr_volatile, PtrLenUnknown, |
| 18402 | src_ptr_align, 0, 0); | 18402 | src_ptr_align, 0, 0); |
| 18403 | TypeTableEntry *u8_slice = get_slice_type(ira->codegen, u8_ptr); | 18403 | ZigType *u8_slice = get_slice_type(ira->codegen, u8_ptr); |
| 18404 | | 18404 | |
| 18405 | IrInstruction *casted_value = ir_implicit_cast(ira, target, u8_slice); | 18405 | IrInstruction *casted_value = ir_implicit_cast(ira, target, u8_slice); |
| 18406 | if (type_is_invalid(casted_value->value.type)) | 18406 | if (type_is_invalid(casted_value->value.type)) |
| ... | @@ -18445,7 +18445,7 @@ static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstr | ... | @@ -18445,7 +18445,7 @@ static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstr |
| 18445 | return dest_slice_type; | 18445 | return dest_slice_type; |
| 18446 | } | 18446 | } |
| 18447 | | 18447 | |
| 18448 | static TypeTableEntry *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstructionToBytes *instruction) { | 18448 | static ZigType *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstructionToBytes *instruction) { |
| 18449 | IrInstruction *target = instruction->target->other; | 18449 | IrInstruction *target = instruction->target->other; |
| 18450 | if (type_is_invalid(target->value.type)) | 18450 | if (type_is_invalid(target->value.type)) |
| 18451 | return ira->codegen->builtin_types.entry_invalid; | 18451 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18456,20 +18456,20 @@ static TypeTableEntry *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstruc | ... | @@ -18456,20 +18456,20 @@ static TypeTableEntry *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstruc |
| 18456 | return ira->codegen->builtin_types.entry_invalid; | 18456 | return ira->codegen->builtin_types.entry_invalid; |
| 18457 | } | 18457 | } |
| 18458 | | 18458 | |
| 18459 | TypeTableEntry *src_ptr_type = target->value.type->data.structure.fields[slice_ptr_index].type_entry; | 18459 | ZigType *src_ptr_type = target->value.type->data.structure.fields[slice_ptr_index].type_entry; |
| 18460 | | 18460 | |
| 18461 | TypeTableEntry *dest_ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, | 18461 | ZigType *dest_ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 18462 | src_ptr_type->data.pointer.is_const, src_ptr_type->data.pointer.is_volatile, PtrLenUnknown, | 18462 | src_ptr_type->data.pointer.is_const, src_ptr_type->data.pointer.is_volatile, PtrLenUnknown, |
| 18463 | src_ptr_type->data.pointer.alignment, 0, 0); | 18463 | src_ptr_type->data.pointer.alignment, 0, 0); |
| 18464 | TypeTableEntry *dest_slice_type = get_slice_type(ira->codegen, dest_ptr_type); | 18464 | ZigType *dest_slice_type = get_slice_type(ira->codegen, dest_ptr_type); |
| 18465 | | 18465 | |
| 18466 | IrInstruction *result = ir_resolve_cast(ira, &instruction->base, target, dest_slice_type, CastOpResizeSlice, true); | 18466 | IrInstruction *result = ir_resolve_cast(ira, &instruction->base, target, dest_slice_type, CastOpResizeSlice, true); |
| 18467 | ir_link_new_instruction(result, &instruction->base); | 18467 | ir_link_new_instruction(result, &instruction->base); |
| 18468 | return dest_slice_type; | 18468 | return dest_slice_type; |
| 18469 | } | 18469 | } |
| 18470 | | 18470 | |
| 18471 | static TypeTableEntry *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrInstructionIntToFloat *instruction) { | 18471 | static ZigType *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrInstructionIntToFloat *instruction) { |
| 18472 | TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other); | 18472 | ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other); |
| 18473 | if (type_is_invalid(dest_type)) | 18473 | if (type_is_invalid(dest_type)) |
| 18474 | return ira->codegen->builtin_types.entry_invalid; | 18474 | return ira->codegen->builtin_types.entry_invalid; |
| 18475 | | 18475 | |
| ... | @@ -18488,8 +18488,8 @@ static TypeTableEntry *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrIns | ... | @@ -18488,8 +18488,8 @@ static TypeTableEntry *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrIns |
| 18488 | return dest_type; | 18488 | return dest_type; |
| 18489 | } | 18489 | } |
| 18490 | | 18490 | |
| 18491 | static TypeTableEntry *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrInstructionFloatToInt *instruction) { | 18491 | static ZigType *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrInstructionFloatToInt *instruction) { |
| 18492 | TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other); | 18492 | ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other); |
| 18493 | if (type_is_invalid(dest_type)) | 18493 | if (type_is_invalid(dest_type)) |
| 18494 | return ira->codegen->builtin_types.entry_invalid; | 18494 | return ira->codegen->builtin_types.entry_invalid; |
| 18495 | | 18495 | |
| ... | @@ -18516,7 +18516,7 @@ static TypeTableEntry *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrIns | ... | @@ -18516,7 +18516,7 @@ static TypeTableEntry *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrIns |
| 18516 | return dest_type; | 18516 | return dest_type; |
| 18517 | } | 18517 | } |
| 18518 | | 18518 | |
| 18519 | static TypeTableEntry *ir_analyze_instruction_err_to_int(IrAnalyze *ira, IrInstructionErrToInt *instruction) { | 18519 | static ZigType *ir_analyze_instruction_err_to_int(IrAnalyze *ira, IrInstructionErrToInt *instruction) { |
| 18520 | IrInstruction *target = instruction->target->other; | 18520 | IrInstruction *target = instruction->target->other; |
| 18521 | if (type_is_invalid(target->value.type)) | 18521 | if (type_is_invalid(target->value.type)) |
| 18522 | return ira->codegen->builtin_types.entry_invalid; | 18522 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18535,7 +18535,7 @@ static TypeTableEntry *ir_analyze_instruction_err_to_int(IrAnalyze *ira, IrInstr | ... | @@ -18535,7 +18535,7 @@ static TypeTableEntry *ir_analyze_instruction_err_to_int(IrAnalyze *ira, IrInstr |
| 18535 | return result->value.type; | 18535 | return result->value.type; |
| 18536 | } | 18536 | } |
| 18537 | | 18537 | |
| 18538 | static TypeTableEntry *ir_analyze_instruction_int_to_err(IrAnalyze *ira, IrInstructionIntToErr *instruction) { | 18538 | static ZigType *ir_analyze_instruction_int_to_err(IrAnalyze *ira, IrInstructionIntToErr *instruction) { |
| 18539 | IrInstruction *target = instruction->target->other; | 18539 | IrInstruction *target = instruction->target->other; |
| 18540 | if (type_is_invalid(target->value.type)) | 18540 | if (type_is_invalid(target->value.type)) |
| 18541 | return ira->codegen->builtin_types.entry_invalid; | 18541 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18549,7 +18549,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_err(IrAnalyze *ira, IrInstr | ... | @@ -18549,7 +18549,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_err(IrAnalyze *ira, IrInstr |
| 18549 | return result->value.type; | 18549 | return result->value.type; |
| 18550 | } | 18550 | } |
| 18551 | | 18551 | |
| 18552 | static TypeTableEntry *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInstructionBoolToInt *instruction) { | 18552 | static ZigType *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInstructionBoolToInt *instruction) { |
| 18553 | IrInstruction *target = instruction->target->other; | 18553 | IrInstruction *target = instruction->target->other; |
| 18554 | if (type_is_invalid(target->value.type)) | 18554 | if (type_is_invalid(target->value.type)) |
| 18555 | return ira->codegen->builtin_types.entry_invalid; | 18555 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18570,13 +18570,13 @@ static TypeTableEntry *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInst | ... | @@ -18570,13 +18570,13 @@ static TypeTableEntry *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInst |
| 18570 | return ira->codegen->builtin_types.entry_num_lit_int; | 18570 | return ira->codegen->builtin_types.entry_num_lit_int; |
| 18571 | } | 18571 | } |
| 18572 | | 18572 | |
| 18573 | TypeTableEntry *u1_type = get_int_type(ira->codegen, false, 1); | 18573 | ZigType *u1_type = get_int_type(ira->codegen, false, 1); |
| 18574 | IrInstruction *result = ir_resolve_cast(ira, &instruction->base, target, u1_type, CastOpBoolToInt, false); | 18574 | IrInstruction *result = ir_resolve_cast(ira, &instruction->base, target, u1_type, CastOpBoolToInt, false); |
| 18575 | ir_link_new_instruction(result, &instruction->base); | 18575 | ir_link_new_instruction(result, &instruction->base); |
| 18576 | return u1_type; | 18576 | return u1_type; |
| 18577 | } | 18577 | } |
| 18578 | | 18578 | |
| 18579 | static TypeTableEntry *ir_analyze_instruction_int_type(IrAnalyze *ira, IrInstructionIntType *instruction) { | 18579 | static ZigType *ir_analyze_instruction_int_type(IrAnalyze *ira, IrInstructionIntType *instruction) { |
| 18580 | IrInstruction *is_signed_value = instruction->is_signed->other; | 18580 | IrInstruction *is_signed_value = instruction->is_signed->other; |
| 18581 | bool is_signed; | 18581 | bool is_signed; |
| 18582 | if (!ir_resolve_bool(ira, is_signed_value, &is_signed)) | 18582 | if (!ir_resolve_bool(ira, is_signed_value, &is_signed)) |
| ... | @@ -18592,12 +18592,12 @@ static TypeTableEntry *ir_analyze_instruction_int_type(IrAnalyze *ira, IrInstruc | ... | @@ -18592,12 +18592,12 @@ static TypeTableEntry *ir_analyze_instruction_int_type(IrAnalyze *ira, IrInstruc |
| 18592 | return ira->codegen->builtin_types.entry_type; | 18592 | return ira->codegen->builtin_types.entry_type; |
| 18593 | } | 18593 | } |
| 18594 | | 18594 | |
| 18595 | static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstructionBoolNot *instruction) { | 18595 | static ZigType *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstructionBoolNot *instruction) { |
| 18596 | IrInstruction *value = instruction->value->other; | 18596 | IrInstruction *value = instruction->value->other; |
| 18597 | if (type_is_invalid(value->value.type)) | 18597 | if (type_is_invalid(value->value.type)) |
| 18598 | return ira->codegen->builtin_types.entry_invalid; | 18598 | return ira->codegen->builtin_types.entry_invalid; |
| 18599 | | 18599 | |
| 18600 | TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool; | 18600 | ZigType *bool_type = ira->codegen->builtin_types.entry_bool; |
| 18601 | | 18601 | |
| 18602 | IrInstruction *casted_value = ir_implicit_cast(ira, value, bool_type); | 18602 | IrInstruction *casted_value = ir_implicit_cast(ira, value, bool_type); |
| 18603 | if (type_is_invalid(casted_value->value.type)) | 18603 | if (type_is_invalid(casted_value->value.type)) |
| ... | @@ -18617,7 +18617,7 @@ static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstruc | ... | @@ -18617,7 +18617,7 @@ static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstruc |
| 18617 | return bool_type; | 18617 | return bool_type; |
| 18618 | } | 18618 | } |
| 18619 | | 18619 | |
| 18620 | static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructionMemset *instruction) { | 18620 | static ZigType *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructionMemset *instruction) { |
| 18621 | IrInstruction *dest_ptr = instruction->dest_ptr->other; | 18621 | IrInstruction *dest_ptr = instruction->dest_ptr->other; |
| 18622 | if (type_is_invalid(dest_ptr->value.type)) | 18622 | if (type_is_invalid(dest_ptr->value.type)) |
| 18623 | return ira->codegen->builtin_types.entry_invalid; | 18623 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18630,15 +18630,15 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi | ... | @@ -18630,15 +18630,15 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi |
| 18630 | if (type_is_invalid(count_value->value.type)) | 18630 | if (type_is_invalid(count_value->value.type)) |
| 18631 | return ira->codegen->builtin_types.entry_invalid; | 18631 | return ira->codegen->builtin_types.entry_invalid; |
| 18632 | | 18632 | |
| 18633 | TypeTableEntry *dest_uncasted_type = dest_ptr->value.type; | 18633 | ZigType *dest_uncasted_type = dest_ptr->value.type; |
| 18634 | bool dest_is_volatile = (dest_uncasted_type->id == TypeTableEntryIdPointer) && | 18634 | bool dest_is_volatile = (dest_uncasted_type->id == TypeTableEntryIdPointer) && |
| 18635 | dest_uncasted_type->data.pointer.is_volatile; | 18635 | dest_uncasted_type->data.pointer.is_volatile; |
| 18636 | | 18636 | |
| 18637 | TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize; | 18637 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 18638 | TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8; | 18638 | ZigType *u8 = ira->codegen->builtin_types.entry_u8; |
| 18639 | uint32_t dest_align = (dest_uncasted_type->id == TypeTableEntryIdPointer) ? | 18639 | uint32_t dest_align = (dest_uncasted_type->id == TypeTableEntryIdPointer) ? |
| 18640 | dest_uncasted_type->data.pointer.alignment : get_abi_alignment(ira->codegen, u8); | 18640 | dest_uncasted_type->data.pointer.alignment : get_abi_alignment(ira->codegen, u8); |
| 18641 | TypeTableEntry *u8_ptr = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile, | 18641 | ZigType *u8_ptr = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile, |
| 18642 | PtrLenUnknown, dest_align, 0, 0); | 18642 | PtrLenUnknown, dest_align, 0, 0); |
| 18643 | | 18643 | |
| 18644 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr); | 18644 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr); |
| ... | @@ -18709,7 +18709,7 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi | ... | @@ -18709,7 +18709,7 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi |
| 18709 | return ira->codegen->builtin_types.entry_void; | 18709 | return ira->codegen->builtin_types.entry_void; |
| 18710 | } | 18710 | } |
| 18711 | | 18711 | |
| 18712 | static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructionMemcpy *instruction) { | 18712 | static ZigType *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructionMemcpy *instruction) { |
| 18713 | IrInstruction *dest_ptr = instruction->dest_ptr->other; | 18713 | IrInstruction *dest_ptr = instruction->dest_ptr->other; |
| 18714 | if (type_is_invalid(dest_ptr->value.type)) | 18714 | if (type_is_invalid(dest_ptr->value.type)) |
| 18715 | return ira->codegen->builtin_types.entry_invalid; | 18715 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18722,9 +18722,9 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi | ... | @@ -18722,9 +18722,9 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi |
| 18722 | if (type_is_invalid(count_value->value.type)) | 18722 | if (type_is_invalid(count_value->value.type)) |
| 18723 | return ira->codegen->builtin_types.entry_invalid; | 18723 | return ira->codegen->builtin_types.entry_invalid; |
| 18724 | | 18724 | |
| 18725 | TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8; | 18725 | ZigType *u8 = ira->codegen->builtin_types.entry_u8; |
| 18726 | TypeTableEntry *dest_uncasted_type = dest_ptr->value.type; | 18726 | ZigType *dest_uncasted_type = dest_ptr->value.type; |
| 18727 | TypeTableEntry *src_uncasted_type = src_ptr->value.type; | 18727 | ZigType *src_uncasted_type = src_ptr->value.type; |
| 18728 | bool dest_is_volatile = (dest_uncasted_type->id == TypeTableEntryIdPointer) && | 18728 | bool dest_is_volatile = (dest_uncasted_type->id == TypeTableEntryIdPointer) && |
| 18729 | dest_uncasted_type->data.pointer.is_volatile; | 18729 | dest_uncasted_type->data.pointer.is_volatile; |
| 18730 | bool src_is_volatile = (src_uncasted_type->id == TypeTableEntryIdPointer) && | 18730 | bool src_is_volatile = (src_uncasted_type->id == TypeTableEntryIdPointer) && |
| ... | @@ -18734,10 +18734,10 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi | ... | @@ -18734,10 +18734,10 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi |
| 18734 | uint32_t src_align = (src_uncasted_type->id == TypeTableEntryIdPointer) ? | 18734 | uint32_t src_align = (src_uncasted_type->id == TypeTableEntryIdPointer) ? |
| 18735 | src_uncasted_type->data.pointer.alignment : get_abi_alignment(ira->codegen, u8); | 18735 | src_uncasted_type->data.pointer.alignment : get_abi_alignment(ira->codegen, u8); |
| 18736 | | 18736 | |
| 18737 | TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize; | 18737 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 18738 | TypeTableEntry *u8_ptr_mut = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile, | 18738 | ZigType *u8_ptr_mut = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile, |
| 18739 | PtrLenUnknown, dest_align, 0, 0); | 18739 | PtrLenUnknown, dest_align, 0, 0); |
| 18740 | TypeTableEntry *u8_ptr_const = get_pointer_to_type_extra(ira->codegen, u8, true, src_is_volatile, | 18740 | ZigType *u8_ptr_const = get_pointer_to_type_extra(ira->codegen, u8, true, src_is_volatile, |
| 18741 | PtrLenUnknown, src_align, 0, 0); | 18741 | PtrLenUnknown, src_align, 0, 0); |
| 18742 | | 18742 | |
| 18743 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr_mut); | 18743 | IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr_mut); |
| ... | @@ -18844,20 +18844,20 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi | ... | @@ -18844,20 +18844,20 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi |
| 18844 | return ira->codegen->builtin_types.entry_void; | 18844 | return ira->codegen->builtin_types.entry_void; |
| 18845 | } | 18845 | } |
| 18846 | | 18846 | |
| 18847 | static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice *instruction) { | 18847 | static ZigType *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice *instruction) { |
| 18848 | IrInstruction *ptr_ptr = instruction->ptr->other; | 18848 | IrInstruction *ptr_ptr = instruction->ptr->other; |
| 18849 | if (type_is_invalid(ptr_ptr->value.type)) | 18849 | if (type_is_invalid(ptr_ptr->value.type)) |
| 18850 | return ira->codegen->builtin_types.entry_invalid; | 18850 | return ira->codegen->builtin_types.entry_invalid; |
| 18851 | | 18851 | |
| 18852 | TypeTableEntry *ptr_type = ptr_ptr->value.type; | 18852 | ZigType *ptr_type = ptr_ptr->value.type; |
| 18853 | assert(ptr_type->id == TypeTableEntryIdPointer); | 18853 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 18854 | TypeTableEntry *array_type = ptr_type->data.pointer.child_type; | 18854 | ZigType *array_type = ptr_type->data.pointer.child_type; |
| 18855 | | 18855 | |
| 18856 | IrInstruction *start = instruction->start->other; | 18856 | IrInstruction *start = instruction->start->other; |
| 18857 | if (type_is_invalid(start->value.type)) | 18857 | if (type_is_invalid(start->value.type)) |
| 18858 | return ira->codegen->builtin_types.entry_invalid; | 18858 | return ira->codegen->builtin_types.entry_invalid; |
| 18859 | | 18859 | |
| 18860 | TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize; | 18860 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 18861 | IrInstruction *casted_start = ir_implicit_cast(ira, start, usize); | 18861 | IrInstruction *casted_start = ir_implicit_cast(ira, start, usize); |
| 18862 | if (type_is_invalid(casted_start->value.type)) | 18862 | if (type_is_invalid(casted_start->value.type)) |
| 18863 | return ira->codegen->builtin_types.entry_invalid; | 18863 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -18874,7 +18874,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio | ... | @@ -18874,7 +18874,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio |
| 18874 | end = nullptr; | 18874 | end = nullptr; |
| 18875 | } | 18875 | } |
| 18876 | | 18876 | |
| 18877 | TypeTableEntry *return_type; | 18877 | ZigType *return_type; |
| 18878 | | 18878 | |
| 18879 | if (array_type->id == TypeTableEntryIdArray) { | 18879 | if (array_type->id == TypeTableEntryIdArray) { |
| 18880 | uint32_t byte_alignment = ptr_type->data.pointer.alignment; | 18880 | uint32_t byte_alignment = ptr_type->data.pointer.alignment; |
| ... | @@ -18883,7 +18883,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio | ... | @@ -18883,7 +18883,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio |
| 18883 | } | 18883 | } |
| 18884 | bool is_comptime_const = ptr_ptr->value.special == ConstValSpecialStatic && | 18884 | bool is_comptime_const = ptr_ptr->value.special == ConstValSpecialStatic && |
| 18885 | ptr_ptr->value.data.x_ptr.mut == ConstPtrMutComptimeConst; | 18885 | ptr_ptr->value.data.x_ptr.mut == ConstPtrMutComptimeConst; |
| 18886 | TypeTableEntry *slice_ptr_type = get_pointer_to_type_extra(ira->codegen, array_type->data.array.child_type, | 18886 | ZigType *slice_ptr_type = get_pointer_to_type_extra(ira->codegen, array_type->data.array.child_type, |
| 18887 | ptr_type->data.pointer.is_const || is_comptime_const, | 18887 | ptr_type->data.pointer.is_const || is_comptime_const, |
| 18888 | ptr_type->data.pointer.is_volatile, | 18888 | ptr_type->data.pointer.is_volatile, |
| 18889 | PtrLenUnknown, | 18889 | PtrLenUnknown, |
| ... | @@ -18891,9 +18891,9 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio | ... | @@ -18891,9 +18891,9 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio |
| 18891 | return_type = get_slice_type(ira->codegen, slice_ptr_type); | 18891 | return_type = get_slice_type(ira->codegen, slice_ptr_type); |
| 18892 | } else if (array_type->id == TypeTableEntryIdPointer) { | 18892 | } else if (array_type->id == TypeTableEntryIdPointer) { |
| 18893 | if (array_type->data.pointer.ptr_len == PtrLenSingle) { | 18893 | if (array_type->data.pointer.ptr_len == PtrLenSingle) { |
| 18894 | TypeTableEntry *main_type = array_type->data.pointer.child_type; | 18894 | ZigType *main_type = array_type->data.pointer.child_type; |
| 18895 | if (main_type->id == TypeTableEntryIdArray) { | 18895 | if (main_type->id == TypeTableEntryIdArray) { |
| 18896 | TypeTableEntry *slice_ptr_type = get_pointer_to_type_extra(ira->codegen, | 18896 | ZigType *slice_ptr_type = get_pointer_to_type_extra(ira->codegen, |
| 18897 | main_type->data.pointer.child_type, | 18897 | main_type->data.pointer.child_type, |
| 18898 | array_type->data.pointer.is_const, array_type->data.pointer.is_volatile, | 18898 | array_type->data.pointer.is_const, array_type->data.pointer.is_volatile, |
| 18899 | PtrLenUnknown, | 18899 | PtrLenUnknown, |
| ... | @@ -18904,7 +18904,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio | ... | @@ -18904,7 +18904,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio |
| 18904 | return ira->codegen->builtin_types.entry_invalid; | 18904 | return ira->codegen->builtin_types.entry_invalid; |
| 18905 | } | 18905 | } |
| 18906 | } else { | 18906 | } else { |
| 18907 | TypeTableEntry *slice_ptr_type = get_pointer_to_type_extra(ira->codegen, array_type->data.pointer.child_type, | 18907 | ZigType *slice_ptr_type = get_pointer_to_type_extra(ira->codegen, array_type->data.pointer.child_type, |
| 18908 | array_type->data.pointer.is_const, array_type->data.pointer.is_volatile, | 18908 | array_type->data.pointer.is_const, array_type->data.pointer.is_volatile, |
| 18909 | PtrLenUnknown, | 18909 | PtrLenUnknown, |
| 18910 | array_type->data.pointer.alignment, 0, 0); | 18910 | array_type->data.pointer.alignment, 0, 0); |
| ... | @@ -18915,7 +18915,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio | ... | @@ -18915,7 +18915,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio |
| 18915 | } | 18915 | } |
| 18916 | } | 18916 | } |
| 18917 | } else if (is_slice(array_type)) { | 18917 | } else if (is_slice(array_type)) { |
| 18918 | TypeTableEntry *ptr_type = array_type->data.structure.fields[slice_ptr_index].type_entry; | 18918 | ZigType *ptr_type = array_type->data.structure.fields[slice_ptr_index].type_entry; |
| 18919 | return_type = get_slice_type(ira->codegen, ptr_type); | 18919 | return_type = get_slice_type(ira->codegen, ptr_type); |
| 18920 | } else { | 18920 | } else { |
| 18921 | ir_add_error(ira, &instruction->base, | 18921 | ir_add_error(ira, &instruction->base, |
| ... | @@ -18936,7 +18936,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio | ... | @@ -18936,7 +18936,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio |
| 18936 | (array_type->id == TypeTableEntryIdPointer && array_type->data.pointer.ptr_len == PtrLenSingle)) | 18936 | (array_type->id == TypeTableEntryIdPointer && array_type->data.pointer.ptr_len == PtrLenSingle)) |
| 18937 | { | 18937 | { |
| 18938 | if (array_type->id == TypeTableEntryIdPointer) { | 18938 | if (array_type->id == TypeTableEntryIdPointer) { |
| 18939 | TypeTableEntry *child_array_type = array_type->data.pointer.child_type; | 18939 | ZigType *child_array_type = array_type->data.pointer.child_type; |
| 18940 | assert(child_array_type->id == TypeTableEntryIdArray); | 18940 | assert(child_array_type->id == TypeTableEntryIdArray); |
| 18941 | parent_ptr = ir_const_ptr_pointee(ira, &ptr_ptr->value, instruction->base.source_node); | 18941 | parent_ptr = ir_const_ptr_pointee(ira, &ptr_ptr->value, instruction->base.source_node); |
| 18942 | if (parent_ptr == nullptr) | 18942 | if (parent_ptr == nullptr) |
| ... | @@ -19109,12 +19109,12 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio | ... | @@ -19109,12 +19109,12 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio |
| 19109 | return return_type; | 19109 | return return_type; |
| 19110 | } | 19110 | } |
| 19111 | | 19111 | |
| 19112 | static TypeTableEntry *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstructionMemberCount *instruction) { | 19112 | static ZigType *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstructionMemberCount *instruction) { |
| 19113 | Error err; | 19113 | Error err; |
| 19114 | IrInstruction *container = instruction->container->other; | 19114 | IrInstruction *container = instruction->container->other; |
| 19115 | if (type_is_invalid(container->value.type)) | 19115 | if (type_is_invalid(container->value.type)) |
| 19116 | return ira->codegen->builtin_types.entry_invalid; | 19116 | return ira->codegen->builtin_types.entry_invalid; |
| 19117 | TypeTableEntry *container_type = ir_resolve_type(ira, container); | 19117 | ZigType *container_type = ir_resolve_type(ira, container); |
| 19118 | | 19118 | |
| 19119 | if ((err = ensure_complete_type(ira->codegen, container_type))) | 19119 | if ((err = ensure_complete_type(ira->codegen, container_type))) |
| 19120 | return ira->codegen->builtin_types.entry_invalid; | 19120 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -19147,10 +19147,10 @@ static TypeTableEntry *ir_analyze_instruction_member_count(IrAnalyze *ira, IrIns | ... | @@ -19147,10 +19147,10 @@ static TypeTableEntry *ir_analyze_instruction_member_count(IrAnalyze *ira, IrIns |
| 19147 | return ira->codegen->builtin_types.entry_num_lit_int; | 19147 | return ira->codegen->builtin_types.entry_num_lit_int; |
| 19148 | } | 19148 | } |
| 19149 | | 19149 | |
| 19150 | static TypeTableEntry *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInstructionMemberType *instruction) { | 19150 | static ZigType *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInstructionMemberType *instruction) { |
| 19151 | Error err; | 19151 | Error err; |
| 19152 | IrInstruction *container_type_value = instruction->container_type->other; | 19152 | IrInstruction *container_type_value = instruction->container_type->other; |
| 19153 | TypeTableEntry *container_type = ir_resolve_type(ira, container_type_value); | 19153 | ZigType *container_type = ir_resolve_type(ira, container_type_value); |
| 19154 | if (type_is_invalid(container_type)) | 19154 | if (type_is_invalid(container_type)) |
| 19155 | return ira->codegen->builtin_types.entry_invalid; | 19155 | return ira->codegen->builtin_types.entry_invalid; |
| 19156 | | 19156 | |
| ... | @@ -19194,10 +19194,10 @@ static TypeTableEntry *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInst | ... | @@ -19194,10 +19194,10 @@ static TypeTableEntry *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInst |
| 19194 | } | 19194 | } |
| 19195 | } | 19195 | } |
| 19196 | | 19196 | |
| 19197 | static TypeTableEntry *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInstructionMemberName *instruction) { | 19197 | static ZigType *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInstructionMemberName *instruction) { |
| 19198 | Error err; | 19198 | Error err; |
| 19199 | IrInstruction *container_type_value = instruction->container_type->other; | 19199 | IrInstruction *container_type_value = instruction->container_type->other; |
| 19200 | TypeTableEntry *container_type = ir_resolve_type(ira, container_type_value); | 19200 | ZigType *container_type = ir_resolve_type(ira, container_type_value); |
| 19201 | if (type_is_invalid(container_type)) | 19201 | if (type_is_invalid(container_type)) |
| 19202 | return ira->codegen->builtin_types.entry_invalid; | 19202 | return ira->codegen->builtin_types.entry_invalid; |
| 19203 | | 19203 | |
| ... | @@ -19252,28 +19252,28 @@ static TypeTableEntry *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInst | ... | @@ -19252,28 +19252,28 @@ static TypeTableEntry *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInst |
| 19252 | } | 19252 | } |
| 19253 | } | 19253 | } |
| 19254 | | 19254 | |
| 19255 | static TypeTableEntry *ir_analyze_instruction_breakpoint(IrAnalyze *ira, IrInstructionBreakpoint *instruction) { | 19255 | static ZigType *ir_analyze_instruction_breakpoint(IrAnalyze *ira, IrInstructionBreakpoint *instruction) { |
| 19256 | ir_build_breakpoint_from(&ira->new_irb, &instruction->base); | 19256 | ir_build_breakpoint_from(&ira->new_irb, &instruction->base); |
| 19257 | return ira->codegen->builtin_types.entry_void; | 19257 | return ira->codegen->builtin_types.entry_void; |
| 19258 | } | 19258 | } |
| 19259 | | 19259 | |
| 19260 | static TypeTableEntry *ir_analyze_instruction_return_address(IrAnalyze *ira, IrInstructionReturnAddress *instruction) { | 19260 | static ZigType *ir_analyze_instruction_return_address(IrAnalyze *ira, IrInstructionReturnAddress *instruction) { |
| 19261 | ir_build_return_address_from(&ira->new_irb, &instruction->base); | 19261 | ir_build_return_address_from(&ira->new_irb, &instruction->base); |
| 19262 | | 19262 | |
| 19263 | TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8; | 19263 | ZigType *u8 = ira->codegen->builtin_types.entry_u8; |
| 19264 | TypeTableEntry *u8_ptr_const = get_pointer_to_type(ira->codegen, u8, true); | 19264 | ZigType *u8_ptr_const = get_pointer_to_type(ira->codegen, u8, true); |
| 19265 | return u8_ptr_const; | 19265 | return u8_ptr_const; |
| 19266 | } | 19266 | } |
| 19267 | | 19267 | |
| 19268 | static TypeTableEntry *ir_analyze_instruction_frame_address(IrAnalyze *ira, IrInstructionFrameAddress *instruction) { | 19268 | static ZigType *ir_analyze_instruction_frame_address(IrAnalyze *ira, IrInstructionFrameAddress *instruction) { |
| 19269 | ir_build_frame_address_from(&ira->new_irb, &instruction->base); | 19269 | ir_build_frame_address_from(&ira->new_irb, &instruction->base); |
| 19270 | | 19270 | |
| 19271 | TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8; | 19271 | ZigType *u8 = ira->codegen->builtin_types.entry_u8; |
| 19272 | TypeTableEntry *u8_ptr_const = get_pointer_to_type(ira->codegen, u8, true); | 19272 | ZigType *u8_ptr_const = get_pointer_to_type(ira->codegen, u8, true); |
| 19273 | return u8_ptr_const; | 19273 | return u8_ptr_const; |
| 19274 | } | 19274 | } |
| 19275 | | 19275 | |
| 19276 | static TypeTableEntry *ir_analyze_instruction_handle(IrAnalyze *ira, IrInstructionHandle *instruction) { | 19276 | static ZigType *ir_analyze_instruction_handle(IrAnalyze *ira, IrInstructionHandle *instruction) { |
| 19277 | ir_build_handle_from(&ira->new_irb, &instruction->base); | 19277 | ir_build_handle_from(&ira->new_irb, &instruction->base); |
| 19278 | | 19278 | |
| 19279 | FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec); | 19279 | FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec); |
| ... | @@ -19281,12 +19281,12 @@ static TypeTableEntry *ir_analyze_instruction_handle(IrAnalyze *ira, IrInstructi | ... | @@ -19281,12 +19281,12 @@ static TypeTableEntry *ir_analyze_instruction_handle(IrAnalyze *ira, IrInstructi |
| 19281 | return get_promise_type(ira->codegen, fn_entry->type_entry->data.fn.fn_type_id.return_type); | 19281 | return get_promise_type(ira->codegen, fn_entry->type_entry->data.fn.fn_type_id.return_type); |
| 19282 | } | 19282 | } |
| 19283 | | 19283 | |
| 19284 | static TypeTableEntry *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstructionAlignOf *instruction) { | 19284 | static ZigType *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstructionAlignOf *instruction) { |
| 19285 | Error err; | 19285 | Error err; |
| 19286 | IrInstruction *type_value = instruction->type_value->other; | 19286 | IrInstruction *type_value = instruction->type_value->other; |
| 19287 | if (type_is_invalid(type_value->value.type)) | 19287 | if (type_is_invalid(type_value->value.type)) |
| 19288 | return ira->codegen->builtin_types.entry_invalid; | 19288 | return ira->codegen->builtin_types.entry_invalid; |
| 19289 | TypeTableEntry *type_entry = ir_resolve_type(ira, type_value); | 19289 | ZigType *type_entry = ir_resolve_type(ira, type_value); |
| 19290 | | 19290 | |
| 19291 | if ((err = type_ensure_zero_bits_known(ira->codegen, type_entry))) | 19291 | if ((err = type_ensure_zero_bits_known(ira->codegen, type_entry))) |
| 19292 | return ira->codegen->builtin_types.entry_invalid; | 19292 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -19332,12 +19332,12 @@ static TypeTableEntry *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstruc | ... | @@ -19332,12 +19332,12 @@ static TypeTableEntry *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstruc |
| 19332 | zig_unreachable(); | 19332 | zig_unreachable(); |
| 19333 | } | 19333 | } |
| 19334 | | 19334 | |
| 19335 | static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstructionOverflowOp *instruction) { | 19335 | static ZigType *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstructionOverflowOp *instruction) { |
| 19336 | IrInstruction *type_value = instruction->type_value->other; | 19336 | IrInstruction *type_value = instruction->type_value->other; |
| 19337 | if (type_is_invalid(type_value->value.type)) | 19337 | if (type_is_invalid(type_value->value.type)) |
| 19338 | return ira->codegen->builtin_types.entry_invalid; | 19338 | return ira->codegen->builtin_types.entry_invalid; |
| 19339 | | 19339 | |
| 19340 | TypeTableEntry *dest_type = ir_resolve_type(ira, type_value); | 19340 | ZigType *dest_type = ir_resolve_type(ira, type_value); |
| 19341 | if (type_is_invalid(dest_type)) | 19341 | if (type_is_invalid(dest_type)) |
| 19342 | return ira->codegen->builtin_types.entry_invalid; | 19342 | return ira->codegen->builtin_types.entry_invalid; |
| 19343 | | 19343 | |
| ... | @@ -19361,7 +19361,7 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst | ... | @@ -19361,7 +19361,7 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst |
| 19361 | | 19361 | |
| 19362 | IrInstruction *casted_op2; | 19362 | IrInstruction *casted_op2; |
| 19363 | if (instruction->op == IrOverflowOpShl) { | 19363 | if (instruction->op == IrOverflowOpShl) { |
| 19364 | TypeTableEntry *shift_amt_type = get_smallest_unsigned_int_type(ira->codegen, | 19364 | ZigType *shift_amt_type = get_smallest_unsigned_int_type(ira->codegen, |
| 19365 | dest_type->data.integral.bit_count - 1); | 19365 | dest_type->data.integral.bit_count - 1); |
| 19366 | casted_op2 = ir_implicit_cast(ira, op2, shift_amt_type); | 19366 | casted_op2 = ir_implicit_cast(ira, op2, shift_amt_type); |
| 19367 | } else { | 19367 | } else { |
| ... | @@ -19374,7 +19374,7 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst | ... | @@ -19374,7 +19374,7 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst |
| 19374 | if (type_is_invalid(result_ptr->value.type)) | 19374 | if (type_is_invalid(result_ptr->value.type)) |
| 19375 | return ira->codegen->builtin_types.entry_invalid; | 19375 | return ira->codegen->builtin_types.entry_invalid; |
| 19376 | | 19376 | |
| 19377 | TypeTableEntry *expected_ptr_type; | 19377 | ZigType *expected_ptr_type; |
| 19378 | if (result_ptr->value.type->id == TypeTableEntryIdPointer) { | 19378 | if (result_ptr->value.type->id == TypeTableEntryIdPointer) { |
| 19379 | expected_ptr_type = get_pointer_to_type_extra(ira->codegen, dest_type, | 19379 | expected_ptr_type = get_pointer_to_type_extra(ira->codegen, dest_type, |
| 19380 | false, result_ptr->value.type->data.pointer.is_volatile, | 19380 | false, result_ptr->value.type->data.pointer.is_volatile, |
| ... | @@ -19431,12 +19431,12 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst | ... | @@ -19431,12 +19431,12 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst |
| 19431 | return ira->codegen->builtin_types.entry_bool; | 19431 | return ira->codegen->builtin_types.entry_bool; |
| 19432 | } | 19432 | } |
| 19433 | | 19433 | |
| 19434 | static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstructionTestErr *instruction) { | 19434 | static ZigType *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstructionTestErr *instruction) { |
| 19435 | IrInstruction *value = instruction->value->other; | 19435 | IrInstruction *value = instruction->value->other; |
| 19436 | if (type_is_invalid(value->value.type)) | 19436 | if (type_is_invalid(value->value.type)) |
| 19437 | return ira->codegen->builtin_types.entry_invalid; | 19437 | return ira->codegen->builtin_types.entry_invalid; |
| 19438 | | 19438 | |
| 19439 | TypeTableEntry *type_entry = value->value.type; | 19439 | ZigType *type_entry = value->value.type; |
| 19440 | if (type_is_invalid(type_entry)) { | 19440 | if (type_is_invalid(type_entry)) { |
| 19441 | return ira->codegen->builtin_types.entry_invalid; | 19441 | return ira->codegen->builtin_types.entry_invalid; |
| 19442 | } else if (type_entry->id == TypeTableEntryIdErrorUnion) { | 19442 | } else if (type_entry->id == TypeTableEntryIdErrorUnion) { |
| ... | @@ -19452,7 +19452,7 @@ static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruc | ... | @@ -19452,7 +19452,7 @@ static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruc |
| 19452 | } | 19452 | } |
| 19453 | } | 19453 | } |
| 19454 | | 19454 | |
| 19455 | TypeTableEntry *err_set_type = type_entry->data.error_union.err_set_type; | 19455 | ZigType *err_set_type = type_entry->data.error_union.err_set_type; |
| 19456 | if (!resolve_inferred_error_set(ira->codegen, err_set_type, instruction->base.source_node)) { | 19456 | if (!resolve_inferred_error_set(ira->codegen, err_set_type, instruction->base.source_node)) { |
| 19457 | return ira->codegen->builtin_types.entry_invalid; | 19457 | return ira->codegen->builtin_types.entry_invalid; |
| 19458 | } | 19458 | } |
| ... | @@ -19478,18 +19478,18 @@ static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruc | ... | @@ -19478,18 +19478,18 @@ static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruc |
| 19478 | } | 19478 | } |
| 19479 | } | 19479 | } |
| 19480 | | 19480 | |
| 19481 | static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, | 19481 | static ZigType *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, |
| 19482 | IrInstructionUnwrapErrCode *instruction) | 19482 | IrInstructionUnwrapErrCode *instruction) |
| 19483 | { | 19483 | { |
| 19484 | IrInstruction *value = instruction->value->other; | 19484 | IrInstruction *value = instruction->value->other; |
| 19485 | if (type_is_invalid(value->value.type)) | 19485 | if (type_is_invalid(value->value.type)) |
| 19486 | return ira->codegen->builtin_types.entry_invalid; | 19486 | return ira->codegen->builtin_types.entry_invalid; |
| 19487 | TypeTableEntry *ptr_type = value->value.type; | 19487 | ZigType *ptr_type = value->value.type; |
| 19488 | | 19488 | |
| 19489 | // This will be a pointer type because unwrap err payload IR instruction operates on a pointer to a thing. | 19489 | // This will be a pointer type because unwrap err payload IR instruction operates on a pointer to a thing. |
| 19490 | assert(ptr_type->id == TypeTableEntryIdPointer); | 19490 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 19491 | | 19491 | |
| 19492 | TypeTableEntry *type_entry = ptr_type->data.pointer.child_type; | 19492 | ZigType *type_entry = ptr_type->data.pointer.child_type; |
| 19493 | if (type_is_invalid(type_entry)) { | 19493 | if (type_is_invalid(type_entry)) { |
| 19494 | return ira->codegen->builtin_types.entry_invalid; | 19494 | return ira->codegen->builtin_types.entry_invalid; |
| 19495 | } else if (type_entry->id == TypeTableEntryIdErrorUnion) { | 19495 | } else if (type_entry->id == TypeTableEntryIdErrorUnion) { |
| ... | @@ -19519,27 +19519,27 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, | ... | @@ -19519,27 +19519,27 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, |
| 19519 | } | 19519 | } |
| 19520 | } | 19520 | } |
| 19521 | | 19521 | |
| 19522 | static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira, | 19522 | static ZigType *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira, |
| 19523 | IrInstructionUnwrapErrPayload *instruction) | 19523 | IrInstructionUnwrapErrPayload *instruction) |
| 19524 | { | 19524 | { |
| 19525 | assert(instruction->value->other); | 19525 | assert(instruction->value->other); |
| 19526 | IrInstruction *value = instruction->value->other; | 19526 | IrInstruction *value = instruction->value->other; |
| 19527 | if (type_is_invalid(value->value.type)) | 19527 | if (type_is_invalid(value->value.type)) |
| 19528 | return ira->codegen->builtin_types.entry_invalid; | 19528 | return ira->codegen->builtin_types.entry_invalid; |
| 19529 | TypeTableEntry *ptr_type = value->value.type; | 19529 | ZigType *ptr_type = value->value.type; |
| 19530 | | 19530 | |
| 19531 | // This will be a pointer type because unwrap err payload IR instruction operates on a pointer to a thing. | 19531 | // This will be a pointer type because unwrap err payload IR instruction operates on a pointer to a thing. |
| 19532 | assert(ptr_type->id == TypeTableEntryIdPointer); | 19532 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 19533 | | 19533 | |
| 19534 | TypeTableEntry *type_entry = ptr_type->data.pointer.child_type; | 19534 | ZigType *type_entry = ptr_type->data.pointer.child_type; |
| 19535 | if (type_is_invalid(type_entry)) { | 19535 | if (type_is_invalid(type_entry)) { |
| 19536 | return ira->codegen->builtin_types.entry_invalid; | 19536 | return ira->codegen->builtin_types.entry_invalid; |
| 19537 | } else if (type_entry->id == TypeTableEntryIdErrorUnion) { | 19537 | } else if (type_entry->id == TypeTableEntryIdErrorUnion) { |
| 19538 | TypeTableEntry *payload_type = type_entry->data.error_union.payload_type; | 19538 | ZigType *payload_type = type_entry->data.error_union.payload_type; |
| 19539 | if (type_is_invalid(payload_type)) { | 19539 | if (type_is_invalid(payload_type)) { |
| 19540 | return ira->codegen->builtin_types.entry_invalid; | 19540 | return ira->codegen->builtin_types.entry_invalid; |
| 19541 | } | 19541 | } |
| 19542 | TypeTableEntry *result_type = get_pointer_to_type_extra(ira->codegen, payload_type, | 19542 | ZigType *result_type = get_pointer_to_type_extra(ira->codegen, payload_type, |
| 19543 | ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile, | 19543 | ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile, |
| 19544 | PtrLenSingle, | 19544 | PtrLenSingle, |
| 19545 | get_abi_alignment(ira->codegen, payload_type), 0, 0); | 19545 | get_abi_alignment(ira->codegen, payload_type), 0, 0); |
| ... | @@ -19575,7 +19575,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira, | ... | @@ -19575,7 +19575,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira, |
| 19575 | | 19575 | |
| 19576 | } | 19576 | } |
| 19577 | | 19577 | |
| 19578 | static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstructionFnProto *instruction) { | 19578 | static ZigType *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstructionFnProto *instruction) { |
| 19579 | AstNode *proto_node = instruction->base.source_node; | 19579 | AstNode *proto_node = instruction->base.source_node; |
| 19580 | assert(proto_node->type == NodeTypeFnProto); | 19580 | assert(proto_node->type == NodeTypeFnProto); |
| 19581 | | 19581 | |
| ... | @@ -19656,7 +19656,7 @@ static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruc | ... | @@ -19656,7 +19656,7 @@ static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruc |
| 19656 | return ira->codegen->builtin_types.entry_type; | 19656 | return ira->codegen->builtin_types.entry_type; |
| 19657 | } | 19657 | } |
| 19658 | | 19658 | |
| 19659 | static TypeTableEntry *ir_analyze_instruction_test_comptime(IrAnalyze *ira, IrInstructionTestComptime *instruction) { | 19659 | static ZigType *ir_analyze_instruction_test_comptime(IrAnalyze *ira, IrInstructionTestComptime *instruction) { |
| 19660 | IrInstruction *value = instruction->value->other; | 19660 | IrInstruction *value = instruction->value->other; |
| 19661 | if (type_is_invalid(value->value.type)) | 19661 | if (type_is_invalid(value->value.type)) |
| 19662 | return ira->codegen->builtin_types.entry_invalid; | 19662 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -19666,11 +19666,11 @@ static TypeTableEntry *ir_analyze_instruction_test_comptime(IrAnalyze *ira, IrIn | ... | @@ -19666,11 +19666,11 @@ static TypeTableEntry *ir_analyze_instruction_test_comptime(IrAnalyze *ira, IrIn |
| 19666 | return ira->codegen->builtin_types.entry_bool; | 19666 | return ira->codegen->builtin_types.entry_bool; |
| 19667 | } | 19667 | } |
| 19668 | | 19668 | |
| 19669 | static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, | 19669 | static ZigType *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 19670 | IrInstructionCheckSwitchProngs *instruction) | 19670 | IrInstructionCheckSwitchProngs *instruction) |
| 19671 | { | 19671 | { |
| 19672 | IrInstruction *target_value = instruction->target_value->other; | 19672 | IrInstruction *target_value = instruction->target_value->other; |
| 19673 | TypeTableEntry *switch_type = target_value->value.type; | 19673 | ZigType *switch_type = target_value->value.type; |
| 19674 | if (type_is_invalid(switch_type)) | 19674 | if (type_is_invalid(switch_type)) |
| 19675 | return ira->codegen->builtin_types.entry_invalid; | 19675 | return ira->codegen->builtin_types.entry_invalid; |
| 19676 | | 19676 | |
| ... | @@ -19846,11 +19846,11 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira | ... | @@ -19846,11 +19846,11 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira |
| 19846 | return ira->codegen->builtin_types.entry_void; | 19846 | return ira->codegen->builtin_types.entry_void; |
| 19847 | } | 19847 | } |
| 19848 | | 19848 | |
| 19849 | static TypeTableEntry *ir_analyze_instruction_check_statement_is_void(IrAnalyze *ira, | 19849 | static ZigType *ir_analyze_instruction_check_statement_is_void(IrAnalyze *ira, |
| 19850 | IrInstructionCheckStatementIsVoid *instruction) | 19850 | IrInstructionCheckStatementIsVoid *instruction) |
| 19851 | { | 19851 | { |
| 19852 | IrInstruction *statement_value = instruction->statement_value->other; | 19852 | IrInstruction *statement_value = instruction->statement_value->other; |
| 19853 | TypeTableEntry *statement_type = statement_value->value.type; | 19853 | ZigType *statement_type = statement_value->value.type; |
| 19854 | if (type_is_invalid(statement_type)) | 19854 | if (type_is_invalid(statement_type)) |
| 19855 | return ira->codegen->builtin_types.entry_invalid; | 19855 | return ira->codegen->builtin_types.entry_invalid; |
| 19856 | | 19856 | |
| ... | @@ -19862,7 +19862,7 @@ static TypeTableEntry *ir_analyze_instruction_check_statement_is_void(IrAnalyze | ... | @@ -19862,7 +19862,7 @@ static TypeTableEntry *ir_analyze_instruction_check_statement_is_void(IrAnalyze |
| 19862 | return ira->codegen->builtin_types.entry_void; | 19862 | return ira->codegen->builtin_types.entry_void; |
| 19863 | } | 19863 | } |
| 19864 | | 19864 | |
| 19865 | static TypeTableEntry *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructionPanic *instruction) { | 19865 | static ZigType *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructionPanic *instruction) { |
| 19866 | IrInstruction *msg = instruction->msg->other; | 19866 | IrInstruction *msg = instruction->msg->other; |
| 19867 | if (type_is_invalid(msg->value.type)) | 19867 | if (type_is_invalid(msg->value.type)) |
| 19868 | return ir_unreach_error(ira); | 19868 | return ir_unreach_error(ira); |
| ... | @@ -19872,9 +19872,9 @@ static TypeTableEntry *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructio | ... | @@ -19872,9 +19872,9 @@ static TypeTableEntry *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructio |
| 19872 | return ir_unreach_error(ira); | 19872 | return ir_unreach_error(ira); |
| 19873 | } | 19873 | } |
| 19874 | | 19874 | |
| 19875 | TypeTableEntry *u8_ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, | 19875 | ZigType *u8_ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 19876 | true, false, PtrLenUnknown, get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), 0, 0); | 19876 | true, false, PtrLenUnknown, get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), 0, 0); |
| 19877 | TypeTableEntry *str_type = get_slice_type(ira->codegen, u8_ptr_type); | 19877 | ZigType *str_type = get_slice_type(ira->codegen, u8_ptr_type); |
| 19878 | IrInstruction *casted_msg = ir_implicit_cast(ira, msg, str_type); | 19878 | IrInstruction *casted_msg = ir_implicit_cast(ira, msg, str_type); |
| 19879 | if (type_is_invalid(casted_msg->value.type)) | 19879 | if (type_is_invalid(casted_msg->value.type)) |
| 19880 | return ir_unreach_error(ira); | 19880 | return ir_unreach_error(ira); |
| ... | @@ -19886,10 +19886,10 @@ static TypeTableEntry *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructio | ... | @@ -19886,10 +19886,10 @@ static TypeTableEntry *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructio |
| 19886 | } | 19886 | } |
| 19887 | | 19887 | |
| 19888 | static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint32_t align_bytes, bool safety_check_on) { | 19888 | static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint32_t align_bytes, bool safety_check_on) { |
| 19889 | TypeTableEntry *target_type = target->value.type; | 19889 | ZigType *target_type = target->value.type; |
| 19890 | assert(!type_is_invalid(target_type)); | 19890 | assert(!type_is_invalid(target_type)); |
| 19891 | | 19891 | |
| 19892 | TypeTableEntry *result_type; | 19892 | ZigType *result_type; |
| 19893 | uint32_t old_align_bytes; | 19893 | uint32_t old_align_bytes; |
| 19894 | | 19894 | |
| 19895 | if (target_type->id == TypeTableEntryIdPointer) { | 19895 | if (target_type->id == TypeTableEntryIdPointer) { |
| ... | @@ -19903,9 +19903,9 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3 | ... | @@ -19903,9 +19903,9 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3 |
| 19903 | } else if (target_type->id == TypeTableEntryIdOptional && | 19903 | } else if (target_type->id == TypeTableEntryIdOptional && |
| 19904 | target_type->data.maybe.child_type->id == TypeTableEntryIdPointer) | 19904 | target_type->data.maybe.child_type->id == TypeTableEntryIdPointer) |
| 19905 | { | 19905 | { |
| 19906 | TypeTableEntry *ptr_type = target_type->data.maybe.child_type; | 19906 | ZigType *ptr_type = target_type->data.maybe.child_type; |
| 19907 | old_align_bytes = ptr_type->data.pointer.alignment; | 19907 | old_align_bytes = ptr_type->data.pointer.alignment; |
| 19908 | TypeTableEntry *better_ptr_type = adjust_ptr_align(ira->codegen, ptr_type, align_bytes); | 19908 | ZigType *better_ptr_type = adjust_ptr_align(ira->codegen, ptr_type, align_bytes); |
| 19909 | | 19909 | |
| 19910 | result_type = get_optional_type(ira->codegen, better_ptr_type); | 19910 | result_type = get_optional_type(ira->codegen, better_ptr_type); |
| 19911 | } else if (target_type->id == TypeTableEntryIdOptional && | 19911 | } else if (target_type->id == TypeTableEntryIdOptional && |
| ... | @@ -19914,12 +19914,12 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3 | ... | @@ -19914,12 +19914,12 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3 |
| 19914 | FnTypeId fn_type_id = target_type->data.maybe.child_type->data.fn.fn_type_id; | 19914 | FnTypeId fn_type_id = target_type->data.maybe.child_type->data.fn.fn_type_id; |
| 19915 | old_align_bytes = fn_type_id.alignment; | 19915 | old_align_bytes = fn_type_id.alignment; |
| 19916 | fn_type_id.alignment = align_bytes; | 19916 | fn_type_id.alignment = align_bytes; |
| 19917 | TypeTableEntry *fn_type = get_fn_type(ira->codegen, &fn_type_id); | 19917 | ZigType *fn_type = get_fn_type(ira->codegen, &fn_type_id); |
| 19918 | result_type = get_optional_type(ira->codegen, fn_type); | 19918 | result_type = get_optional_type(ira->codegen, fn_type); |
| 19919 | } else if (is_slice(target_type)) { | 19919 | } else if (is_slice(target_type)) { |
| 19920 | TypeTableEntry *slice_ptr_type = target_type->data.structure.fields[slice_ptr_index].type_entry; | 19920 | ZigType *slice_ptr_type = target_type->data.structure.fields[slice_ptr_index].type_entry; |
| 19921 | old_align_bytes = slice_ptr_type->data.pointer.alignment; | 19921 | old_align_bytes = slice_ptr_type->data.pointer.alignment; |
| 19922 | TypeTableEntry *result_ptr_type = adjust_ptr_align(ira->codegen, slice_ptr_type, align_bytes); | 19922 | ZigType *result_ptr_type = adjust_ptr_align(ira->codegen, slice_ptr_type, align_bytes); |
| 19923 | result_type = get_slice_type(ira->codegen, result_ptr_type); | 19923 | result_type = get_slice_type(ira->codegen, result_ptr_type); |
| 19924 | } else { | 19924 | } else { |
| 19925 | ir_add_error(ira, target, | 19925 | ir_add_error(ira, target, |
| ... | @@ -19957,16 +19957,16 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3 | ... | @@ -19957,16 +19957,16 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3 |
| 19957 | return result; | 19957 | return result; |
| 19958 | } | 19958 | } |
| 19959 | | 19959 | |
| 19960 | static TypeTableEntry *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstructionPtrCast *instruction) { | 19960 | static ZigType *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstructionPtrCast *instruction) { |
| 19961 | Error err; | 19961 | Error err; |
| 19962 | | 19962 | |
| 19963 | IrInstruction *dest_type_value = instruction->dest_type->other; | 19963 | IrInstruction *dest_type_value = instruction->dest_type->other; |
| 19964 | TypeTableEntry *dest_type = ir_resolve_type(ira, dest_type_value); | 19964 | ZigType *dest_type = ir_resolve_type(ira, dest_type_value); |
| 19965 | if (type_is_invalid(dest_type)) | 19965 | if (type_is_invalid(dest_type)) |
| 19966 | return ira->codegen->builtin_types.entry_invalid; | 19966 | return ira->codegen->builtin_types.entry_invalid; |
| 19967 | | 19967 | |
| 19968 | IrInstruction *ptr = instruction->ptr->other; | 19968 | IrInstruction *ptr = instruction->ptr->other; |
| 19969 | TypeTableEntry *src_type = ptr->value.type; | 19969 | ZigType *src_type = ptr->value.type; |
| 19970 | if (type_is_invalid(src_type)) | 19970 | if (type_is_invalid(src_type)) |
| 19971 | return ira->codegen->builtin_types.entry_invalid; | 19971 | return ira->codegen->builtin_types.entry_invalid; |
| 19972 | | 19972 | |
| ... | @@ -20155,15 +20155,15 @@ static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue | ... | @@ -20155,15 +20155,15 @@ static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue |
| 20155 | zig_unreachable(); | 20155 | zig_unreachable(); |
| 20156 | } | 20156 | } |
| 20157 | | 20157 | |
| 20158 | static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstructionBitCast *instruction) { | 20158 | static ZigType *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstructionBitCast *instruction) { |
| 20159 | Error err; | 20159 | Error err; |
| 20160 | IrInstruction *dest_type_value = instruction->dest_type->other; | 20160 | IrInstruction *dest_type_value = instruction->dest_type->other; |
| 20161 | TypeTableEntry *dest_type = ir_resolve_type(ira, dest_type_value); | 20161 | ZigType *dest_type = ir_resolve_type(ira, dest_type_value); |
| 20162 | if (type_is_invalid(dest_type)) | 20162 | if (type_is_invalid(dest_type)) |
| 20163 | return ira->codegen->builtin_types.entry_invalid; | 20163 | return ira->codegen->builtin_types.entry_invalid; |
| 20164 | | 20164 | |
| 20165 | IrInstruction *value = instruction->value->other; | 20165 | IrInstruction *value = instruction->value->other; |
| 20166 | TypeTableEntry *src_type = value->value.type; | 20166 | ZigType *src_type = value->value.type; |
| 20167 | if (type_is_invalid(src_type)) | 20167 | if (type_is_invalid(src_type)) |
| 20168 | return ira->codegen->builtin_types.entry_invalid; | 20168 | return ira->codegen->builtin_types.entry_invalid; |
| 20169 | | 20169 | |
| ... | @@ -20255,10 +20255,10 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc | ... | @@ -20255,10 +20255,10 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc |
| 20255 | return dest_type; | 20255 | return dest_type; |
| 20256 | } | 20256 | } |
| 20257 | | 20257 | |
| 20258 | static TypeTableEntry *ir_analyze_instruction_int_to_ptr(IrAnalyze *ira, IrInstructionIntToPtr *instruction) { | 20258 | static ZigType *ir_analyze_instruction_int_to_ptr(IrAnalyze *ira, IrInstructionIntToPtr *instruction) { |
| 20259 | Error err; | 20259 | Error err; |
| 20260 | IrInstruction *dest_type_value = instruction->dest_type->other; | 20260 | IrInstruction *dest_type_value = instruction->dest_type->other; |
| 20261 | TypeTableEntry *dest_type = ir_resolve_type(ira, dest_type_value); | 20261 | ZigType *dest_type = ir_resolve_type(ira, dest_type_value); |
| 20262 | if (type_is_invalid(dest_type)) | 20262 | if (type_is_invalid(dest_type)) |
| 20263 | return ira->codegen->builtin_types.entry_invalid; | 20263 | return ira->codegen->builtin_types.entry_invalid; |
| 20264 | | 20264 | |
| ... | @@ -20300,7 +20300,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_ptr(IrAnalyze *ira, IrInstr | ... | @@ -20300,7 +20300,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_ptr(IrAnalyze *ira, IrInstr |
| 20300 | return dest_type; | 20300 | return dest_type; |
| 20301 | } | 20301 | } |
| 20302 | | 20302 | |
| 20303 | static TypeTableEntry *ir_analyze_instruction_decl_ref(IrAnalyze *ira, | 20303 | static ZigType *ir_analyze_instruction_decl_ref(IrAnalyze *ira, |
| 20304 | IrInstructionDeclRef *instruction) | 20304 | IrInstructionDeclRef *instruction) |
| 20305 | { | 20305 | { |
| 20306 | Tld *tld = instruction->tld; | 20306 | Tld *tld = instruction->tld; |
| ... | @@ -20361,12 +20361,12 @@ static TypeTableEntry *ir_analyze_instruction_decl_ref(IrAnalyze *ira, | ... | @@ -20361,12 +20361,12 @@ static TypeTableEntry *ir_analyze_instruction_decl_ref(IrAnalyze *ira, |
| 20361 | zig_unreachable(); | 20361 | zig_unreachable(); |
| 20362 | } | 20362 | } |
| 20363 | | 20363 | |
| 20364 | static TypeTableEntry *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstructionPtrToInt *instruction) { | 20364 | static ZigType *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstructionPtrToInt *instruction) { |
| 20365 | IrInstruction *target = instruction->target->other; | 20365 | IrInstruction *target = instruction->target->other; |
| 20366 | if (type_is_invalid(target->value.type)) | 20366 | if (type_is_invalid(target->value.type)) |
| 20367 | return ira->codegen->builtin_types.entry_invalid; | 20367 | return ira->codegen->builtin_types.entry_invalid; |
| 20368 | | 20368 | |
| 20369 | TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize; | 20369 | ZigType *usize = ira->codegen->builtin_types.entry_usize; |
| 20370 | | 20370 | |
| 20371 | if (get_codegen_ptr_type(target->value.type) == nullptr) { | 20371 | if (get_codegen_ptr_type(target->value.type) == nullptr) { |
| 20372 | ir_add_error(ira, target, | 20372 | ir_add_error(ira, target, |
| ... | @@ -20400,9 +20400,9 @@ static TypeTableEntry *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstr | ... | @@ -20400,9 +20400,9 @@ static TypeTableEntry *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstr |
| 20400 | return usize; | 20400 | return usize; |
| 20401 | } | 20401 | } |
| 20402 | | 20402 | |
| 20403 | static TypeTableEntry *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstructionPtrType *instruction) { | 20403 | static ZigType *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstructionPtrType *instruction) { |
| 20404 | Error err; | 20404 | Error err; |
| 20405 | TypeTableEntry *child_type = ir_resolve_type(ira, instruction->child_type->other); | 20405 | ZigType *child_type = ir_resolve_type(ira, instruction->child_type->other); |
| 20406 | if (type_is_invalid(child_type)) | 20406 | if (type_is_invalid(child_type)) |
| 20407 | return ira->codegen->builtin_types.entry_invalid; | 20407 | return ira->codegen->builtin_types.entry_invalid; |
| 20408 | | 20408 | |
| ... | @@ -20433,7 +20433,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstruc | ... | @@ -20433,7 +20433,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstruc |
| 20433 | return ira->codegen->builtin_types.entry_type; | 20433 | return ira->codegen->builtin_types.entry_type; |
| 20434 | } | 20434 | } |
| 20435 | | 20435 | |
| 20436 | static TypeTableEntry *ir_analyze_instruction_align_cast(IrAnalyze *ira, IrInstructionAlignCast *instruction) { | 20436 | static ZigType *ir_analyze_instruction_align_cast(IrAnalyze *ira, IrInstructionAlignCast *instruction) { |
| 20437 | uint32_t align_bytes; | 20437 | uint32_t align_bytes; |
| 20438 | IrInstruction *align_bytes_inst = instruction->align_bytes->other; | 20438 | IrInstruction *align_bytes_inst = instruction->align_bytes->other; |
| 20439 | if (!ir_resolve_align(ira, align_bytes_inst, &align_bytes)) | 20439 | if (!ir_resolve_align(ira, align_bytes_inst, &align_bytes)) |
| ... | @@ -20451,7 +20451,7 @@ static TypeTableEntry *ir_analyze_instruction_align_cast(IrAnalyze *ira, IrInstr | ... | @@ -20451,7 +20451,7 @@ static TypeTableEntry *ir_analyze_instruction_align_cast(IrAnalyze *ira, IrInstr |
| 20451 | return result->value.type; | 20451 | return result->value.type; |
| 20452 | } | 20452 | } |
| 20453 | | 20453 | |
| 20454 | static TypeTableEntry *ir_analyze_instruction_opaque_type(IrAnalyze *ira, IrInstructionOpaqueType *instruction) { | 20454 | static ZigType *ir_analyze_instruction_opaque_type(IrAnalyze *ira, IrInstructionOpaqueType *instruction) { |
| 20455 | Buf *name = get_anon_type_name(ira->codegen, ira->new_irb.exec, "opaque", instruction->base.source_node); | 20455 | Buf *name = get_anon_type_name(ira->codegen, ira->new_irb.exec, "opaque", instruction->base.source_node); |
| 20456 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 20456 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 20457 | out_val->data.x_type = get_opaque_type(ira->codegen, instruction->base.scope, instruction->base.source_node, | 20457 | out_val->data.x_type = get_opaque_type(ira->codegen, instruction->base.scope, instruction->base.source_node, |
| ... | @@ -20459,7 +20459,7 @@ static TypeTableEntry *ir_analyze_instruction_opaque_type(IrAnalyze *ira, IrInst | ... | @@ -20459,7 +20459,7 @@ static TypeTableEntry *ir_analyze_instruction_opaque_type(IrAnalyze *ira, IrInst |
| 20459 | return ira->codegen->builtin_types.entry_type; | 20459 | return ira->codegen->builtin_types.entry_type; |
| 20460 | } | 20460 | } |
| 20461 | | 20461 | |
| 20462 | static TypeTableEntry *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, IrInstructionSetAlignStack *instruction) { | 20462 | static ZigType *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, IrInstructionSetAlignStack *instruction) { |
| 20463 | uint32_t align_bytes; | 20463 | uint32_t align_bytes; |
| 20464 | IrInstruction *align_bytes_inst = instruction->align_bytes->other; | 20464 | IrInstruction *align_bytes_inst = instruction->align_bytes->other; |
| 20465 | if (!ir_resolve_align(ira, align_bytes_inst, &align_bytes)) | 20465 | if (!ir_resolve_align(ira, align_bytes_inst, &align_bytes)) |
| ... | @@ -20499,9 +20499,9 @@ static TypeTableEntry *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, Ir | ... | @@ -20499,9 +20499,9 @@ static TypeTableEntry *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, Ir |
| 20499 | return ira->codegen->builtin_types.entry_void; | 20499 | return ira->codegen->builtin_types.entry_void; |
| 20500 | } | 20500 | } |
| 20501 | | 20501 | |
| 20502 | static TypeTableEntry *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstructionArgType *instruction) { | 20502 | static ZigType *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstructionArgType *instruction) { |
| 20503 | IrInstruction *fn_type_inst = instruction->fn_type->other; | 20503 | IrInstruction *fn_type_inst = instruction->fn_type->other; |
| 20504 | TypeTableEntry *fn_type = ir_resolve_type(ira, fn_type_inst); | 20504 | ZigType *fn_type = ir_resolve_type(ira, fn_type_inst); |
| 20505 | if (type_is_invalid(fn_type)) | 20505 | if (type_is_invalid(fn_type)) |
| 20506 | return ira->codegen->builtin_types.entry_invalid; | 20506 | return ira->codegen->builtin_types.entry_invalid; |
| 20507 | | 20507 | |
| ... | @@ -20538,10 +20538,10 @@ static TypeTableEntry *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstruc | ... | @@ -20538,10 +20538,10 @@ static TypeTableEntry *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstruc |
| 20538 | return ira->codegen->builtin_types.entry_type; | 20538 | return ira->codegen->builtin_types.entry_type; |
| 20539 | } | 20539 | } |
| 20540 | | 20540 | |
| 20541 | static TypeTableEntry *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstructionTagType *instruction) { | 20541 | static ZigType *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstructionTagType *instruction) { |
| 20542 | Error err; | 20542 | Error err; |
| 20543 | IrInstruction *target_inst = instruction->target->other; | 20543 | IrInstruction *target_inst = instruction->target->other; |
| 20544 | TypeTableEntry *enum_type = ir_resolve_type(ira, target_inst); | 20544 | ZigType *enum_type = ir_resolve_type(ira, target_inst); |
| 20545 | if (type_is_invalid(enum_type)) | 20545 | if (type_is_invalid(enum_type)) |
| 20546 | return ira->codegen->builtin_types.entry_invalid; | 20546 | return ira->codegen->builtin_types.entry_invalid; |
| 20547 | | 20547 | |
| ... | @@ -20576,7 +20576,7 @@ static TypeTableEntry *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstruc | ... | @@ -20576,7 +20576,7 @@ static TypeTableEntry *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstruc |
| 20576 | } | 20576 | } |
| 20577 | } | 20577 | } |
| 20578 | | 20578 | |
| 20579 | static TypeTableEntry *ir_analyze_instruction_cancel(IrAnalyze *ira, IrInstructionCancel *instruction) { | 20579 | static ZigType *ir_analyze_instruction_cancel(IrAnalyze *ira, IrInstructionCancel *instruction) { |
| 20580 | IrInstruction *target_inst = instruction->target->other; | 20580 | IrInstruction *target_inst = instruction->target->other; |
| 20581 | if (type_is_invalid(target_inst->value.type)) | 20581 | if (type_is_invalid(target_inst->value.type)) |
| 20582 | return ira->codegen->builtin_types.entry_invalid; | 20582 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20591,7 +20591,7 @@ static TypeTableEntry *ir_analyze_instruction_cancel(IrAnalyze *ira, IrInstructi | ... | @@ -20591,7 +20591,7 @@ static TypeTableEntry *ir_analyze_instruction_cancel(IrAnalyze *ira, IrInstructi |
| 20591 | return result->value.type; | 20591 | return result->value.type; |
| 20592 | } | 20592 | } |
| 20593 | | 20593 | |
| 20594 | static TypeTableEntry *ir_analyze_instruction_coro_id(IrAnalyze *ira, IrInstructionCoroId *instruction) { | 20594 | static ZigType *ir_analyze_instruction_coro_id(IrAnalyze *ira, IrInstructionCoroId *instruction) { |
| 20595 | IrInstruction *promise_ptr = instruction->promise_ptr->other; | 20595 | IrInstruction *promise_ptr = instruction->promise_ptr->other; |
| 20596 | if (type_is_invalid(promise_ptr->value.type)) | 20596 | if (type_is_invalid(promise_ptr->value.type)) |
| 20597 | return ira->codegen->builtin_types.entry_invalid; | 20597 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20603,7 +20603,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_id(IrAnalyze *ira, IrInstruct | ... | @@ -20603,7 +20603,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_id(IrAnalyze *ira, IrInstruct |
| 20603 | return result->value.type; | 20603 | return result->value.type; |
| 20604 | } | 20604 | } |
| 20605 | | 20605 | |
| 20606 | static TypeTableEntry *ir_analyze_instruction_coro_alloc(IrAnalyze *ira, IrInstructionCoroAlloc *instruction) { | 20606 | static ZigType *ir_analyze_instruction_coro_alloc(IrAnalyze *ira, IrInstructionCoroAlloc *instruction) { |
| 20607 | IrInstruction *coro_id = instruction->coro_id->other; | 20607 | IrInstruction *coro_id = instruction->coro_id->other; |
| 20608 | if (type_is_invalid(coro_id->value.type)) | 20608 | if (type_is_invalid(coro_id->value.type)) |
| 20609 | return ira->codegen->builtin_types.entry_invalid; | 20609 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20615,14 +20615,14 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc(IrAnalyze *ira, IrInstr | ... | @@ -20615,14 +20615,14 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc(IrAnalyze *ira, IrInstr |
| 20615 | return result->value.type; | 20615 | return result->value.type; |
| 20616 | } | 20616 | } |
| 20617 | | 20617 | |
| 20618 | static TypeTableEntry *ir_analyze_instruction_coro_size(IrAnalyze *ira, IrInstructionCoroSize *instruction) { | 20618 | static ZigType *ir_analyze_instruction_coro_size(IrAnalyze *ira, IrInstructionCoroSize *instruction) { |
| 20619 | IrInstruction *result = ir_build_coro_size(&ira->new_irb, instruction->base.scope, instruction->base.source_node); | 20619 | IrInstruction *result = ir_build_coro_size(&ira->new_irb, instruction->base.scope, instruction->base.source_node); |
| 20620 | ir_link_new_instruction(result, &instruction->base); | 20620 | ir_link_new_instruction(result, &instruction->base); |
| 20621 | result->value.type = ira->codegen->builtin_types.entry_usize; | 20621 | result->value.type = ira->codegen->builtin_types.entry_usize; |
| 20622 | return result->value.type; | 20622 | return result->value.type; |
| 20623 | } | 20623 | } |
| 20624 | | 20624 | |
| 20625 | static TypeTableEntry *ir_analyze_instruction_coro_begin(IrAnalyze *ira, IrInstructionCoroBegin *instruction) { | 20625 | static ZigType *ir_analyze_instruction_coro_begin(IrAnalyze *ira, IrInstructionCoroBegin *instruction) { |
| 20626 | IrInstruction *coro_id = instruction->coro_id->other; | 20626 | IrInstruction *coro_id = instruction->coro_id->other; |
| 20627 | if (type_is_invalid(coro_id->value.type)) | 20627 | if (type_is_invalid(coro_id->value.type)) |
| 20628 | return ira->codegen->builtin_types.entry_invalid; | 20628 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20640,13 +20640,13 @@ static TypeTableEntry *ir_analyze_instruction_coro_begin(IrAnalyze *ira, IrInstr | ... | @@ -20640,13 +20640,13 @@ static TypeTableEntry *ir_analyze_instruction_coro_begin(IrAnalyze *ira, IrInstr |
| 20640 | return result->value.type; | 20640 | return result->value.type; |
| 20641 | } | 20641 | } |
| 20642 | | 20642 | |
| 20643 | static TypeTableEntry *ir_analyze_instruction_get_implicit_allocator(IrAnalyze *ira, IrInstructionGetImplicitAllocator *instruction) { | 20643 | static ZigType *ir_analyze_instruction_get_implicit_allocator(IrAnalyze *ira, IrInstructionGetImplicitAllocator *instruction) { |
| 20644 | IrInstruction *result = ir_get_implicit_allocator(ira, &instruction->base, instruction->id); | 20644 | IrInstruction *result = ir_get_implicit_allocator(ira, &instruction->base, instruction->id); |
| 20645 | ir_link_new_instruction(result, &instruction->base); | 20645 | ir_link_new_instruction(result, &instruction->base); |
| 20646 | return result->value.type; | 20646 | return result->value.type; |
| 20647 | } | 20647 | } |
| 20648 | | 20648 | |
| 20649 | static TypeTableEntry *ir_analyze_instruction_coro_alloc_fail(IrAnalyze *ira, IrInstructionCoroAllocFail *instruction) { | 20649 | static ZigType *ir_analyze_instruction_coro_alloc_fail(IrAnalyze *ira, IrInstructionCoroAllocFail *instruction) { |
| 20650 | IrInstruction *err_val = instruction->err_val->other; | 20650 | IrInstruction *err_val = instruction->err_val->other; |
| 20651 | if (type_is_invalid(err_val->value.type)) | 20651 | if (type_is_invalid(err_val->value.type)) |
| 20652 | return ir_unreach_error(ira); | 20652 | return ir_unreach_error(ira); |
| ... | @@ -20657,7 +20657,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc_fail(IrAnalyze *ira, Ir | ... | @@ -20657,7 +20657,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc_fail(IrAnalyze *ira, Ir |
| 20657 | return ir_finish_anal(ira, result->value.type); | 20657 | return ir_finish_anal(ira, result->value.type); |
| 20658 | } | 20658 | } |
| 20659 | | 20659 | |
| 20660 | static TypeTableEntry *ir_analyze_instruction_coro_suspend(IrAnalyze *ira, IrInstructionCoroSuspend *instruction) { | 20660 | static ZigType *ir_analyze_instruction_coro_suspend(IrAnalyze *ira, IrInstructionCoroSuspend *instruction) { |
| 20661 | IrInstruction *save_point = nullptr; | 20661 | IrInstruction *save_point = nullptr; |
| 20662 | if (instruction->save_point != nullptr) { | 20662 | if (instruction->save_point != nullptr) { |
| 20663 | save_point = instruction->save_point->other; | 20663 | save_point = instruction->save_point->other; |
| ... | @@ -20676,7 +20676,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_suspend(IrAnalyze *ira, IrIns | ... | @@ -20676,7 +20676,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_suspend(IrAnalyze *ira, IrIns |
| 20676 | return result->value.type; | 20676 | return result->value.type; |
| 20677 | } | 20677 | } |
| 20678 | | 20678 | |
| 20679 | static TypeTableEntry *ir_analyze_instruction_coro_end(IrAnalyze *ira, IrInstructionCoroEnd *instruction) { | 20679 | static ZigType *ir_analyze_instruction_coro_end(IrAnalyze *ira, IrInstructionCoroEnd *instruction) { |
| 20680 | IrInstruction *result = ir_build_coro_end(&ira->new_irb, instruction->base.scope, | 20680 | IrInstruction *result = ir_build_coro_end(&ira->new_irb, instruction->base.scope, |
| 20681 | instruction->base.source_node); | 20681 | instruction->base.source_node); |
| 20682 | ir_link_new_instruction(result, &instruction->base); | 20682 | ir_link_new_instruction(result, &instruction->base); |
| ... | @@ -20684,7 +20684,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_end(IrAnalyze *ira, IrInstruc | ... | @@ -20684,7 +20684,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_end(IrAnalyze *ira, IrInstruc |
| 20684 | return result->value.type; | 20684 | return result->value.type; |
| 20685 | } | 20685 | } |
| 20686 | | 20686 | |
| 20687 | static TypeTableEntry *ir_analyze_instruction_coro_free(IrAnalyze *ira, IrInstructionCoroFree *instruction) { | 20687 | static ZigType *ir_analyze_instruction_coro_free(IrAnalyze *ira, IrInstructionCoroFree *instruction) { |
| 20688 | IrInstruction *coro_id = instruction->coro_id->other; | 20688 | IrInstruction *coro_id = instruction->coro_id->other; |
| 20689 | if (type_is_invalid(coro_id->value.type)) | 20689 | if (type_is_invalid(coro_id->value.type)) |
| 20690 | return ira->codegen->builtin_types.entry_invalid; | 20690 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20696,12 +20696,12 @@ static TypeTableEntry *ir_analyze_instruction_coro_free(IrAnalyze *ira, IrInstru | ... | @@ -20696,12 +20696,12 @@ static TypeTableEntry *ir_analyze_instruction_coro_free(IrAnalyze *ira, IrInstru |
| 20696 | IrInstruction *result = ir_build_coro_free(&ira->new_irb, instruction->base.scope, | 20696 | IrInstruction *result = ir_build_coro_free(&ira->new_irb, instruction->base.scope, |
| 20697 | instruction->base.source_node, coro_id, coro_handle); | 20697 | instruction->base.source_node, coro_id, coro_handle); |
| 20698 | ir_link_new_instruction(result, &instruction->base); | 20698 | ir_link_new_instruction(result, &instruction->base); |
| 20699 | TypeTableEntry *ptr_type = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_u8, false); | 20699 | ZigType *ptr_type = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_u8, false); |
| 20700 | result->value.type = get_optional_type(ira->codegen, ptr_type); | 20700 | result->value.type = get_optional_type(ira->codegen, ptr_type); |
| 20701 | return result->value.type; | 20701 | return result->value.type; |
| 20702 | } | 20702 | } |
| 20703 | | 20703 | |
| 20704 | static TypeTableEntry *ir_analyze_instruction_coro_resume(IrAnalyze *ira, IrInstructionCoroResume *instruction) { | 20704 | static ZigType *ir_analyze_instruction_coro_resume(IrAnalyze *ira, IrInstructionCoroResume *instruction) { |
| 20705 | IrInstruction *awaiter_handle = instruction->awaiter_handle->other; | 20705 | IrInstruction *awaiter_handle = instruction->awaiter_handle->other; |
| 20706 | if (type_is_invalid(awaiter_handle->value.type)) | 20706 | if (type_is_invalid(awaiter_handle->value.type)) |
| 20707 | return ira->codegen->builtin_types.entry_invalid; | 20707 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20717,7 +20717,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_resume(IrAnalyze *ira, IrInst | ... | @@ -20717,7 +20717,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_resume(IrAnalyze *ira, IrInst |
| 20717 | return result->value.type; | 20717 | return result->value.type; |
| 20718 | } | 20718 | } |
| 20719 | | 20719 | |
| 20720 | static TypeTableEntry *ir_analyze_instruction_coro_save(IrAnalyze *ira, IrInstructionCoroSave *instruction) { | 20720 | static ZigType *ir_analyze_instruction_coro_save(IrAnalyze *ira, IrInstructionCoroSave *instruction) { |
| 20721 | IrInstruction *coro_handle = instruction->coro_handle->other; | 20721 | IrInstruction *coro_handle = instruction->coro_handle->other; |
| 20722 | if (type_is_invalid(coro_handle->value.type)) | 20722 | if (type_is_invalid(coro_handle->value.type)) |
| 20723 | return ira->codegen->builtin_types.entry_invalid; | 20723 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20729,7 +20729,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_save(IrAnalyze *ira, IrInstru | ... | @@ -20729,7 +20729,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_save(IrAnalyze *ira, IrInstru |
| 20729 | return result->value.type; | 20729 | return result->value.type; |
| 20730 | } | 20730 | } |
| 20731 | | 20731 | |
| 20732 | static TypeTableEntry *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrInstructionCoroPromise *instruction) { | 20732 | static ZigType *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrInstructionCoroPromise *instruction) { |
| 20733 | IrInstruction *coro_handle = instruction->coro_handle->other; | 20733 | IrInstruction *coro_handle = instruction->coro_handle->other; |
| 20734 | if (type_is_invalid(coro_handle->value.type)) | 20734 | if (type_is_invalid(coro_handle->value.type)) |
| 20735 | return ira->codegen->builtin_types.entry_invalid; | 20735 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20742,7 +20742,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrIns | ... | @@ -20742,7 +20742,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrIns |
| 20742 | return ira->codegen->builtin_types.entry_invalid; | 20742 | return ira->codegen->builtin_types.entry_invalid; |
| 20743 | } | 20743 | } |
| 20744 | | 20744 | |
| 20745 | TypeTableEntry *coro_frame_type = get_promise_frame_type(ira->codegen, | 20745 | ZigType *coro_frame_type = get_promise_frame_type(ira->codegen, |
| 20746 | coro_handle->value.type->data.promise.result_type); | 20746 | coro_handle->value.type->data.promise.result_type); |
| 20747 | | 20747 | |
| 20748 | IrInstruction *result = ir_build_coro_promise(&ira->new_irb, instruction->base.scope, | 20748 | IrInstruction *result = ir_build_coro_promise(&ira->new_irb, instruction->base.scope, |
| ... | @@ -20752,7 +20752,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrIns | ... | @@ -20752,7 +20752,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrIns |
| 20752 | return result->value.type; | 20752 | return result->value.type; |
| 20753 | } | 20753 | } |
| 20754 | | 20754 | |
| 20755 | static TypeTableEntry *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira, IrInstructionCoroAllocHelper *instruction) { | 20755 | static ZigType *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira, IrInstructionCoroAllocHelper *instruction) { |
| 20756 | IrInstruction *alloc_fn = instruction->alloc_fn->other; | 20756 | IrInstruction *alloc_fn = instruction->alloc_fn->other; |
| 20757 | if (type_is_invalid(alloc_fn->value.type)) | 20757 | if (type_is_invalid(alloc_fn->value.type)) |
| 20758 | return ira->codegen->builtin_types.entry_invalid; | 20758 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20764,13 +20764,13 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira, | ... | @@ -20764,13 +20764,13 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira, |
| 20764 | IrInstruction *result = ir_build_coro_alloc_helper(&ira->new_irb, instruction->base.scope, | 20764 | IrInstruction *result = ir_build_coro_alloc_helper(&ira->new_irb, instruction->base.scope, |
| 20765 | instruction->base.source_node, alloc_fn, coro_size); | 20765 | instruction->base.source_node, alloc_fn, coro_size); |
| 20766 | ir_link_new_instruction(result, &instruction->base); | 20766 | ir_link_new_instruction(result, &instruction->base); |
| 20767 | TypeTableEntry *u8_ptr_type = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_u8, false); | 20767 | ZigType *u8_ptr_type = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_u8, false); |
| 20768 | result->value.type = get_optional_type(ira->codegen, u8_ptr_type); | 20768 | result->value.type = get_optional_type(ira->codegen, u8_ptr_type); |
| 20769 | return result->value.type; | 20769 | return result->value.type; |
| 20770 | } | 20770 | } |
| 20771 | | 20771 | |
| 20772 | static TypeTableEntry *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op) { | 20772 | static ZigType *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op) { |
| 20773 | TypeTableEntry *operand_type = ir_resolve_type(ira, op); | 20773 | ZigType *operand_type = ir_resolve_type(ira, op); |
| 20774 | if (type_is_invalid(operand_type)) | 20774 | if (type_is_invalid(operand_type)) |
| 20775 | return ira->codegen->builtin_types.entry_invalid; | 20775 | return ira->codegen->builtin_types.entry_invalid; |
| 20776 | | 20776 | |
| ... | @@ -20801,8 +20801,8 @@ static TypeTableEntry *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruct | ... | @@ -20801,8 +20801,8 @@ static TypeTableEntry *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruct |
| 20801 | return operand_type; | 20801 | return operand_type; |
| 20802 | } | 20802 | } |
| 20803 | | 20803 | |
| 20804 | static TypeTableEntry *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstructionAtomicRmw *instruction) { | 20804 | static ZigType *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstructionAtomicRmw *instruction) { |
| 20805 | TypeTableEntry *operand_type = ir_resolve_atomic_operand_type(ira, instruction->operand_type->other); | 20805 | ZigType *operand_type = ir_resolve_atomic_operand_type(ira, instruction->operand_type->other); |
| 20806 | if (type_is_invalid(operand_type)) | 20806 | if (type_is_invalid(operand_type)) |
| 20807 | return ira->codegen->builtin_types.entry_invalid; | 20807 | return ira->codegen->builtin_types.entry_invalid; |
| 20808 | | 20808 | |
| ... | @@ -20811,7 +20811,7 @@ static TypeTableEntry *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstr | ... | @@ -20811,7 +20811,7 @@ static TypeTableEntry *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstr |
| 20811 | return ira->codegen->builtin_types.entry_invalid; | 20811 | return ira->codegen->builtin_types.entry_invalid; |
| 20812 | | 20812 | |
| 20813 | // TODO let this be volatile | 20813 | // TODO let this be volatile |
| 20814 | TypeTableEntry *ptr_type = get_pointer_to_type(ira->codegen, operand_type, false); | 20814 | ZigType *ptr_type = get_pointer_to_type(ira->codegen, operand_type, false); |
| 20815 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr_inst, ptr_type); | 20815 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr_inst, ptr_type); |
| 20816 | if (type_is_invalid(casted_ptr->value.type)) | 20816 | if (type_is_invalid(casted_ptr->value.type)) |
| 20817 | return ira->codegen->builtin_types.entry_invalid; | 20817 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20859,8 +20859,8 @@ static TypeTableEntry *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstr | ... | @@ -20859,8 +20859,8 @@ static TypeTableEntry *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstr |
| 20859 | return result->value.type; | 20859 | return result->value.type; |
| 20860 | } | 20860 | } |
| 20861 | | 20861 | |
| 20862 | static TypeTableEntry *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInstructionAtomicLoad *instruction) { | 20862 | static ZigType *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInstructionAtomicLoad *instruction) { |
| 20863 | TypeTableEntry *operand_type = ir_resolve_atomic_operand_type(ira, instruction->operand_type->other); | 20863 | ZigType *operand_type = ir_resolve_atomic_operand_type(ira, instruction->operand_type->other); |
| 20864 | if (type_is_invalid(operand_type)) | 20864 | if (type_is_invalid(operand_type)) |
| 20865 | return ira->codegen->builtin_types.entry_invalid; | 20865 | return ira->codegen->builtin_types.entry_invalid; |
| 20866 | | 20866 | |
| ... | @@ -20868,7 +20868,7 @@ static TypeTableEntry *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInst | ... | @@ -20868,7 +20868,7 @@ static TypeTableEntry *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInst |
| 20868 | if (type_is_invalid(ptr_inst->value.type)) | 20868 | if (type_is_invalid(ptr_inst->value.type)) |
| 20869 | return ira->codegen->builtin_types.entry_invalid; | 20869 | return ira->codegen->builtin_types.entry_invalid; |
| 20870 | | 20870 | |
| 20871 | TypeTableEntry *ptr_type = get_pointer_to_type(ira->codegen, operand_type, true); | 20871 | ZigType *ptr_type = get_pointer_to_type(ira->codegen, operand_type, true); |
| 20872 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr_inst, ptr_type); | 20872 | IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr_inst, ptr_type); |
| 20873 | if (type_is_invalid(casted_ptr->value.type)) | 20873 | if (type_is_invalid(casted_ptr->value.type)) |
| 20874 | return ira->codegen->builtin_types.entry_invalid; | 20874 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20902,8 +20902,8 @@ static TypeTableEntry *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInst | ... | @@ -20902,8 +20902,8 @@ static TypeTableEntry *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInst |
| 20902 | return result->value.type; | 20902 | return result->value.type; |
| 20903 | } | 20903 | } |
| 20904 | | 20904 | |
| 20905 | static TypeTableEntry *ir_analyze_instruction_promise_result_type(IrAnalyze *ira, IrInstructionPromiseResultType *instruction) { | 20905 | static ZigType *ir_analyze_instruction_promise_result_type(IrAnalyze *ira, IrInstructionPromiseResultType *instruction) { |
| 20906 | TypeTableEntry *promise_type = ir_resolve_type(ira, instruction->promise_type->other); | 20906 | ZigType *promise_type = ir_resolve_type(ira, instruction->promise_type->other); |
| 20907 | if (type_is_invalid(promise_type)) | 20907 | if (type_is_invalid(promise_type)) |
| 20908 | return ira->codegen->builtin_types.entry_invalid; | 20908 | return ira->codegen->builtin_types.entry_invalid; |
| 20909 | | 20909 | |
| ... | @@ -20918,8 +20918,8 @@ static TypeTableEntry *ir_analyze_instruction_promise_result_type(IrAnalyze *ira | ... | @@ -20918,8 +20918,8 @@ static TypeTableEntry *ir_analyze_instruction_promise_result_type(IrAnalyze *ira |
| 20918 | return ira->codegen->builtin_types.entry_type; | 20918 | return ira->codegen->builtin_types.entry_type; |
| 20919 | } | 20919 | } |
| 20920 | | 20920 | |
| 20921 | static TypeTableEntry *ir_analyze_instruction_await_bookkeeping(IrAnalyze *ira, IrInstructionAwaitBookkeeping *instruction) { | 20921 | static ZigType *ir_analyze_instruction_await_bookkeeping(IrAnalyze *ira, IrInstructionAwaitBookkeeping *instruction) { |
| 20922 | TypeTableEntry *promise_result_type = ir_resolve_type(ira, instruction->promise_result_type->other); | 20922 | ZigType *promise_result_type = ir_resolve_type(ira, instruction->promise_result_type->other); |
| 20923 | if (type_is_invalid(promise_result_type)) | 20923 | if (type_is_invalid(promise_result_type)) |
| 20924 | return ira->codegen->builtin_types.entry_invalid; | 20924 | return ira->codegen->builtin_types.entry_invalid; |
| 20925 | | 20925 | |
| ... | @@ -20935,7 +20935,7 @@ static TypeTableEntry *ir_analyze_instruction_await_bookkeeping(IrAnalyze *ira, | ... | @@ -20935,7 +20935,7 @@ static TypeTableEntry *ir_analyze_instruction_await_bookkeeping(IrAnalyze *ira, |
| 20935 | return out_val->type; | 20935 | return out_val->type; |
| 20936 | } | 20936 | } |
| 20937 | | 20937 | |
| 20938 | static TypeTableEntry *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ira, | 20938 | static ZigType *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ira, |
| 20939 | IrInstructionMergeErrRetTraces *instruction) | 20939 | IrInstructionMergeErrRetTraces *instruction) |
| 20940 | { | 20940 | { |
| 20941 | IrInstruction *coro_promise_ptr = instruction->coro_promise_ptr->other; | 20941 | IrInstruction *coro_promise_ptr = instruction->coro_promise_ptr->other; |
| ... | @@ -20943,9 +20943,9 @@ static TypeTableEntry *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ir | ... | @@ -20943,9 +20943,9 @@ static TypeTableEntry *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ir |
| 20943 | return ira->codegen->builtin_types.entry_invalid; | 20943 | return ira->codegen->builtin_types.entry_invalid; |
| 20944 | | 20944 | |
| 20945 | assert(coro_promise_ptr->value.type->id == TypeTableEntryIdPointer); | 20945 | assert(coro_promise_ptr->value.type->id == TypeTableEntryIdPointer); |
| 20946 | TypeTableEntry *promise_frame_type = coro_promise_ptr->value.type->data.pointer.child_type; | 20946 | ZigType *promise_frame_type = coro_promise_ptr->value.type->data.pointer.child_type; |
| 20947 | assert(promise_frame_type->id == TypeTableEntryIdStruct); | 20947 | assert(promise_frame_type->id == TypeTableEntryIdStruct); |
| 20948 | TypeTableEntry *promise_result_type = promise_frame_type->data.structure.fields[1].type_entry; | 20948 | ZigType *promise_result_type = promise_frame_type->data.structure.fields[1].type_entry; |
| 20949 | | 20949 | |
| 20950 | if (!type_can_fail(promise_result_type)) { | 20950 | if (!type_can_fail(promise_result_type)) { |
| 20951 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 20951 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| ... | @@ -20968,7 +20968,7 @@ static TypeTableEntry *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ir | ... | @@ -20968,7 +20968,7 @@ static TypeTableEntry *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ir |
| 20968 | return result->value.type; | 20968 | return result->value.type; |
| 20969 | } | 20969 | } |
| 20970 | | 20970 | |
| 20971 | static TypeTableEntry *ir_analyze_instruction_save_err_ret_addr(IrAnalyze *ira, IrInstructionSaveErrRetAddr *instruction) { | 20971 | static ZigType *ir_analyze_instruction_save_err_ret_addr(IrAnalyze *ira, IrInstructionSaveErrRetAddr *instruction) { |
| 20972 | IrInstruction *result = ir_build_save_err_ret_addr(&ira->new_irb, instruction->base.scope, | 20972 | IrInstruction *result = ir_build_save_err_ret_addr(&ira->new_irb, instruction->base.scope, |
| 20973 | instruction->base.source_node); | 20973 | instruction->base.source_node); |
| 20974 | ir_link_new_instruction(result, &instruction->base); | 20974 | ir_link_new_instruction(result, &instruction->base); |
| ... | @@ -20976,7 +20976,7 @@ static TypeTableEntry *ir_analyze_instruction_save_err_ret_addr(IrAnalyze *ira, | ... | @@ -20976,7 +20976,7 @@ static TypeTableEntry *ir_analyze_instruction_save_err_ret_addr(IrAnalyze *ira, |
| 20976 | return result->value.type; | 20976 | return result->value.type; |
| 20977 | } | 20977 | } |
| 20978 | | 20978 | |
| 20979 | static TypeTableEntry *ir_analyze_instruction_mark_err_ret_trace_ptr(IrAnalyze *ira, IrInstructionMarkErrRetTracePtr *instruction) { | 20979 | static ZigType *ir_analyze_instruction_mark_err_ret_trace_ptr(IrAnalyze *ira, IrInstructionMarkErrRetTracePtr *instruction) { |
| 20980 | IrInstruction *err_ret_trace_ptr = instruction->err_ret_trace_ptr->other; | 20980 | IrInstruction *err_ret_trace_ptr = instruction->err_ret_trace_ptr->other; |
| 20981 | if (type_is_invalid(err_ret_trace_ptr->value.type)) | 20981 | if (type_is_invalid(err_ret_trace_ptr->value.type)) |
| 20982 | return ira->codegen->builtin_types.entry_invalid; | 20982 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -20988,8 +20988,8 @@ static TypeTableEntry *ir_analyze_instruction_mark_err_ret_trace_ptr(IrAnalyze * | ... | @@ -20988,8 +20988,8 @@ static TypeTableEntry *ir_analyze_instruction_mark_err_ret_trace_ptr(IrAnalyze * |
| 20988 | return result->value.type; | 20988 | return result->value.type; |
| 20989 | } | 20989 | } |
| 20990 | | 20990 | |
| 20991 | static TypeTableEntry *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstructionSqrt *instruction) { | 20991 | static ZigType *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstructionSqrt *instruction) { |
| 20992 | TypeTableEntry *float_type = ir_resolve_type(ira, instruction->type->other); | 20992 | ZigType *float_type = ir_resolve_type(ira, instruction->type->other); |
| 20993 | if (type_is_invalid(float_type)) | 20993 | if (type_is_invalid(float_type)) |
| 20994 | return ira->codegen->builtin_types.entry_invalid; | 20994 | return ira->codegen->builtin_types.entry_invalid; |
| 20995 | | 20995 | |
| ... | @@ -21055,7 +21055,7 @@ static TypeTableEntry *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstruction | ... | @@ -21055,7 +21055,7 @@ static TypeTableEntry *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstruction |
| 21055 | return result->value.type; | 21055 | return result->value.type; |
| 21056 | } | 21056 | } |
| 21057 | | 21057 | |
| 21058 | static TypeTableEntry *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInstructionEnumToInt *instruction) { | 21058 | static ZigType *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInstructionEnumToInt *instruction) { |
| 21059 | Error err; | 21059 | Error err; |
| 21060 | IrInstruction *target = instruction->target->other; | 21060 | IrInstruction *target = instruction->target->other; |
| 21061 | if (type_is_invalid(target->value.type)) | 21061 | if (type_is_invalid(target->value.type)) |
| ... | @@ -21070,17 +21070,17 @@ static TypeTableEntry *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInst | ... | @@ -21070,17 +21070,17 @@ static TypeTableEntry *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInst |
| 21070 | if ((err = type_ensure_zero_bits_known(ira->codegen, target->value.type))) | 21070 | if ((err = type_ensure_zero_bits_known(ira->codegen, target->value.type))) |
| 21071 | return ira->codegen->builtin_types.entry_invalid; | 21071 | return ira->codegen->builtin_types.entry_invalid; |
| 21072 | | 21072 | |
| 21073 | TypeTableEntry *tag_type = target->value.type->data.enumeration.tag_int_type; | 21073 | ZigType *tag_type = target->value.type->data.enumeration.tag_int_type; |
| 21074 | | 21074 | |
| 21075 | IrInstruction *result = ir_analyze_enum_to_int(ira, &instruction->base, target, tag_type); | 21075 | IrInstruction *result = ir_analyze_enum_to_int(ira, &instruction->base, target, tag_type); |
| 21076 | ir_link_new_instruction(result, &instruction->base); | 21076 | ir_link_new_instruction(result, &instruction->base); |
| 21077 | return result->value.type; | 21077 | return result->value.type; |
| 21078 | } | 21078 | } |
| 21079 | | 21079 | |
| 21080 | static TypeTableEntry *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInstructionIntToEnum *instruction) { | 21080 | static ZigType *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInstructionIntToEnum *instruction) { |
| 21081 | Error err; | 21081 | Error err; |
| 21082 | IrInstruction *dest_type_value = instruction->dest_type->other; | 21082 | IrInstruction *dest_type_value = instruction->dest_type->other; |
| 21083 | TypeTableEntry *dest_type = ir_resolve_type(ira, dest_type_value); | 21083 | ZigType *dest_type = ir_resolve_type(ira, dest_type_value); |
| 21084 | if (type_is_invalid(dest_type)) | 21084 | if (type_is_invalid(dest_type)) |
| 21085 | return ira->codegen->builtin_types.entry_invalid; | 21085 | return ira->codegen->builtin_types.entry_invalid; |
| 21086 | | 21086 | |
| ... | @@ -21093,7 +21093,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInst | ... | @@ -21093,7 +21093,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInst |
| 21093 | if ((err = type_ensure_zero_bits_known(ira->codegen, dest_type))) | 21093 | if ((err = type_ensure_zero_bits_known(ira->codegen, dest_type))) |
| 21094 | return ira->codegen->builtin_types.entry_invalid; | 21094 | return ira->codegen->builtin_types.entry_invalid; |
| 21095 | | 21095 | |
| 21096 | TypeTableEntry *tag_type = dest_type->data.enumeration.tag_int_type; | 21096 | ZigType *tag_type = dest_type->data.enumeration.tag_int_type; |
| 21097 | | 21097 | |
| 21098 | IrInstruction *target = instruction->target->other; | 21098 | IrInstruction *target = instruction->target->other; |
| 21099 | if (type_is_invalid(target->value.type)) | 21099 | if (type_is_invalid(target->value.type)) |
| ... | @@ -21108,7 +21108,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInst | ... | @@ -21108,7 +21108,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInst |
| 21108 | return result->value.type; | 21108 | return result->value.type; |
| 21109 | } | 21109 | } |
| 21110 | | 21110 | |
| 21111 | static TypeTableEntry *ir_analyze_instruction_check_runtime_scope(IrAnalyze *ira, IrInstructionCheckRuntimeScope *instruction) { | 21111 | static ZigType *ir_analyze_instruction_check_runtime_scope(IrAnalyze *ira, IrInstructionCheckRuntimeScope *instruction) { |
| 21112 | IrInstruction *block_comptime_inst = instruction->scope_is_comptime->other; | 21112 | IrInstruction *block_comptime_inst = instruction->scope_is_comptime->other; |
| 21113 | bool scope_is_comptime; | 21113 | bool scope_is_comptime; |
| 21114 | if (!ir_resolve_bool(ira, block_comptime_inst, &scope_is_comptime)) | 21114 | if (!ir_resolve_bool(ira, block_comptime_inst, &scope_is_comptime)) |
| ... | @@ -21131,7 +21131,7 @@ static TypeTableEntry *ir_analyze_instruction_check_runtime_scope(IrAnalyze *ira | ... | @@ -21131,7 +21131,7 @@ static TypeTableEntry *ir_analyze_instruction_check_runtime_scope(IrAnalyze *ira |
| 21131 | return ira->codegen->builtin_types.entry_void; | 21131 | return ira->codegen->builtin_types.entry_void; |
| 21132 | } | 21132 | } |
| 21133 | | 21133 | |
| 21134 | static TypeTableEntry *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstruction *instruction) { | 21134 | static ZigType *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstruction *instruction) { |
| 21135 | switch (instruction->id) { | 21135 | switch (instruction->id) { |
| 21136 | case IrInstructionIdInvalid: | 21136 | case IrInstructionIdInvalid: |
| 21137 | case IrInstructionIdWidenOrShorten: | 21137 | case IrInstructionIdWidenOrShorten: |
| ... | @@ -21413,8 +21413,8 @@ static TypeTableEntry *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstructi | ... | @@ -21413,8 +21413,8 @@ static TypeTableEntry *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstructi |
| 21413 | zig_unreachable(); | 21413 | zig_unreachable(); |
| 21414 | } | 21414 | } |
| 21415 | | 21415 | |
| 21416 | static TypeTableEntry *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *instruction) { | 21416 | static ZigType *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *instruction) { |
| 21417 | TypeTableEntry *instruction_type = ir_analyze_instruction_nocast(ira, instruction); | 21417 | ZigType *instruction_type = ir_analyze_instruction_nocast(ira, instruction); |
| 21418 | instruction->value.type = instruction_type; | 21418 | instruction->value.type = instruction_type; |
| 21419 | | 21419 | |
| 21420 | if (instruction->other) { | 21420 | if (instruction->other) { |
| ... | @@ -21430,8 +21430,8 @@ static TypeTableEntry *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *ins | ... | @@ -21430,8 +21430,8 @@ static TypeTableEntry *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *ins |
| 21430 | | 21430 | |
| 21431 | // This function attempts to evaluate IR code while doing type checking and other analysis. | 21431 | // This function attempts to evaluate IR code while doing type checking and other analysis. |
| 21432 | // It emits a new IrExecutable which is partially evaluated IR code. | 21432 | // It emits a new IrExecutable which is partially evaluated IR code. |
| 21433 | TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_exec, | 21433 | ZigType *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_exec, |
| 21434 | TypeTableEntry *expected_type, AstNode *expected_type_source_node) | 21434 | ZigType *expected_type, AstNode *expected_type_source_node) |
| 21435 | { | 21435 | { |
| 21436 | assert(!old_exec->invalid); | 21436 | assert(!old_exec->invalid); |
| 21437 | assert(expected_type == nullptr || !type_is_invalid(expected_type)); | 21437 | assert(expected_type == nullptr || !type_is_invalid(expected_type)); |
| ... | @@ -21472,7 +21472,7 @@ TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutabl | ... | @@ -21472,7 +21472,7 @@ TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutabl |
| 21472 | continue; | 21472 | continue; |
| 21473 | } | 21473 | } |
| 21474 | | 21474 | |
| 21475 | TypeTableEntry *return_type = ir_analyze_instruction(ira, old_instruction); | 21475 | ZigType *return_type = ir_analyze_instruction(ira, old_instruction); |
| 21476 | if (type_is_invalid(return_type) && ir_should_inline(new_exec, old_instruction->scope)) { | 21476 | if (type_is_invalid(return_type) && ir_should_inline(new_exec, old_instruction->scope)) { |
| 21477 | return ira->codegen->builtin_types.entry_invalid; | 21477 | return ira->codegen->builtin_types.entry_invalid; |
| 21478 | } | 21478 | } |