| ... | @@ -16124,7 +16124,7 @@ static Stage1AirInst *ir_analyze_instruction_optional_unwrap_ptr(IrAnalyze *ira, | ... | @@ -16124,7 +16124,7 @@ static Stage1AirInst *ir_analyze_instruction_optional_unwrap_ptr(IrAnalyze *ira, |
| 16124 | | 16124 | |
| 16125 | static Stage1AirInst *ir_analyze_instruction_ctz(IrAnalyze *ira, Stage1ZirInstCtz *instruction) { | 16125 | static Stage1AirInst *ir_analyze_instruction_ctz(IrAnalyze *ira, Stage1ZirInstCtz *instruction) { |
| 16126 | Error err; | 16126 | Error err; |
| 16127 | | 16127 | |
| 16128 | ZigType *int_type = ir_resolve_int_type(ira, instruction->type->child); | 16128 | ZigType *int_type = ir_resolve_int_type(ira, instruction->type->child); |
| 16129 | if (type_is_invalid(int_type)) | 16129 | if (type_is_invalid(int_type)) |
| 16130 | return ira->codegen->invalid_inst_gen; | 16130 | return ira->codegen->invalid_inst_gen; |
| ... | @@ -16166,7 +16166,7 @@ static Stage1AirInst *ir_analyze_instruction_ctz(IrAnalyze *ira, Stage1ZirInstCt | ... | @@ -16166,7 +16166,7 @@ static Stage1AirInst *ir_analyze_instruction_ctz(IrAnalyze *ira, Stage1ZirInstCt |
| 16166 | return ira->codegen->invalid_inst_gen; | 16166 | return ira->codegen->invalid_inst_gen; |
| 16167 | if (val->special == ConstValSpecialUndef) | 16167 | if (val->special == ConstValSpecialUndef) |
| 16168 | return ir_const_undef(ira, instruction->base.scope, instruction->base.source_node, ira->codegen->builtin_types.entry_num_lit_int); | 16168 | return ir_const_undef(ira, instruction->base.scope, instruction->base.source_node, ira->codegen->builtin_types.entry_num_lit_int); |
| 16169 | | 16169 | |
| 16170 | if (is_vector) { | 16170 | if (is_vector) { |
| 16171 | ZigType *smallest_vec_type = get_vector_type(ira->codegen, vector_len, smallest_type); | 16171 | ZigType *smallest_vec_type = get_vector_type(ira->codegen, vector_len, smallest_type); |
| 16172 | Stage1AirInst *result = ir_const(ira, instruction->base.scope, instruction->base.source_node, smallest_vec_type); | 16172 | Stage1AirInst *result = ir_const(ira, instruction->base.scope, instruction->base.source_node, smallest_vec_type); |
| ... | @@ -16200,7 +16200,7 @@ static Stage1AirInst *ir_analyze_instruction_ctz(IrAnalyze *ira, Stage1ZirInstCt | ... | @@ -16200,7 +16200,7 @@ static Stage1AirInst *ir_analyze_instruction_ctz(IrAnalyze *ira, Stage1ZirInstCt |
| 16200 | | 16200 | |
| 16201 | static Stage1AirInst *ir_analyze_instruction_clz(IrAnalyze *ira, Stage1ZirInstClz *instruction) { | 16201 | static Stage1AirInst *ir_analyze_instruction_clz(IrAnalyze *ira, Stage1ZirInstClz *instruction) { |
| 16202 | Error err; | 16202 | Error err; |
| 16203 | | 16203 | |
| 16204 | ZigType *int_type = ir_resolve_int_type(ira, instruction->type->child); | 16204 | ZigType *int_type = ir_resolve_int_type(ira, instruction->type->child); |
| 16205 | if (type_is_invalid(int_type)) | 16205 | if (type_is_invalid(int_type)) |
| 16206 | return ira->codegen->invalid_inst_gen; | 16206 | return ira->codegen->invalid_inst_gen; |
| ... | @@ -16242,7 +16242,7 @@ static Stage1AirInst *ir_analyze_instruction_clz(IrAnalyze *ira, Stage1ZirInstCl | ... | @@ -16242,7 +16242,7 @@ static Stage1AirInst *ir_analyze_instruction_clz(IrAnalyze *ira, Stage1ZirInstCl |
| 16242 | return ira->codegen->invalid_inst_gen; | 16242 | return ira->codegen->invalid_inst_gen; |
| 16243 | if (val->special == ConstValSpecialUndef) | 16243 | if (val->special == ConstValSpecialUndef) |
| 16244 | return ir_const_undef(ira, instruction->base.scope, instruction->base.source_node, ira->codegen->builtin_types.entry_num_lit_int); | 16244 | return ir_const_undef(ira, instruction->base.scope, instruction->base.source_node, ira->codegen->builtin_types.entry_num_lit_int); |
| 16245 | | 16245 | |
| 16246 | if (is_vector) { | 16246 | if (is_vector) { |
| 16247 | ZigType *smallest_vec_type = get_vector_type(ira->codegen, vector_len, smallest_type); | 16247 | ZigType *smallest_vec_type = get_vector_type(ira->codegen, vector_len, smallest_type); |
| 16248 | Stage1AirInst *result = ir_const(ira, instruction->base.scope, instruction->base.source_node, smallest_vec_type); | 16248 | Stage1AirInst *result = ir_const(ira, instruction->base.scope, instruction->base.source_node, smallest_vec_type); |
| ... | @@ -16276,7 +16276,7 @@ static Stage1AirInst *ir_analyze_instruction_clz(IrAnalyze *ira, Stage1ZirInstCl | ... | @@ -16276,7 +16276,7 @@ static Stage1AirInst *ir_analyze_instruction_clz(IrAnalyze *ira, Stage1ZirInstCl |
| 16276 | | 16276 | |
| 16277 | static Stage1AirInst *ir_analyze_instruction_pop_count(IrAnalyze *ira, Stage1ZirInstPopCount *instruction) { | 16277 | static Stage1AirInst *ir_analyze_instruction_pop_count(IrAnalyze *ira, Stage1ZirInstPopCount *instruction) { |
| 16278 | Error err; | 16278 | Error err; |
| 16279 | | 16279 | |
| 16280 | ZigType *int_type = ir_resolve_int_type(ira, instruction->type->child); | 16280 | ZigType *int_type = ir_resolve_int_type(ira, instruction->type->child); |
| 16281 | if (type_is_invalid(int_type)) | 16281 | if (type_is_invalid(int_type)) |
| 16282 | return ira->codegen->invalid_inst_gen; | 16282 | return ira->codegen->invalid_inst_gen; |
| ... | @@ -16318,7 +16318,7 @@ static Stage1AirInst *ir_analyze_instruction_pop_count(IrAnalyze *ira, Stage1Zir | ... | @@ -16318,7 +16318,7 @@ static Stage1AirInst *ir_analyze_instruction_pop_count(IrAnalyze *ira, Stage1Zir |
| 16318 | return ira->codegen->invalid_inst_gen; | 16318 | return ira->codegen->invalid_inst_gen; |
| 16319 | if (val->special == ConstValSpecialUndef) | 16319 | if (val->special == ConstValSpecialUndef) |
| 16320 | return ir_const_undef(ira, instruction->base.scope, instruction->base.source_node, ira->codegen->builtin_types.entry_num_lit_int); | 16320 | return ir_const_undef(ira, instruction->base.scope, instruction->base.source_node, ira->codegen->builtin_types.entry_num_lit_int); |
| 16321 | | 16321 | |
| 16322 | if (is_vector) { | 16322 | if (is_vector) { |
| 16323 | ZigType *smallest_vec_type = get_vector_type(ira->codegen, vector_len, smallest_type); | 16323 | ZigType *smallest_vec_type = get_vector_type(ira->codegen, vector_len, smallest_type); |
| 16324 | Stage1AirInst *result = ir_const(ira, instruction->base.scope, instruction->base.source_node, smallest_vec_type); | 16324 | Stage1AirInst *result = ir_const(ira, instruction->base.scope, instruction->base.source_node, smallest_vec_type); |
| ... | @@ -17904,7 +17904,7 @@ static ZigValue *create_ptr_like_type_info(IrAnalyze *ira, Scope *scope, AstNode | ... | @@ -17904,7 +17904,7 @@ static ZigValue *create_ptr_like_type_info(IrAnalyze *ira, Scope *scope, AstNode |
| 17904 | result->special = ConstValSpecialStatic; | 17904 | result->special = ConstValSpecialStatic; |
| 17905 | result->type = type_info_pointer_type; | 17905 | result->type = type_info_pointer_type; |
| 17906 | | 17906 | |
| 17907 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 7); | 17907 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 8); |
| 17908 | result->data.x_struct.fields = fields; | 17908 | result->data.x_struct.fields = fields; |
| 17909 | | 17909 | |
| 17910 | // size: Size | 17910 | // size: Size |
| ... | @@ -17939,24 +17939,29 @@ static ZigValue *create_ptr_like_type_info(IrAnalyze *ira, Scope *scope, AstNode | ... | @@ -17939,24 +17939,29 @@ static ZigValue *create_ptr_like_type_info(IrAnalyze *ira, Scope *scope, AstNode |
| 17939 | lazy_align_of->base.id = LazyValueIdAlignOf; | 17939 | lazy_align_of->base.id = LazyValueIdAlignOf; |
| 17940 | lazy_align_of->target_type = ir_const_type(ira, scope, source_node, attrs_type->data.pointer.child_type); | 17940 | lazy_align_of->target_type = ir_const_type(ira, scope, source_node, attrs_type->data.pointer.child_type); |
| 17941 | } | 17941 | } |
| 17942 | // child: type | 17942 | // address_space: AddressSpace, |
| 17943 | ensure_field_index(result->type, "child", 4); | 17943 | ensure_field_index(result->type, "address_space", 4); |
| 17944 | fields[4]->special = ConstValSpecialStatic; | 17944 | fields[4]->special = ConstValSpecialStatic; |
| 17945 | fields[4]->type = ira->codegen->builtin_types.entry_type; | 17945 | fields[4]->type = get_builtin_type(ira->codegen, "AddressSpace"); |
| 17946 | fields[4]->data.x_type = attrs_type->data.pointer.child_type; | 17946 | bigint_init_unsigned(&fields[4]->data.x_enum_tag, AddressSpaceGeneric); |
| 17947 | // is_allowzero: bool | 17947 | // child: type |
| 17948 | ensure_field_index(result->type, "is_allowzero", 5); | 17948 | ensure_field_index(result->type, "child", 5); |
| 17949 | fields[5]->special = ConstValSpecialStatic; | 17949 | fields[5]->special = ConstValSpecialStatic; |
| 17950 | fields[5]->type = ira->codegen->builtin_types.entry_bool; | 17950 | fields[5]->type = ira->codegen->builtin_types.entry_type; |
| 17951 | fields[5]->data.x_bool = attrs_type->data.pointer.allow_zero; | 17951 | fields[5]->data.x_type = attrs_type->data.pointer.child_type; |
| 17952 | // sentinel: anytype | 17952 | // is_allowzero: bool |
| 17953 | ensure_field_index(result->type, "sentinel", 6); | 17953 | ensure_field_index(result->type, "is_allowzero", 6); |
| 17954 | fields[6]->special = ConstValSpecialStatic; | 17954 | fields[6]->special = ConstValSpecialStatic; |
| | 17955 | fields[6]->type = ira->codegen->builtin_types.entry_bool; |
| | 17956 | fields[6]->data.x_bool = attrs_type->data.pointer.allow_zero; |
| | 17957 | // sentinel: anytype |
| | 17958 | ensure_field_index(result->type, "sentinel", 7); |
| | 17959 | fields[7]->special = ConstValSpecialStatic; |
| 17955 | if (attrs_type->data.pointer.sentinel != nullptr) { | 17960 | if (attrs_type->data.pointer.sentinel != nullptr) { |
| 17956 | fields[6]->type = get_optional_type(ira->codegen, attrs_type->data.pointer.child_type); | 17961 | fields[7]->type = get_optional_type(ira->codegen, attrs_type->data.pointer.child_type); |
| 17957 | set_optional_payload(fields[6], attrs_type->data.pointer.sentinel); | 17962 | set_optional_payload(fields[7], attrs_type->data.pointer.sentinel); |
| 17958 | } else { | 17963 | } else { |
| 17959 | fields[6]->type = ira->codegen->builtin_types.entry_null; | 17964 | fields[7]->type = ira->codegen->builtin_types.entry_null; |
| 17960 | } | 17965 | } |
| 17961 | | 17966 | |
| 17962 | return result; | 17967 | return result; |
| ... | @@ -18465,7 +18470,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18465,7 +18470,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18465 | result->special = ConstValSpecialStatic; | 18470 | result->special = ConstValSpecialStatic; |
| 18466 | result->type = ir_type_info_get_type(ira, "Fn", nullptr); | 18471 | result->type = ir_type_info_get_type(ira, "Fn", nullptr); |
| 18467 | | 18472 | |
| 18468 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 6); | 18473 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 7); |
| 18469 | result->data.x_struct.fields = fields; | 18474 | result->data.x_struct.fields = fields; |
| 18470 | | 18475 | |
| 18471 | // calling_convention: TypeInfo.CallingConvention | 18476 | // calling_convention: TypeInfo.CallingConvention |
| ... | @@ -18478,30 +18483,35 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18478,30 +18483,35 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18478 | fields[1]->special = ConstValSpecialStatic; | 18483 | fields[1]->special = ConstValSpecialStatic; |
| 18479 | fields[1]->type = ira->codegen->builtin_types.entry_num_lit_int; | 18484 | fields[1]->type = ira->codegen->builtin_types.entry_num_lit_int; |
| 18480 | bigint_init_unsigned(&fields[1]->data.x_bigint, get_ptr_align(ira->codegen, type_entry)); | 18485 | bigint_init_unsigned(&fields[1]->data.x_bigint, get_ptr_align(ira->codegen, type_entry)); |
| | 18486 | // address_space: AddressSpace |
| | 18487 | ensure_field_index(result->type, "address_space", 2); |
| | 18488 | fields[2]->special = ConstValSpecialStatic; |
| | 18489 | fields[2]->type = get_builtin_type(ira->codegen, "AddressSpace"); |
| | 18490 | bigint_init_unsigned(&fields[2]->data.x_enum_tag, AddressSpaceGeneric); |
| 18481 | // is_generic: bool | 18491 | // is_generic: bool |
| 18482 | ensure_field_index(result->type, "is_generic", 2); | 18492 | ensure_field_index(result->type, "is_generic", 3); |
| 18483 | bool is_generic = type_entry->data.fn.is_generic; | 18493 | bool is_generic = type_entry->data.fn.is_generic; |
| 18484 | fields[2]->special = ConstValSpecialStatic; | | |
| 18485 | fields[2]->type = ira->codegen->builtin_types.entry_bool; | | |
| 18486 | fields[2]->data.x_bool = is_generic; | | |
| 18487 | // is_varargs: bool | | |
| 18488 | ensure_field_index(result->type, "is_var_args", 3); | | |
| 18489 | bool is_varargs = type_entry->data.fn.fn_type_id.is_var_args; | | |
| 18490 | fields[3]->special = ConstValSpecialStatic; | 18494 | fields[3]->special = ConstValSpecialStatic; |
| 18491 | fields[3]->type = ira->codegen->builtin_types.entry_bool; | 18495 | fields[3]->type = ira->codegen->builtin_types.entry_bool; |
| 18492 | fields[3]->data.x_bool = is_varargs; | 18496 | fields[3]->data.x_bool = is_generic; |
| 18493 | // return_type: ?type | 18497 | // is_varargs: bool |
| 18494 | ensure_field_index(result->type, "return_type", 4); | 18498 | ensure_field_index(result->type, "is_var_args", 4); |
| | 18499 | bool is_varargs = type_entry->data.fn.fn_type_id.is_var_args; |
| 18495 | fields[4]->special = ConstValSpecialStatic; | 18500 | fields[4]->special = ConstValSpecialStatic; |
| 18496 | fields[4]->type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_type); | 18501 | fields[4]->type = ira->codegen->builtin_types.entry_bool; |
| | 18502 | fields[4]->data.x_bool = is_varargs; |
| | 18503 | // return_type: ?type |
| | 18504 | ensure_field_index(result->type, "return_type", 5); |
| | 18505 | fields[5]->special = ConstValSpecialStatic; |
| | 18506 | fields[5]->type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_type); |
| 18497 | if (type_entry->data.fn.fn_type_id.return_type == nullptr) | 18507 | if (type_entry->data.fn.fn_type_id.return_type == nullptr) |
| 18498 | fields[4]->data.x_optional = nullptr; | 18508 | fields[5]->data.x_optional = nullptr; |
| 18499 | else { | 18509 | else { |
| 18500 | ZigValue *return_type = ira->codegen->pass1_arena->create<ZigValue>(); | 18510 | ZigValue *return_type = ira->codegen->pass1_arena->create<ZigValue>(); |
| 18501 | return_type->special = ConstValSpecialStatic; | 18511 | return_type->special = ConstValSpecialStatic; |
| 18502 | return_type->type = ira->codegen->builtin_types.entry_type; | 18512 | return_type->type = ira->codegen->builtin_types.entry_type; |
| 18503 | return_type->data.x_type = type_entry->data.fn.fn_type_id.return_type; | 18513 | return_type->data.x_type = type_entry->data.fn.fn_type_id.return_type; |
| 18504 | fields[4]->data.x_optional = return_type; | 18514 | fields[5]->data.x_optional = return_type; |
| 18505 | } | 18515 | } |
| 18506 | // args: []TypeInfo.FnArg | 18516 | // args: []TypeInfo.FnArg |
| 18507 | ZigType *type_info_fn_arg_type = ir_type_info_get_type(ira, "FnArg", nullptr); | 18517 | ZigType *type_info_fn_arg_type = ir_type_info_get_type(ira, "FnArg", nullptr); |
| ... | @@ -18516,7 +18526,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18516,7 +18526,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18516 | fn_arg_array->data.x_array.special = ConstArraySpecialNone; | 18526 | fn_arg_array->data.x_array.special = ConstArraySpecialNone; |
| 18517 | fn_arg_array->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(fn_arg_count); | 18527 | fn_arg_array->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(fn_arg_count); |
| 18518 | | 18528 | |
| 18519 | init_const_slice(ira->codegen, fields[5], fn_arg_array, 0, fn_arg_count, false, nullptr); | 18529 | init_const_slice(ira->codegen, fields[6], fn_arg_array, 0, fn_arg_count, false, nullptr); |
| 18520 | | 18530 | |
| 18521 | for (size_t fn_arg_index = 0; fn_arg_index < fn_arg_count; fn_arg_index++) { | 18531 | for (size_t fn_arg_index = 0; fn_arg_index < fn_arg_count; fn_arg_index++) { |
| 18522 | FnTypeParamInfo *fn_param_info = &type_entry->data.fn.fn_type_id.param_info[fn_arg_index]; | 18532 | FnTypeParamInfo *fn_param_info = &type_entry->data.fn.fn_type_id.param_info[fn_arg_index]; |
| ... | @@ -18826,11 +18836,11 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -18826,11 +18836,11 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 18826 | assert(size_value->type == ir_type_info_get_type(ira, "Size", type_info_pointer_type)); | 18836 | assert(size_value->type == ir_type_info_get_type(ira, "Size", type_info_pointer_type)); |
| 18827 | BuiltinPtrSize size_enum_index = (BuiltinPtrSize)bigint_as_u32(&size_value->data.x_enum_tag); | 18837 | BuiltinPtrSize size_enum_index = (BuiltinPtrSize)bigint_as_u32(&size_value->data.x_enum_tag); |
| 18828 | PtrLen ptr_len = size_enum_index_to_ptr_len(size_enum_index); | 18838 | PtrLen ptr_len = size_enum_index_to_ptr_len(size_enum_index); |
| 18829 | ZigType *elem_type = get_const_field_meta_type(ira, source_node, payload, "child", 4); | 18839 | ZigType *elem_type = get_const_field_meta_type(ira, source_node, payload, "child", 5); |
| 18830 | if (type_is_invalid(elem_type)) | 18840 | if (type_is_invalid(elem_type)) |
| 18831 | return ira->codegen->invalid_inst_gen->value->type; | 18841 | return ira->codegen->invalid_inst_gen->value->type; |
| 18832 | ZigValue *sentinel; | 18842 | ZigValue *sentinel; |
| 18833 | if ((err = get_const_field_sentinel(ira, scope, source_node, payload, "sentinel", 6, | 18843 | if ((err = get_const_field_sentinel(ira, scope, source_node, payload, "sentinel", 7, |
| 18834 | elem_type, &sentinel))) | 18844 | elem_type, &sentinel))) |
| 18835 | { | 18845 | { |
| 18836 | return ira->codegen->invalid_inst_gen->value->type; | 18846 | return ira->codegen->invalid_inst_gen->value->type; |
| ... | @@ -18845,6 +18855,19 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -18845,6 +18855,19 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 18845 | if (alignment == nullptr) | 18855 | if (alignment == nullptr) |
| 18846 | return ira->codegen->invalid_inst_gen->value->type; | 18856 | return ira->codegen->invalid_inst_gen->value->type; |
| 18847 | | 18857 | |
| | 18858 | ZigValue *as_value = get_const_field(ira, source_node, payload, "address_space", 4); |
| | 18859 | if (as_value == nullptr) |
| | 18860 | return ira->codegen->invalid_inst_gen->value->type; |
| | 18861 | assert(as_value->special == ConstValSpecialStatic); |
| | 18862 | assert(as_value->type == get_builtin_type(ira->codegen, "AddressSpace")); |
| | 18863 | AddressSpace as = (AddressSpace)bigint_as_u32(&as_value->data.x_enum_tag); |
| | 18864 | if (as != AddressSpaceGeneric) { |
| | 18865 | ir_add_error_node(ira, source_node, buf_sprintf( |
| | 18866 | "address space '%s' not available in stage 1 compiler, must be .generic", |
| | 18867 | address_space_name(as))); |
| | 18868 | return ira->codegen->invalid_inst_gen->value->type; |
| | 18869 | } |
| | 18870 | |
| 18848 | bool is_const; | 18871 | bool is_const; |
| 18849 | if ((err = get_const_field_bool(ira, source_node, payload, "is_const", 1, &is_const))) | 18872 | if ((err = get_const_field_bool(ira, source_node, payload, "is_const", 1, &is_const))) |
| 18850 | return ira->codegen->invalid_inst_gen->value->type; | 18873 | return ira->codegen->invalid_inst_gen->value->type; |
| ... | @@ -18857,13 +18880,12 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -18857,13 +18880,12 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 18857 | } | 18880 | } |
| 18858 | | 18881 | |
| 18859 | bool is_allowzero; | 18882 | bool is_allowzero; |
| 18860 | if ((err = get_const_field_bool(ira, source_node, payload, "is_allowzero", 5, | 18883 | if ((err = get_const_field_bool(ira, source_node, payload, "is_allowzero", 6, |
| 18861 | &is_allowzero))) | 18884 | &is_allowzero))) |
| 18862 | { | 18885 | { |
| 18863 | return ira->codegen->invalid_inst_gen->value->type; | 18886 | return ira->codegen->invalid_inst_gen->value->type; |
| 18864 | } | 18887 | } |
| 18865 | | 18888 | |
| 18866 | | | |
| 18867 | ZigType *ptr_type = get_pointer_to_type_extra2(ira->codegen, | 18889 | ZigType *ptr_type = get_pointer_to_type_extra2(ira->codegen, |
| 18868 | elem_type, | 18890 | elem_type, |
| 18869 | is_const, | 18891 | is_const, |
| ... | @@ -19308,9 +19330,22 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19308,9 +19330,22 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19308 | if (alignment == nullptr) | 19330 | if (alignment == nullptr) |
| 19309 | return ira->codegen->invalid_inst_gen->value->type; | 19331 | return ira->codegen->invalid_inst_gen->value->type; |
| 19310 | | 19332 | |
| | 19333 | ZigValue *as_value = get_const_field(ira, source_node, payload, "address_space", 2); |
| | 19334 | if (as_value == nullptr) |
| | 19335 | return ira->codegen->invalid_inst_gen->value->type; |
| | 19336 | assert(as_value->special == ConstValSpecialStatic); |
| | 19337 | assert(as_value->type == get_builtin_type(ira->codegen, "AddressSpace")); |
| | 19338 | AddressSpace as = (AddressSpace)bigint_as_u32(&as_value->data.x_enum_tag); |
| | 19339 | if (as != AddressSpaceGeneric) { |
| | 19340 | ir_add_error_node(ira, source_node, buf_sprintf( |
| | 19341 | "address space '%s' not available in stage 1 compiler, must be .generic", |
| | 19342 | address_space_name(as))); |
| | 19343 | return ira->codegen->invalid_inst_gen->value->type; |
| | 19344 | } |
| | 19345 | |
| 19311 | Error err; | 19346 | Error err; |
| 19312 | bool is_generic; | 19347 | bool is_generic; |
| 19313 | if ((err = get_const_field_bool(ira, source_node, payload, "is_generic", 2, &is_generic))) | 19348 | if ((err = get_const_field_bool(ira, source_node, payload, "is_generic", 3, &is_generic))) |
| 19314 | return ira->codegen->invalid_inst_gen->value->type; | 19349 | return ira->codegen->invalid_inst_gen->value->type; |
| 19315 | if (is_generic) { | 19350 | if (is_generic) { |
| 19316 | ir_add_error_node(ira, source_node, buf_sprintf("TypeInfo.Fn.is_generic must be false for @Type")); | 19351 | ir_add_error_node(ira, source_node, buf_sprintf("TypeInfo.Fn.is_generic must be false for @Type")); |
| ... | @@ -19318,20 +19353,20 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19318,20 +19353,20 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19318 | } | 19353 | } |
| 19319 | | 19354 | |
| 19320 | bool is_var_args; | 19355 | bool is_var_args; |
| 19321 | if ((err = get_const_field_bool(ira, source_node, payload, "is_var_args", 3, &is_var_args))) | 19356 | if ((err = get_const_field_bool(ira, source_node, payload, "is_var_args", 4, &is_var_args))) |
| 19322 | return ira->codegen->invalid_inst_gen->value->type; | 19357 | return ira->codegen->invalid_inst_gen->value->type; |
| 19323 | if (is_var_args && cc != CallingConventionC) { | 19358 | if (is_var_args && cc != CallingConventionC) { |
| 19324 | ir_add_error_node(ira, source_node, buf_sprintf("varargs functions must have C calling convention")); | 19359 | ir_add_error_node(ira, source_node, buf_sprintf("varargs functions must have C calling convention")); |
| 19325 | return ira->codegen->invalid_inst_gen->value->type; | 19360 | return ira->codegen->invalid_inst_gen->value->type; |
| 19326 | } | 19361 | } |
| 19327 | | 19362 | |
| 19328 | ZigType *return_type = get_const_field_meta_type_optional(ira, source_node, payload, "return_type", 4); | 19363 | ZigType *return_type = get_const_field_meta_type_optional(ira, source_node, payload, "return_type", 5); |
| 19329 | if (return_type == nullptr) { | 19364 | if (return_type == nullptr) { |
| 19330 | ir_add_error_node(ira, source_node, buf_sprintf("TypeInfo.Fn.return_type must be non-null for @Type")); | 19365 | ir_add_error_node(ira, source_node, buf_sprintf("TypeInfo.Fn.return_type must be non-null for @Type")); |
| 19331 | return ira->codegen->invalid_inst_gen->value->type; | 19366 | return ira->codegen->invalid_inst_gen->value->type; |
| 19332 | } | 19367 | } |
| 19333 | | 19368 | |
| 19334 | ZigValue *args_value = get_const_field(ira, source_node, payload, "args", 5); | 19369 | ZigValue *args_value = get_const_field(ira, source_node, payload, "args", 6); |
| 19335 | if (args_value == nullptr) | 19370 | if (args_value == nullptr) |
| 19336 | return ira->codegen->invalid_inst_gen->value->type; | 19371 | return ira->codegen->invalid_inst_gen->value->type; |
| 19337 | assert(args_value->special == ConstValSpecialStatic); | 19372 | assert(args_value->special == ConstValSpecialStatic); |