authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-05 18:33:07-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-05 18:33:07-04:00
logdb882e5d63d2840b1410a2574fd12d973b7f3ee2
tree6316a85c4da5de1fd54b380c554d65daaf4d6700
parenta3d384e593e9128ed3b69cc77e6d6e048f0c6bb7
signaturelock-open Commit is signed but in an unrecognized format.

stage1: rename TypeTableEntry to ZigType


6 files changed, 1137 insertions(+), 1137 deletions(-)

src/all_types.hpp+87-87
......@@ -24,7 +24,7 @@ struct FnTableEntry;
2424struct Scope;
2525struct ScopeBlock;
2626struct ScopeFnDef;
27struct TypeTableEntry;
27struct ZigType;
2828struct VariableTableEntry;
2929struct ErrorTableEntry;
3030struct BuiltinFnEntry;
......@@ -251,7 +251,7 @@ struct ConstGlobalRefs {
251251};
252252
253253struct ConstExprValue {
254 TypeTableEntry *type;
254 ZigType *type;
255255 ConstValSpecial special;
256256 ConstGlobalRefs *global_refs;
257257
......@@ -265,7 +265,7 @@ struct ConstExprValue {
265265 float128_t x_f128;
266266 bool x_bool;
267267 ConstBoundFnValue x_bound_fn;
268 TypeTableEntry *x_type;
268 ZigType *x_type;
269269 ConstExprValue *x_optional;
270270 ConstErrValue x_err_union;
271271 ErrorTableEntry *x_err_set;
......@@ -353,7 +353,7 @@ struct TldContainer {
353353 Tld base;
354354
355355 ScopeDecls *decls_scope;
356 TypeTableEntry *type_entry;
356 ZigType *type_entry;
357357};
358358
359359struct TldCompTime {
......@@ -370,7 +370,7 @@ struct TypeEnumField {
370370struct TypeUnionField {
371371 Buf *name;
372372 TypeEnumField *enum_field;
373 TypeTableEntry *type_entry;
373 ZigType *type_entry;
374374 AstNode *decl_node;
375375 uint32_t gen_index;
376376};
......@@ -973,7 +973,7 @@ struct AstNode {
973973// this struct is allocated with allocate_nonzero
974974struct FnTypeParamInfo {
975975 bool is_noalias;
976 TypeTableEntry *type;
976 ZigType *type;
977977};
978978
979979struct GenericFnTypeId {
......@@ -986,14 +986,14 @@ uint32_t generic_fn_type_id_hash(GenericFnTypeId *id);
986986bool generic_fn_type_id_eql(GenericFnTypeId *a, GenericFnTypeId *b);
987987
988988struct FnTypeId {
989 TypeTableEntry *return_type;
989 ZigType *return_type;
990990 FnTypeParamInfo *param_info;
991991 size_t param_count;
992992 size_t next_param_index;
993993 bool is_var_args;
994994 CallingConvention cc;
995995 uint32_t alignment;
996 TypeTableEntry *async_allocator_type;
996 ZigType *async_allocator_type;
997997};
998998
999999uint32_t fn_type_id_hash(FnTypeId*);
......@@ -1005,14 +1005,14 @@ enum PtrLen {
10051005};
10061006
10071007struct TypeTableEntryPointer {
1008 TypeTableEntry *child_type;
1008 ZigType *child_type;
10091009 PtrLen ptr_len;
10101010 bool is_const;
10111011 bool is_volatile;
10121012 uint32_t alignment;
10131013 uint32_t bit_offset;
10141014 uint32_t unaligned_bit_count;
1015 TypeTableEntry *slice_parent;
1015 ZigType *slice_parent;
10161016};
10171017
10181018struct TypeTableEntryInt {
......@@ -1025,13 +1025,13 @@ struct TypeTableEntryFloat {
10251025};
10261026
10271027struct TypeTableEntryArray {
1028 TypeTableEntry *child_type;
1028 ZigType *child_type;
10291029 uint64_t len;
10301030};
10311031
10321032struct TypeStructField {
10331033 Buf *name;
1034 TypeTableEntry *type_entry;
1034 ZigType *type_entry;
10351035 size_t src_index;
10361036 size_t gen_index;
10371037 // offset from the memory at gen_index
......@@ -1069,12 +1069,12 @@ struct TypeTableEntryStruct {
10691069};
10701070
10711071struct TypeTableEntryOptional {
1072 TypeTableEntry *child_type;
1072 ZigType *child_type;
10731073};
10741074
10751075struct TypeTableEntryErrorUnion {
1076 TypeTableEntry *err_set_type;
1077 TypeTableEntry *payload_type;
1076 ZigType *err_set_type;
1077 ZigType *payload_type;
10781078};
10791079
10801080struct TypeTableEntryErrorSet {
......@@ -1089,7 +1089,7 @@ struct TypeTableEntryEnum {
10891089 uint32_t src_field_count;
10901090 TypeEnumField *fields;
10911091 bool is_invalid; // true if any fields are invalid
1092 TypeTableEntry *tag_int_type;
1092 ZigType *tag_int_type;
10931093
10941094 ScopeDecls *decls_scope;
10951095
......@@ -1107,8 +1107,8 @@ struct TypeTableEntryEnum {
11071107 HashMap<Buf *, TypeEnumField *, buf_hash, buf_eql_buf> fields_by_name;
11081108};
11091109
1110uint32_t type_ptr_hash(const TypeTableEntry *ptr);
1111bool type_ptr_eql(const TypeTableEntry *a, const TypeTableEntry *b);
1110uint32_t type_ptr_hash(const ZigType *ptr);
1111bool type_ptr_eql(const ZigType *a, const ZigType *b);
11121112
11131113struct TypeTableEntryUnion {
11141114 AstNode *decl_node;
......@@ -1117,7 +1117,7 @@ struct TypeTableEntryUnion {
11171117 uint32_t gen_field_count;
11181118 TypeUnionField *fields;
11191119 bool is_invalid; // true if any fields are invalid
1120 TypeTableEntry *tag_type; // always an enum or null
1120 ZigType *tag_type; // always an enum or null
11211121 LLVMTypeRef union_type_ref;
11221122
11231123 ScopeDecls *decls_scope;
......@@ -1142,7 +1142,7 @@ struct TypeTableEntryUnion {
11421142 bool have_explicit_tag_type;
11431143
11441144 uint32_t union_size_bytes;
1145 TypeTableEntry *most_aligned_union_member;
1145 ZigType *most_aligned_union_member;
11461146
11471147 HashMap<Buf *, TypeUnionField *, buf_hash, buf_eql_buf> fields_by_name;
11481148};
......@@ -1151,31 +1151,31 @@ struct FnGenParamInfo {
11511151 size_t src_index;
11521152 size_t gen_index;
11531153 bool is_byval;
1154 TypeTableEntry *type;
1154 ZigType *type;
11551155};
11561156
11571157struct TypeTableEntryFn {
11581158 FnTypeId fn_type_id;
11591159 bool is_generic;
1160 TypeTableEntry *gen_return_type;
1160 ZigType *gen_return_type;
11611161 size_t gen_param_count;
11621162 FnGenParamInfo *gen_param_info;
11631163
11641164 LLVMTypeRef raw_type_ref;
11651165
1166 TypeTableEntry *bound_fn_parent;
1166 ZigType *bound_fn_parent;
11671167};
11681168
11691169struct TypeTableEntryBoundFn {
1170 TypeTableEntry *fn_type;
1170 ZigType *fn_type;
11711171};
11721172
11731173struct TypeTableEntryPromise {
11741174 // null if `promise` instead of `promise->T`
1175 TypeTableEntry *result_type;
1175 ZigType *result_type;
11761176};
11771177
1178enum TypeTableEntryId {
1178enum ZigTypeId {
11791179 TypeTableEntryIdInvalid,
11801180 TypeTableEntryIdMetaType,
11811181 TypeTableEntryIdVoid,
......@@ -1204,8 +1204,8 @@ enum TypeTableEntryId {
12041204 TypeTableEntryIdPromise,
12051205};
12061206
1207struct TypeTableEntry {
1208 TypeTableEntryId id;
1207struct ZigType {
1208 ZigTypeId id;
12091209 Buf name;
12101210
12111211 LLVMTypeRef type_ref;
......@@ -1232,10 +1232,10 @@ struct TypeTableEntry {
12321232 } data;
12331233
12341234 // use these fields to make sure we don't duplicate type table entries for the same type
1235 TypeTableEntry *pointer_parent[2]; // [0 - mut, 1 - const]
1236 TypeTableEntry *optional_parent;
1237 TypeTableEntry *promise_parent;
1238 TypeTableEntry *promise_frame_parent;
1235 ZigType *pointer_parent[2]; // [0 - mut, 1 - const]
1236 ZigType *optional_parent;
1237 ZigType *promise_parent;
1238 ZigType *promise_frame_parent;
12391239 // If we generate a constant name value for this type, we memoize it here.
12401240 // The type of this is array
12411241 ConstExprValue *cached_const_name_val;
......@@ -1291,11 +1291,11 @@ struct FnTableEntry {
12911291 Scope *child_scope; // parent is scope for last parameter
12921292 ScopeBlock *def_scope; // parent is child_scope
12931293 Buf symbol_name;
1294 TypeTableEntry *type_entry; // function type
1294 ZigType *type_entry; // function type
12951295 // in the case of normal functions this is the implicit return type
12961296 // in the case of async functions this is the implicit return type according to the
12971297 // zig source code, not according to zig ir
1298 TypeTableEntry *src_implicit_return_type;
1298 ZigType *src_implicit_return_type;
12991299 bool is_test;
13001300 FnInline fn_inline;
13011301 FnAnalState anal_state;
......@@ -1445,11 +1445,11 @@ uint32_t fn_eval_hash(Scope*);
14451445bool fn_eval_eql(Scope *a, Scope *b);
14461446
14471447struct TypeId {
1448 TypeTableEntryId id;
1448 ZigTypeId id;
14491449
14501450 union {
14511451 struct {
1452 TypeTableEntry *child_type;
1452 ZigType *child_type;
14531453 PtrLen ptr_len;
14541454 bool is_const;
14551455 bool is_volatile;
......@@ -1458,7 +1458,7 @@ struct TypeId {
14581458 uint32_t unaligned_bit_count;
14591459 } pointer;
14601460 struct {
1461 TypeTableEntry *child_type;
1461 ZigType *child_type;
14621462 uint64_t size;
14631463 } array;
14641464 struct {
......@@ -1466,8 +1466,8 @@ struct TypeId {
14661466 uint32_t bit_count;
14671467 } integer;
14681468 struct {
1469 TypeTableEntry *err_set_type;
1470 TypeTableEntry *payload_type;
1469 ZigType *err_set_type;
1470 ZigType *payload_type;
14711471 } error_union;
14721472 } data;
14731473};
......@@ -1563,9 +1563,9 @@ struct CodeGen {
15631563 // reminder: hash tables must be initialized before use
15641564 HashMap<Buf *, ImportTableEntry *, buf_hash, buf_eql_buf> import_table;
15651565 HashMap<Buf *, BuiltinFnEntry *, buf_hash, buf_eql_buf> builtin_fn_table;
1566 HashMap<Buf *, TypeTableEntry *, buf_hash, buf_eql_buf> primitive_type_table;
1567 HashMap<TypeId, TypeTableEntry *, type_id_hash, type_id_eql> type_table;
1568 HashMap<FnTypeId *, TypeTableEntry *, fn_type_id_hash, fn_type_id_eql> fn_type_table;
1566 HashMap<Buf *, ZigType *, buf_hash, buf_eql_buf> primitive_type_table;
1567 HashMap<TypeId, ZigType *, type_id_hash, type_id_eql> type_table;
1568 HashMap<FnTypeId *, ZigType *, fn_type_id_hash, fn_type_id_eql> fn_type_table;
15691569 HashMap<Buf *, ErrorTableEntry *, buf_hash, buf_eql_buf> error_table;
15701570 HashMap<GenericFnTypeId *, FnTableEntry *, generic_fn_type_id_hash, generic_fn_type_id_eql> generic_table;
15711571 HashMap<Scope *, IrInstruction *, fn_eval_hash, fn_eval_eql> memoized_fn_eval_table;
......@@ -1573,7 +1573,7 @@ struct CodeGen {
15731573 HashMap<Buf *, AstNode *, buf_hash, buf_eql_buf> exported_symbol_names;
15741574 HashMap<Buf *, Tld *, buf_hash, buf_eql_buf> external_prototypes;
15751575 HashMap<Buf *, ConstExprValue *, buf_hash, buf_eql_buf> string_literals_table;
1576 HashMap<const TypeTableEntry *, ConstExprValue *, type_ptr_hash, type_ptr_eql> type_info_cache;
1576 HashMap<const ZigType *, ConstExprValue *, type_ptr_hash, type_ptr_eql> type_info_cache;
15771577
15781578
15791579 ZigList<ImportTableEntry *> import_queue;
......@@ -1586,38 +1586,38 @@ struct CodeGen {
15861586 uint32_t next_unresolved_index;
15871587
15881588 struct {
1589 TypeTableEntry *entry_bool;
1590 TypeTableEntry *entry_c_int[CIntTypeCount];
1591 TypeTableEntry *entry_c_longdouble;
1592 TypeTableEntry *entry_c_void;
1593 TypeTableEntry *entry_u8;
1594 TypeTableEntry *entry_u16;
1595 TypeTableEntry *entry_u32;
1596 TypeTableEntry *entry_u29;
1597 TypeTableEntry *entry_u64;
1598 TypeTableEntry *entry_i8;
1599 TypeTableEntry *entry_i32;
1600 TypeTableEntry *entry_i64;
1601 TypeTableEntry *entry_isize;
1602 TypeTableEntry *entry_usize;
1603 TypeTableEntry *entry_f16;
1604 TypeTableEntry *entry_f32;
1605 TypeTableEntry *entry_f64;
1606 TypeTableEntry *entry_f128;
1607 TypeTableEntry *entry_void;
1608 TypeTableEntry *entry_unreachable;
1609 TypeTableEntry *entry_type;
1610 TypeTableEntry *entry_invalid;
1611 TypeTableEntry *entry_namespace;
1612 TypeTableEntry *entry_block;
1613 TypeTableEntry *entry_num_lit_int;
1614 TypeTableEntry *entry_num_lit_float;
1615 TypeTableEntry *entry_undef;
1616 TypeTableEntry *entry_null;
1617 TypeTableEntry *entry_var;
1618 TypeTableEntry *entry_global_error_set;
1619 TypeTableEntry *entry_arg_tuple;
1620 TypeTableEntry *entry_promise;
1589 ZigType *entry_bool;
1590 ZigType *entry_c_int[CIntTypeCount];
1591 ZigType *entry_c_longdouble;
1592 ZigType *entry_c_void;
1593 ZigType *entry_u8;
1594 ZigType *entry_u16;
1595 ZigType *entry_u32;
1596 ZigType *entry_u29;
1597 ZigType *entry_u64;
1598 ZigType *entry_i8;
1599 ZigType *entry_i32;
1600 ZigType *entry_i64;
1601 ZigType *entry_isize;
1602 ZigType *entry_usize;
1603 ZigType *entry_f16;
1604 ZigType *entry_f32;
1605 ZigType *entry_f64;
1606 ZigType *entry_f128;
1607 ZigType *entry_void;
1608 ZigType *entry_unreachable;
1609 ZigType *entry_type;
1610 ZigType *entry_invalid;
1611 ZigType *entry_namespace;
1612 ZigType *entry_block;
1613 ZigType *entry_num_lit_int;
1614 ZigType *entry_num_lit_float;
1615 ZigType *entry_undef;
1616 ZigType *entry_null;
1617 ZigType *entry_var;
1618 ZigType *entry_global_error_set;
1619 ZigType *entry_arg_tuple;
1620 ZigType *entry_promise;
16211621 } builtin_types;
16221622
16231623 EmitFileType emit_file_type;
......@@ -1735,11 +1735,11 @@ struct CodeGen {
17351735 size_t llvm_argv_len;
17361736
17371737 ZigList<FnTableEntry *> test_fns;
1738 TypeTableEntry *test_fn_type;
1738 ZigType *test_fn_type;
17391739
17401740 bool each_lib_rpath;
17411741
1742 TypeTableEntry *err_tag_type;
1742 ZigType *err_tag_type;
17431743 ZigList<ZigLLVMDIEnumerator *> err_enumerators;
17441744 ZigList<ErrorTableEntry *> errors_by_index;
17451745 bool generate_error_name_table;
......@@ -1769,9 +1769,9 @@ struct CodeGen {
17691769 ZigList<FnTableEntry *> inline_fns;
17701770 ZigList<AstNode *> tld_ref_source_node_stack;
17711771
1772 TypeTableEntry *align_amt_type;
1773 TypeTableEntry *stack_trace_type;
1774 TypeTableEntry *ptr_to_stack_trace_type;
1772 ZigType *align_amt_type;
1773 ZigType *stack_trace_type;
1774 ZigType *ptr_to_stack_trace_type;
17751775
17761776 ZigList<ZigLLVMDIType **> error_di_types;
17771777
......@@ -1818,7 +1818,7 @@ struct ErrorTableEntry {
18181818 Buf name;
18191819 uint32_t value;
18201820 AstNode *decl_node;
1821 TypeTableEntry *set_with_only_this_in_it;
1821 ZigType *set_with_only_this_in_it;
18221822 // If we generate a constant error name value for this error, we memoize it here.
18231823 // The type of this is array
18241824 ConstExprValue *cached_error_name_val;
......@@ -1862,7 +1862,7 @@ struct ScopeDecls {
18621862 AstNode *fast_math_set_node;
18631863 ImportTableEntry *import;
18641864 // If this is a scope from a container, this is the type entry, otherwise null
1865 TypeTableEntry *container_type;
1865 ZigType *container_type;
18661866};
18671867
18681868// This scope comes from a block expression in user code.
......@@ -2386,7 +2386,7 @@ struct IrInstructionCast {
23862386 IrInstruction base;
23872387
23882388 IrInstruction *value;
2389 TypeTableEntry *dest_type;
2389 ZigType *dest_type;
23902390 CastOp cast_op;
23912391 LLVMValueRef tmp_ptr;
23922392};
......@@ -2423,7 +2423,7 @@ struct IrInstructionStructInitField {
24232423struct IrInstructionStructInit {
24242424 IrInstruction base;
24252425
2426 TypeTableEntry *struct_type;
2426 ZigType *struct_type;
24272427 size_t field_count;
24282428 IrInstructionStructInitField *fields;
24292429 LLVMValueRef tmp_ptr;
......@@ -2432,7 +2432,7 @@ struct IrInstructionStructInit {
24322432struct IrInstructionUnionInit {
24332433 IrInstruction base;
24342434
2435 TypeTableEntry *union_type;
2435 ZigType *union_type;
24362436 TypeUnionField *field;
24372437 IrInstruction *init_value;
24382438 LLVMValueRef tmp_ptr;
......@@ -2661,7 +2661,7 @@ struct IrInstructionCmpxchg {
26612661 IrInstruction *failure_order_value;
26622662
26632663 // if this instruction gets to runtime then we know these values:
2664 TypeTableEntry *type;
2664 ZigType *type;
26652665 AtomicOrder success_order;
26662666 AtomicOrder failure_order;
26672667
......@@ -2831,7 +2831,7 @@ struct IrInstructionOverflowOp {
28312831 IrInstruction *op2;
28322832 IrInstruction *result_ptr;
28332833
2834 TypeTableEntry *result_ptr_type;
2834 ZigType *result_ptr_type;
28352835};
28362836
28372837struct IrInstructionAlignOf {
src/analyze.cpp+217-217
......@@ -19,12 +19,12 @@
1919
2020static const size_t default_backward_branch_quota = 1000;
2121
22static Error resolve_enum_type(CodeGen *g, TypeTableEntry *enum_type);
23static Error resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type);
22static Error resolve_enum_type(CodeGen *g, ZigType *enum_type);
23static Error resolve_struct_type(CodeGen *g, ZigType *struct_type);
2424
25static Error ATTRIBUTE_MUST_USE resolve_struct_zero_bits(CodeGen *g, TypeTableEntry *struct_type);
26static Error ATTRIBUTE_MUST_USE resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type);
27static Error ATTRIBUTE_MUST_USE resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type);
25static Error ATTRIBUTE_MUST_USE resolve_struct_zero_bits(CodeGen *g, ZigType *struct_type);
26static Error ATTRIBUTE_MUST_USE resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type);
27static Error ATTRIBUTE_MUST_USE resolve_union_zero_bits(CodeGen *g, ZigType *union_type);
2828static void analyze_fn_body(CodeGen *g, FnTableEntry *fn_table_entry);
2929
3030ErrorMsg *add_node_error(CodeGen *g, AstNode *node, Buf *msg) {
......@@ -70,13 +70,13 @@ ErrorMsg *add_error_note(CodeGen *g, ErrorMsg *parent_msg, AstNode *node, Buf *m
7070 return err;
7171}
7272
73TypeTableEntry *new_type_table_entry(TypeTableEntryId id) {
74 TypeTableEntry *entry = allocate<TypeTableEntry>(1);
73ZigType *new_type_table_entry(ZigTypeId id) {
74 ZigType *entry = allocate<ZigType>(1);
7575 entry->id = id;
7676 return entry;
7777}
7878
79static ScopeDecls **get_container_scope_ptr(TypeTableEntry *type_entry) {
79static ScopeDecls **get_container_scope_ptr(ZigType *type_entry) {
8080 if (type_entry->id == TypeTableEntryIdStruct) {
8181 return &type_entry->data.structure.decls_scope;
8282 } else if (type_entry->id == TypeTableEntryIdEnum) {
......@@ -87,7 +87,7 @@ static ScopeDecls **get_container_scope_ptr(TypeTableEntry *type_entry) {
8787 zig_unreachable();
8888}
8989
90ScopeDecls *get_container_scope(TypeTableEntry *type_entry) {
90ScopeDecls *get_container_scope(ZigType *type_entry) {
9191 return *get_container_scope_ptr(type_entry);
9292}
9393
......@@ -97,7 +97,7 @@ void init_scope(Scope *dest, ScopeId id, AstNode *source_node, Scope *parent) {
9797 dest->parent = parent;
9898}
9999
100ScopeDecls *create_decls_scope(AstNode *node, Scope *parent, TypeTableEntry *container_type, ImportTableEntry *import) {
100ScopeDecls *create_decls_scope(AstNode *node, Scope *parent, ZigType *container_type, ImportTableEntry *import) {
101101 assert(node == nullptr || node->type == NodeTypeRoot || node->type == NodeTypeContainerDecl || node->type == NodeTypeFnCallExpr);
102102 ScopeDecls *scope = allocate<ScopeDecls>(1);
103103 init_scope(&scope->base, ScopeIdDecls, node, parent);
......@@ -203,8 +203,8 @@ ImportTableEntry *get_scope_import(Scope *scope) {
203203 zig_unreachable();
204204}
205205
206static TypeTableEntry *new_container_type_entry(TypeTableEntryId id, AstNode *source_node, Scope *parent_scope) {
207 TypeTableEntry *entry = new_type_table_entry(id);
206static ZigType *new_container_type_entry(ZigTypeId id, AstNode *source_node, Scope *parent_scope) {
207 ZigType *entry = new_type_table_entry(id);
208208 *get_container_scope_ptr(entry) = create_decls_scope(source_node, parent_scope, entry, get_scope_import(parent_scope));
209209 return entry;
210210}
......@@ -218,7 +218,7 @@ static uint8_t bits_needed_for_unsigned(uint64_t x) {
218218 return (upper >= x) ? base : (base + 1);
219219}
220220
221AstNode *type_decl_node(TypeTableEntry *type_entry) {
221AstNode *type_decl_node(ZigType *type_entry) {
222222 switch (type_entry->id) {
223223 case TypeTableEntryIdInvalid:
224224 zig_unreachable();
......@@ -255,7 +255,7 @@ AstNode *type_decl_node(TypeTableEntry *type_entry) {
255255 zig_unreachable();
256256}
257257
258bool type_is_complete(TypeTableEntry *type_entry) {
258bool type_is_complete(ZigType *type_entry) {
259259 switch (type_entry->id) {
260260 case TypeTableEntryIdInvalid:
261261 zig_unreachable();
......@@ -293,7 +293,7 @@ bool type_is_complete(TypeTableEntry *type_entry) {
293293 zig_unreachable();
294294}
295295
296bool type_has_zero_bits_known(TypeTableEntry *type_entry) {
296bool type_has_zero_bits_known(ZigType *type_entry) {
297297 switch (type_entry->id) {
298298 case TypeTableEntryIdInvalid:
299299 zig_unreachable();
......@@ -331,7 +331,7 @@ bool type_has_zero_bits_known(TypeTableEntry *type_entry) {
331331}
332332
333333
334uint64_t type_size(CodeGen *g, TypeTableEntry *type_entry) {
334uint64_t type_size(CodeGen *g, ZigType *type_entry) {
335335 assert(type_is_complete(type_entry));
336336
337337 if (!type_has_bits(type_entry))
......@@ -341,7 +341,7 @@ uint64_t type_size(CodeGen *g, TypeTableEntry *type_entry) {
341341 uint64_t size_in_bits = type_size_bits(g, type_entry);
342342 return (size_in_bits + 7) / 8;
343343 } else if (type_entry->id == TypeTableEntryIdArray) {
344 TypeTableEntry *child_type = type_entry->data.array.child_type;
344 ZigType *child_type = type_entry->data.array.child_type;
345345 if (child_type->id == TypeTableEntryIdStruct &&
346346 child_type->data.structure.layout == ContainerLayoutPacked)
347347 {
......@@ -353,7 +353,7 @@ uint64_t type_size(CodeGen *g, TypeTableEntry *type_entry) {
353353 return LLVMStoreSizeOfType(g->target_data_ref, type_entry->type_ref);
354354}
355355
356uint64_t type_size_bits(CodeGen *g, TypeTableEntry *type_entry) {
356uint64_t type_size_bits(CodeGen *g, ZigType *type_entry) {
357357 assert(type_is_complete(type_entry));
358358
359359 if (!type_has_bits(type_entry))
......@@ -366,7 +366,7 @@ uint64_t type_size_bits(CodeGen *g, TypeTableEntry *type_entry) {
366366 }
367367 return result;
368368 } else if (type_entry->id == TypeTableEntryIdArray) {
369 TypeTableEntry *child_type = type_entry->data.array.child_type;
369 ZigType *child_type = type_entry->data.array.child_type;
370370 if (child_type->id == TypeTableEntryIdStruct &&
371371 child_type->data.structure.layout == ContainerLayoutPacked)
372372 {
......@@ -377,7 +377,7 @@ uint64_t type_size_bits(CodeGen *g, TypeTableEntry *type_entry) {
377377 return LLVMSizeOfTypeInBits(g->target_data_ref, type_entry->type_ref);
378378}
379379
380Result<bool> type_is_copyable(CodeGen *g, TypeTableEntry *type_entry) {
380Result<bool> type_is_copyable(CodeGen *g, ZigType *type_entry) {
381381 Error err;
382382 if ((err = type_ensure_zero_bits_known(g, type_entry)))
383383 return err;
......@@ -394,23 +394,23 @@ Result<bool> type_is_copyable(CodeGen *g, TypeTableEntry *type_entry) {
394394 return type_entry->is_copyable;
395395}
396396
397static bool is_slice(TypeTableEntry *type) {
397static bool is_slice(ZigType *type) {
398398 return type->id == TypeTableEntryIdStruct && type->data.structure.is_slice;
399399}
400400
401TypeTableEntry *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x) {
401ZigType *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x) {
402402 return get_int_type(g, false, bits_needed_for_unsigned(x));
403403}
404404
405TypeTableEntry *get_promise_type(CodeGen *g, TypeTableEntry *result_type) {
405ZigType *get_promise_type(CodeGen *g, ZigType *result_type) {
406406 if (result_type != nullptr && result_type->promise_parent != nullptr) {
407407 return result_type->promise_parent;
408408 } else if (result_type == nullptr && g->builtin_types.entry_promise != nullptr) {
409409 return g->builtin_types.entry_promise;
410410 }
411411
412 TypeTableEntry *u8_ptr_type = get_pointer_to_type(g, g->builtin_types.entry_u8, false);
413 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdPromise);
412 ZigType *u8_ptr_type = get_pointer_to_type(g, g->builtin_types.entry_u8, false);
413 ZigType *entry = new_type_table_entry(TypeTableEntryIdPromise);
414414 entry->type_ref = u8_ptr_type->type_ref;
415415 entry->zero_bits = false;
416416 entry->data.promise.result_type = result_type;
......@@ -428,14 +428,14 @@ TypeTableEntry *get_promise_type(CodeGen *g, TypeTableEntry *result_type) {
428428 return entry;
429429}
430430
431TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type, bool is_const,
431ZigType *get_pointer_to_type_extra(CodeGen *g, ZigType *child_type, bool is_const,
432432 bool is_volatile, PtrLen ptr_len, uint32_t byte_alignment, uint32_t bit_offset, uint32_t unaligned_bit_count)
433433{
434434 assert(!type_is_invalid(child_type));
435435 assert(ptr_len == PtrLenSingle || child_type->id != TypeTableEntryIdOpaque);
436436
437437 TypeId type_id = {};
438 TypeTableEntry **parent_pointer = nullptr;
438 ZigType **parent_pointer = nullptr;
439439 uint32_t abi_alignment = get_abi_alignment(g, child_type);
440440 if (unaligned_bit_count != 0 || is_volatile || byte_alignment != abi_alignment || ptr_len != PtrLenSingle) {
441441 type_id.id = TypeTableEntryIdPointer;
......@@ -461,7 +461,7 @@ TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type
461461
462462 assertNoError(type_ensure_zero_bits_known(g, child_type));
463463
464 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdPointer);
464 ZigType *entry = new_type_table_entry(TypeTableEntryIdPointer);
465465 entry->is_copyable = true;
466466
467467 const char *star_str = ptr_len == PtrLenSingle ? "*" : "[*]";
......@@ -487,7 +487,7 @@ TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type
487487 if (is_const || is_volatile || unaligned_bit_count != 0 || byte_alignment != abi_alignment ||
488488 ptr_len != PtrLenSingle)
489489 {
490 TypeTableEntry *peer_type = get_pointer_to_type(g, child_type, false);
490 ZigType *peer_type = get_pointer_to_type(g, child_type, false);
491491 entry->type_ref = peer_type->type_ref;
492492 entry->di_type = peer_type->di_type;
493493 } else {
......@@ -520,18 +520,18 @@ TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type
520520 return entry;
521521}
522522
523TypeTableEntry *get_pointer_to_type(CodeGen *g, TypeTableEntry *child_type, bool is_const) {
523ZigType *get_pointer_to_type(CodeGen *g, ZigType *child_type, bool is_const) {
524524 return get_pointer_to_type_extra(g, child_type, is_const, false, PtrLenSingle,
525525 get_abi_alignment(g, child_type), 0, 0);
526526}
527527
528TypeTableEntry *get_promise_frame_type(CodeGen *g, TypeTableEntry *return_type) {
528ZigType *get_promise_frame_type(CodeGen *g, ZigType *return_type) {
529529 if (return_type->promise_frame_parent != nullptr) {
530530 return return_type->promise_frame_parent;
531531 }
532532
533 TypeTableEntry *atomic_state_type = g->builtin_types.entry_usize;
534 TypeTableEntry *result_ptr_type = get_pointer_to_type(g, return_type, false);
533 ZigType *atomic_state_type = g->builtin_types.entry_usize;
534 ZigType *result_ptr_type = get_pointer_to_type(g, return_type, false);
535535
536536 ZigList<const char *> field_names = {};
537537 field_names.append(ATOMIC_STATE_FIELD_NAME);
......@@ -543,7 +543,7 @@ TypeTableEntry *get_promise_frame_type(CodeGen *g, TypeTableEntry *return_type)
543543 field_names.append(RETURN_ADDRESSES_FIELD_NAME);
544544 }
545545
546 ZigList<TypeTableEntry *> field_types = {};
546 ZigList<ZigType *> field_types = {};
547547 field_types.append(atomic_state_type);
548548 field_types.append(return_type);
549549 field_types.append(result_ptr_type);
......@@ -555,20 +555,20 @@ TypeTableEntry *get_promise_frame_type(CodeGen *g, TypeTableEntry *return_type)
555555
556556 assert(field_names.length == field_types.length);
557557 Buf *name = buf_sprintf("AsyncFramePromise(%s)", buf_ptr(&return_type->name));
558 TypeTableEntry *entry = get_struct_type(g, buf_ptr(name), field_names.items, field_types.items, field_names.length);
558 ZigType *entry = get_struct_type(g, buf_ptr(name), field_names.items, field_types.items, field_names.length);
559559
560560 return_type->promise_frame_parent = entry;
561561 return entry;
562562}
563563
564TypeTableEntry *get_optional_type(CodeGen *g, TypeTableEntry *child_type) {
564ZigType *get_optional_type(CodeGen *g, ZigType *child_type) {
565565 if (child_type->optional_parent) {
566 TypeTableEntry *entry = child_type->optional_parent;
566 ZigType *entry = child_type->optional_parent;
567567 return entry;
568568 } else {
569569 assertNoError(ensure_complete_type(g, child_type));
570570
571 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdOptional);
571 ZigType *entry = new_type_table_entry(TypeTableEntryIdOptional);
572572 assert(child_type->type_ref || child_type->zero_bits);
573573 entry->is_copyable = type_is_copyable(g, child_type).unwrap();
574574
......@@ -606,7 +606,7 @@ TypeTableEntry *get_optional_type(CodeGen *g, TypeTableEntry *child_type) {
606606 uint64_t val_debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, child_type->type_ref);
607607 uint64_t val_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, entry->type_ref, 0);
608608
609 TypeTableEntry *bool_type = g->builtin_types.entry_bool;
609 ZigType *bool_type = g->builtin_types.entry_bool;
610610 uint64_t maybe_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, bool_type->type_ref);
611611 uint64_t maybe_debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, bool_type->type_ref);
612612 uint64_t maybe_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, entry->type_ref, 1);
......@@ -645,7 +645,7 @@ TypeTableEntry *get_optional_type(CodeGen *g, TypeTableEntry *child_type) {
645645 }
646646}
647647
648TypeTableEntry *get_error_union_type(CodeGen *g, TypeTableEntry *err_set_type, TypeTableEntry *payload_type) {
648ZigType *get_error_union_type(CodeGen *g, ZigType *err_set_type, ZigType *payload_type) {
649649 assert(err_set_type->id == TypeTableEntryIdErrorSet);
650650 assert(!type_is_invalid(payload_type));
651651
......@@ -659,7 +659,7 @@ TypeTableEntry *get_error_union_type(CodeGen *g, TypeTableEntry *err_set_type, T
659659 return existing_entry->value;
660660 }
661661
662 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdErrorUnion);
662 ZigType *entry = new_type_table_entry(TypeTableEntryIdErrorUnion);
663663 entry->is_copyable = true;
664664 assert(payload_type->di_type);
665665 assertNoError(ensure_complete_type(g, payload_type));
......@@ -740,20 +740,20 @@ TypeTableEntry *get_error_union_type(CodeGen *g, TypeTableEntry *err_set_type, T
740740 return entry;
741741}
742742
743TypeTableEntry *get_array_type(CodeGen *g, TypeTableEntry *child_type, uint64_t array_size) {
743ZigType *get_array_type(CodeGen *g, ZigType *child_type, uint64_t array_size) {
744744 TypeId type_id = {};
745745 type_id.id = TypeTableEntryIdArray;
746746 type_id.data.array.child_type = child_type;
747747 type_id.data.array.size = array_size;
748748 auto existing_entry = g->type_table.maybe_get(type_id);
749749 if (existing_entry) {
750 TypeTableEntry *entry = existing_entry->value;
750 ZigType *entry = existing_entry->value;
751751 return entry;
752752 }
753753
754754 assertNoError(ensure_complete_type(g, child_type));
755755
756 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdArray);
756 ZigType *entry = new_type_table_entry(TypeTableEntryIdArray);
757757 entry->zero_bits = (array_size == 0) || child_type->zero_bits;
758758 entry->is_copyable = false;
759759
......@@ -780,7 +780,7 @@ TypeTableEntry *get_array_type(CodeGen *g, TypeTableEntry *child_type, uint64_t
780780 return entry;
781781}
782782
783static void slice_type_common_init(CodeGen *g, TypeTableEntry *pointer_type, TypeTableEntry *entry) {
783static void slice_type_common_init(CodeGen *g, ZigType *pointer_type, ZigType *entry) {
784784 unsigned element_count = 2;
785785 Buf *ptr_field_name = buf_create_from_str("ptr");
786786 Buf *len_field_name = buf_create_from_str("len");
......@@ -811,16 +811,16 @@ static void slice_type_common_init(CodeGen *g, TypeTableEntry *pointer_type, Typ
811811 }
812812}
813813
814TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type) {
814ZigType *get_slice_type(CodeGen *g, ZigType *ptr_type) {
815815 assert(ptr_type->id == TypeTableEntryIdPointer);
816816 assert(ptr_type->data.pointer.ptr_len == PtrLenUnknown);
817817
818 TypeTableEntry **parent_pointer = &ptr_type->data.pointer.slice_parent;
818 ZigType **parent_pointer = &ptr_type->data.pointer.slice_parent;
819819 if (*parent_pointer) {
820820 return *parent_pointer;
821821 }
822822
823 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdStruct);
823 ZigType *entry = new_type_table_entry(TypeTableEntryIdStruct);
824824 entry->is_copyable = true;
825825
826826 // replace the & with [] to go from a ptr type name to a slice type name
......@@ -828,14 +828,14 @@ TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type) {
828828 size_t name_offset = (ptr_type->data.pointer.ptr_len == PtrLenSingle) ? 1 : 3;
829829 buf_appendf(&entry->name, "[]%s", buf_ptr(&ptr_type->name) + name_offset);
830830
831 TypeTableEntry *child_type = ptr_type->data.pointer.child_type;
831 ZigType *child_type = ptr_type->data.pointer.child_type;
832832 uint32_t abi_alignment = get_abi_alignment(g, child_type);
833833 if (ptr_type->data.pointer.is_const || ptr_type->data.pointer.is_volatile ||
834834 ptr_type->data.pointer.alignment != abi_alignment)
835835 {
836 TypeTableEntry *peer_ptr_type = get_pointer_to_type_extra(g, child_type, false, false,
836 ZigType *peer_ptr_type = get_pointer_to_type_extra(g, child_type, false, false,
837837 PtrLenUnknown, abi_alignment, 0, 0);
838 TypeTableEntry *peer_slice_type = get_slice_type(g, peer_ptr_type);
838 ZigType *peer_slice_type = get_slice_type(g, peer_ptr_type);
839839
840840 slice_type_common_init(g, ptr_type, entry);
841841
......@@ -852,18 +852,18 @@ TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type) {
852852 // If the child type is []const T then we need to make sure the type ref
853853 // and debug info is the same as if the child type were []T.
854854 if (is_slice(child_type)) {
855 TypeTableEntry *child_ptr_type = child_type->data.structure.fields[slice_ptr_index].type_entry;
855 ZigType *child_ptr_type = child_type->data.structure.fields[slice_ptr_index].type_entry;
856856 assert(child_ptr_type->id == TypeTableEntryIdPointer);
857 TypeTableEntry *grand_child_type = child_ptr_type->data.pointer.child_type;
857 ZigType *grand_child_type = child_ptr_type->data.pointer.child_type;
858858 if (child_ptr_type->data.pointer.is_const || child_ptr_type->data.pointer.is_volatile ||
859859 child_ptr_type->data.pointer.alignment != get_abi_alignment(g, grand_child_type))
860860 {
861 TypeTableEntry *bland_child_ptr_type = get_pointer_to_type_extra(g, grand_child_type, false, false,
861 ZigType *bland_child_ptr_type = get_pointer_to_type_extra(g, grand_child_type, false, false,
862862 PtrLenUnknown, get_abi_alignment(g, grand_child_type), 0, 0);
863 TypeTableEntry *bland_child_slice = get_slice_type(g, bland_child_ptr_type);
864 TypeTableEntry *peer_ptr_type = get_pointer_to_type_extra(g, bland_child_slice, false, false,
863 ZigType *bland_child_slice = get_slice_type(g, bland_child_ptr_type);
864 ZigType *peer_ptr_type = get_pointer_to_type_extra(g, bland_child_slice, false, false,
865865 PtrLenUnknown, get_abi_alignment(g, bland_child_slice), 0, 0);
866 TypeTableEntry *peer_slice_type = get_slice_type(g, peer_ptr_type);
866 ZigType *peer_slice_type = get_slice_type(g, peer_ptr_type);
867867
868868 entry->type_ref = peer_slice_type->type_ref;
869869 entry->di_type = peer_slice_type->di_type;
......@@ -889,7 +889,7 @@ TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type) {
889889 };
890890 LLVMStructSetBody(entry->type_ref, element_types, 1, false);
891891
892 TypeTableEntry *usize_type = g->builtin_types.entry_usize;
892 ZigType *usize_type = g->builtin_types.entry_usize;
893893 uint64_t len_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, usize_type->type_ref);
894894 uint64_t len_debug_align_in_bits = 8*LLVMABIAlignmentOfType(g->target_data_ref, usize_type->type_ref);
895895 uint64_t len_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, entry->type_ref, 0);
......@@ -928,7 +928,7 @@ TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type) {
928928 uint64_t ptr_debug_align_in_bits = 8*LLVMABIAlignmentOfType(g->target_data_ref, ptr_type->type_ref);
929929 uint64_t ptr_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, entry->type_ref, 0);
930930
931 TypeTableEntry *usize_type = g->builtin_types.entry_usize;
931 ZigType *usize_type = g->builtin_types.entry_usize;
932932 uint64_t len_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, usize_type->type_ref);
933933 uint64_t len_debug_align_in_bits = 8*LLVMABIAlignmentOfType(g->target_data_ref, usize_type->type_ref);
934934 uint64_t len_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, entry->type_ref, 1);
......@@ -971,8 +971,8 @@ TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type) {
971971 return entry;
972972}
973973
974TypeTableEntry *get_opaque_type(CodeGen *g, Scope *scope, AstNode *source_node, const char *name) {
975 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdOpaque);
974ZigType *get_opaque_type(CodeGen *g, Scope *scope, AstNode *source_node, const char *name) {
975 ZigType *entry = new_type_table_entry(TypeTableEntryIdOpaque);
976976
977977 buf_init_from_str(&entry->name, name);
978978
......@@ -991,13 +991,13 @@ TypeTableEntry *get_opaque_type(CodeGen *g, Scope *scope, AstNode *source_node,
991991 return entry;
992992}
993993
994TypeTableEntry *get_bound_fn_type(CodeGen *g, FnTableEntry *fn_entry) {
995 TypeTableEntry *fn_type = fn_entry->type_entry;
994ZigType *get_bound_fn_type(CodeGen *g, FnTableEntry *fn_entry) {
995 ZigType *fn_type = fn_entry->type_entry;
996996 assert(fn_type->id == TypeTableEntryIdFn);
997997 if (fn_type->data.fn.bound_fn_parent)
998998 return fn_type->data.fn.bound_fn_parent;
999999
1000 TypeTableEntry *bound_fn_type = new_type_table_entry(TypeTableEntryIdBoundFn);
1000 ZigType *bound_fn_type = new_type_table_entry(TypeTableEntryIdBoundFn);
10011001 bound_fn_type->is_copyable = false;
10021002 bound_fn_type->data.bound_fn.fn_type = fn_type;
10031003 bound_fn_type->zero_bits = true;
......@@ -1051,7 +1051,7 @@ static bool calling_convention_allows_zig_types(CallingConvention cc) {
10511051 zig_unreachable();
10521052}
10531053
1054TypeTableEntry *get_ptr_to_stack_trace_type(CodeGen *g) {
1054ZigType *get_ptr_to_stack_trace_type(CodeGen *g) {
10551055 if (g->stack_trace_type == nullptr) {
10561056 ConstExprValue *stack_trace_type_val = get_builtin_value(g, "StackTrace");
10571057 assert(stack_trace_type_val->type->id == TypeTableEntryIdMetaType);
......@@ -1061,7 +1061,7 @@ TypeTableEntry *get_ptr_to_stack_trace_type(CodeGen *g) {
10611061 return g->ptr_to_stack_trace_type;
10621062}
10631063
1064TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
1064ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
10651065 Error err;
10661066 auto table_entry = g->fn_type_table.maybe_get(fn_type_id);
10671067 if (table_entry) {
......@@ -1075,7 +1075,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
10751075 zig_panic("TODO implement inferred return types https://github.com/ziglang/zig/issues/447");
10761076 }
10771077
1078 TypeTableEntry *fn_type = new_type_table_entry(TypeTableEntryIdFn);
1078 ZigType *fn_type = new_type_table_entry(TypeTableEntryIdFn);
10791079 fn_type->is_copyable = true;
10801080 fn_type->data.fn.fn_type_id = *fn_type_id;
10811081
......@@ -1094,7 +1094,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
10941094 for (size_t i = 0; i < fn_type_id->param_count; i += 1) {
10951095 FnTypeParamInfo *param_info = &fn_type_id->param_info[i];
10961096
1097 TypeTableEntry *param_type = param_info->type;
1097 ZigType *param_type = param_info->type;
10981098 const char *comma = (i == 0) ? "" : ", ";
10991099 const char *noalias_str = param_info->is_noalias ? "noalias " : "";
11001100 buf_appendf(&fn_type->name, "%s%s%s", comma, noalias_str, buf_ptr(&param_type->name));
......@@ -1131,13 +1131,13 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
11311131 ZigLLVMDIType **param_di_types = allocate<ZigLLVMDIType*>(5 + fn_type_id->param_count);
11321132 param_di_types[0] = fn_type_id->return_type->di_type;
11331133 size_t gen_param_index = 0;
1134 TypeTableEntry *gen_return_type;
1134 ZigType *gen_return_type;
11351135 if (is_async) {
11361136 gen_return_type = get_pointer_to_type(g, g->builtin_types.entry_u8, false);
11371137 } else if (!type_has_bits(fn_type_id->return_type)) {
11381138 gen_return_type = g->builtin_types.entry_void;
11391139 } else if (first_arg_return) {
1140 TypeTableEntry *gen_type = get_pointer_to_type(g, fn_type_id->return_type, false);
1140 ZigType *gen_type = get_pointer_to_type(g, fn_type_id->return_type, false);
11411141 gen_param_types[gen_param_index] = gen_type->type_ref;
11421142 gen_param_index += 1;
11431143 // after the gen_param_index += 1 because 0 is the return type
......@@ -1149,7 +1149,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
11491149 fn_type->data.fn.gen_return_type = gen_return_type;
11501150
11511151 if (prefix_arg_error_return_trace) {
1152 TypeTableEntry *gen_type = get_ptr_to_stack_trace_type(g);
1152 ZigType *gen_type = get_ptr_to_stack_trace_type(g);
11531153 gen_param_types[gen_param_index] = gen_type->type_ref;
11541154 gen_param_index += 1;
11551155 // after the gen_param_index += 1 because 0 is the return type
......@@ -1158,7 +1158,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
11581158 if (is_async) {
11591159 {
11601160 // async allocator param
1161 TypeTableEntry *gen_type = fn_type_id->async_allocator_type;
1161 ZigType *gen_type = fn_type_id->async_allocator_type;
11621162 gen_param_types[gen_param_index] = gen_type->type_ref;
11631163 gen_param_index += 1;
11641164 // after the gen_param_index += 1 because 0 is the return type
......@@ -1167,7 +1167,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
11671167
11681168 {
11691169 // error code pointer
1170 TypeTableEntry *gen_type = get_pointer_to_type(g, g->builtin_types.entry_global_error_set, false);
1170 ZigType *gen_type = get_pointer_to_type(g, g->builtin_types.entry_global_error_set, false);
11711171 gen_param_types[gen_param_index] = gen_type->type_ref;
11721172 gen_param_index += 1;
11731173 // after the gen_param_index += 1 because 0 is the return type
......@@ -1178,7 +1178,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
11781178 fn_type->data.fn.gen_param_info = allocate<FnGenParamInfo>(fn_type_id->param_count);
11791179 for (size_t i = 0; i < fn_type_id->param_count; i += 1) {
11801180 FnTypeParamInfo *src_param_info = &fn_type->data.fn.fn_type_id.param_info[i];
1181 TypeTableEntry *type_entry = src_param_info->type;
1181 ZigType *type_entry = src_param_info->type;
11821182 FnGenParamInfo *gen_param_info = &fn_type->data.fn.gen_param_info[i];
11831183
11841184 gen_param_info->src_index = i;
......@@ -1188,7 +1188,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
11881188 return g->builtin_types.entry_invalid;
11891189
11901190 if (type_has_bits(type_entry)) {
1191 TypeTableEntry *gen_type;
1191 ZigType *gen_type;
11921192 if (handle_is_ptr(type_entry)) {
11931193 gen_type = get_pointer_to_type(g, type_entry, true);
11941194 gen_param_info->is_byval = true;
......@@ -1219,7 +1219,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
12191219 return fn_type;
12201220}
12211221
1222static TypeTableEntryId container_to_type(ContainerKind kind) {
1222static ZigTypeId container_to_type(ContainerKind kind) {
12231223 switch (kind) {
12241224 case ContainerKindStruct:
12251225 return TypeTableEntryIdStruct;
......@@ -1231,11 +1231,11 @@ static TypeTableEntryId container_to_type(ContainerKind kind) {
12311231 zig_unreachable();
12321232}
12331233
1234TypeTableEntry *get_partial_container_type(CodeGen *g, Scope *scope, ContainerKind kind,
1234ZigType *get_partial_container_type(CodeGen *g, Scope *scope, ContainerKind kind,
12351235 AstNode *decl_node, const char *name, ContainerLayout layout)
12361236{
1237 TypeTableEntryId type_id = container_to_type(kind);
1238 TypeTableEntry *entry = new_container_type_entry(type_id, decl_node, scope);
1237 ZigTypeId type_id = container_to_type(kind);
1238 ZigType *entry = new_container_type_entry(type_id, decl_node, scope);
12391239
12401240 switch (kind) {
12411241 case ContainerKindStruct:
......@@ -1266,14 +1266,14 @@ TypeTableEntry *get_partial_container_type(CodeGen *g, Scope *scope, ContainerKi
12661266 return entry;
12671267}
12681268
1269static IrInstruction *analyze_const_value(CodeGen *g, Scope *scope, AstNode *node, TypeTableEntry *type_entry, Buf *type_name) {
1269static IrInstruction *analyze_const_value(CodeGen *g, Scope *scope, AstNode *node, ZigType *type_entry, Buf *type_name) {
12701270 size_t backward_branch_count = 0;
12711271 return ir_eval_const_value(g, scope, node, type_entry,
12721272 &backward_branch_count, default_backward_branch_quota,
12731273 nullptr, nullptr, node, type_name, nullptr);
12741274}
12751275
1276TypeTableEntry *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node) {
1276ZigType *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node) {
12771277 IrInstruction *result = analyze_const_value(g, scope, node, g->builtin_types.entry_type, nullptr);
12781278 if (result->value.type->id == TypeTableEntryIdInvalid)
12791279 return g->builtin_types.entry_invalid;
......@@ -1282,8 +1282,8 @@ TypeTableEntry *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node) {
12821282 return result->value.data.x_type;
12831283}
12841284
1285TypeTableEntry *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
1286 TypeTableEntry *fn_type = new_type_table_entry(TypeTableEntryIdFn);
1285ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
1286 ZigType *fn_type = new_type_table_entry(TypeTableEntryIdFn);
12871287 fn_type->is_copyable = false;
12881288 buf_resize(&fn_type->name, 0);
12891289 if (fn_type->data.fn.fn_type_id.cc == CallingConventionAsync) {
......@@ -1350,9 +1350,9 @@ static bool analyze_const_align(CodeGen *g, Scope *scope, AstNode *node, uint32_
13501350}
13511351
13521352static bool analyze_const_string(CodeGen *g, Scope *scope, AstNode *node, Buf **out_buffer) {
1353 TypeTableEntry *ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
1353 ZigType *ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
13541354 PtrLenUnknown, get_abi_alignment(g, g->builtin_types.entry_u8), 0, 0);
1355 TypeTableEntry *str_type = get_slice_type(g, ptr_type);
1355 ZigType *str_type = get_slice_type(g, ptr_type);
13561356 IrInstruction *instr = analyze_const_value(g, scope, node, str_type, nullptr);
13571357 if (type_is_invalid(instr->value.type))
13581358 return false;
......@@ -1382,7 +1382,7 @@ static bool analyze_const_string(CodeGen *g, Scope *scope, AstNode *node, Buf **
13821382 return true;
13831383}
13841384
1385static bool type_allowed_in_packed_struct(TypeTableEntry *type_entry) {
1385static bool type_allowed_in_packed_struct(ZigType *type_entry) {
13861386 switch (type_entry->id) {
13871387 case TypeTableEntryIdInvalid:
13881388 zig_unreachable();
......@@ -1415,7 +1415,7 @@ static bool type_allowed_in_packed_struct(TypeTableEntry *type_entry) {
14151415 return type_entry->data.unionation.layout == ContainerLayoutPacked;
14161416 case TypeTableEntryIdOptional:
14171417 {
1418 TypeTableEntry *child_type = type_entry->data.maybe.child_type;
1418 ZigType *child_type = type_entry->data.maybe.child_type;
14191419 return type_is_codegen_pointer(child_type);
14201420 }
14211421 case TypeTableEntryIdEnum:
......@@ -1424,7 +1424,7 @@ static bool type_allowed_in_packed_struct(TypeTableEntry *type_entry) {
14241424 zig_unreachable();
14251425}
14261426
1427static bool type_allowed_in_extern(CodeGen *g, TypeTableEntry *type_entry) {
1427static bool type_allowed_in_extern(CodeGen *g, ZigType *type_entry) {
14281428 switch (type_entry->id) {
14291429 case TypeTableEntryIdInvalid:
14301430 zig_unreachable();
......@@ -1471,7 +1471,7 @@ static bool type_allowed_in_extern(CodeGen *g, TypeTableEntry *type_entry) {
14711471 return type_entry->data.structure.layout == ContainerLayoutExtern || type_entry->data.structure.layout == ContainerLayoutPacked;
14721472 case TypeTableEntryIdOptional:
14731473 {
1474 TypeTableEntry *child_type = type_entry->data.maybe.child_type;
1474 ZigType *child_type = type_entry->data.maybe.child_type;
14751475 if (child_type->id != TypeTableEntryIdPointer && child_type->id != TypeTableEntryIdFn) {
14761476 return false;
14771477 }
......@@ -1485,8 +1485,8 @@ static bool type_allowed_in_extern(CodeGen *g, TypeTableEntry *type_entry) {
14851485 zig_unreachable();
14861486}
14871487
1488TypeTableEntry *get_auto_err_set_type(CodeGen *g, FnTableEntry *fn_entry) {
1489 TypeTableEntry *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
1488ZigType *get_auto_err_set_type(CodeGen *g, FnTableEntry *fn_entry) {
1489 ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
14901490 buf_resize(&err_set_type->name, 0);
14911491 buf_appendf(&err_set_type->name, "@typeOf(%s).ReturnType.ErrorSet", buf_ptr(&fn_entry->symbol_name));
14921492 err_set_type->is_copyable = true;
......@@ -1501,7 +1501,7 @@ TypeTableEntry *get_auto_err_set_type(CodeGen *g, FnTableEntry *fn_entry) {
15011501 return err_set_type;
15021502}
15031503
1504static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_scope, FnTableEntry *fn_entry) {
1504static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_scope, FnTableEntry *fn_entry) {
15051505 assert(proto_node->type == NodeTypeFnProto);
15061506 AstNodeFnProto *fn_proto = &proto_node->data.fn_proto;
15071507 Error err;
......@@ -1524,7 +1524,7 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c
15241524 return g->builtin_types.entry_invalid;
15251525 }
15261526 if (param_node->data.param_decl.type != nullptr) {
1527 TypeTableEntry *type_entry = analyze_type_expr(g, child_scope, param_node->data.param_decl.type);
1527 ZigType *type_entry = analyze_type_expr(g, child_scope, param_node->data.param_decl.type);
15281528 if (type_is_invalid(type_entry)) {
15291529 return g->builtin_types.entry_invalid;
15301530 }
......@@ -1557,7 +1557,7 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c
15571557 return get_generic_fn_type(g, &fn_type_id);
15581558 }
15591559
1560 TypeTableEntry *type_entry = analyze_type_expr(g, child_scope, param_node->data.param_decl.type);
1560 ZigType *type_entry = analyze_type_expr(g, child_scope, param_node->data.param_decl.type);
15611561 if (type_is_invalid(type_entry)) {
15621562 return g->builtin_types.entry_invalid;
15631563 }
......@@ -1645,14 +1645,14 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c
16451645 //return get_generic_fn_type(g, &fn_type_id);
16461646 }
16471647
1648 TypeTableEntry *specified_return_type = analyze_type_expr(g, child_scope, fn_proto->return_type);
1648 ZigType *specified_return_type = analyze_type_expr(g, child_scope, fn_proto->return_type);
16491649 if (type_is_invalid(specified_return_type)) {
16501650 fn_type_id.return_type = g->builtin_types.entry_invalid;
16511651 return g->builtin_types.entry_invalid;
16521652 }
16531653
16541654 if (fn_proto->auto_err_set) {
1655 TypeTableEntry *inferred_err_set_type = get_auto_err_set_type(g, fn_entry);
1655 ZigType *inferred_err_set_type = get_auto_err_set_type(g, fn_entry);
16561656 fn_type_id.return_type = get_error_union_type(g, inferred_err_set_type, specified_return_type);
16571657 } else {
16581658 fn_type_id.return_type = specified_return_type;
......@@ -1723,7 +1723,7 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c
17231723 return get_fn_type(g, &fn_type_id);
17241724}
17251725
1726bool type_is_invalid(TypeTableEntry *type_entry) {
1726bool type_is_invalid(ZigType *type_entry) {
17271727 switch (type_entry->id) {
17281728 case TypeTableEntryIdInvalid:
17291729 return true;
......@@ -1740,7 +1740,7 @@ bool type_is_invalid(TypeTableEntry *type_entry) {
17401740}
17411741
17421742
1743static Error resolve_enum_type(CodeGen *g, TypeTableEntry *enum_type) {
1743static Error resolve_enum_type(CodeGen *g, ZigType *enum_type) {
17441744 assert(enum_type->id == TypeTableEntryIdEnum);
17451745
17461746 if (enum_type->data.enumeration.is_invalid)
......@@ -1815,7 +1815,7 @@ static Error resolve_enum_type(CodeGen *g, TypeTableEntry *enum_type) {
18151815 return ErrorNone;
18161816 }
18171817
1818 TypeTableEntry *tag_int_type = enum_type->data.enumeration.tag_int_type;
1818 ZigType *tag_int_type = enum_type->data.enumeration.tag_int_type;
18191819
18201820 // create debug type for tag
18211821 uint64_t tag_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, tag_int_type->type_ref);
......@@ -1834,10 +1834,10 @@ static Error resolve_enum_type(CodeGen *g, TypeTableEntry *enum_type) {
18341834}
18351835
18361836
1837TypeTableEntry *get_struct_type(CodeGen *g, const char *type_name, const char *field_names[],
1838 TypeTableEntry *field_types[], size_t field_count)
1837ZigType *get_struct_type(CodeGen *g, const char *type_name, const char *field_names[],
1838 ZigType *field_types[], size_t field_count)
18391839{
1840 TypeTableEntry *struct_type = new_type_table_entry(TypeTableEntryIdStruct);
1840 ZigType *struct_type = new_type_table_entry(TypeTableEntryIdStruct);
18411841
18421842 buf_init_from_str(&struct_type->name, type_name);
18431843
......@@ -1881,7 +1881,7 @@ TypeTableEntry *get_struct_type(CodeGen *g, const char *type_name, const char *f
18811881 if (type_struct_field->gen_index == SIZE_MAX) {
18821882 continue;
18831883 }
1884 TypeTableEntry *field_type = type_struct_field->type_entry;
1884 ZigType *field_type = type_struct_field->type_entry;
18851885 uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, field_type->type_ref);
18861886 uint64_t debug_align_in_bits = 8*LLVMABIAlignmentOfType(g->target_data_ref, field_type->type_ref);
18871887 uint64_t debug_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, struct_type->type_ref, type_struct_field->gen_index);
......@@ -1913,7 +1913,7 @@ TypeTableEntry *get_struct_type(CodeGen *g, const char *type_name, const char *f
19131913 return struct_type;
19141914}
19151915
1916static Error resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {
1916static Error resolve_struct_type(CodeGen *g, ZigType *struct_type) {
19171917 assert(struct_type->id == TypeTableEntryIdStruct);
19181918
19191919 if (struct_type->data.structure.complete)
......@@ -1957,7 +1957,7 @@ static Error resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {
19571957
19581958 for (size_t i = 0; i < field_count; i += 1) {
19591959 TypeStructField *type_struct_field = &struct_type->data.structure.fields[i];
1960 TypeTableEntry *field_type = type_struct_field->type_entry;
1960 ZigType *field_type = type_struct_field->type_entry;
19611961
19621962 if ((err = ensure_complete_type(g, field_type))) {
19631963 struct_type->data.structure.is_invalid = true;
......@@ -2088,12 +2088,12 @@ static Error resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {
20882088 continue;
20892089 }
20902090
2091 TypeTableEntry *field_type = type_struct_field->type_entry;
2091 ZigType *field_type = type_struct_field->type_entry;
20922092
20932093 // if the field is a function, actually the debug info should be a pointer.
20942094 ZigLLVMDIType *field_di_type;
20952095 if (field_type->id == TypeTableEntryIdFn) {
2096 TypeTableEntry *field_ptr_type = get_pointer_to_type(g, field_type, true);
2096 ZigType *field_ptr_type = get_pointer_to_type(g, field_type, true);
20972097 uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, field_ptr_type->type_ref);
20982098 uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, field_ptr_type->type_ref);
20992099 field_di_type = ZigLLVMCreateDebugPointerType(g->dbuilder, field_type->di_type,
......@@ -2147,7 +2147,7 @@ static Error resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {
21472147 return ErrorNone;
21482148}
21492149
2150static Error resolve_union_type(CodeGen *g, TypeTableEntry *union_type) {
2150static Error resolve_union_type(CodeGen *g, ZigType *union_type) {
21512151 assert(union_type->id == TypeTableEntryIdUnion);
21522152
21532153 if (union_type->data.unionation.complete)
......@@ -2179,7 +2179,7 @@ static Error resolve_union_type(CodeGen *g, TypeTableEntry *union_type) {
21792179 uint32_t gen_field_count = union_type->data.unionation.gen_field_count;
21802180 ZigLLVMDIType **union_inner_di_types = allocate<ZigLLVMDIType*>(gen_field_count);
21812181
2182 TypeTableEntry *most_aligned_union_member = nullptr;
2182 ZigType *most_aligned_union_member = nullptr;
21832183 uint64_t size_of_most_aligned_member_in_bits = 0;
21842184 uint64_t biggest_align_in_bits = 0;
21852185 uint64_t biggest_size_in_bits = 0;
......@@ -2194,7 +2194,7 @@ static Error resolve_union_type(CodeGen *g, TypeTableEntry *union_type) {
21942194 for (uint32_t i = 0; i < field_count; i += 1) {
21952195 AstNode *field_node = decl_node->data.container_decl.fields.at(i);
21962196 TypeUnionField *union_field = &union_type->data.unionation.fields[i];
2197 TypeTableEntry *field_type = union_field->type_entry;
2197 ZigType *field_type = union_field->type_entry;
21982198
21992199 if ((err = ensure_complete_type(g, field_type))) {
22002200 union_type->data.unionation.is_invalid = true;
......@@ -2259,13 +2259,13 @@ static Error resolve_union_type(CodeGen *g, TypeTableEntry *union_type) {
22592259
22602260 uint64_t padding_in_bits = biggest_size_in_bits - size_of_most_aligned_member_in_bits;
22612261
2262 TypeTableEntry *tag_type = union_type->data.unionation.tag_type;
2262 ZigType *tag_type = union_type->data.unionation.tag_type;
22632263 if (tag_type == nullptr || tag_type->zero_bits) {
22642264 assert(most_aligned_union_member != nullptr);
22652265
22662266 if (padding_in_bits > 0) {
2267 TypeTableEntry *u8_type = get_int_type(g, false, 8);
2268 TypeTableEntry *padding_array = get_array_type(g, u8_type, padding_in_bits / 8);
2267 ZigType *u8_type = get_int_type(g, false, 8);
2268 ZigType *padding_array = get_array_type(g, u8_type, padding_in_bits / 8);
22692269 LLVMTypeRef union_element_types[] = {
22702270 most_aligned_union_member->type_ref,
22712271 padding_array->type_ref,
......@@ -2295,8 +2295,8 @@ static Error resolve_union_type(CodeGen *g, TypeTableEntry *union_type) {
22952295
22962296 LLVMTypeRef union_type_ref;
22972297 if (padding_in_bits > 0) {
2298 TypeTableEntry *u8_type = get_int_type(g, false, 8);
2299 TypeTableEntry *padding_array = get_array_type(g, u8_type, padding_in_bits / 8);
2298 ZigType *u8_type = get_int_type(g, false, 8);
2299 ZigType *padding_array = get_array_type(g, u8_type, padding_in_bits / 8);
23002300 LLVMTypeRef union_element_types[] = {
23012301 most_aligned_union_member->type_ref,
23022302 padding_array->type_ref,
......@@ -2319,7 +2319,7 @@ static Error resolve_union_type(CodeGen *g, TypeTableEntry *union_type) {
23192319 assert(8*LLVMStoreSizeOfType(g->target_data_ref, union_type_ref) >= biggest_size_in_bits);
23202320
23212321 // create llvm type for root struct
2322 TypeTableEntry *tag_int_type = tag_type->data.enumeration.tag_int_type;
2322 ZigType *tag_int_type = tag_type->data.enumeration.tag_int_type;
23232323 uint64_t align_of_tag_in_bits = 8*LLVMABIAlignmentOfType(g->target_data_ref, tag_int_type->type_ref);
23242324
23252325 if (align_of_tag_in_bits >= biggest_align_in_bits) {
......@@ -2387,7 +2387,7 @@ static Error resolve_union_type(CodeGen *g, TypeTableEntry *union_type) {
23872387 return ErrorNone;
23882388}
23892389
2390static Error resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type) {
2390static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) {
23912391 assert(enum_type->id == TypeTableEntryIdEnum);
23922392
23932393 if (enum_type->data.enumeration.zero_bits_known)
......@@ -2428,7 +2428,7 @@ static Error resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type) {
24282428 HashMap<BigInt, AstNode *, bigint_hash, bigint_eql> occupied_tag_values = {};
24292429 occupied_tag_values.init(field_count);
24302430
2431 TypeTableEntry *tag_int_type;
2431 ZigType *tag_int_type;
24322432 if (enum_type->data.enumeration.layout == ContainerLayoutExtern) {
24332433 tag_int_type = get_c_int_type(g, CIntTypeInt);
24342434 } else {
......@@ -2437,7 +2437,7 @@ static Error resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type) {
24372437
24382438 // TODO: Are extern enums allowed to have an init_arg_expr?
24392439 if (decl_node->data.container_decl.init_arg_expr != nullptr) {
2440 TypeTableEntry *wanted_tag_int_type = analyze_type_expr(g, scope, decl_node->data.container_decl.init_arg_expr);
2440 ZigType *wanted_tag_int_type = analyze_type_expr(g, scope, decl_node->data.container_decl.init_arg_expr);
24412441 if (type_is_invalid(wanted_tag_int_type)) {
24422442 enum_type->data.enumeration.is_invalid = true;
24432443 } else if (wanted_tag_int_type->id != TypeTableEntryIdInt) {
......@@ -2550,7 +2550,7 @@ static Error resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type) {
25502550 return ErrorNone;
25512551}
25522552
2553static Error resolve_struct_zero_bits(CodeGen *g, TypeTableEntry *struct_type) {
2553static Error resolve_struct_zero_bits(CodeGen *g, ZigType *struct_type) {
25542554 assert(struct_type->id == TypeTableEntryIdStruct);
25552555
25562556 Error err;
......@@ -2614,7 +2614,7 @@ static Error resolve_struct_zero_bits(CodeGen *g, TypeTableEntry *struct_type) {
26142614 continue;
26152615 }
26162616
2617 TypeTableEntry *field_type = analyze_type_expr(g, scope, field_node->data.struct_field.type);
2617 ZigType *field_type = analyze_type_expr(g, scope, field_node->data.struct_field.type);
26182618 type_struct_field->type_entry = field_type;
26192619 type_struct_field->src_index = i;
26202620 type_struct_field->gen_index = SIZE_MAX;
......@@ -2669,7 +2669,7 @@ static Error resolve_struct_zero_bits(CodeGen *g, TypeTableEntry *struct_type) {
26692669 return ErrorNone;
26702670}
26712671
2672static Error resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) {
2672static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) {
26732673 assert(union_type->id == TypeTableEntryIdUnion);
26742674
26752675 Error err;
......@@ -2734,7 +2734,7 @@ static Error resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) {
27342734 enum_type_node != nullptr;
27352735 bool auto_layout = (union_type->data.unionation.layout == ContainerLayoutAuto);
27362736 bool want_safety = (field_count >= 2) && (auto_layout || enum_type_node != nullptr);
2737 TypeTableEntry *tag_type;
2737 ZigType *tag_type;
27382738 bool create_enum_type = decl_node->data.container_decl.auto_enum || (enum_type_node == nullptr && want_safety);
27392739 bool *covered_enum_fields;
27402740 ZigLLVMDIEnumerator **di_enumerators;
......@@ -2744,7 +2744,7 @@ static Error resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) {
27442744
27452745 di_enumerators = allocate<ZigLLVMDIEnumerator*>(field_count);
27462746
2747 TypeTableEntry *tag_int_type;
2747 ZigType *tag_int_type;
27482748 if (enum_type_node != nullptr) {
27492749 tag_int_type = analyze_type_expr(g, scope, enum_type_node);
27502750 if (type_is_invalid(tag_int_type)) {
......@@ -2779,7 +2779,7 @@ static Error resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) {
27792779 tag_type->data.enumeration.decls_scope = union_type->data.unionation.decls_scope;
27802780 tag_type->data.enumeration.complete = true;
27812781 } else if (enum_type_node != nullptr) {
2782 TypeTableEntry *enum_type = analyze_type_expr(g, scope, enum_type_node);
2782 ZigType *enum_type = analyze_type_expr(g, scope, enum_type_node);
27832783 if (type_is_invalid(enum_type)) {
27842784 union_type->data.unionation.is_invalid = true;
27852785 return ErrorSemanticAnalyzeFail;
......@@ -2816,7 +2816,7 @@ static Error resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) {
28162816 continue;
28172817 }
28182818
2819 TypeTableEntry *field_type;
2819 ZigType *field_type;
28202820 if (field_node->data.struct_field.type == nullptr) {
28212821 if (decl_node->data.container_decl.auto_enum || decl_node->data.container_decl.init_arg_expr != nullptr) {
28222822 field_type = g->builtin_types.entry_void;
......@@ -2860,7 +2860,7 @@ static Error resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) {
28602860 // In this first pass we resolve explicit tag values.
28612861 // In a second pass we will fill in the unspecified ones.
28622862 if (tag_value != nullptr) {
2863 TypeTableEntry *tag_int_type = tag_type->data.enumeration.tag_int_type;
2863 ZigType *tag_int_type = tag_type->data.enumeration.tag_int_type;
28642864 IrInstruction *result_inst = analyze_const_value(g, scope, tag_value, tag_int_type, nullptr);
28652865 if (result_inst->value.type->id == TypeTableEntryIdInvalid) {
28662866 union_type->data.unionation.is_invalid = true;
......@@ -3075,7 +3075,7 @@ static bool scope_is_root_decls(Scope *scope) {
30753075 zig_unreachable();
30763076}
30773077
3078static void wrong_panic_prototype(CodeGen *g, AstNode *proto_node, TypeTableEntry *fn_type) {
3078static void wrong_panic_prototype(CodeGen *g, AstNode *proto_node, ZigType *fn_type) {
30793079 add_node_error(g, proto_node,
30803080 buf_sprintf("expected 'fn([]const u8, ?*builtin.StackTrace) noreturn', found '%s'",
30813081 buf_ptr(&fn_type->name)));
......@@ -3084,30 +3084,30 @@ static void wrong_panic_prototype(CodeGen *g, AstNode *proto_node, TypeTableEntr
30843084static void typecheck_panic_fn(CodeGen *g, FnTableEntry *panic_fn) {
30853085 AstNode *proto_node = panic_fn->proto_node;
30863086 assert(proto_node->type == NodeTypeFnProto);
3087 TypeTableEntry *fn_type = panic_fn->type_entry;
3087 ZigType *fn_type = panic_fn->type_entry;
30883088 FnTypeId *fn_type_id = &fn_type->data.fn.fn_type_id;
30893089 if (fn_type_id->param_count != 2) {
30903090 return wrong_panic_prototype(g, proto_node, fn_type);
30913091 }
3092 TypeTableEntry *const_u8_ptr = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
3092 ZigType *const_u8_ptr = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
30933093 PtrLenUnknown, get_abi_alignment(g, g->builtin_types.entry_u8), 0, 0);
3094 TypeTableEntry *const_u8_slice = get_slice_type(g, const_u8_ptr);
3094 ZigType *const_u8_slice = get_slice_type(g, const_u8_ptr);
30953095 if (fn_type_id->param_info[0].type != const_u8_slice) {
30963096 return wrong_panic_prototype(g, proto_node, fn_type);
30973097 }
30983098
3099 TypeTableEntry *optional_ptr_to_stack_trace_type = get_optional_type(g, get_ptr_to_stack_trace_type(g));
3099 ZigType *optional_ptr_to_stack_trace_type = get_optional_type(g, get_ptr_to_stack_trace_type(g));
31003100 if (fn_type_id->param_info[1].type != optional_ptr_to_stack_trace_type) {
31013101 return wrong_panic_prototype(g, proto_node, fn_type);
31023102 }
31033103
3104 TypeTableEntry *actual_return_type = fn_type_id->return_type;
3104 ZigType *actual_return_type = fn_type_id->return_type;
31053105 if (actual_return_type != g->builtin_types.entry_unreachable) {
31063106 return wrong_panic_prototype(g, proto_node, fn_type);
31073107 }
31083108}
31093109
3110TypeTableEntry *get_test_fn_type(CodeGen *g) {
3110ZigType *get_test_fn_type(CodeGen *g) {
31113111 if (g->test_fn_type)
31123112 return g->test_fn_type;
31133113
......@@ -3280,7 +3280,7 @@ static void add_top_level_decl(CodeGen *g, ScopeDecls *decls_scope, Tld *tld) {
32803280 }
32813281
32823282 {
3283 TypeTableEntry *type = get_primitive_type(g, tld->name);
3283 ZigType *type = get_primitive_type(g, tld->name);
32843284 if (type != nullptr) {
32853285 add_node_error(g, tld->source_node,
32863286 buf_sprintf("declaration shadows type '%s'", buf_ptr(&type->name)));
......@@ -3444,7 +3444,7 @@ void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node) {
34443444}
34453445
34463446static void resolve_decl_container(CodeGen *g, TldContainer *tld_container) {
3447 TypeTableEntry *type_entry = tld_container->type_entry;
3447 ZigType *type_entry = tld_container->type_entry;
34483448 assert(type_entry);
34493449
34503450 switch (type_entry->id) {
......@@ -3462,7 +3462,7 @@ static void resolve_decl_container(CodeGen *g, TldContainer *tld_container) {
34623462 }
34633463}
34643464
3465TypeTableEntry *validate_var_type(CodeGen *g, AstNode *source_node, TypeTableEntry *type_entry) {
3465ZigType *validate_var_type(CodeGen *g, AstNode *source_node, ZigType *type_entry) {
34663466 switch (type_entry->id) {
34673467 case TypeTableEntryIdInvalid:
34683468 return g->builtin_types.entry_invalid;
......@@ -3526,7 +3526,7 @@ VariableTableEntry *add_variable(CodeGen *g, AstNode *source_node, Scope *parent
35263526 add_error_note(g, msg, existing_var->decl_node, buf_sprintf("previous declaration is here"));
35273527 variable_entry->value->type = g->builtin_types.entry_invalid;
35283528 } else {
3529 TypeTableEntry *type = get_primitive_type(g, name);
3529 ZigType *type = get_primitive_type(g, name);
35303530 if (type != nullptr) {
35313531 add_node_error(g, source_node,
35323532 buf_sprintf("variable shadows type '%s'", buf_ptr(&type->name)));
......@@ -3577,9 +3577,9 @@ static void resolve_decl_var(CodeGen *g, TldVar *tld_var) {
35773577 bool is_extern = var_decl->is_extern;
35783578 bool is_export = var_decl->is_export;
35793579
3580 TypeTableEntry *explicit_type = nullptr;
3580 ZigType *explicit_type = nullptr;
35813581 if (var_decl->type) {
3582 TypeTableEntry *proposed_type = analyze_type_expr(g, tld_var->base.parent_scope, var_decl->type);
3582 ZigType *proposed_type = analyze_type_expr(g, tld_var->base.parent_scope, var_decl->type);
35833583 explicit_type = validate_var_type(g, var_decl->type, proposed_type);
35843584 }
35853585
......@@ -3597,7 +3597,7 @@ static void resolve_decl_var(CodeGen *g, TldVar *tld_var) {
35973597 IrInstruction *init_value = nullptr;
35983598
35993599 // TODO more validation for types that can't be used for export/extern variables
3600 TypeTableEntry *implicit_type = nullptr;
3600 ZigType *implicit_type = nullptr;
36013601 if (explicit_type && explicit_type->id == TypeTableEntryIdInvalid) {
36023602 implicit_type = explicit_type;
36033603 } else if (var_decl->expr) {
......@@ -3627,7 +3627,7 @@ static void resolve_decl_var(CodeGen *g, TldVar *tld_var) {
36273627 implicit_type = g->builtin_types.entry_invalid;
36283628 }
36293629
3630 TypeTableEntry *type = explicit_type ? explicit_type : implicit_type;
3630 ZigType *type = explicit_type ? explicit_type : implicit_type;
36313631 assert(type != nullptr); // should have been caught by the parser
36323632
36333633 ConstExprValue *init_val = init_value ? &init_value->value : create_const_runtime(type);
......@@ -3789,7 +3789,7 @@ FnTableEntry *scope_get_fn_if_root(Scope *scope) {
37893789 return nullptr;
37903790}
37913791
3792TypeEnumField *find_enum_type_field(TypeTableEntry *enum_type, Buf *name) {
3792TypeEnumField *find_enum_type_field(ZigType *enum_type, Buf *name) {
37933793 assert(enum_type->id == TypeTableEntryIdEnum);
37943794 if (enum_type->data.enumeration.src_field_count == 0)
37953795 return nullptr;
......@@ -3799,7 +3799,7 @@ TypeEnumField *find_enum_type_field(TypeTableEntry *enum_type, Buf *name) {
37993799 return entry->value;
38003800}
38013801
3802TypeStructField *find_struct_type_field(TypeTableEntry *type_entry, Buf *name) {
3802TypeStructField *find_struct_type_field(ZigType *type_entry, Buf *name) {
38033803 assert(type_entry->id == TypeTableEntryIdStruct);
38043804 assert(type_entry->data.structure.complete);
38053805 if (type_entry->data.structure.src_field_count == 0)
......@@ -3810,7 +3810,7 @@ TypeStructField *find_struct_type_field(TypeTableEntry *type_entry, Buf *name) {
38103810 return entry->value;
38113811}
38123812
3813TypeUnionField *find_union_type_field(TypeTableEntry *type_entry, Buf *name) {
3813TypeUnionField *find_union_type_field(ZigType *type_entry, Buf *name) {
38143814 assert(type_entry->id == TypeTableEntryIdUnion);
38153815 assert(type_entry->data.unionation.zero_bits_known);
38163816 if (type_entry->data.unionation.src_field_count == 0)
......@@ -3821,7 +3821,7 @@ TypeUnionField *find_union_type_field(TypeTableEntry *type_entry, Buf *name) {
38213821 return entry->value;
38223822}
38233823
3824TypeUnionField *find_union_field_by_tag(TypeTableEntry *type_entry, const BigInt *tag) {
3824TypeUnionField *find_union_field_by_tag(ZigType *type_entry, const BigInt *tag) {
38253825 assert(type_entry->id == TypeTableEntryIdUnion);
38263826 assert(type_entry->data.unionation.zero_bits_known);
38273827 for (uint32_t i = 0; i < type_entry->data.unionation.src_field_count; i += 1) {
......@@ -3833,7 +3833,7 @@ TypeUnionField *find_union_field_by_tag(TypeTableEntry *type_entry, const BigInt
38333833 return nullptr;
38343834}
38353835
3836TypeEnumField *find_enum_field_by_tag(TypeTableEntry *enum_type, const BigInt *tag) {
3836TypeEnumField *find_enum_field_by_tag(ZigType *enum_type, const BigInt *tag) {
38373837 assert(enum_type->data.enumeration.zero_bits_known);
38383838 for (uint32_t i = 0; i < enum_type->data.enumeration.src_field_count; i += 1) {
38393839 TypeEnumField *field = &enum_type->data.enumeration.fields[i];
......@@ -3845,7 +3845,7 @@ TypeEnumField *find_enum_field_by_tag(TypeTableEntry *enum_type, const BigInt *t
38453845}
38463846
38473847
3848static bool is_container(TypeTableEntry *type_entry) {
3848static bool is_container(ZigType *type_entry) {
38493849 switch (type_entry->id) {
38503850 case TypeTableEntryIdInvalid:
38513851 zig_unreachable();
......@@ -3880,28 +3880,28 @@ static bool is_container(TypeTableEntry *type_entry) {
38803880 zig_unreachable();
38813881}
38823882
3883bool is_ref(TypeTableEntry *type_entry) {
3883bool is_ref(ZigType *type_entry) {
38843884 return type_entry->id == TypeTableEntryIdPointer && type_entry->data.pointer.ptr_len == PtrLenSingle;
38853885}
38863886
3887bool is_array_ref(TypeTableEntry *type_entry) {
3888 TypeTableEntry *array = is_ref(type_entry) ?
3887bool is_array_ref(ZigType *type_entry) {
3888 ZigType *array = is_ref(type_entry) ?
38893889 type_entry->data.pointer.child_type : type_entry;
38903890 return array->id == TypeTableEntryIdArray;
38913891}
38923892
3893bool is_container_ref(TypeTableEntry *type_entry) {
3893bool is_container_ref(ZigType *type_entry) {
38943894 return is_ref(type_entry) ?
38953895 is_container(type_entry->data.pointer.child_type) : is_container(type_entry);
38963896}
38973897
3898TypeTableEntry *container_ref_type(TypeTableEntry *type_entry) {
3898ZigType *container_ref_type(ZigType *type_entry) {
38993899 assert(is_container_ref(type_entry));
39003900 return is_ref(type_entry) ?
39013901 type_entry->data.pointer.child_type : type_entry;
39023902}
39033903
3904void resolve_container_type(CodeGen *g, TypeTableEntry *type_entry) {
3904void resolve_container_type(CodeGen *g, ZigType *type_entry) {
39053905 switch (type_entry->id) {
39063906 case TypeTableEntryIdStruct:
39073907 resolve_struct_type(g, type_entry);
......@@ -3939,7 +3939,7 @@ void resolve_container_type(CodeGen *g, TypeTableEntry *type_entry) {
39393939 }
39403940}
39413941
3942TypeTableEntry *get_codegen_ptr_type(TypeTableEntry *type) {
3942ZigType *get_codegen_ptr_type(ZigType *type) {
39433943 if (type->id == TypeTableEntryIdPointer) return type;
39443944 if (type->id == TypeTableEntryIdFn) return type;
39453945 if (type->id == TypeTableEntryIdPromise) return type;
......@@ -3951,12 +3951,12 @@ TypeTableEntry *get_codegen_ptr_type(TypeTableEntry *type) {
39513951 return nullptr;
39523952}
39533953
3954bool type_is_codegen_pointer(TypeTableEntry *type) {
3954bool type_is_codegen_pointer(ZigType *type) {
39553955 return get_codegen_ptr_type(type) == type;
39563956}
39573957
3958uint32_t get_ptr_align(TypeTableEntry *type) {
3959 TypeTableEntry *ptr_type = get_codegen_ptr_type(type);
3958uint32_t get_ptr_align(ZigType *type) {
3959 ZigType *ptr_type = get_codegen_ptr_type(type);
39603960 if (ptr_type->id == TypeTableEntryIdPointer) {
39613961 return ptr_type->data.pointer.alignment;
39623962 } else if (ptr_type->id == TypeTableEntryIdFn) {
......@@ -3968,8 +3968,8 @@ uint32_t get_ptr_align(TypeTableEntry *type) {
39683968 }
39693969}
39703970
3971bool get_ptr_const(TypeTableEntry *type) {
3972 TypeTableEntry *ptr_type = get_codegen_ptr_type(type);
3971bool get_ptr_const(ZigType *type) {
3972 ZigType *ptr_type = get_codegen_ptr_type(type);
39733973 if (ptr_type->id == TypeTableEntryIdPointer) {
39743974 return ptr_type->data.pointer.is_const;
39753975 } else if (ptr_type->id == TypeTableEntryIdFn) {
......@@ -3991,7 +3991,7 @@ AstNode *get_param_decl_node(FnTableEntry *fn_entry, size_t index) {
39913991}
39923992
39933993static void define_local_param_variables(CodeGen *g, FnTableEntry *fn_table_entry) {
3994 TypeTableEntry *fn_type = fn_table_entry->type_entry;
3994 ZigType *fn_type = fn_table_entry->type_entry;
39953995 assert(!fn_type->data.fn.is_generic);
39963996 FnTypeId *fn_type_id = &fn_type->data.fn.fn_type_id;
39973997 for (size_t i = 0; i < fn_type_id->param_count; i += 1) {
......@@ -4008,7 +4008,7 @@ static void define_local_param_variables(CodeGen *g, FnTableEntry *fn_table_entr
40084008 continue;
40094009 }
40104010
4011 TypeTableEntry *param_type = param_info->type;
4011 ZigType *param_type = param_info->type;
40124012 bool is_noalias = param_info->is_noalias;
40134013
40144014 if (is_noalias && get_codegen_ptr_type(param_type) == nullptr) {
......@@ -4031,7 +4031,7 @@ static void define_local_param_variables(CodeGen *g, FnTableEntry *fn_table_entr
40314031 }
40324032}
40334033
4034bool resolve_inferred_error_set(CodeGen *g, TypeTableEntry *err_set_type, AstNode *source_node) {
4034bool resolve_inferred_error_set(CodeGen *g, ZigType *err_set_type, AstNode *source_node) {
40354035 FnTableEntry *infer_fn = err_set_type->data.error_set.infer_fn;
40364036 if (infer_fn != nullptr) {
40374037 if (infer_fn->anal_state == FnAnalStateInvalid) {
......@@ -4053,11 +4053,11 @@ bool resolve_inferred_error_set(CodeGen *g, TypeTableEntry *err_set_type, AstNod
40534053}
40544054
40554055void analyze_fn_ir(CodeGen *g, FnTableEntry *fn_table_entry, AstNode *return_type_node) {
4056 TypeTableEntry *fn_type = fn_table_entry->type_entry;
4056 ZigType *fn_type = fn_table_entry->type_entry;
40574057 assert(!fn_type->data.fn.is_generic);
40584058 FnTypeId *fn_type_id = &fn_type->data.fn.fn_type_id;
40594059
4060 TypeTableEntry *block_return_type = ir_analyze(g, &fn_table_entry->ir_executable,
4060 ZigType *block_return_type = ir_analyze(g, &fn_table_entry->ir_executable,
40614061 &fn_table_entry->analyzed_executable, fn_type_id->return_type, return_type_node);
40624062 fn_table_entry->src_implicit_return_type = block_return_type;
40634063
......@@ -4068,9 +4068,9 @@ void analyze_fn_ir(CodeGen *g, FnTableEntry *fn_table_entry, AstNode *return_typ
40684068 }
40694069
40704070 if (fn_type_id->return_type->id == TypeTableEntryIdErrorUnion) {
4071 TypeTableEntry *return_err_set_type = fn_type_id->return_type->data.error_union.err_set_type;
4071 ZigType *return_err_set_type = fn_type_id->return_type->data.error_union.err_set_type;
40724072 if (return_err_set_type->data.error_set.infer_fn != nullptr) {
4073 TypeTableEntry *inferred_err_set_type;
4073 ZigType *inferred_err_set_type;
40744074 if (fn_table_entry->src_implicit_return_type->id == TypeTableEntryIdErrorSet) {
40754075 inferred_err_set_type = fn_table_entry->src_implicit_return_type;
40764076 } else if (fn_table_entry->src_implicit_return_type->id == TypeTableEntryIdErrorUnion) {
......@@ -4129,7 +4129,7 @@ static void analyze_fn_body(CodeGen *g, FnTableEntry *fn_table_entry) {
41294129
41304130 define_local_param_variables(g, fn_table_entry);
41314131
4132 TypeTableEntry *fn_type = fn_table_entry->type_entry;
4132 ZigType *fn_type = fn_table_entry->type_entry;
41334133 assert(!fn_type->data.fn.is_generic);
41344134
41354135 ir_gen_fn(g, fn_table_entry);
......@@ -4355,7 +4355,7 @@ void semantic_analyze(CodeGen *g) {
43554355 }
43564356}
43574357
4358TypeTableEntry *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) {
4358ZigType *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) {
43594359 TypeId type_id = {};
43604360 type_id.id = TypeTableEntryIdInt;
43614361 type_id.data.integer.is_signed = is_signed;
......@@ -4367,20 +4367,20 @@ TypeTableEntry *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits)
43674367 return entry->value;
43684368 }
43694369
4370 TypeTableEntry *new_entry = make_int_type(g, is_signed, size_in_bits);
4370 ZigType *new_entry = make_int_type(g, is_signed, size_in_bits);
43714371 g->type_table.put(type_id, new_entry);
43724372 return new_entry;
43734373}
43744374
4375TypeTableEntry **get_c_int_type_ptr(CodeGen *g, CIntType c_int_type) {
4375ZigType **get_c_int_type_ptr(CodeGen *g, CIntType c_int_type) {
43764376 return &g->builtin_types.entry_c_int[c_int_type];
43774377}
43784378
4379TypeTableEntry *get_c_int_type(CodeGen *g, CIntType c_int_type) {
4379ZigType *get_c_int_type(CodeGen *g, CIntType c_int_type) {
43804380 return *get_c_int_type_ptr(g, c_int_type);
43814381}
43824382
4383bool handle_is_ptr(TypeTableEntry *type_entry) {
4383bool handle_is_ptr(ZigType *type_entry) {
43844384 switch (type_entry->id) {
43854385 case TypeTableEntryIdInvalid:
43864386 case TypeTableEntryIdMetaType:
......@@ -4916,7 +4916,7 @@ static bool can_mutate_comptime_var_state(ConstExprValue *value) {
49164916 zig_unreachable();
49174917}
49184918
4919static bool return_type_is_cacheable(TypeTableEntry *return_type) {
4919static bool return_type_is_cacheable(ZigType *return_type) {
49204920 switch (return_type->id) {
49214921 case TypeTableEntryIdInvalid:
49224922 zig_unreachable();
......@@ -4958,7 +4958,7 @@ static bool return_type_is_cacheable(TypeTableEntry *return_type) {
49584958 zig_unreachable();
49594959}
49604960
4961bool fn_eval_cacheable(Scope *scope, TypeTableEntry *return_type) {
4961bool fn_eval_cacheable(Scope *scope, ZigType *return_type) {
49624962 if (!return_type_is_cacheable(return_type))
49634963 return false;
49644964 while (scope) {
......@@ -5027,14 +5027,14 @@ bool fn_eval_eql(Scope *a, Scope *b) {
50275027 return false;
50285028}
50295029
5030bool type_has_bits(TypeTableEntry *type_entry) {
5030bool type_has_bits(ZigType *type_entry) {
50315031 assert(type_entry);
50325032 assert(type_entry->id != TypeTableEntryIdInvalid);
50335033 assert(type_has_zero_bits_known(type_entry));
50345034 return !type_entry->zero_bits;
50355035}
50365036
5037bool type_requires_comptime(TypeTableEntry *type_entry) {
5037bool type_requires_comptime(ZigType *type_entry) {
50385038 switch (type_entry->id) {
50395039 case TypeTableEntryIdInvalid:
50405040 case TypeTableEntryIdOpaque:
......@@ -5143,27 +5143,27 @@ ConstExprValue *create_const_c_str_lit(CodeGen *g, Buf *str) {
51435143 return const_val;
51445144}
51455145
5146void init_const_bigint(ConstExprValue *const_val, TypeTableEntry *type, const BigInt *bigint) {
5146void init_const_bigint(ConstExprValue *const_val, ZigType *type, const BigInt *bigint) {
51475147 const_val->special = ConstValSpecialStatic;
51485148 const_val->type = type;
51495149 bigint_init_bigint(&const_val->data.x_bigint, bigint);
51505150}
51515151
5152ConstExprValue *create_const_bigint(TypeTableEntry *type, const BigInt *bigint) {
5152ConstExprValue *create_const_bigint(ZigType *type, const BigInt *bigint) {
51535153 ConstExprValue *const_val = create_const_vals(1);
51545154 init_const_bigint(const_val, type, bigint);
51555155 return const_val;
51565156}
51575157
51585158
5159void init_const_unsigned_negative(ConstExprValue *const_val, TypeTableEntry *type, uint64_t x, bool negative) {
5159void init_const_unsigned_negative(ConstExprValue *const_val, ZigType *type, uint64_t x, bool negative) {
51605160 const_val->special = ConstValSpecialStatic;
51615161 const_val->type = type;
51625162 bigint_init_unsigned(&const_val->data.x_bigint, x);
51635163 const_val->data.x_bigint.is_negative = negative;
51645164}
51655165
5166ConstExprValue *create_const_unsigned_negative(TypeTableEntry *type, uint64_t x, bool negative) {
5166ConstExprValue *create_const_unsigned_negative(ZigType *type, uint64_t x, bool negative) {
51675167 ConstExprValue *const_val = create_const_vals(1);
51685168 init_const_unsigned_negative(const_val, type, x, negative);
51695169 return const_val;
......@@ -5177,19 +5177,19 @@ ConstExprValue *create_const_usize(CodeGen *g, uint64_t x) {
51775177 return create_const_unsigned_negative(g->builtin_types.entry_usize, x, false);
51785178}
51795179
5180void init_const_signed(ConstExprValue *const_val, TypeTableEntry *type, int64_t x) {
5180void init_const_signed(ConstExprValue *const_val, ZigType *type, int64_t x) {
51815181 const_val->special = ConstValSpecialStatic;
51825182 const_val->type = type;
51835183 bigint_init_signed(&const_val->data.x_bigint, x);
51845184}
51855185
5186ConstExprValue *create_const_signed(TypeTableEntry *type, int64_t x) {
5186ConstExprValue *create_const_signed(ZigType *type, int64_t x) {
51875187 ConstExprValue *const_val = create_const_vals(1);
51885188 init_const_signed(const_val, type, x);
51895189 return const_val;
51905190}
51915191
5192void init_const_float(ConstExprValue *const_val, TypeTableEntry *type, double value) {
5192void init_const_float(ConstExprValue *const_val, ZigType *type, double value) {
51935193 const_val->special = ConstValSpecialStatic;
51945194 const_val->type = type;
51955195 if (type->id == TypeTableEntryIdComptimeFloat) {
......@@ -5216,19 +5216,19 @@ void init_const_float(ConstExprValue *const_val, TypeTableEntry *type, double va
52165216 }
52175217}
52185218
5219ConstExprValue *create_const_float(TypeTableEntry *type, double value) {
5219ConstExprValue *create_const_float(ZigType *type, double value) {
52205220 ConstExprValue *const_val = create_const_vals(1);
52215221 init_const_float(const_val, type, value);
52225222 return const_val;
52235223}
52245224
5225void init_const_enum(ConstExprValue *const_val, TypeTableEntry *type, const BigInt *tag) {
5225void init_const_enum(ConstExprValue *const_val, ZigType *type, const BigInt *tag) {
52265226 const_val->special = ConstValSpecialStatic;
52275227 const_val->type = type;
52285228 bigint_init_bigint(&const_val->data.x_enum_tag, tag);
52295229}
52305230
5231ConstExprValue *create_const_enum(TypeTableEntry *type, const BigInt *tag) {
5231ConstExprValue *create_const_enum(ZigType *type, const BigInt *tag) {
52325232 ConstExprValue *const_val = create_const_vals(1);
52335233 init_const_enum(const_val, type, tag);
52345234 return const_val;
......@@ -5247,24 +5247,24 @@ ConstExprValue *create_const_bool(CodeGen *g, bool value) {
52475247 return const_val;
52485248}
52495249
5250void init_const_runtime(ConstExprValue *const_val, TypeTableEntry *type) {
5250void init_const_runtime(ConstExprValue *const_val, ZigType *type) {
52515251 const_val->special = ConstValSpecialRuntime;
52525252 const_val->type = type;
52535253}
52545254
5255ConstExprValue *create_const_runtime(TypeTableEntry *type) {
5255ConstExprValue *create_const_runtime(ZigType *type) {
52565256 ConstExprValue *const_val = create_const_vals(1);
52575257 init_const_runtime(const_val, type);
52585258 return const_val;
52595259}
52605260
5261void init_const_type(CodeGen *g, ConstExprValue *const_val, TypeTableEntry *type_value) {
5261void init_const_type(CodeGen *g, ConstExprValue *const_val, ZigType *type_value) {
52625262 const_val->special = ConstValSpecialStatic;
52635263 const_val->type = g->builtin_types.entry_type;
52645264 const_val->data.x_type = type_value;
52655265}
52665266
5267ConstExprValue *create_const_type(CodeGen *g, TypeTableEntry *type_value) {
5267ConstExprValue *create_const_type(CodeGen *g, ZigType *type_value) {
52685268 ConstExprValue *const_val = create_const_vals(1);
52695269 init_const_type(g, const_val, type_value);
52705270 return const_val;
......@@ -5275,7 +5275,7 @@ void init_const_slice(CodeGen *g, ConstExprValue *const_val, ConstExprValue *arr
52755275{
52765276 assert(array_val->type->id == TypeTableEntryIdArray);
52775277
5278 TypeTableEntry *ptr_type = get_pointer_to_type_extra(g, array_val->type->data.array.child_type,
5278 ZigType *ptr_type = get_pointer_to_type_extra(g, array_val->type->data.array.child_type,
52795279 is_const, false, PtrLenUnknown, get_abi_alignment(g, array_val->type->data.array.child_type),
52805280 0, 0);
52815281
......@@ -5298,7 +5298,7 @@ void init_const_ptr_array(CodeGen *g, ConstExprValue *const_val, ConstExprValue
52985298 size_t elem_index, bool is_const, PtrLen ptr_len)
52995299{
53005300 assert(array_val->type->id == TypeTableEntryIdArray);
5301 TypeTableEntry *child_type = array_val->type->data.array.child_type;
5301 ZigType *child_type = array_val->type->data.array.child_type;
53025302
53035303 const_val->special = ConstValSpecialStatic;
53045304 const_val->type = get_pointer_to_type_extra(g, child_type, is_const, false,
......@@ -5329,7 +5329,7 @@ ConstExprValue *create_const_ptr_ref(CodeGen *g, ConstExprValue *pointee_val, bo
53295329 return const_val;
53305330}
53315331
5332void init_const_ptr_hard_coded_addr(CodeGen *g, ConstExprValue *const_val, TypeTableEntry *pointee_type,
5332void init_const_ptr_hard_coded_addr(CodeGen *g, ConstExprValue *const_val, ZigType *pointee_type,
53335333 size_t addr, bool is_const)
53345334{
53355335 const_val->special = ConstValSpecialStatic;
......@@ -5338,7 +5338,7 @@ void init_const_ptr_hard_coded_addr(CodeGen *g, ConstExprValue *const_val, TypeT
53385338 const_val->data.x_ptr.data.hard_coded_addr.addr = addr;
53395339}
53405340
5341ConstExprValue *create_const_ptr_hard_coded_addr(CodeGen *g, TypeTableEntry *pointee_type,
5341ConstExprValue *create_const_ptr_hard_coded_addr(CodeGen *g, ZigType *pointee_type,
53425342 size_t addr, bool is_const)
53435343{
53445344 ConstExprValue *const_val = create_const_vals(1);
......@@ -5362,7 +5362,7 @@ ConstExprValue *create_const_arg_tuple(CodeGen *g, size_t arg_index_start, size_
53625362
53635363void init_const_undefined(CodeGen *g, ConstExprValue *const_val) {
53645364 Error err;
5365 TypeTableEntry *wanted_type = const_val->type;
5365 ZigType *wanted_type = const_val->type;
53665366 if (wanted_type->id == TypeTableEntryIdArray) {
53675367 const_val->special = ConstValSpecialStatic;
53685368 const_val->data.x_array.special = ConstArraySpecialUndef;
......@@ -5400,7 +5400,7 @@ ConstExprValue *create_const_vals(size_t count) {
54005400 return vals;
54015401}
54025402
5403Error ensure_complete_type(CodeGen *g, TypeTableEntry *type_entry) {
5403Error ensure_complete_type(CodeGen *g, ZigType *type_entry) {
54045404 if (type_is_invalid(type_entry))
54055405 return ErrorSemanticAnalyzeFail;
54065406 if (type_entry->id == TypeTableEntryIdStruct) {
......@@ -5416,7 +5416,7 @@ Error ensure_complete_type(CodeGen *g, TypeTableEntry *type_entry) {
54165416 return ErrorNone;
54175417}
54185418
5419Error type_ensure_zero_bits_known(CodeGen *g, TypeTableEntry *type_entry) {
5419Error type_ensure_zero_bits_known(CodeGen *g, ZigType *type_entry) {
54205420 if (type_is_invalid(type_entry))
54215421 return ErrorSemanticAnalyzeFail;
54225422 if (type_entry->id == TypeTableEntryIdStruct) {
......@@ -5591,7 +5591,7 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
55915591 zig_unreachable();
55925592}
55935593
5594void eval_min_max_value_int(CodeGen *g, TypeTableEntry *int_type, BigInt *bigint, bool is_max) {
5594void eval_min_max_value_int(CodeGen *g, ZigType *int_type, BigInt *bigint, bool is_max) {
55955595 assert(int_type->id == TypeTableEntryIdInt);
55965596 if (int_type->data.integral.bit_count == 0) {
55975597 bigint_init_unsigned(bigint, 0);
......@@ -5628,7 +5628,7 @@ void eval_min_max_value_int(CodeGen *g, TypeTableEntry *int_type, BigInt *bigint
56285628 }
56295629}
56305630
5631void eval_min_max_value(CodeGen *g, TypeTableEntry *type_entry, ConstExprValue *const_val, bool is_max) {
5631void eval_min_max_value(CodeGen *g, ZigType *type_entry, ConstExprValue *const_val, bool is_max) {
56325632 if (type_entry->id == TypeTableEntryIdInt) {
56335633 const_val->special = ConstValSpecialStatic;
56345634 eval_min_max_value_int(g, type_entry, &const_val->data.x_bigint, is_max);
......@@ -5642,7 +5642,7 @@ void eval_min_max_value(CodeGen *g, TypeTableEntry *type_entry, ConstExprValue *
56425642 }
56435643}
56445644
5645void render_const_val_ptr(CodeGen *g, Buf *buf, ConstExprValue *const_val, TypeTableEntry *type_entry) {
5645void render_const_val_ptr(CodeGen *g, Buf *buf, ConstExprValue *const_val, ZigType *type_entry) {
56465646 switch (const_val->data.x_ptr.special) {
56475647 case ConstPtrSpecialInvalid:
56485648 zig_unreachable();
......@@ -5690,7 +5690,7 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
56905690 }
56915691 assert(const_val->type);
56925692
5693 TypeTableEntry *type_entry = const_val->type;
5693 ZigType *type_entry = const_val->type;
56945694 switch (type_entry->id) {
56955695 case TypeTableEntryIdOpaque:
56965696 zig_unreachable();
......@@ -5765,7 +5765,7 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
57655765 }
57665766 case TypeTableEntryIdArray:
57675767 {
5768 TypeTableEntry *child_type = type_entry->data.array.child_type;
5768 ZigType *child_type = type_entry->data.array.child_type;
57695769 uint64_t len = type_entry->data.array.len;
57705770
57715771 if (const_val->data.x_array.special == ConstArraySpecialUndef) {
......@@ -5878,8 +5878,8 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
58785878 zig_unreachable();
58795879}
58805880
5881TypeTableEntry *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) {
5882 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdInt);
5881ZigType *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) {
5882 ZigType *entry = new_type_table_entry(TypeTableEntryIdInt);
58835883 entry->is_copyable = true;
58845884 entry->type_ref = (size_in_bits == 0) ? LLVMVoidType() : LLVMIntType(size_in_bits);
58855885 entry->zero_bits = (size_in_bits == 0);
......@@ -6071,7 +6071,7 @@ void expand_undef_array(CodeGen *g, ConstExprValue *const_val) {
60716071
60726072ConstParent *get_const_val_parent(CodeGen *g, ConstExprValue *value) {
60736073 assert(value->type);
6074 TypeTableEntry *type_entry = value->type;
6074 ZigType *type_entry = value->type;
60756075 if (type_entry->id == TypeTableEntryIdArray) {
60766076 expand_undef_array(g, value);
60776077 return &value->data.x_array.s_none.parent;
......@@ -6083,7 +6083,7 @@ ConstParent *get_const_val_parent(CodeGen *g, ConstExprValue *value) {
60836083 return nullptr;
60846084}
60856085
6086static const TypeTableEntryId all_type_ids[] = {
6086static const ZigTypeId all_type_ids[] = {
60876087 TypeTableEntryIdMetaType,
60886088 TypeTableEntryIdVoid,
60896089 TypeTableEntryIdBool,
......@@ -6111,7 +6111,7 @@ static const TypeTableEntryId all_type_ids[] = {
61116111 TypeTableEntryIdPromise,
61126112};
61136113
6114TypeTableEntryId type_id_at_index(size_t index) {
6114ZigTypeId type_id_at_index(size_t index) {
61156115 assert(index < array_length(all_type_ids));
61166116 return all_type_ids[index];
61176117}
......@@ -6120,7 +6120,7 @@ size_t type_id_len() {
61206120 return array_length(all_type_ids);
61216121}
61226122
6123size_t type_id_index(TypeTableEntry *entry) {
6123size_t type_id_index(ZigType *entry) {
61246124 switch (entry->id) {
61256125 case TypeTableEntryIdInvalid:
61266126 zig_unreachable();
......@@ -6180,7 +6180,7 @@ size_t type_id_index(TypeTableEntry *entry) {
61806180 zig_unreachable();
61816181}
61826182
6183const char *type_id_name(TypeTableEntryId id) {
6183const char *type_id_name(ZigTypeId id) {
61846184 switch (id) {
61856185 case TypeTableEntryIdInvalid:
61866186 zig_unreachable();
......@@ -6266,7 +6266,7 @@ LinkLib *add_link_lib(CodeGen *g, Buf *name) {
62666266 return link_lib;
62676267}
62686268
6269uint32_t get_abi_alignment(CodeGen *g, TypeTableEntry *type_entry) {
6269uint32_t get_abi_alignment(CodeGen *g, ZigType *type_entry) {
62706270 assertNoError(type_ensure_zero_bits_known(g, type_entry));
62716271 if (type_entry->zero_bits) return 0;
62726272
......@@ -6290,7 +6290,7 @@ uint32_t get_abi_alignment(CodeGen *g, TypeTableEntry *type_entry) {
62906290 }
62916291}
62926292
6293TypeTableEntry *get_align_amt_type(CodeGen *g) {
6293ZigType *get_align_amt_type(CodeGen *g) {
62946294 if (g->align_amt_type == nullptr) {
62956295 // according to LLVM the maximum alignment is 1 << 29.
62966296 g->align_amt_type = get_int_type(g, false, 29);
......@@ -6298,11 +6298,11 @@ TypeTableEntry *get_align_amt_type(CodeGen *g) {
62986298 return g->align_amt_type;
62996299}
63006300
6301uint32_t type_ptr_hash(const TypeTableEntry *ptr) {
6301uint32_t type_ptr_hash(const ZigType *ptr) {
63026302 return hash_ptr((void*)ptr);
63036303}
63046304
6305bool type_ptr_eql(const TypeTableEntry *a, const TypeTableEntry *b) {
6305bool type_ptr_eql(const ZigType *a, const ZigType *b) {
63066306 return a == b;
63076307}
63086308
......@@ -6316,7 +6316,7 @@ ConstExprValue *get_builtin_value(CodeGen *codegen, const char *name) {
63166316 return var_value;
63176317}
63186318
6319bool type_is_global_error_set(TypeTableEntry *err_set_type) {
6319bool type_is_global_error_set(ZigType *err_set_type) {
63206320 assert(err_set_type->id == TypeTableEntryIdErrorSet);
63216321 assert(err_set_type->data.error_set.infer_fn == nullptr);
63226322 return err_set_type->data.error_set.err_count == UINT32_MAX;
......@@ -6326,7 +6326,7 @@ uint32_t get_coro_frame_align_bytes(CodeGen *g) {
63266326 return g->pointer_size_bytes * 2;
63276327}
63286328
6329bool type_can_fail(TypeTableEntry *type_entry) {
6329bool type_can_fail(ZigType *type_entry) {
63306330 return type_entry->id == TypeTableEntryIdErrorUnion || type_entry->id == TypeTableEntryIdErrorSet;
63316331}
63326332
......@@ -6334,7 +6334,7 @@ bool fn_type_can_fail(FnTypeId *fn_type_id) {
63346334 return type_can_fail(fn_type_id->return_type) || fn_type_id->cc == CallingConventionAsync;
63356335}
63366336
6337TypeTableEntry *get_primitive_type(CodeGen *g, Buf *name) {
6337ZigType *get_primitive_type(CodeGen *g, Buf *name) {
63386338 if (buf_len(name) >= 2) {
63396339 uint8_t first_c = buf_ptr(name)[0];
63406340 if (first_c == 'i' || first_c == 'u') {
src/analyze.hpp+85-85
......@@ -14,35 +14,35 @@
1414void semantic_analyze(CodeGen *g);
1515ErrorMsg *add_node_error(CodeGen *g, AstNode *node, Buf *msg);
1616ErrorMsg *add_error_note(CodeGen *g, ErrorMsg *parent_msg, AstNode *node, Buf *msg);
17TypeTableEntry *new_type_table_entry(TypeTableEntryId id);
18TypeTableEntry *get_pointer_to_type(CodeGen *g, TypeTableEntry *child_type, bool is_const);
19TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type, bool is_const,
17ZigType *new_type_table_entry(ZigTypeId id);
18ZigType *get_pointer_to_type(CodeGen *g, ZigType *child_type, bool is_const);
19ZigType *get_pointer_to_type_extra(CodeGen *g, ZigType *child_type, bool is_const,
2020 bool is_volatile, PtrLen ptr_len, uint32_t byte_alignment, uint32_t bit_offset, uint32_t unaligned_bit_count);
21uint64_t type_size(CodeGen *g, TypeTableEntry *type_entry);
22uint64_t type_size_bits(CodeGen *g, TypeTableEntry *type_entry);
23TypeTableEntry *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);
24TypeTableEntry **get_c_int_type_ptr(CodeGen *g, CIntType c_int_type);
25TypeTableEntry *get_c_int_type(CodeGen *g, CIntType c_int_type);
26TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id);
27TypeTableEntry *get_optional_type(CodeGen *g, TypeTableEntry *child_type);
28TypeTableEntry *get_array_type(CodeGen *g, TypeTableEntry *child_type, uint64_t array_size);
29TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type);
30TypeTableEntry *get_partial_container_type(CodeGen *g, Scope *scope, ContainerKind kind,
21uint64_t type_size(CodeGen *g, ZigType *type_entry);
22uint64_t type_size_bits(CodeGen *g, ZigType *type_entry);
23ZigType *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);
24ZigType **get_c_int_type_ptr(CodeGen *g, CIntType c_int_type);
25ZigType *get_c_int_type(CodeGen *g, CIntType c_int_type);
26ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id);
27ZigType *get_optional_type(CodeGen *g, ZigType *child_type);
28ZigType *get_array_type(CodeGen *g, ZigType *child_type, uint64_t array_size);
29ZigType *get_slice_type(CodeGen *g, ZigType *ptr_type);
30ZigType *get_partial_container_type(CodeGen *g, Scope *scope, ContainerKind kind,
3131 AstNode *decl_node, const char *name, ContainerLayout layout);
32TypeTableEntry *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x);
33TypeTableEntry *get_error_union_type(CodeGen *g, TypeTableEntry *err_set_type, TypeTableEntry *payload_type);
34TypeTableEntry *get_bound_fn_type(CodeGen *g, FnTableEntry *fn_entry);
35TypeTableEntry *get_opaque_type(CodeGen *g, Scope *scope, AstNode *source_node, const char *name);
36TypeTableEntry *get_struct_type(CodeGen *g, const char *type_name, const char *field_names[],
37 TypeTableEntry *field_types[], size_t field_count);
38TypeTableEntry *get_promise_type(CodeGen *g, TypeTableEntry *result_type);
39TypeTableEntry *get_promise_frame_type(CodeGen *g, TypeTableEntry *return_type);
40TypeTableEntry *get_test_fn_type(CodeGen *g);
41bool handle_is_ptr(TypeTableEntry *type_entry);
32ZigType *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x);
33ZigType *get_error_union_type(CodeGen *g, ZigType *err_set_type, ZigType *payload_type);
34ZigType *get_bound_fn_type(CodeGen *g, FnTableEntry *fn_entry);
35ZigType *get_opaque_type(CodeGen *g, Scope *scope, AstNode *source_node, const char *name);
36ZigType *get_struct_type(CodeGen *g, const char *type_name, const char *field_names[],
37 ZigType *field_types[], size_t field_count);
38ZigType *get_promise_type(CodeGen *g, ZigType *result_type);
39ZigType *get_promise_frame_type(CodeGen *g, ZigType *return_type);
40ZigType *get_test_fn_type(CodeGen *g);
41bool handle_is_ptr(ZigType *type_entry);
4242void find_libc_include_path(CodeGen *g);
4343void find_libc_lib_path(CodeGen *g);
4444
45bool type_has_bits(TypeTableEntry *type_entry);
45bool type_has_bits(ZigType *type_entry);
4646
4747
4848ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *abs_full_path, Buf *source_code);
......@@ -51,28 +51,28 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *a
5151VariableTableEntry *find_variable(CodeGen *g, Scope *orig_context, Buf *name);
5252Tld *find_decl(CodeGen *g, Scope *scope, Buf *name);
5353void resolve_top_level_decl(CodeGen *g, Tld *tld, bool pointer_only, AstNode *source_node);
54bool type_is_codegen_pointer(TypeTableEntry *type);
55
56TypeTableEntry *get_codegen_ptr_type(TypeTableEntry *type);
57uint32_t get_ptr_align(TypeTableEntry *type);
58bool get_ptr_const(TypeTableEntry *type);
59TypeTableEntry *validate_var_type(CodeGen *g, AstNode *source_node, TypeTableEntry *type_entry);
60TypeTableEntry *container_ref_type(TypeTableEntry *type_entry);
61bool type_is_complete(TypeTableEntry *type_entry);
62bool type_is_invalid(TypeTableEntry *type_entry);
63bool type_is_global_error_set(TypeTableEntry *err_set_type);
64bool type_has_zero_bits_known(TypeTableEntry *type_entry);
65void resolve_container_type(CodeGen *g, TypeTableEntry *type_entry);
66ScopeDecls *get_container_scope(TypeTableEntry *type_entry);
67TypeStructField *find_struct_type_field(TypeTableEntry *type_entry, Buf *name);
68TypeEnumField *find_enum_type_field(TypeTableEntry *enum_type, Buf *name);
69TypeUnionField *find_union_type_field(TypeTableEntry *type_entry, Buf *name);
70TypeEnumField *find_enum_field_by_tag(TypeTableEntry *enum_type, const BigInt *tag);
71TypeUnionField *find_union_field_by_tag(TypeTableEntry *type_entry, const BigInt *tag);
72
73bool is_ref(TypeTableEntry *type_entry);
74bool is_array_ref(TypeTableEntry *type_entry);
75bool is_container_ref(TypeTableEntry *type_entry);
54bool type_is_codegen_pointer(ZigType *type);
55
56ZigType *get_codegen_ptr_type(ZigType *type);
57uint32_t get_ptr_align(ZigType *type);
58bool get_ptr_const(ZigType *type);
59ZigType *validate_var_type(CodeGen *g, AstNode *source_node, ZigType *type_entry);
60ZigType *container_ref_type(ZigType *type_entry);
61bool type_is_complete(ZigType *type_entry);
62bool type_is_invalid(ZigType *type_entry);
63bool type_is_global_error_set(ZigType *err_set_type);
64bool type_has_zero_bits_known(ZigType *type_entry);
65void resolve_container_type(CodeGen *g, ZigType *type_entry);
66ScopeDecls *get_container_scope(ZigType *type_entry);
67TypeStructField *find_struct_type_field(ZigType *type_entry, Buf *name);
68TypeEnumField *find_enum_type_field(ZigType *enum_type, Buf *name);
69TypeUnionField *find_union_type_field(ZigType *type_entry, Buf *name);
70TypeEnumField *find_enum_field_by_tag(ZigType *enum_type, const BigInt *tag);
71TypeUnionField *find_union_field_by_tag(ZigType *type_entry, const BigInt *tag);
72
73bool is_ref(ZigType *type_entry);
74bool is_array_ref(ZigType *type_entry);
75bool is_container_ref(ZigType *type_entry);
7676void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node);
7777void scan_import(CodeGen *g, ImportTableEntry *import);
7878void preview_use_decl(CodeGen *g, AstNode *node);
......@@ -82,20 +82,20 @@ ImportTableEntry *get_scope_import(Scope *scope);
8282void init_tld(Tld *tld, TldId id, Buf *name, VisibMod visib_mod, AstNode *source_node, Scope *parent_scope);
8383VariableTableEntry *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
8484 bool is_const, ConstExprValue *init_value, Tld *src_tld);
85TypeTableEntry *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node);
85ZigType *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node);
8686FnTableEntry *create_fn(AstNode *proto_node);
8787FnTableEntry *create_fn_raw(FnInline inline_value, GlobalLinkageId linkage);
8888void init_fn_type_id(FnTypeId *fn_type_id, AstNode *proto_node, size_t param_count_alloc);
8989AstNode *get_param_decl_node(FnTableEntry *fn_entry, size_t index);
9090FnTableEntry *scope_get_fn_if_root(Scope *scope);
91bool type_requires_comptime(TypeTableEntry *type_entry);
92Error ATTRIBUTE_MUST_USE ensure_complete_type(CodeGen *g, TypeTableEntry *type_entry);
93Error ATTRIBUTE_MUST_USE type_ensure_zero_bits_known(CodeGen *g, TypeTableEntry *type_entry);
94void complete_enum(CodeGen *g, TypeTableEntry *enum_type);
91bool type_requires_comptime(ZigType *type_entry);
92Error ATTRIBUTE_MUST_USE ensure_complete_type(CodeGen *g, ZigType *type_entry);
93Error ATTRIBUTE_MUST_USE type_ensure_zero_bits_known(CodeGen *g, ZigType *type_entry);
94void complete_enum(CodeGen *g, ZigType *enum_type);
9595bool ir_get_var_is_comptime(VariableTableEntry *var);
9696bool const_values_equal(ConstExprValue *a, ConstExprValue *b);
97void eval_min_max_value(CodeGen *g, TypeTableEntry *type_entry, ConstExprValue *const_val, bool is_max);
98void eval_min_max_value_int(CodeGen *g, TypeTableEntry *int_type, BigInt *bigint, bool is_max);
97void eval_min_max_value(CodeGen *g, ZigType *type_entry, ConstExprValue *const_val, bool is_max);
98void eval_min_max_value_int(CodeGen *g, ZigType *int_type, BigInt *bigint, bool is_max);
9999
100100void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val);
101101void analyze_fn_ir(CodeGen *g, FnTableEntry *fn_table_entry, AstNode *return_type_node);
......@@ -108,7 +108,7 @@ ScopeCImport *create_cimport_scope(AstNode *node, Scope *parent);
108108ScopeLoop *create_loop_scope(AstNode *node, Scope *parent);
109109ScopeSuspend *create_suspend_scope(AstNode *node, Scope *parent);
110110ScopeFnDef *create_fndef_scope(AstNode *node, Scope *parent, FnTableEntry *fn_entry);
111ScopeDecls *create_decls_scope(AstNode *node, Scope *parent, TypeTableEntry *container_type, ImportTableEntry *import);
111ScopeDecls *create_decls_scope(AstNode *node, Scope *parent, ZigType *container_type, ImportTableEntry *import);
112112Scope *create_comptime_scope(AstNode *node, Scope *parent);
113113Scope *create_coro_prelude_scope(AstNode *node, Scope *parent);
114114Scope *create_runtime_scope(AstNode *node, Scope *parent, IrInstruction *is_comptime);
......@@ -119,39 +119,39 @@ ConstExprValue *create_const_str_lit(CodeGen *g, Buf *str);
119119void init_const_c_str_lit(CodeGen *g, ConstExprValue *const_val, Buf *c_str);
120120ConstExprValue *create_const_c_str_lit(CodeGen *g, Buf *c_str);
121121
122void init_const_bigint(ConstExprValue *const_val, TypeTableEntry *type, const BigInt *bigint);
123ConstExprValue *create_const_bigint(TypeTableEntry *type, const BigInt *bigint);
122void init_const_bigint(ConstExprValue *const_val, ZigType *type, const BigInt *bigint);
123ConstExprValue *create_const_bigint(ZigType *type, const BigInt *bigint);
124124
125void init_const_unsigned_negative(ConstExprValue *const_val, TypeTableEntry *type, uint64_t x, bool negative);
126ConstExprValue *create_const_unsigned_negative(TypeTableEntry *type, uint64_t x, bool negative);
125void init_const_unsigned_negative(ConstExprValue *const_val, ZigType *type, uint64_t x, bool negative);
126ConstExprValue *create_const_unsigned_negative(ZigType *type, uint64_t x, bool negative);
127127
128void init_const_signed(ConstExprValue *const_val, TypeTableEntry *type, int64_t x);
129ConstExprValue *create_const_signed(TypeTableEntry *type, int64_t x);
128void init_const_signed(ConstExprValue *const_val, ZigType *type, int64_t x);
129ConstExprValue *create_const_signed(ZigType *type, int64_t x);
130130
131131void init_const_usize(CodeGen *g, ConstExprValue *const_val, uint64_t x);
132132ConstExprValue *create_const_usize(CodeGen *g, uint64_t x);
133133
134void init_const_float(ConstExprValue *const_val, TypeTableEntry *type, double value);
135ConstExprValue *create_const_float(TypeTableEntry *type, double value);
134void init_const_float(ConstExprValue *const_val, ZigType *type, double value);
135ConstExprValue *create_const_float(ZigType *type, double value);
136136
137void init_const_enum(ConstExprValue *const_val, TypeTableEntry *type, const BigInt *tag);
138ConstExprValue *create_const_enum(TypeTableEntry *type, const BigInt *tag);
137void init_const_enum(ConstExprValue *const_val, ZigType *type, const BigInt *tag);
138ConstExprValue *create_const_enum(ZigType *type, const BigInt *tag);
139139
140140void init_const_bool(CodeGen *g, ConstExprValue *const_val, bool value);
141141ConstExprValue *create_const_bool(CodeGen *g, bool value);
142142
143void init_const_type(CodeGen *g, ConstExprValue *const_val, TypeTableEntry *type_value);
144ConstExprValue *create_const_type(CodeGen *g, TypeTableEntry *type_value);
143void init_const_type(CodeGen *g, ConstExprValue *const_val, ZigType *type_value);
144ConstExprValue *create_const_type(CodeGen *g, ZigType *type_value);
145145
146void init_const_runtime(ConstExprValue *const_val, TypeTableEntry *type);
147ConstExprValue *create_const_runtime(TypeTableEntry *type);
146void init_const_runtime(ConstExprValue *const_val, ZigType *type);
147ConstExprValue *create_const_runtime(ZigType *type);
148148
149149void init_const_ptr_ref(CodeGen *g, ConstExprValue *const_val, ConstExprValue *pointee_val, bool is_const);
150150ConstExprValue *create_const_ptr_ref(CodeGen *g, ConstExprValue *pointee_val, bool is_const);
151151
152void init_const_ptr_hard_coded_addr(CodeGen *g, ConstExprValue *const_val, TypeTableEntry *pointee_type,
152void init_const_ptr_hard_coded_addr(CodeGen *g, ConstExprValue *const_val, ZigType *pointee_type,
153153 size_t addr, bool is_const);
154ConstExprValue *create_const_ptr_hard_coded_addr(CodeGen *g, TypeTableEntry *pointee_type,
154ConstExprValue *create_const_ptr_hard_coded_addr(CodeGen *g, ZigType *pointee_type,
155155 size_t addr, bool is_const);
156156
157157void init_const_ptr_array(CodeGen *g, ConstExprValue *const_val, ConstExprValue *array_val,
......@@ -170,23 +170,23 @@ void init_const_undefined(CodeGen *g, ConstExprValue *const_val);
170170
171171ConstExprValue *create_const_vals(size_t count);
172172
173TypeTableEntry *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);
173ZigType *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);
174174ConstParent *get_const_val_parent(CodeGen *g, ConstExprValue *value);
175175void expand_undef_array(CodeGen *g, ConstExprValue *const_val);
176176void update_compile_var(CodeGen *g, Buf *name, ConstExprValue *value);
177177
178const char *type_id_name(TypeTableEntryId id);
179TypeTableEntryId type_id_at_index(size_t index);
178const char *type_id_name(ZigTypeId id);
179ZigTypeId type_id_at_index(size_t index);
180180size_t type_id_len();
181size_t type_id_index(TypeTableEntry *entry);
182TypeTableEntry *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id);
183Result<bool> type_is_copyable(CodeGen *g, TypeTableEntry *type_entry);
181size_t type_id_index(ZigType *entry);
182ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id);
183Result<bool> type_is_copyable(CodeGen *g, ZigType *type_entry);
184184LinkLib *create_link_lib(Buf *name);
185185bool calling_convention_does_first_arg_return(CallingConvention cc);
186186LinkLib *add_link_lib(CodeGen *codegen, Buf *lib);
187187
188uint32_t get_abi_alignment(CodeGen *g, TypeTableEntry *type_entry);
189TypeTableEntry *get_align_amt_type(CodeGen *g);
188uint32_t get_abi_alignment(CodeGen *g, ZigType *type_entry);
189ZigType *get_align_amt_type(CodeGen *g);
190190PackageTableEntry *new_anonymous_package(void);
191191
192192Buf *const_value_to_buffer(ConstExprValue *const_val);
......@@ -194,17 +194,17 @@ void add_fn_export(CodeGen *g, FnTableEntry *fn_table_entry, Buf *symbol_name, G
194194
195195
196196ConstExprValue *get_builtin_value(CodeGen *codegen, const char *name);
197TypeTableEntry *get_ptr_to_stack_trace_type(CodeGen *g);
198bool resolve_inferred_error_set(CodeGen *g, TypeTableEntry *err_set_type, AstNode *source_node);
197ZigType *get_ptr_to_stack_trace_type(CodeGen *g);
198bool resolve_inferred_error_set(CodeGen *g, ZigType *err_set_type, AstNode *source_node);
199199
200TypeTableEntry *get_auto_err_set_type(CodeGen *g, FnTableEntry *fn_entry);
200ZigType *get_auto_err_set_type(CodeGen *g, FnTableEntry *fn_entry);
201201
202202uint32_t get_coro_frame_align_bytes(CodeGen *g);
203203bool fn_type_can_fail(FnTypeId *fn_type_id);
204bool type_can_fail(TypeTableEntry *type_entry);
205bool fn_eval_cacheable(Scope *scope, TypeTableEntry *return_type);
206AstNode *type_decl_node(TypeTableEntry *type_entry);
204bool type_can_fail(ZigType *type_entry);
205bool fn_eval_cacheable(Scope *scope, ZigType *return_type);
206AstNode *type_decl_node(ZigType *type_entry);
207207
208TypeTableEntry *get_primitive_type(CodeGen *g, Buf *name);
208ZigType *get_primitive_type(CodeGen *g, Buf *name);
209209
210210#endif
src/codegen.cpp+192-192
......@@ -437,11 +437,11 @@ static uint32_t get_err_ret_trace_arg_index(CodeGen *g, FnTableEntry *fn_table_e
437437 if (fn_table_entry->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync) {
438438 return 0;
439439 }
440 TypeTableEntry *fn_type = fn_table_entry->type_entry;
440 ZigType *fn_type = fn_table_entry->type_entry;
441441 if (!fn_type_can_fail(&fn_type->data.fn.fn_type_id)) {
442442 return UINT32_MAX;
443443 }
444 TypeTableEntry *return_type = fn_type->data.fn.fn_type_id.return_type;
444 ZigType *return_type = fn_type->data.fn.fn_type_id.return_type;
445445 bool first_arg_ret = type_has_bits(return_type) && handle_is_ptr(return_type);
446446 return first_arg_ret ? 1 : 0;
447447}
......@@ -474,7 +474,7 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) {
474474 }
475475
476476
477 TypeTableEntry *fn_type = fn_table_entry->type_entry;
477 ZigType *fn_type = fn_table_entry->type_entry;
478478 LLVMTypeRef fn_llvm_type = fn_type->data.fn.raw_type_ref;
479479 if (fn_table_entry->body_node == nullptr) {
480480 LLVMValueRef existing_llvm_fn = LLVMGetNamedFunction(g->module, buf_ptr(symbol_name));
......@@ -532,7 +532,7 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) {
532532 LLVMSetUnnamedAddr(fn_table_entry->llvm_value, true);
533533 }
534534
535 TypeTableEntry *return_type = fn_type->data.fn.fn_type_id.return_type;
535 ZigType *return_type = fn_type->data.fn.fn_type_id.return_type;
536536 if (return_type->id == TypeTableEntryIdUnreachable) {
537537 addLLVMFnAttr(fn_table_entry->llvm_value, "noreturn");
538538 }
......@@ -596,7 +596,7 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) {
596596
597597 FnTypeParamInfo *param_info = &fn_type->data.fn.fn_type_id.param_info[param_i];
598598
599 TypeTableEntry *param_type = gen_info->type;
599 ZigType *param_type = gen_info->type;
600600 if (param_info->is_noalias) {
601601 addLLVMArgAttr(fn_table_entry->llvm_value, (unsigned)gen_index, "noalias");
602602 }
......@@ -688,7 +688,7 @@ static void clear_debug_source_node(CodeGen *g) {
688688 ZigLLVMClearCurrentDebugLocation(g->builder);
689689}
690690
691static LLVMValueRef get_arithmetic_overflow_fn(CodeGen *g, TypeTableEntry *type_entry,
691static LLVMValueRef get_arithmetic_overflow_fn(CodeGen *g, ZigType *type_entry,
692692 const char *signed_name, const char *unsigned_name)
693693{
694694 char fn_name[64];
......@@ -712,7 +712,7 @@ static LLVMValueRef get_arithmetic_overflow_fn(CodeGen *g, TypeTableEntry *type_
712712 return fn_val;
713713}
714714
715static LLVMValueRef get_int_overflow_fn(CodeGen *g, TypeTableEntry *type_entry, AddSubMul add_sub_mul) {
715static LLVMValueRef get_int_overflow_fn(CodeGen *g, ZigType *type_entry, AddSubMul add_sub_mul) {
716716 assert(type_entry->id == TypeTableEntryIdInt);
717717
718718 ZigLLVMFnKey key = {};
......@@ -742,7 +742,7 @@ static LLVMValueRef get_int_overflow_fn(CodeGen *g, TypeTableEntry *type_entry,
742742 return fn_val;
743743}
744744
745static LLVMValueRef get_float_fn(CodeGen *g, TypeTableEntry *type_entry, ZigLLVMFnId fn_id) {
745static LLVMValueRef get_float_fn(CodeGen *g, ZigType *type_entry, ZigLLVMFnId fn_id) {
746746 assert(type_entry->id == TypeTableEntryIdFloat);
747747
748748 ZigLLVMFnKey key = {};
......@@ -787,7 +787,7 @@ static LLVMValueRef gen_store_untyped(CodeGen *g, LLVMValueRef value, LLVMValueR
787787 return instruction;
788788}
789789
790static LLVMValueRef gen_store(CodeGen *g, LLVMValueRef value, LLVMValueRef ptr, TypeTableEntry *ptr_type) {
790static LLVMValueRef gen_store(CodeGen *g, LLVMValueRef value, LLVMValueRef ptr, ZigType *ptr_type) {
791791 assert(ptr_type->id == TypeTableEntryIdPointer);
792792 return gen_store_untyped(g, value, ptr, ptr_type->data.pointer.alignment, ptr_type->data.pointer.is_volatile);
793793}
......@@ -805,12 +805,12 @@ static LLVMValueRef gen_load_untyped(CodeGen *g, LLVMValueRef ptr, uint32_t alig
805805 return result;
806806}
807807
808static LLVMValueRef gen_load(CodeGen *g, LLVMValueRef ptr, TypeTableEntry *ptr_type, const char *name) {
808static LLVMValueRef gen_load(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type, const char *name) {
809809 assert(ptr_type->id == TypeTableEntryIdPointer);
810810 return gen_load_untyped(g, ptr, ptr_type->data.pointer.alignment, ptr_type->data.pointer.is_volatile, name);
811811}
812812
813static LLVMValueRef get_handle_value(CodeGen *g, LLVMValueRef ptr, TypeTableEntry *type, TypeTableEntry *ptr_type) {
813static LLVMValueRef get_handle_value(CodeGen *g, LLVMValueRef ptr, ZigType *type, ZigType *ptr_type) {
814814 if (type_has_bits(type)) {
815815 if (handle_is_ptr(type)) {
816816 return ptr;
......@@ -918,9 +918,9 @@ static LLVMValueRef get_panic_msg_ptr_val(CodeGen *g, PanicMsgId msg_id) {
918918 assert(val->global_refs->llvm_global);
919919 }
920920
921 TypeTableEntry *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
921 ZigType *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
922922 PtrLenUnknown, get_abi_alignment(g, g->builtin_types.entry_u8), 0, 0);
923 TypeTableEntry *str_type = get_slice_type(g, u8_ptr_type);
923 ZigType *str_type = get_slice_type(g, u8_ptr_type);
924924 return LLVMConstBitCast(val->global_refs->llvm_global, LLVMPointerType(str_type->type_ref, 0));
925925}
926926
......@@ -929,7 +929,7 @@ static void gen_panic(CodeGen *g, LLVMValueRef msg_arg, LLVMValueRef stack_trace
929929 LLVMValueRef fn_val = fn_llvm_value(g, g->panic_fn);
930930 LLVMCallConv llvm_cc = get_llvm_cc(g, g->panic_fn->type_entry->data.fn.fn_type_id.cc);
931931 if (stack_trace_arg == nullptr) {
932 TypeTableEntry *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(g);
932 ZigType *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(g);
933933 stack_trace_arg = LLVMConstNull(ptr_to_stack_trace_type->type_ref);
934934 }
935935 LLVMValueRef args[] = {
......@@ -1186,7 +1186,7 @@ static LLVMValueRef get_return_address_fn_val(CodeGen *g) {
11861186 if (g->return_address_fn_val)
11871187 return g->return_address_fn_val;
11881188
1189 TypeTableEntry *return_type = get_pointer_to_type(g, g->builtin_types.entry_u8, true);
1189 ZigType *return_type = get_pointer_to_type(g, g->builtin_types.entry_u8, true);
11901190
11911191 LLVMTypeRef fn_type = LLVMFunctionType(return_type->type_ref,
11921192 &g->builtin_types.entry_i32->type_ref, 1, false);
......@@ -1237,7 +1237,7 @@ static LLVMValueRef get_add_error_return_trace_addr_fn(CodeGen *g) {
12371237 size_t addresses_field_index = g->stack_trace_type->data.structure.fields[1].gen_index;
12381238 LLVMValueRef addresses_field_ptr = LLVMBuildStructGEP(g->builder, err_ret_trace_ptr, (unsigned)addresses_field_index, "");
12391239
1240 TypeTableEntry *slice_type = g->stack_trace_type->data.structure.fields[1].type_entry;
1240 ZigType *slice_type = g->stack_trace_type->data.structure.fields[1].type_entry;
12411241 size_t ptr_field_index = slice_type->data.structure.fields[slice_ptr_index].gen_index;
12421242 LLVMValueRef ptr_field_ptr = LLVMBuildStructGEP(g->builder, addresses_field_ptr, (unsigned)ptr_field_index, "");
12431243 size_t len_field_index = slice_type->data.structure.fields[slice_len_index].gen_index;
......@@ -1337,7 +1337,7 @@ static LLVMValueRef get_merge_err_ret_traces_fn_val(CodeGen *g) {
13371337 (unsigned)src_index_field_index, "");
13381338 LLVMValueRef src_addresses_field_ptr = LLVMBuildStructGEP(g->builder, src_stack_trace_ptr,
13391339 (unsigned)src_addresses_field_index, "");
1340 TypeTableEntry *slice_type = g->stack_trace_type->data.structure.fields[1].type_entry;
1340 ZigType *slice_type = g->stack_trace_type->data.structure.fields[1].type_entry;
13411341 size_t ptr_field_index = slice_type->data.structure.fields[slice_ptr_index].gen_index;
13421342 LLVMValueRef src_ptr_field_ptr = LLVMBuildStructGEP(g->builder, src_addresses_field_ptr, (unsigned)ptr_field_index, "");
13431343 size_t len_field_index = slice_type->data.structure.fields[slice_len_index].gen_index;
......@@ -1479,7 +1479,7 @@ static LLVMValueRef get_safety_crash_err_fn(CodeGen *g) {
14791479 LLVMSetUnnamedAddr(global_array, true);
14801480 LLVMSetAlignment(global_array, u8_align_bytes);
14811481
1482 TypeTableEntry *usize = g->builtin_types.entry_usize;
1482 ZigType *usize = g->builtin_types.entry_usize;
14831483 LLVMValueRef full_buf_ptr_indices[] = {
14841484 LLVMConstNull(usize->type_ref),
14851485 LLVMConstNull(usize->type_ref),
......@@ -1487,9 +1487,9 @@ static LLVMValueRef get_safety_crash_err_fn(CodeGen *g) {
14871487 LLVMValueRef full_buf_ptr = LLVMConstInBoundsGEP(global_array, full_buf_ptr_indices, 2);
14881488
14891489
1490 TypeTableEntry *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
1490 ZigType *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
14911491 PtrLenUnknown, get_abi_alignment(g, g->builtin_types.entry_u8), 0, 0);
1492 TypeTableEntry *str_type = get_slice_type(g, u8_ptr_type);
1492 ZigType *str_type = get_slice_type(g, u8_ptr_type);
14931493 LLVMValueRef global_slice_fields[] = {
14941494 full_buf_ptr,
14951495 LLVMConstNull(usize->type_ref),
......@@ -1603,7 +1603,7 @@ static void gen_safety_crash_for_err(CodeGen *g, LLVMValueRef err_val, Scope *sc
16031603 LLVMValueRef safety_crash_err_fn = get_safety_crash_err_fn(g);
16041604 LLVMValueRef err_ret_trace_val = get_cur_err_ret_trace_val(g, scope);
16051605 if (err_ret_trace_val == nullptr) {
1606 TypeTableEntry *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(g);
1606 ZigType *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(g);
16071607 err_ret_trace_val = LLVMConstNull(ptr_to_stack_trace_type->type_ref);
16081608 }
16091609 LLVMValueRef args[] = {
......@@ -1649,8 +1649,8 @@ static void add_bounds_check(CodeGen *g, LLVMValueRef target_val,
16491649 LLVMPositionBuilderAtEnd(g->builder, ok_block);
16501650}
16511651
1652static LLVMValueRef gen_widen_or_shorten(CodeGen *g, bool want_runtime_safety, TypeTableEntry *actual_type,
1653 TypeTableEntry *wanted_type, LLVMValueRef expr_val)
1652static LLVMValueRef gen_widen_or_shorten(CodeGen *g, bool want_runtime_safety, ZigType *actual_type,
1653 ZigType *wanted_type, LLVMValueRef expr_val)
16541654{
16551655 assert(actual_type->id == wanted_type->id);
16561656
......@@ -1729,7 +1729,7 @@ static LLVMValueRef gen_widen_or_shorten(CodeGen *g, bool want_runtime_safety, T
17291729 }
17301730}
17311731
1732static LLVMValueRef gen_overflow_op(CodeGen *g, TypeTableEntry *type_entry, AddSubMul op,
1732static LLVMValueRef gen_overflow_op(CodeGen *g, ZigType *type_entry, AddSubMul op,
17331733 LLVMValueRef val1, LLVMValueRef val2)
17341734{
17351735 LLVMValueRef fn_val = get_int_overflow_fn(g, type_entry, op);
......@@ -1789,11 +1789,11 @@ static LLVMRealPredicate cmp_op_to_real_predicate(IrBinOp cmp_op) {
17891789 }
17901790}
17911791
1792static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, TypeTableEntry *ptr_type,
1792static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type,
17931793 LLVMValueRef value)
17941794{
17951795 assert(ptr_type->id == TypeTableEntryIdPointer);
1796 TypeTableEntry *child_type = ptr_type->data.pointer.child_type;
1796 ZigType *child_type = ptr_type->data.pointer.child_type;
17971797
17981798 if (!type_has_bits(child_type))
17991799 return nullptr;
......@@ -1807,7 +1807,7 @@ static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, TypeTableEntry
18071807 LLVMValueRef src_ptr = LLVMBuildBitCast(g->builder, value, ptr_u8, "");
18081808 LLVMValueRef dest_ptr = LLVMBuildBitCast(g->builder, ptr, ptr_u8, "");
18091809
1810 TypeTableEntry *usize = g->builtin_types.entry_usize;
1810 ZigType *usize = g->builtin_types.entry_usize;
18111811 uint64_t size_bytes = LLVMStoreSizeOfType(g->target_data_ref, child_type->type_ref);
18121812 uint64_t align_bytes = ptr_type->data.pointer.alignment;
18131813 assert(size_bytes > 0);
......@@ -1876,7 +1876,7 @@ static LLVMValueRef ir_llvm_value(CodeGen *g, IrInstruction *instruction) {
18761876 // values are rendered with a type other than the one we expect
18771877 if (handle_is_ptr(instruction->value.type)) {
18781878 render_const_val_global(g, &instruction->value, "");
1879 TypeTableEntry *ptr_type = get_pointer_to_type(g, instruction->value.type, true);
1879 ZigType *ptr_type = get_pointer_to_type(g, instruction->value.type, true);
18801880 instruction->llvm_value = LLVMBuildBitCast(g->builder, instruction->value.global_refs->llvm_global, ptr_type->type_ref, "");
18811881 } else if (instruction->value.type->id == TypeTableEntryIdPointer) {
18821882 instruction->llvm_value = LLVMBuildBitCast(g->builder, instruction->value.global_refs->llvm_value, instruction->value.type->type_ref, "");
......@@ -1904,7 +1904,7 @@ static LLVMValueRef ir_render_save_err_ret_addr(CodeGen *g, IrExecutable *execut
19041904
19051905static LLVMValueRef ir_render_return(CodeGen *g, IrExecutable *executable, IrInstructionReturn *return_instruction) {
19061906 LLVMValueRef value = ir_llvm_value(g, return_instruction->value);
1907 TypeTableEntry *return_type = return_instruction->value->value.type;
1907 ZigType *return_type = return_instruction->value->value.type;
19081908
19091909 if (handle_is_ptr(return_type)) {
19101910 if (calling_convention_does_first_arg_return(g->cur_fn->type_entry->data.fn.fn_type_id.cc)) {
......@@ -1921,7 +1921,7 @@ static LLVMValueRef ir_render_return(CodeGen *g, IrExecutable *executable, IrIns
19211921 return nullptr;
19221922}
19231923
1924static LLVMValueRef gen_overflow_shl_op(CodeGen *g, TypeTableEntry *type_entry,
1924static LLVMValueRef gen_overflow_shl_op(CodeGen *g, ZigType *type_entry,
19251925 LLVMValueRef val1, LLVMValueRef val2)
19261926{
19271927 // for unsigned left shifting, we do the lossy shift, then logically shift
......@@ -1951,7 +1951,7 @@ static LLVMValueRef gen_overflow_shl_op(CodeGen *g, TypeTableEntry *type_entry,
19511951 return result;
19521952}
19531953
1954static LLVMValueRef gen_overflow_shr_op(CodeGen *g, TypeTableEntry *type_entry,
1954static LLVMValueRef gen_overflow_shr_op(CodeGen *g, ZigType *type_entry,
19551955 LLVMValueRef val1, LLVMValueRef val2)
19561956{
19571957 assert(type_entry->id == TypeTableEntryIdInt);
......@@ -1976,7 +1976,7 @@ static LLVMValueRef gen_overflow_shr_op(CodeGen *g, TypeTableEntry *type_entry,
19761976 return result;
19771977}
19781978
1979static LLVMValueRef gen_floor(CodeGen *g, LLVMValueRef val, TypeTableEntry *type_entry) {
1979static LLVMValueRef gen_floor(CodeGen *g, LLVMValueRef val, ZigType *type_entry) {
19801980 if (type_entry->id == TypeTableEntryIdInt)
19811981 return val;
19821982
......@@ -1984,7 +1984,7 @@ static LLVMValueRef gen_floor(CodeGen *g, LLVMValueRef val, TypeTableEntry *type
19841984 return LLVMBuildCall(g->builder, floor_fn, &val, 1, "");
19851985}
19861986
1987static LLVMValueRef gen_ceil(CodeGen *g, LLVMValueRef val, TypeTableEntry *type_entry) {
1987static LLVMValueRef gen_ceil(CodeGen *g, LLVMValueRef val, ZigType *type_entry) {
19881988 if (type_entry->id == TypeTableEntryIdInt)
19891989 return val;
19901990
......@@ -2018,7 +2018,7 @@ static LLVMValueRef bigint_to_llvm_const(LLVMTypeRef type_ref, BigInt *bigint) {
20182018
20192019static LLVMValueRef gen_div(CodeGen *g, bool want_runtime_safety, bool want_fast_math,
20202020 LLVMValueRef val1, LLVMValueRef val2,
2021 TypeTableEntry *type_entry, DivKind div_kind)
2021 ZigType *type_entry, DivKind div_kind)
20222022{
20232023 ZigLLVMSetFastMath(g->builder, want_fast_math);
20242024
......@@ -2177,7 +2177,7 @@ enum RemKind {
21772177
21782178static LLVMValueRef gen_rem(CodeGen *g, bool want_runtime_safety, bool want_fast_math,
21792179 LLVMValueRef val1, LLVMValueRef val2,
2180 TypeTableEntry *type_entry, RemKind rem_kind)
2180 ZigType *type_entry, RemKind rem_kind)
21812181{
21822182 ZigLLVMSetFastMath(g->builder, want_fast_math);
21832183
......@@ -2246,7 +2246,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
22462246 (op_id == IrBinOpAdd || op_id == IrBinOpSub) &&
22472247 op1->value.type->data.pointer.ptr_len == PtrLenUnknown)
22482248 );
2249 TypeTableEntry *type_entry = op1->value.type;
2249 ZigType *type_entry = op1->value.type;
22502250
22512251 bool want_runtime_safety = bin_op_instruction->safety_check_on &&
22522252 ir_want_runtime_safety(g, &bin_op_instruction->base);
......@@ -2421,7 +2421,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
24212421 zig_unreachable();
24222422}
24232423
2424static void add_error_range_check(CodeGen *g, TypeTableEntry *err_set_type, TypeTableEntry *int_type, LLVMValueRef target_val) {
2424static void add_error_range_check(CodeGen *g, ZigType *err_set_type, ZigType *int_type, LLVMValueRef target_val) {
24252425 assert(err_set_type->id == TypeTableEntryIdErrorSet);
24262426
24272427 if (type_is_global_error_set(err_set_type)) {
......@@ -2472,8 +2472,8 @@ static void add_error_range_check(CodeGen *g, TypeTableEntry *err_set_type, Type
24722472static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
24732473 IrInstructionCast *cast_instruction)
24742474{
2475 TypeTableEntry *actual_type = cast_instruction->value->value.type;
2476 TypeTableEntry *wanted_type = cast_instruction->base.value.type;
2475 ZigType *actual_type = cast_instruction->value->value.type;
2476 ZigType *wanted_type = cast_instruction->base.value.type;
24772477 LLVMValueRef expr_val = ir_llvm_value(g, cast_instruction->value);
24782478 assert(expr_val);
24792479
......@@ -2491,10 +2491,10 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
24912491 assert(actual_type->id == TypeTableEntryIdStruct);
24922492 assert(actual_type->data.structure.is_slice);
24932493
2494 TypeTableEntry *actual_pointer_type = actual_type->data.structure.fields[0].type_entry;
2495 TypeTableEntry *actual_child_type = actual_pointer_type->data.pointer.child_type;
2496 TypeTableEntry *wanted_pointer_type = wanted_type->data.structure.fields[0].type_entry;
2497 TypeTableEntry *wanted_child_type = wanted_pointer_type->data.pointer.child_type;
2494 ZigType *actual_pointer_type = actual_type->data.structure.fields[0].type_entry;
2495 ZigType *actual_child_type = actual_pointer_type->data.pointer.child_type;
2496 ZigType *wanted_pointer_type = wanted_type->data.structure.fields[0].type_entry;
2497 ZigType *wanted_child_type = wanted_pointer_type->data.pointer.child_type;
24982498
24992499
25002500 size_t actual_ptr_index = actual_type->data.structure.fields[slice_ptr_index].gen_index;
......@@ -2553,8 +2553,8 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
25532553 assert(wanted_type->data.structure.is_slice);
25542554 assert(actual_type->id == TypeTableEntryIdArray);
25552555
2556 TypeTableEntry *wanted_pointer_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
2557 TypeTableEntry *wanted_child_type = wanted_pointer_type->data.pointer.child_type;
2556 ZigType *wanted_pointer_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
2557 ZigType *wanted_child_type = wanted_pointer_type->data.pointer.child_type;
25582558
25592559
25602560 size_t wanted_ptr_index = wanted_type->data.structure.fields[0].gen_index;
......@@ -2628,7 +2628,7 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
26282628 case CastOpPtrOfArrayToSlice: {
26292629 assert(cast_instruction->tmp_ptr);
26302630 assert(actual_type->id == TypeTableEntryIdPointer);
2631 TypeTableEntry *array_type = actual_type->data.pointer.child_type;
2631 ZigType *array_type = actual_type->data.pointer.child_type;
26322632 assert(array_type->id == TypeTableEntryIdArray);
26332633
26342634 LLVMValueRef ptr_field_ptr = LLVMBuildStructGEP(g->builder, cast_instruction->tmp_ptr,
......@@ -2655,7 +2655,7 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
26552655static LLVMValueRef ir_render_ptr_cast(CodeGen *g, IrExecutable *executable,
26562656 IrInstructionPtrCast *instruction)
26572657{
2658 TypeTableEntry *wanted_type = instruction->base.value.type;
2658 ZigType *wanted_type = instruction->base.value.type;
26592659 if (!type_has_bits(wanted_type)) {
26602660 return nullptr;
26612661 }
......@@ -2666,7 +2666,7 @@ static LLVMValueRef ir_render_ptr_cast(CodeGen *g, IrExecutable *executable,
26662666static LLVMValueRef ir_render_bit_cast(CodeGen *g, IrExecutable *executable,
26672667 IrInstructionBitCast *instruction)
26682668{
2669 TypeTableEntry *wanted_type = instruction->base.value.type;
2669 ZigType *wanted_type = instruction->base.value.type;
26702670 LLVMValueRef value = ir_llvm_value(g, instruction->value);
26712671 return LLVMBuildBitCast(g->builder, value, wanted_type->type_ref, "");
26722672}
......@@ -2674,10 +2674,10 @@ static LLVMValueRef ir_render_bit_cast(CodeGen *g, IrExecutable *executable,
26742674static LLVMValueRef ir_render_widen_or_shorten(CodeGen *g, IrExecutable *executable,
26752675 IrInstructionWidenOrShorten *instruction)
26762676{
2677 TypeTableEntry *actual_type = instruction->target->value.type;
2677 ZigType *actual_type = instruction->target->value.type;
26782678 // TODO instead of this logic, use the Noop instruction to change the type from
26792679 // enum_tag to the underlying int type
2680 TypeTableEntry *int_type;
2680 ZigType *int_type;
26812681 if (actual_type->id == TypeTableEntryIdEnum) {
26822682 int_type = actual_type->data.enumeration.tag_int_type;
26832683 } else {
......@@ -2689,21 +2689,21 @@ static LLVMValueRef ir_render_widen_or_shorten(CodeGen *g, IrExecutable *executa
26892689}
26902690
26912691static LLVMValueRef ir_render_int_to_ptr(CodeGen *g, IrExecutable *executable, IrInstructionIntToPtr *instruction) {
2692 TypeTableEntry *wanted_type = instruction->base.value.type;
2692 ZigType *wanted_type = instruction->base.value.type;
26932693 LLVMValueRef target_val = ir_llvm_value(g, instruction->target);
26942694 return LLVMBuildIntToPtr(g->builder, target_val, wanted_type->type_ref, "");
26952695}
26962696
26972697static LLVMValueRef ir_render_ptr_to_int(CodeGen *g, IrExecutable *executable, IrInstructionPtrToInt *instruction) {
2698 TypeTableEntry *wanted_type = instruction->base.value.type;
2698 ZigType *wanted_type = instruction->base.value.type;
26992699 LLVMValueRef target_val = ir_llvm_value(g, instruction->target);
27002700 return LLVMBuildPtrToInt(g->builder, target_val, wanted_type->type_ref, "");
27012701}
27022702
27032703static LLVMValueRef ir_render_int_to_enum(CodeGen *g, IrExecutable *executable, IrInstructionIntToEnum *instruction) {
2704 TypeTableEntry *wanted_type = instruction->base.value.type;
2704 ZigType *wanted_type = instruction->base.value.type;
27052705 assert(wanted_type->id == TypeTableEntryIdEnum);
2706 TypeTableEntry *tag_int_type = wanted_type->data.enumeration.tag_int_type;
2706 ZigType *tag_int_type = wanted_type->data.enumeration.tag_int_type;
27072707
27082708 LLVMValueRef target_val = ir_llvm_value(g, instruction->target);
27092709 LLVMValueRef tag_int_value = gen_widen_or_shorten(g, ir_want_runtime_safety(g, &instruction->base),
......@@ -2728,10 +2728,10 @@ static LLVMValueRef ir_render_int_to_enum(CodeGen *g, IrExecutable *executable,
27282728}
27292729
27302730static LLVMValueRef ir_render_int_to_err(CodeGen *g, IrExecutable *executable, IrInstructionIntToErr *instruction) {
2731 TypeTableEntry *wanted_type = instruction->base.value.type;
2731 ZigType *wanted_type = instruction->base.value.type;
27322732 assert(wanted_type->id == TypeTableEntryIdErrorSet);
27332733
2734 TypeTableEntry *actual_type = instruction->target->value.type;
2734 ZigType *actual_type = instruction->target->value.type;
27352735 assert(actual_type->id == TypeTableEntryIdInt);
27362736 assert(!actual_type->data.integral.is_signed);
27372737
......@@ -2745,11 +2745,11 @@ static LLVMValueRef ir_render_int_to_err(CodeGen *g, IrExecutable *executable, I
27452745}
27462746
27472747static LLVMValueRef ir_render_err_to_int(CodeGen *g, IrExecutable *executable, IrInstructionErrToInt *instruction) {
2748 TypeTableEntry *wanted_type = instruction->base.value.type;
2748 ZigType *wanted_type = instruction->base.value.type;
27492749 assert(wanted_type->id == TypeTableEntryIdInt);
27502750 assert(!wanted_type->data.integral.is_signed);
27512751
2752 TypeTableEntry *actual_type = instruction->target->value.type;
2752 ZigType *actual_type = instruction->target->value.type;
27532753 LLVMValueRef target_val = ir_llvm_value(g, instruction->target);
27542754
27552755 if (actual_type->id == TypeTableEntryIdErrorSet) {
......@@ -2799,7 +2799,7 @@ static LLVMValueRef ir_render_br(CodeGen *g, IrExecutable *executable, IrInstruc
27992799static LLVMValueRef ir_render_un_op(CodeGen *g, IrExecutable *executable, IrInstructionUnOp *un_op_instruction) {
28002800 IrUnOp op_id = un_op_instruction->op_id;
28012801 LLVMValueRef expr = ir_llvm_value(g, un_op_instruction->value);
2802 TypeTableEntry *expr_type = un_op_instruction->value->value.type;
2802 ZigType *expr_type = un_op_instruction->value->value.type;
28032803
28042804 switch (op_id) {
28052805 case IrUnOpInvalid:
......@@ -2880,13 +2880,13 @@ static LLVMValueRef ir_render_decl_var(CodeGen *g, IrExecutable *executable,
28802880
28812881 if (have_init_expr) {
28822882 assert(var->value->type == init_value->value.type);
2883 TypeTableEntry *var_ptr_type = get_pointer_to_type_extra(g, var->value->type, false, false,
2883 ZigType *var_ptr_type = get_pointer_to_type_extra(g, var->value->type, false, false,
28842884 PtrLenSingle, var->align_bytes, 0, 0);
28852885 gen_assign_raw(g, var->value_ref, var_ptr_type, ir_llvm_value(g, init_value));
28862886 } else {
28872887 bool want_safe = ir_want_runtime_safety(g, &decl_var_instruction->base);
28882888 if (want_safe) {
2889 TypeTableEntry *usize = g->builtin_types.entry_usize;
2889 ZigType *usize = g->builtin_types.entry_usize;
28902890 uint64_t size_bytes = LLVMStoreSizeOfType(g->target_data_ref, var->value->type->type_ref);
28912891 assert(size_bytes > 0);
28922892
......@@ -2915,12 +2915,12 @@ static LLVMValueRef ir_render_decl_var(CodeGen *g, IrExecutable *executable,
29152915}
29162916
29172917static LLVMValueRef ir_render_load_ptr(CodeGen *g, IrExecutable *executable, IrInstructionLoadPtr *instruction) {
2918 TypeTableEntry *child_type = instruction->base.value.type;
2918 ZigType *child_type = instruction->base.value.type;
29192919 if (!type_has_bits(child_type))
29202920 return nullptr;
29212921
29222922 LLVMValueRef ptr = ir_llvm_value(g, instruction->ptr);
2923 TypeTableEntry *ptr_type = instruction->ptr->value.type;
2923 ZigType *ptr_type = instruction->ptr->value.type;
29242924 assert(ptr_type->id == TypeTableEntryIdPointer);
29252925
29262926 uint32_t unaligned_bit_count = ptr_type->data.pointer.unaligned_bit_count;
......@@ -2947,7 +2947,7 @@ static LLVMValueRef ir_render_store_ptr(CodeGen *g, IrExecutable *executable, Ir
29472947 LLVMValueRef value = ir_llvm_value(g, instruction->value);
29482948
29492949 assert(instruction->ptr->value.type->id == TypeTableEntryIdPointer);
2950 TypeTableEntry *ptr_type = instruction->ptr->value.type;
2950 ZigType *ptr_type = instruction->ptr->value.type;
29512951
29522952 gen_assign_raw(g, ptr, ptr_type, value);
29532953
......@@ -2966,9 +2966,9 @@ static LLVMValueRef ir_render_var_ptr(CodeGen *g, IrExecutable *executable, IrIn
29662966
29672967static LLVMValueRef ir_render_elem_ptr(CodeGen *g, IrExecutable *executable, IrInstructionElemPtr *instruction) {
29682968 LLVMValueRef array_ptr_ptr = ir_llvm_value(g, instruction->array_ptr);
2969 TypeTableEntry *array_ptr_type = instruction->array_ptr->value.type;
2969 ZigType *array_ptr_type = instruction->array_ptr->value.type;
29702970 assert(array_ptr_type->id == TypeTableEntryIdPointer);
2971 TypeTableEntry *array_type = array_ptr_type->data.pointer.child_type;
2971 ZigType *array_type = array_ptr_type->data.pointer.child_type;
29722972 LLVMValueRef array_ptr = get_handle_value(g, array_ptr_ptr, array_type, array_ptr_type);
29732973 LLVMValueRef subscript_value = ir_llvm_value(g, instruction->elem_index);
29742974 assert(subscript_value);
......@@ -2993,7 +2993,7 @@ static LLVMValueRef ir_render_elem_ptr(CodeGen *g, IrExecutable *executable, IrI
29932993 if (array_ptr_type->data.pointer.unaligned_bit_count != 0) {
29942994 return array_ptr_ptr;
29952995 }
2996 TypeTableEntry *child_type = array_type->data.array.child_type;
2996 ZigType *child_type = array_type->data.array.child_type;
29972997 if (child_type->id == TypeTableEntryIdStruct &&
29982998 child_type->data.structure.layout == ContainerLayoutPacked)
29992999 {
......@@ -3113,7 +3113,7 @@ static void set_call_instr_sret(CodeGen *g, LLVMValueRef call_instr) {
31133113
31143114static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstructionCall *instruction) {
31153115 LLVMValueRef fn_val;
3116 TypeTableEntry *fn_type;
3116 ZigType *fn_type;
31173117 if (instruction->fn_entry) {
31183118 fn_val = fn_llvm_value(g, instruction->fn_entry);
31193119 fn_type = instruction->fn_entry->type_entry;
......@@ -3125,7 +3125,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
31253125
31263126 FnTypeId *fn_type_id = &fn_type->data.fn.fn_type_id;
31273127
3128 TypeTableEntry *src_return_type = fn_type_id->return_type;
3128 ZigType *src_return_type = fn_type_id->return_type;
31293129 bool ret_has_bits = type_has_bits(src_return_type);
31303130
31313131 bool first_arg_ret = ret_has_bits && handle_is_ptr(src_return_type) &&
......@@ -3154,7 +3154,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
31543154 }
31553155 for (size_t call_i = 0; call_i < instruction->arg_count; call_i += 1) {
31563156 IrInstruction *param_instruction = instruction->args[call_i];
3157 TypeTableEntry *param_type = param_instruction->value.type;
3157 ZigType *param_type = param_instruction->value.type;
31583158 if (is_var_args || type_has_bits(param_type)) {
31593159 LLVMValueRef param_value = ir_llvm_value(g, param_instruction);
31603160 assert(param_value);
......@@ -3222,7 +3222,7 @@ static LLVMValueRef ir_render_struct_field_ptr(CodeGen *g, IrExecutable *executa
32223222{
32233223 LLVMValueRef struct_ptr = ir_llvm_value(g, instruction->struct_ptr);
32243224 // not necessarily a pointer. could be TypeTableEntryIdStruct
3225 TypeTableEntry *struct_ptr_type = instruction->struct_ptr->value.type;
3225 ZigType *struct_ptr_type = instruction->struct_ptr->value.type;
32263226 TypeStructField *field = instruction->field;
32273227
32283228 if (!type_has_bits(field->type_entry))
......@@ -3241,9 +3241,9 @@ static LLVMValueRef ir_render_struct_field_ptr(CodeGen *g, IrExecutable *executa
32413241static LLVMValueRef ir_render_union_field_ptr(CodeGen *g, IrExecutable *executable,
32423242 IrInstructionUnionFieldPtr *instruction)
32433243{
3244 TypeTableEntry *union_ptr_type = instruction->union_ptr->value.type;
3244 ZigType *union_ptr_type = instruction->union_ptr->value.type;
32453245 assert(union_ptr_type->id == TypeTableEntryIdPointer);
3246 TypeTableEntry *union_type = union_ptr_type->data.pointer.child_type;
3246 ZigType *union_type = union_ptr_type->data.pointer.child_type;
32473247 assert(union_type->id == TypeTableEntryIdUnion);
32483248
32493249 TypeUnionField *field = instruction->field;
......@@ -3411,9 +3411,9 @@ static LLVMValueRef ir_render_asm(CodeGen *g, IrExecutable *executable, IrInstru
34113411 return LLVMBuildCall(g->builder, asm_fn, param_values, (unsigned)input_and_output_count, "");
34123412}
34133413
3414static LLVMValueRef gen_non_null_bit(CodeGen *g, TypeTableEntry *maybe_type, LLVMValueRef maybe_handle) {
3414static LLVMValueRef gen_non_null_bit(CodeGen *g, ZigType *maybe_type, LLVMValueRef maybe_handle) {
34153415 assert(maybe_type->id == TypeTableEntryIdOptional);
3416 TypeTableEntry *child_type = maybe_type->data.maybe.child_type;
3416 ZigType *child_type = maybe_type->data.maybe.child_type;
34173417 if (child_type->zero_bits) {
34183418 return maybe_handle;
34193419 } else {
......@@ -3436,11 +3436,11 @@ static LLVMValueRef ir_render_test_non_null(CodeGen *g, IrExecutable *executable
34363436static LLVMValueRef ir_render_unwrap_maybe(CodeGen *g, IrExecutable *executable,
34373437 IrInstructionUnwrapOptional *instruction)
34383438{
3439 TypeTableEntry *ptr_type = instruction->value->value.type;
3439 ZigType *ptr_type = instruction->value->value.type;
34403440 assert(ptr_type->id == TypeTableEntryIdPointer);
3441 TypeTableEntry *maybe_type = ptr_type->data.pointer.child_type;
3441 ZigType *maybe_type = ptr_type->data.pointer.child_type;
34423442 assert(maybe_type->id == TypeTableEntryIdOptional);
3443 TypeTableEntry *child_type = maybe_type->data.maybe.child_type;
3443 ZigType *child_type = maybe_type->data.maybe.child_type;
34443444 LLVMValueRef maybe_ptr = ir_llvm_value(g, instruction->value);
34453445 LLVMValueRef maybe_handle = get_handle_value(g, maybe_ptr, maybe_type, ptr_type);
34463446 if (ir_want_runtime_safety(g, &instruction->base) && instruction->safety_check_on) {
......@@ -3467,7 +3467,7 @@ static LLVMValueRef ir_render_unwrap_maybe(CodeGen *g, IrExecutable *executable,
34673467 }
34683468}
34693469
3470static LLVMValueRef get_int_builtin_fn(CodeGen *g, TypeTableEntry *int_type, BuiltinFnId fn_id) {
3470static LLVMValueRef get_int_builtin_fn(CodeGen *g, ZigType *int_type, BuiltinFnId fn_id) {
34713471 ZigLLVMFnKey key = {};
34723472 const char *fn_name;
34733473 uint32_t n_args;
......@@ -3510,7 +3510,7 @@ static LLVMValueRef get_int_builtin_fn(CodeGen *g, TypeTableEntry *int_type, Bui
35103510}
35113511
35123512static LLVMValueRef ir_render_clz(CodeGen *g, IrExecutable *executable, IrInstructionClz *instruction) {
3513 TypeTableEntry *int_type = instruction->value->value.type;
3513 ZigType *int_type = instruction->value->value.type;
35143514 LLVMValueRef fn_val = get_int_builtin_fn(g, int_type, BuiltinFnIdClz);
35153515 LLVMValueRef operand = ir_llvm_value(g, instruction->value);
35163516 LLVMValueRef params[] {
......@@ -3522,7 +3522,7 @@ static LLVMValueRef ir_render_clz(CodeGen *g, IrExecutable *executable, IrInstru
35223522}
35233523
35243524static LLVMValueRef ir_render_ctz(CodeGen *g, IrExecutable *executable, IrInstructionCtz *instruction) {
3525 TypeTableEntry *int_type = instruction->value->value.type;
3525 ZigType *int_type = instruction->value->value.type;
35263526 LLVMValueRef fn_val = get_int_builtin_fn(g, int_type, BuiltinFnIdCtz);
35273527 LLVMValueRef operand = ir_llvm_value(g, instruction->value);
35283528 LLVMValueRef params[] {
......@@ -3534,7 +3534,7 @@ static LLVMValueRef ir_render_ctz(CodeGen *g, IrExecutable *executable, IrInstru
35343534}
35353535
35363536static LLVMValueRef ir_render_pop_count(CodeGen *g, IrExecutable *executable, IrInstructionPopCount *instruction) {
3537 TypeTableEntry *int_type = instruction->value->value.type;
3537 ZigType *int_type = instruction->value->value.type;
35383538 LLVMValueRef fn_val = get_int_builtin_fn(g, int_type, BuiltinFnIdPopCount);
35393539 LLVMValueRef operand = ir_llvm_value(g, instruction->value);
35403540 LLVMValueRef wrong_size_int = LLVMBuildCall(g->builder, fn_val, &operand, 1, "");
......@@ -3611,15 +3611,15 @@ static LLVMValueRef ir_render_err_name(CodeGen *g, IrExecutable *executable, IrI
36113611 return LLVMBuildInBoundsGEP(g->builder, g->err_name_table, indices, 2, "");
36123612}
36133613
3614static LLVMValueRef get_enum_tag_name_function(CodeGen *g, TypeTableEntry *enum_type) {
3614static LLVMValueRef get_enum_tag_name_function(CodeGen *g, ZigType *enum_type) {
36153615 assert(enum_type->id == TypeTableEntryIdEnum);
36163616 if (enum_type->data.enumeration.name_function)
36173617 return enum_type->data.enumeration.name_function;
36183618
3619 TypeTableEntry *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, false, false,
3619 ZigType *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, false, false,
36203620 PtrLenUnknown, get_abi_alignment(g, g->builtin_types.entry_u8), 0, 0);
3621 TypeTableEntry *u8_slice_type = get_slice_type(g, u8_ptr_type);
3622 TypeTableEntry *tag_int_type = enum_type->data.enumeration.tag_int_type;
3621 ZigType *u8_slice_type = get_slice_type(g, u8_ptr_type);
3622 ZigType *tag_int_type = enum_type->data.enumeration.tag_int_type;
36233623
36243624 LLVMTypeRef fn_type_ref = LLVMFunctionType(LLVMPointerType(u8_slice_type->type_ref, 0),
36253625 &tag_int_type->type_ref, 1, false);
......@@ -3652,7 +3652,7 @@ static LLVMValueRef get_enum_tag_name_function(CodeGen *g, TypeTableEntry *enum_
36523652 LLVMValueRef switch_instr = LLVMBuildSwitch(g->builder, tag_int_value, bad_value_block, field_count);
36533653
36543654
3655 TypeTableEntry *usize = g->builtin_types.entry_usize;
3655 ZigType *usize = g->builtin_types.entry_usize;
36563656 LLVMValueRef array_ptr_indices[] = {
36573657 LLVMConstNull(usize->type_ref),
36583658 LLVMConstNull(usize->type_ref),
......@@ -3709,7 +3709,7 @@ static LLVMValueRef get_enum_tag_name_function(CodeGen *g, TypeTableEntry *enum_
37093709static LLVMValueRef ir_render_enum_tag_name(CodeGen *g, IrExecutable *executable,
37103710 IrInstructionTagName *instruction)
37113711{
3712 TypeTableEntry *enum_type = instruction->target->value.type;
3712 ZigType *enum_type = instruction->target->value.type;
37133713 assert(enum_type->id == TypeTableEntryIdEnum);
37143714
37153715 LLVMValueRef enum_name_function = get_enum_tag_name_function(g, enum_type);
......@@ -3722,10 +3722,10 @@ static LLVMValueRef ir_render_enum_tag_name(CodeGen *g, IrExecutable *executable
37223722static LLVMValueRef ir_render_field_parent_ptr(CodeGen *g, IrExecutable *executable,
37233723 IrInstructionFieldParentPtr *instruction)
37243724{
3725 TypeTableEntry *container_ptr_type = instruction->base.value.type;
3725 ZigType *container_ptr_type = instruction->base.value.type;
37263726 assert(container_ptr_type->id == TypeTableEntryIdPointer);
37273727
3728 TypeTableEntry *container_type = container_ptr_type->data.pointer.child_type;
3728 ZigType *container_type = container_ptr_type->data.pointer.child_type;
37293729
37303730 size_t byte_offset = LLVMOffsetOfElement(g->target_data_ref,
37313731 container_type->type_ref, instruction->field->gen_index);
......@@ -3735,7 +3735,7 @@ static LLVMValueRef ir_render_field_parent_ptr(CodeGen *g, IrExecutable *executa
37353735 if (byte_offset == 0) {
37363736 return LLVMBuildBitCast(g->builder, field_ptr_val, container_ptr_type->type_ref, "");
37373737 } else {
3738 TypeTableEntry *usize = g->builtin_types.entry_usize;
3738 ZigType *usize = g->builtin_types.entry_usize;
37393739
37403740 LLVMValueRef field_ptr_int = LLVMBuildPtrToInt(g->builder, field_ptr_val,
37413741 usize->type_ref, "");
......@@ -3756,7 +3756,7 @@ static LLVMValueRef ir_render_align_cast(CodeGen *g, IrExecutable *executable, I
37563756 return target_val;
37573757 }
37583758
3759 TypeTableEntry *target_type = instruction->base.value.type;
3759 ZigType *target_type = instruction->base.value.type;
37603760 uint32_t align_bytes;
37613761 LLVMValueRef ptr_val;
37623762
......@@ -3781,7 +3781,7 @@ static LLVMValueRef ir_render_align_cast(CodeGen *g, IrExecutable *executable, I
37813781 {
37823782 zig_panic("TODO audit this function");
37833783 } else if (target_type->id == TypeTableEntryIdStruct && target_type->data.structure.is_slice) {
3784 TypeTableEntry *slice_ptr_type = target_type->data.structure.fields[slice_ptr_index].type_entry;
3784 ZigType *slice_ptr_type = target_type->data.structure.fields[slice_ptr_index].type_entry;
37853785 align_bytes = slice_ptr_type->data.pointer.alignment;
37863786
37873787 size_t ptr_index = target_type->data.structure.fields[slice_ptr_index].gen_index;
......@@ -3793,7 +3793,7 @@ static LLVMValueRef ir_render_align_cast(CodeGen *g, IrExecutable *executable, I
37933793
37943794 assert(align_bytes != 1);
37953795
3796 TypeTableEntry *usize = g->builtin_types.entry_usize;
3796 ZigType *usize = g->builtin_types.entry_usize;
37973797 LLVMValueRef ptr_as_int_val = LLVMBuildPtrToInt(g->builder, ptr_val, usize->type_ref, "");
37983798 LLVMValueRef alignment_minus_1 = LLVMConstInt(usize->type_ref, align_bytes - 1, false);
37993799 LLVMValueRef anded_val = LLVMBuildAnd(g->builder, ptr_as_int_val, alignment_minus_1, "");
......@@ -3817,7 +3817,7 @@ static LLVMValueRef ir_render_error_return_trace(CodeGen *g, IrExecutable *execu
38173817{
38183818 LLVMValueRef cur_err_ret_trace_val = get_cur_err_ret_trace_val(g, instruction->base.scope);
38193819 if (cur_err_ret_trace_val == nullptr) {
3820 TypeTableEntry *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(g);
3820 ZigType *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(g);
38213821 return LLVMConstNull(ptr_to_stack_trace_type->type_ref);
38223822 }
38233823 return cur_err_ret_trace_val;
......@@ -3877,9 +3877,9 @@ static LLVMValueRef ir_render_cmpxchg(CodeGen *g, IrExecutable *executable, IrIn
38773877 LLVMValueRef result_val = ZigLLVMBuildCmpXchg(g->builder, ptr_val, cmp_val, new_val,
38783878 success_order, failure_order, instruction->is_weak);
38793879
3880 TypeTableEntry *maybe_type = instruction->base.value.type;
3880 ZigType *maybe_type = instruction->base.value.type;
38813881 assert(maybe_type->id == TypeTableEntryIdOptional);
3882 TypeTableEntry *child_type = maybe_type->data.maybe.child_type;
3882 ZigType *child_type = maybe_type->data.maybe.child_type;
38833883
38843884 if (type_is_codegen_pointer(child_type)) {
38853885 LLVMValueRef payload_val = LLVMBuildExtractValue(g->builder, result_val, 0, "");
......@@ -3909,8 +3909,8 @@ static LLVMValueRef ir_render_fence(CodeGen *g, IrExecutable *executable, IrInst
39093909
39103910static LLVMValueRef ir_render_truncate(CodeGen *g, IrExecutable *executable, IrInstructionTruncate *instruction) {
39113911 LLVMValueRef target_val = ir_llvm_value(g, instruction->target);
3912 TypeTableEntry *dest_type = instruction->base.value.type;
3913 TypeTableEntry *src_type = instruction->target->value.type;
3912 ZigType *dest_type = instruction->base.value.type;
3913 ZigType *src_type = instruction->target->value.type;
39143914 if (dest_type == src_type) {
39153915 // no-op
39163916 return target_val;
......@@ -3931,7 +3931,7 @@ static LLVMValueRef ir_render_memset(CodeGen *g, IrExecutable *executable, IrIns
39313931
39323932 LLVMValueRef dest_ptr_casted = LLVMBuildBitCast(g->builder, dest_ptr, ptr_u8, "");
39333933
3934 TypeTableEntry *ptr_type = instruction->dest_ptr->value.type;
3934 ZigType *ptr_type = instruction->dest_ptr->value.type;
39353935 assert(ptr_type->id == TypeTableEntryIdPointer);
39363936
39373937 LLVMValueRef is_volatile = ptr_type->data.pointer.is_volatile ?
......@@ -3961,8 +3961,8 @@ static LLVMValueRef ir_render_memcpy(CodeGen *g, IrExecutable *executable, IrIns
39613961 LLVMValueRef dest_ptr_casted = LLVMBuildBitCast(g->builder, dest_ptr, ptr_u8, "");
39623962 LLVMValueRef src_ptr_casted = LLVMBuildBitCast(g->builder, src_ptr, ptr_u8, "");
39633963
3964 TypeTableEntry *dest_ptr_type = instruction->dest_ptr->value.type;
3965 TypeTableEntry *src_ptr_type = instruction->src_ptr->value.type;
3964 ZigType *dest_ptr_type = instruction->dest_ptr->value.type;
3965 ZigType *src_ptr_type = instruction->src_ptr->value.type;
39663966
39673967 assert(dest_ptr_type->id == TypeTableEntryIdPointer);
39683968 assert(src_ptr_type->id == TypeTableEntryIdPointer);
......@@ -3989,9 +3989,9 @@ static LLVMValueRef ir_render_slice(CodeGen *g, IrExecutable *executable, IrInst
39893989 assert(instruction->tmp_ptr);
39903990
39913991 LLVMValueRef array_ptr_ptr = ir_llvm_value(g, instruction->ptr);
3992 TypeTableEntry *array_ptr_type = instruction->ptr->value.type;
3992 ZigType *array_ptr_type = instruction->ptr->value.type;
39933993 assert(array_ptr_type->id == TypeTableEntryIdPointer);
3994 TypeTableEntry *array_type = array_ptr_type->data.pointer.child_type;
3994 ZigType *array_type = array_ptr_type->data.pointer.child_type;
39953995 LLVMValueRef array_ptr = get_handle_value(g, array_ptr_ptr, array_type, array_ptr_type);
39963996
39973997 LLVMValueRef tmp_struct_ptr = instruction->tmp_ptr;
......@@ -4140,7 +4140,7 @@ static LLVMValueRef get_frame_address_fn_val(CodeGen *g) {
41404140 if (g->frame_address_fn_val)
41414141 return g->frame_address_fn_val;
41424142
4143 TypeTableEntry *return_type = get_pointer_to_type(g, g->builtin_types.entry_u8, true);
4143 ZigType *return_type = get_pointer_to_type(g, g->builtin_types.entry_u8, true);
41444144
41454145 LLVMTypeRef fn_type = LLVMFunctionType(return_type->type_ref,
41464146 &g->builtin_types.entry_i32->type_ref, 1, false);
......@@ -4178,7 +4178,7 @@ static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,
41784178}
41794179
41804180static LLVMValueRef render_shl_with_overflow(CodeGen *g, IrInstructionOverflowOp *instruction) {
4181 TypeTableEntry *int_type = instruction->result_ptr_type;
4181 ZigType *int_type = instruction->result_ptr_type;
41824182 assert(int_type->id == TypeTableEntryIdInt);
41834183
41844184 LLVMValueRef op1 = ir_llvm_value(g, instruction->op1);
......@@ -4218,7 +4218,7 @@ static LLVMValueRef ir_render_overflow_op(CodeGen *g, IrExecutable *executable,
42184218 return render_shl_with_overflow(g, instruction);
42194219 }
42204220
4221 TypeTableEntry *int_type = instruction->result_ptr_type;
4221 ZigType *int_type = instruction->result_ptr_type;
42224222 assert(int_type->id == TypeTableEntryIdInt);
42234223
42244224 LLVMValueRef fn_val = get_int_overflow_fn(g, int_type, add_sub_mul);
......@@ -4241,8 +4241,8 @@ static LLVMValueRef ir_render_overflow_op(CodeGen *g, IrExecutable *executable,
42414241}
42424242
42434243static LLVMValueRef ir_render_test_err(CodeGen *g, IrExecutable *executable, IrInstructionTestErr *instruction) {
4244 TypeTableEntry *err_union_type = instruction->value->value.type;
4245 TypeTableEntry *payload_type = err_union_type->data.error_union.payload_type;
4244 ZigType *err_union_type = instruction->value->value.type;
4245 ZigType *payload_type = err_union_type->data.error_union.payload_type;
42464246 LLVMValueRef err_union_handle = ir_llvm_value(g, instruction->value);
42474247
42484248 LLVMValueRef err_val;
......@@ -4258,10 +4258,10 @@ static LLVMValueRef ir_render_test_err(CodeGen *g, IrExecutable *executable, IrI
42584258}
42594259
42604260static LLVMValueRef ir_render_unwrap_err_code(CodeGen *g, IrExecutable *executable, IrInstructionUnwrapErrCode *instruction) {
4261 TypeTableEntry *ptr_type = instruction->value->value.type;
4261 ZigType *ptr_type = instruction->value->value.type;
42624262 assert(ptr_type->id == TypeTableEntryIdPointer);
4263 TypeTableEntry *err_union_type = ptr_type->data.pointer.child_type;
4264 TypeTableEntry *payload_type = err_union_type->data.error_union.payload_type;
4263 ZigType *err_union_type = ptr_type->data.pointer.child_type;
4264 ZigType *payload_type = err_union_type->data.error_union.payload_type;
42654265 LLVMValueRef err_union_ptr = ir_llvm_value(g, instruction->value);
42664266 LLVMValueRef err_union_handle = get_handle_value(g, err_union_ptr, err_union_type, ptr_type);
42674267
......@@ -4274,10 +4274,10 @@ static LLVMValueRef ir_render_unwrap_err_code(CodeGen *g, IrExecutable *executab
42744274}
42754275
42764276static LLVMValueRef ir_render_unwrap_err_payload(CodeGen *g, IrExecutable *executable, IrInstructionUnwrapErrPayload *instruction) {
4277 TypeTableEntry *ptr_type = instruction->value->value.type;
4277 ZigType *ptr_type = instruction->value->value.type;
42784278 assert(ptr_type->id == TypeTableEntryIdPointer);
4279 TypeTableEntry *err_union_type = ptr_type->data.pointer.child_type;
4280 TypeTableEntry *payload_type = err_union_type->data.error_union.payload_type;
4279 ZigType *err_union_type = ptr_type->data.pointer.child_type;
4280 ZigType *payload_type = err_union_type->data.error_union.payload_type;
42814281 LLVMValueRef err_union_ptr = ir_llvm_value(g, instruction->value);
42824282 LLVMValueRef err_union_handle = get_handle_value(g, err_union_ptr, err_union_type, ptr_type);
42834283
......@@ -4313,11 +4313,11 @@ static LLVMValueRef ir_render_unwrap_err_payload(CodeGen *g, IrExecutable *execu
43134313}
43144314
43154315static LLVMValueRef ir_render_maybe_wrap(CodeGen *g, IrExecutable *executable, IrInstructionOptionalWrap *instruction) {
4316 TypeTableEntry *wanted_type = instruction->base.value.type;
4316 ZigType *wanted_type = instruction->base.value.type;
43174317
43184318 assert(wanted_type->id == TypeTableEntryIdOptional);
43194319
4320 TypeTableEntry *child_type = wanted_type->data.maybe.child_type;
4320 ZigType *child_type = wanted_type->data.maybe.child_type;
43214321
43224322 if (child_type->zero_bits) {
43234323 return LLVMConstInt(LLVMInt1Type(), 1, false);
......@@ -4340,12 +4340,12 @@ static LLVMValueRef ir_render_maybe_wrap(CodeGen *g, IrExecutable *executable, I
43404340}
43414341
43424342static LLVMValueRef ir_render_err_wrap_code(CodeGen *g, IrExecutable *executable, IrInstructionErrWrapCode *instruction) {
4343 TypeTableEntry *wanted_type = instruction->base.value.type;
4343 ZigType *wanted_type = instruction->base.value.type;
43444344
43454345 assert(wanted_type->id == TypeTableEntryIdErrorUnion);
43464346
4347 TypeTableEntry *payload_type = wanted_type->data.error_union.payload_type;
4348 TypeTableEntry *err_set_type = wanted_type->data.error_union.err_set_type;
4347 ZigType *payload_type = wanted_type->data.error_union.payload_type;
4348 ZigType *err_set_type = wanted_type->data.error_union.err_set_type;
43494349
43504350 LLVMValueRef err_val = ir_llvm_value(g, instruction->value);
43514351
......@@ -4361,12 +4361,12 @@ static LLVMValueRef ir_render_err_wrap_code(CodeGen *g, IrExecutable *executable
43614361}
43624362
43634363static LLVMValueRef ir_render_err_wrap_payload(CodeGen *g, IrExecutable *executable, IrInstructionErrWrapPayload *instruction) {
4364 TypeTableEntry *wanted_type = instruction->base.value.type;
4364 ZigType *wanted_type = instruction->base.value.type;
43654365
43664366 assert(wanted_type->id == TypeTableEntryIdErrorUnion);
43674367
4368 TypeTableEntry *payload_type = wanted_type->data.error_union.payload_type;
4369 TypeTableEntry *err_set_type = wanted_type->data.error_union.err_set_type;
4368 ZigType *payload_type = wanted_type->data.error_union.payload_type;
4369 ZigType *err_set_type = wanted_type->data.error_union.err_set_type;
43704370
43714371 if (!type_has_bits(err_set_type)) {
43724372 return ir_llvm_value(g, instruction->value);
......@@ -4391,10 +4391,10 @@ static LLVMValueRef ir_render_err_wrap_payload(CodeGen *g, IrExecutable *executa
43914391}
43924392
43934393static LLVMValueRef ir_render_union_tag(CodeGen *g, IrExecutable *executable, IrInstructionUnionTag *instruction) {
4394 TypeTableEntry *union_type = instruction->value->value.type;
4394 ZigType *union_type = instruction->value->value.type;
43954395 assert(union_type->data.unionation.gen_tag_index != SIZE_MAX);
43964396
4397 TypeTableEntry *tag_type = union_type->data.unionation.tag_type;
4397 ZigType *tag_type = union_type->data.unionation.tag_type;
43984398 if (!type_has_bits(tag_type))
43994399 return nullptr;
44004400
......@@ -4404,7 +4404,7 @@ static LLVMValueRef ir_render_union_tag(CodeGen *g, IrExecutable *executable, Ir
44044404
44054405 LLVMValueRef tag_field_ptr = LLVMBuildStructGEP(g->builder, union_val,
44064406 union_type->data.unionation.gen_tag_index, "");
4407 TypeTableEntry *ptr_type = get_pointer_to_type(g, tag_type, false);
4407 ZigType *ptr_type = get_pointer_to_type(g, tag_type, false);
44084408 return get_handle_value(g, tag_field_ptr, tag_type, ptr_type);
44094409}
44104410
......@@ -4421,7 +4421,7 @@ static LLVMValueRef ir_render_struct_init(CodeGen *g, IrExecutable *executable,
44214421
44224422 uint32_t field_align_bytes = get_abi_alignment(g, type_struct_field->type_entry);
44234423
4424 TypeTableEntry *ptr_type = get_pointer_to_type_extra(g, type_struct_field->type_entry,
4424 ZigType *ptr_type = get_pointer_to_type_extra(g, type_struct_field->type_entry,
44254425 false, false, PtrLenSingle, field_align_bytes,
44264426 (uint32_t)type_struct_field->packed_bits_offset, (uint32_t)type_struct_field->unaligned_bit_count);
44274427
......@@ -4437,14 +4437,14 @@ static LLVMValueRef ir_render_union_init(CodeGen *g, IrExecutable *executable, I
44374437 return nullptr;
44384438
44394439 uint32_t field_align_bytes = get_abi_alignment(g, type_union_field->type_entry);
4440 TypeTableEntry *ptr_type = get_pointer_to_type_extra(g, type_union_field->type_entry,
4440 ZigType *ptr_type = get_pointer_to_type_extra(g, type_union_field->type_entry,
44414441 false, false, PtrLenSingle, field_align_bytes,
44424442 0, 0);
44434443
44444444 LLVMValueRef uncasted_union_ptr;
44454445 // Even if safety is off in this block, if the union type has the safety field, we have to populate it
44464446 // correctly. Otherwise safety code somewhere other than here could fail.
4447 TypeTableEntry *union_type = instruction->union_type;
4447 ZigType *union_type = instruction->union_type;
44484448 if (union_type->data.unionation.gen_tag_index != SIZE_MAX) {
44494449 LLVMValueRef tag_field_ptr = LLVMBuildStructGEP(g->builder, instruction->tmp_ptr,
44504450 union_type->data.unionation.gen_tag_index, "");
......@@ -4470,14 +4470,14 @@ static LLVMValueRef ir_render_union_init(CodeGen *g, IrExecutable *executable, I
44704470static LLVMValueRef ir_render_container_init_list(CodeGen *g, IrExecutable *executable,
44714471 IrInstructionContainerInitList *instruction)
44724472{
4473 TypeTableEntry *array_type = instruction->base.value.type;
4473 ZigType *array_type = instruction->base.value.type;
44744474 assert(array_type->id == TypeTableEntryIdArray);
44754475 LLVMValueRef tmp_array_ptr = instruction->tmp_ptr;
44764476 assert(tmp_array_ptr);
44774477
44784478 size_t field_count = instruction->item_count;
44794479
4480 TypeTableEntry *child_type = array_type->data.array.child_type;
4480 ZigType *child_type = array_type->data.array.child_type;
44814481 for (size_t i = 0; i < field_count; i += 1) {
44824482 LLVMValueRef elem_val = ir_llvm_value(g, instruction->items[i]);
44834483 LLVMValueRef indices[] = {
......@@ -4601,13 +4601,13 @@ static LLVMValueRef ir_render_coro_promise(CodeGen *g, IrExecutable *executable,
46014601 return LLVMBuildBitCast(g->builder, uncasted_result, instruction->base.value.type->type_ref, "");
46024602}
46034603
4604static LLVMValueRef get_coro_alloc_helper_fn_val(CodeGen *g, LLVMTypeRef alloc_fn_type_ref, TypeTableEntry *fn_type) {
4604static LLVMValueRef get_coro_alloc_helper_fn_val(CodeGen *g, LLVMTypeRef alloc_fn_type_ref, ZigType *fn_type) {
46054605 if (g->coro_alloc_helper_fn_val != nullptr)
46064606 return g->coro_alloc_helper_fn_val;
46074607
46084608 assert(fn_type->id == TypeTableEntryIdFn);
46094609
4610 TypeTableEntry *ptr_to_err_code_type = get_pointer_to_type(g, g->builtin_types.entry_global_error_set, false);
4610 ZigType *ptr_to_err_code_type = get_pointer_to_type(g, g->builtin_types.entry_global_error_set, false);
46114611
46124612 LLVMTypeRef alloc_raw_fn_type_ref = LLVMGetElementType(alloc_fn_type_ref);
46134613 LLVMTypeRef *alloc_fn_arg_types = allocate<LLVMTypeRef>(LLVMCountParamTypes(alloc_raw_fn_type_ref));
......@@ -4686,9 +4686,9 @@ static LLVMValueRef get_coro_alloc_helper_fn_val(CodeGen *g, LLVMTypeRef alloc_f
46864686
46874687 LLVMPositionBuilderAtEnd(g->builder, ok_block);
46884688 LLVMValueRef payload_ptr = LLVMBuildStructGEP(g->builder, sret_ptr, err_union_payload_index, "");
4689 TypeTableEntry *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, false, false,
4689 ZigType *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, false, false,
46904690 PtrLenUnknown, get_abi_alignment(g, g->builtin_types.entry_u8), 0, 0);
4691 TypeTableEntry *slice_type = get_slice_type(g, u8_ptr_type);
4691 ZigType *slice_type = get_slice_type(g, u8_ptr_type);
46924692 size_t ptr_field_index = slice_type->data.structure.fields[slice_ptr_index].gen_index;
46934693 LLVMValueRef ptr_field_ptr = LLVMBuildStructGEP(g->builder, payload_ptr, ptr_field_index, "");
46944694 LLVMValueRef ptr_val = LLVMBuildLoad(g->builder, ptr_field_ptr, "");
......@@ -4733,7 +4733,7 @@ static LLVMValueRef ir_render_atomic_rmw(CodeGen *g, IrExecutable *executable,
47334733 IrInstructionAtomicRmw *instruction)
47344734{
47354735 bool is_signed;
4736 TypeTableEntry *operand_type = instruction->operand->value.type;
4736 ZigType *operand_type = instruction->operand->value.type;
47374737 if (operand_type->id == TypeTableEntryIdInt) {
47384738 is_signed = operand_type->data.integral.is_signed;
47394739 } else {
......@@ -5090,14 +5090,14 @@ static LLVMValueRef gen_const_ptr_array_recursive(CodeGen *g, ConstExprValue *ar
50905090
50915091 LLVMTypeKind el_type = LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(base_ptr)));
50925092 if (el_type == LLVMArrayTypeKind) {
5093 TypeTableEntry *usize = g->builtin_types.entry_usize;
5093 ZigType *usize = g->builtin_types.entry_usize;
50945094 LLVMValueRef indices[] = {
50955095 LLVMConstNull(usize->type_ref),
50965096 LLVMConstInt(usize->type_ref, index, false),
50975097 };
50985098 return LLVMConstInBoundsGEP(base_ptr, indices, 2);
50995099 } else if (el_type == LLVMStructTypeKind) {
5100 TypeTableEntry *u32 = g->builtin_types.entry_u32;
5100 ZigType *u32 = g->builtin_types.entry_u32;
51015101 LLVMValueRef indices[] = {
51025102 LLVMConstNull(u32->type_ref),
51035103 LLVMConstInt(u32->type_ref, index, false),
......@@ -5113,7 +5113,7 @@ static LLVMValueRef gen_const_ptr_struct_recursive(CodeGen *g, ConstExprValue *s
51135113 ConstParent *parent = &struct_const_val->data.x_struct.parent;
51145114 LLVMValueRef base_ptr = gen_parent_ptr(g, struct_const_val, parent);
51155115
5116 TypeTableEntry *u32 = g->builtin_types.entry_u32;
5116 ZigType *u32 = g->builtin_types.entry_u32;
51175117 LLVMValueRef indices[] = {
51185118 LLVMConstNull(u32->type_ref),
51195119 LLVMConstInt(u32->type_ref, field_index, false),
......@@ -5125,7 +5125,7 @@ static LLVMValueRef gen_const_ptr_union_recursive(CodeGen *g, ConstExprValue *un
51255125 ConstParent *parent = &union_const_val->data.x_union.parent;
51265126 LLVMValueRef base_ptr = gen_parent_ptr(g, union_const_val, parent);
51275127
5128 TypeTableEntry *u32 = g->builtin_types.entry_u32;
5128 ZigType *u32 = g->builtin_types.entry_u32;
51295129 LLVMValueRef indices[] = {
51305130 LLVMConstNull(u32->type_ref),
51315131 LLVMConstInt(u32->type_ref, 0, false), // TODO test const union with more aligned tag type than payload
......@@ -5143,7 +5143,7 @@ static LLVMValueRef pack_const_int(CodeGen *g, LLVMTypeRef big_int_type_ref, Con
51435143 break;
51445144 }
51455145
5146 TypeTableEntry *type_entry = const_val->type;
5146 ZigType *type_entry = const_val->type;
51475147 assert(!type_entry->zero_bits);
51485148 switch (type_entry->id) {
51495149 case TypeTableEntryIdInvalid:
......@@ -5228,7 +5228,7 @@ static LLVMValueRef pack_const_int(CodeGen *g, LLVMTypeRef big_int_type_ref, Con
52285228
52295229// We have this because union constants can't be represented by the official union type,
52305230// and this property bubbles up in whatever aggregate type contains a union constant
5231static bool is_llvm_value_unnamed_type(TypeTableEntry *type_entry, LLVMValueRef val) {
5231static bool is_llvm_value_unnamed_type(ZigType *type_entry, LLVMValueRef val) {
52325232 return LLVMTypeOf(val) != type_entry->type_ref;
52335233}
52345234
......@@ -5256,7 +5256,7 @@ static LLVMValueRef gen_const_val_ptr(CodeGen *g, ConstExprValue *const_val, con
52565256 assert(array_const_val->type->id == TypeTableEntryIdArray);
52575257 if (array_const_val->type->zero_bits) {
52585258 // make this a null pointer
5259 TypeTableEntry *usize = g->builtin_types.entry_usize;
5259 ZigType *usize = g->builtin_types.entry_usize;
52605260 const_val->global_refs->llvm_value = LLVMConstIntToPtr(LLVMConstNull(usize->type_ref),
52615261 const_val->type->type_ref);
52625262 render_const_val_global(g, const_val, "");
......@@ -5276,7 +5276,7 @@ static LLVMValueRef gen_const_val_ptr(CodeGen *g, ConstExprValue *const_val, con
52765276 assert(struct_const_val->type->id == TypeTableEntryIdStruct);
52775277 if (struct_const_val->type->zero_bits) {
52785278 // make this a null pointer
5279 TypeTableEntry *usize = g->builtin_types.entry_usize;
5279 ZigType *usize = g->builtin_types.entry_usize;
52805280 const_val->global_refs->llvm_value = LLVMConstIntToPtr(LLVMConstNull(usize->type_ref),
52815281 const_val->type->type_ref);
52825282 render_const_val_global(g, const_val, "");
......@@ -5296,7 +5296,7 @@ static LLVMValueRef gen_const_val_ptr(CodeGen *g, ConstExprValue *const_val, con
52965296 {
52975297 render_const_val_global(g, const_val, name);
52985298 uint64_t addr_value = const_val->data.x_ptr.data.hard_coded_addr.addr;
5299 TypeTableEntry *usize = g->builtin_types.entry_usize;
5299 ZigType *usize = g->builtin_types.entry_usize;
53005300 const_val->global_refs->llvm_value = LLVMConstIntToPtr(LLVMConstInt(usize->type_ref, addr_value, false),
53015301 const_val->type->type_ref);
53025302 render_const_val_global(g, const_val, "");
......@@ -5309,7 +5309,7 @@ static LLVMValueRef gen_const_val_ptr(CodeGen *g, ConstExprValue *const_val, con
53095309}
53105310
53115311static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const char *name) {
5312 TypeTableEntry *type_entry = const_val->type;
5312 ZigType *type_entry = const_val->type;
53135313 assert(!type_entry->zero_bits);
53145314
53155315 switch (const_val->special) {
......@@ -5356,7 +5356,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
53565356 }
53575357 case TypeTableEntryIdOptional:
53585358 {
5359 TypeTableEntry *child_type = type_entry->data.maybe.child_type;
5359 ZigType *child_type = type_entry->data.maybe.child_type;
53605360 if (child_type->zero_bits) {
53615361 return LLVMConstInt(LLVMInt1Type(), const_val->data.x_optional ? 1 : 0, false);
53625362 } else if (type_is_codegen_pointer(child_type)) {
......@@ -5559,8 +5559,8 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
55595559 return gen_const_val_ptr(g, const_val, name);
55605560 case TypeTableEntryIdErrorUnion:
55615561 {
5562 TypeTableEntry *payload_type = type_entry->data.error_union.payload_type;
5563 TypeTableEntry *err_set_type = type_entry->data.error_union.err_set_type;
5562 ZigType *payload_type = type_entry->data.error_union.payload_type;
5563 ZigType *err_set_type = type_entry->data.error_union.err_set_type;
55645564 if (!type_has_bits(payload_type)) {
55655565 assert(type_has_bits(err_set_type));
55665566 uint64_t value = const_val->data.x_err_union.err ? const_val->data.x_err_union.err->value : 0;
......@@ -5650,9 +5650,9 @@ static void generate_error_name_table(CodeGen *g) {
56505650
56515651 assert(g->errors_by_index.length > 0);
56525652
5653 TypeTableEntry *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
5653 ZigType *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
56545654 PtrLenUnknown, get_abi_alignment(g, g->builtin_types.entry_u8), 0, 0);
5655 TypeTableEntry *str_type = get_slice_type(g, u8_ptr_type);
5655 ZigType *str_type = get_slice_type(g, u8_ptr_type);
56565656
56575657 LLVMValueRef *values = allocate<LLVMValueRef>(g->errors_by_index.length);
56585658 values[0] = LLVMGetUndef(str_type->type_ref);
......@@ -5700,7 +5700,7 @@ static void build_all_basic_blocks(CodeGen *g, FnTableEntry *fn) {
57005700}
57015701
57025702static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef init_val,
5703 TypeTableEntry *type_entry)
5703 ZigType *type_entry)
57045704{
57055705 if (g->strip_debug_symbols) {
57065706 return;
......@@ -5721,7 +5721,7 @@ static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef ini
57215721 // TODO ^^ make an actual global variable
57225722}
57235723
5724static LLVMValueRef build_alloca(CodeGen *g, TypeTableEntry *type_entry, const char *name, uint32_t alignment) {
5724static LLVMValueRef build_alloca(CodeGen *g, ZigType *type_entry, const char *name, uint32_t alignment) {
57255725 assert(alignment > 0);
57265726 LLVMValueRef result = LLVMBuildAlloca(g->builder, type_entry->type_ref, name);
57275727 LLVMSetAlignment(result, alignment);
......@@ -5794,7 +5794,7 @@ static void do_code_gen(CodeGen *g) {
57945794 // Generate debug info for it but that's it.
57955795 ConstExprValue *const_val = var->value;
57965796 assert(const_val->special != ConstValSpecialRuntime);
5797 TypeTableEntry *var_type = g->builtin_types.entry_f128;
5797 ZigType *var_type = g->builtin_types.entry_f128;
57985798 ConstExprValue coerced_value;
57995799 coerced_value.special = ConstValSpecialStatic;
58005800 coerced_value.type = var_type;
......@@ -5812,7 +5812,7 @@ static void do_code_gen(CodeGen *g) {
58125812 if (bits_needed < 8) {
58135813 bits_needed = 8;
58145814 }
5815 TypeTableEntry *var_type = get_int_type(g, const_val->data.x_bigint.is_negative, bits_needed);
5815 ZigType *var_type = get_int_type(g, const_val->data.x_bigint.is_negative, bits_needed);
58165816 LLVMValueRef init_val = bigint_to_llvm_const(var_type->type_ref, &const_val->data.x_bigint);
58175817 gen_global_var(g, var, init_val, var_type);
58185818 continue;
......@@ -5869,7 +5869,7 @@ static void do_code_gen(CodeGen *g) {
58695869 LLVMValueRef fn = fn_llvm_value(g, fn_table_entry);
58705870 g->cur_fn = fn_table_entry;
58715871 g->cur_fn_val = fn;
5872 TypeTableEntry *return_type = fn_table_entry->type_entry->data.fn.fn_type_id.return_type;
5872 ZigType *return_type = fn_table_entry->type_entry->data.fn.fn_type_id.return_type;
58735873 if (handle_is_ptr(return_type)) {
58745874 g->cur_ret_ptr = LLVMGetParam(fn, 0);
58755875 } else {
......@@ -5892,7 +5892,7 @@ static void do_code_gen(CodeGen *g) {
58925892 bool have_err_ret_trace_stack = g->have_err_ret_tracing && fn_table_entry->calls_or_awaits_errorable_fn && !is_async && !have_err_ret_trace_arg;
58935893 LLVMValueRef err_ret_array_val = nullptr;
58945894 if (have_err_ret_trace_stack) {
5895 TypeTableEntry *array_type = get_array_type(g, g->builtin_types.entry_usize, stack_trace_ptr_count);
5895 ZigType *array_type = get_array_type(g, g->builtin_types.entry_usize, stack_trace_ptr_count);
58965896 err_ret_array_val = build_alloca(g, array_type, "error_return_trace_addresses", get_abi_alignment(g, array_type));
58975897 g->cur_err_ret_trace_val_stack = build_alloca(g, g->stack_trace_type, "error_return_trace", get_abi_alignment(g, g->stack_trace_type));
58985898 } else {
......@@ -5903,7 +5903,7 @@ static void do_code_gen(CodeGen *g) {
59035903 for (size_t alloca_i = 0; alloca_i < fn_table_entry->alloca_list.length; alloca_i += 1) {
59045904 IrInstruction *instruction = fn_table_entry->alloca_list.at(alloca_i);
59055905 LLVMValueRef *slot;
5906 TypeTableEntry *slot_type = instruction->value.type;
5906 ZigType *slot_type = instruction->value.type;
59075907 if (instruction->id == IrInstructionIdCast) {
59085908 IrInstructionCast *cast_instruction = (IrInstructionCast *)instruction;
59095909 slot = &cast_instruction->tmp_ptr;
......@@ -5968,7 +5968,7 @@ static void do_code_gen(CodeGen *g) {
59685968
59695969 } else {
59705970 assert(var->gen_arg_index != SIZE_MAX);
5971 TypeTableEntry *gen_type;
5971 ZigType *gen_type;
59725972 FnGenParamInfo *gen_info = &fn_table_entry->type_entry->data.fn.gen_param_info[var->src_arg_index];
59735973
59745974 if (handle_is_ptr(var->value->type)) {
......@@ -5994,7 +5994,7 @@ static void do_code_gen(CodeGen *g) {
59945994
59955995 // finishing error return trace setup. we have to do this after all the allocas.
59965996 if (have_err_ret_trace_stack) {
5997 TypeTableEntry *usize = g->builtin_types.entry_usize;
5997 ZigType *usize = g->builtin_types.entry_usize;
59985998 size_t index_field_index = g->stack_trace_type->data.structure.fields[0].gen_index;
59995999 LLVMValueRef index_field_ptr = LLVMBuildStructGEP(g->builder, g->cur_err_ret_trace_val_stack, (unsigned)index_field_index, "");
60006000 gen_store_untyped(g, LLVMConstNull(usize->type_ref), index_field_ptr, 0, false);
......@@ -6002,14 +6002,14 @@ static void do_code_gen(CodeGen *g) {
60026002 size_t addresses_field_index = g->stack_trace_type->data.structure.fields[1].gen_index;
60036003 LLVMValueRef addresses_field_ptr = LLVMBuildStructGEP(g->builder, g->cur_err_ret_trace_val_stack, (unsigned)addresses_field_index, "");
60046004
6005 TypeTableEntry *slice_type = g->stack_trace_type->data.structure.fields[1].type_entry;
6005 ZigType *slice_type = g->stack_trace_type->data.structure.fields[1].type_entry;
60066006 size_t ptr_field_index = slice_type->data.structure.fields[slice_ptr_index].gen_index;
60076007 LLVMValueRef ptr_field_ptr = LLVMBuildStructGEP(g->builder, addresses_field_ptr, (unsigned)ptr_field_index, "");
60086008 LLVMValueRef zero = LLVMConstNull(usize->type_ref);
60096009 LLVMValueRef indices[] = {zero, zero};
60106010 LLVMValueRef err_ret_array_val_elem0_ptr = LLVMBuildInBoundsGEP(g->builder, err_ret_array_val,
60116011 indices, 2, "");
6012 TypeTableEntry *ptr_ptr_usize_type = get_pointer_to_type(g, get_pointer_to_type(g, usize, false), false);
6012 ZigType *ptr_ptr_usize_type = get_pointer_to_type(g, get_pointer_to_type(g, usize, false), false);
60136013 gen_store(g, err_ret_array_val_elem0_ptr, ptr_field_ptr, ptr_ptr_usize_type);
60146014
60156015 size_t len_field_index = slice_type->data.structure.fields[slice_len_index].gen_index;
......@@ -6173,51 +6173,51 @@ static const GlobalLinkageValue global_linkage_values[] = {
61736173static void define_builtin_types(CodeGen *g) {
61746174 {
61756175 // if this type is anywhere in the AST, we should never hit codegen.
6176 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdInvalid);
6176 ZigType *entry = new_type_table_entry(TypeTableEntryIdInvalid);
61776177 buf_init_from_str(&entry->name, "(invalid)");
61786178 entry->zero_bits = true;
61796179 g->builtin_types.entry_invalid = entry;
61806180 }
61816181 {
6182 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdNamespace);
6182 ZigType *entry = new_type_table_entry(TypeTableEntryIdNamespace);
61836183 buf_init_from_str(&entry->name, "(namespace)");
61846184 entry->zero_bits = true;
61856185 g->builtin_types.entry_namespace = entry;
61866186 }
61876187 {
6188 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdBlock);
6188 ZigType *entry = new_type_table_entry(TypeTableEntryIdBlock);
61896189 buf_init_from_str(&entry->name, "(block)");
61906190 entry->zero_bits = true;
61916191 g->builtin_types.entry_block = entry;
61926192 }
61936193 {
6194 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdComptimeFloat);
6194 ZigType *entry = new_type_table_entry(TypeTableEntryIdComptimeFloat);
61956195 buf_init_from_str(&entry->name, "comptime_float");
61966196 entry->zero_bits = true;
61976197 g->builtin_types.entry_num_lit_float = entry;
61986198 g->primitive_type_table.put(&entry->name, entry);
61996199 }
62006200 {
6201 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdComptimeInt);
6201 ZigType *entry = new_type_table_entry(TypeTableEntryIdComptimeInt);
62026202 buf_init_from_str(&entry->name, "comptime_int");
62036203 entry->zero_bits = true;
62046204 g->builtin_types.entry_num_lit_int = entry;
62056205 g->primitive_type_table.put(&entry->name, entry);
62066206 }
62076207 {
6208 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdUndefined);
6208 ZigType *entry = new_type_table_entry(TypeTableEntryIdUndefined);
62096209 buf_init_from_str(&entry->name, "(undefined)");
62106210 entry->zero_bits = true;
62116211 g->builtin_types.entry_undef = entry;
62126212 }
62136213 {
6214 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdNull);
6214 ZigType *entry = new_type_table_entry(TypeTableEntryIdNull);
62156215 buf_init_from_str(&entry->name, "(null)");
62166216 entry->zero_bits = true;
62176217 g->builtin_types.entry_null = entry;
62186218 }
62196219 {
6220 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdArgTuple);
6220 ZigType *entry = new_type_table_entry(TypeTableEntryIdArgTuple);
62216221 buf_init_from_str(&entry->name, "(args)");
62226222 entry->zero_bits = true;
62236223 g->builtin_types.entry_arg_tuple = entry;
......@@ -6228,7 +6228,7 @@ static void define_builtin_types(CodeGen *g) {
62286228 uint32_t size_in_bits = target_c_type_size_in_bits(&g->zig_target, info->id);
62296229 bool is_signed = info->is_signed;
62306230
6231 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdInt);
6231 ZigType *entry = new_type_table_entry(TypeTableEntryIdInt);
62326232 entry->type_ref = LLVMIntType(size_in_bits);
62336233
62346234 buf_init_from_str(&entry->name, info->name);
......@@ -6245,7 +6245,7 @@ static void define_builtin_types(CodeGen *g) {
62456245 }
62466246
62476247 {
6248 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdBool);
6248 ZigType *entry = new_type_table_entry(TypeTableEntryIdBool);
62496249 entry->type_ref = LLVMInt1Type();
62506250 buf_init_from_str(&entry->name, "bool");
62516251 uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref);
......@@ -6259,7 +6259,7 @@ static void define_builtin_types(CodeGen *g) {
62596259 for (size_t sign_i = 0; sign_i < array_length(is_signed_list); sign_i += 1) {
62606260 bool is_signed = is_signed_list[sign_i];
62616261
6262 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdInt);
6262 ZigType *entry = new_type_table_entry(TypeTableEntryIdInt);
62636263 entry->type_ref = LLVMIntType(g->pointer_size_bytes * 8);
62646264
62656265 const char u_or_i = is_signed ? 'i' : 'u';
......@@ -6286,8 +6286,8 @@ static void define_builtin_types(CodeGen *g) {
62866286 const char *name,
62876287 uint32_t bit_count,
62886288 LLVMTypeRef type_ref,
6289 TypeTableEntry **field) {
6290 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdFloat);
6289 ZigType **field) {
6290 ZigType *entry = new_type_table_entry(TypeTableEntryIdFloat);
62916291 entry->type_ref = type_ref;
62926292 buf_init_from_str(&entry->name, name);
62936293 entry->data.floating.bit_count = bit_count;
......@@ -6306,7 +6306,7 @@ static void define_builtin_types(CodeGen *g) {
63066306 add_fp_entry(g, "c_longdouble", 80, LLVMX86FP80Type(), &g->builtin_types.entry_c_longdouble);
63076307
63086308 {
6309 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdVoid);
6309 ZigType *entry = new_type_table_entry(TypeTableEntryIdVoid);
63106310 entry->type_ref = LLVMVoidType();
63116311 entry->zero_bits = true;
63126312 buf_init_from_str(&entry->name, "void");
......@@ -6317,7 +6317,7 @@ static void define_builtin_types(CodeGen *g) {
63176317 g->primitive_type_table.put(&entry->name, entry);
63186318 }
63196319 {
6320 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdUnreachable);
6320 ZigType *entry = new_type_table_entry(TypeTableEntryIdUnreachable);
63216321 entry->type_ref = LLVMVoidType();
63226322 entry->zero_bits = true;
63236323 buf_init_from_str(&entry->name, "noreturn");
......@@ -6326,7 +6326,7 @@ static void define_builtin_types(CodeGen *g) {
63266326 g->primitive_type_table.put(&entry->name, entry);
63276327 }
63286328 {
6329 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdMetaType);
6329 ZigType *entry = new_type_table_entry(TypeTableEntryIdMetaType);
63306330 buf_init_from_str(&entry->name, "type");
63316331 entry->zero_bits = true;
63326332 g->builtin_types.entry_type = entry;
......@@ -6348,7 +6348,7 @@ static void define_builtin_types(CodeGen *g) {
63486348 }
63496349
63506350 {
6351 TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdErrorSet);
6351 ZigType *entry = new_type_table_entry(TypeTableEntryIdErrorSet);
63526352 buf_init_from_str(&entry->name, "error");
63536353 entry->data.error_set.err_count = UINT32_MAX;
63546354
......@@ -6370,7 +6370,7 @@ static void define_builtin_types(CodeGen *g) {
63706370 g->primitive_type_table.put(&entry->name, entry);
63716371 }
63726372 {
6373 TypeTableEntry *entry = get_promise_type(g, nullptr);
6373 ZigType *entry = get_promise_type(g, nullptr);
63746374 g->primitive_type_table.put(&entry->name, entry);
63756375 }
63766376
......@@ -6623,7 +6623,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
66236623 buf_appendf(contents, "pub const TypeId = enum {\n");
66246624 size_t field_count = type_id_len();
66256625 for (size_t i = 0; i < field_count; i += 1) {
6626 const TypeTableEntryId id = type_id_at_index(i);
6626 const ZigTypeId id = type_id_at_index(i);
66276627 buf_appendf(contents, " %s,\n", type_id_name(id));
66286628 }
66296629 buf_appendf(contents, "};\n\n");
......@@ -7068,14 +7068,14 @@ static void create_test_compile_var_and_add_test_runner(CodeGen *g) {
70687068 exit(0);
70697069 }
70707070
7071 TypeTableEntry *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
7071 ZigType *u8_ptr_type = get_pointer_to_type_extra(g, g->builtin_types.entry_u8, true, false,
70727072 PtrLenUnknown, get_abi_alignment(g, g->builtin_types.entry_u8), 0, 0);
7073 TypeTableEntry *str_type = get_slice_type(g, u8_ptr_type);
7074 TypeTableEntry *fn_type = get_test_fn_type(g);
7073 ZigType *str_type = get_slice_type(g, u8_ptr_type);
7074 ZigType *fn_type = get_test_fn_type(g);
70757075
70767076 const char *field_names[] = { "name", "func", };
7077 TypeTableEntry *field_types[] = { str_type, fn_type, };
7078 TypeTableEntry *struct_type = get_struct_type(g, "ZigTestFn", field_names, field_types, 2);
7077 ZigType *field_types[] = { str_type, fn_type, };
7078 ZigType *struct_type = get_struct_type(g, "ZigTestFn", field_names, field_types, 2);
70797079
70807080 ConstExprValue *test_fn_array = create_const_vals(1);
70817081 test_fn_array->type = get_array_type(g, struct_type, g->test_fns.length);
......@@ -7217,10 +7217,10 @@ static const char *c_int_type_names[] = {
72177217};
72187218
72197219struct GenH {
7220 ZigList<TypeTableEntry *> types_to_declare;
7220 ZigList<ZigType *> types_to_declare;
72217221};
72227222
7223static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, TypeTableEntry *type_entry) {
7223static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, ZigType *type_entry) {
72247224 if (type_entry->gen_h_loop_flag)
72257225 return;
72267226 type_entry->gen_h_loop_flag = true;
......@@ -7285,7 +7285,7 @@ static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, TypeTableEntry
72857285 }
72867286}
72877287
7288static void get_c_type(CodeGen *g, GenH *gen_h, TypeTableEntry *type_entry, Buf *out_buf) {
7288static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_buf) {
72897289 assert(type_entry);
72907290
72917291 for (size_t i = 0; i < array_length(c_int_type_names); i += 1) {
......@@ -7354,7 +7354,7 @@ static void get_c_type(CodeGen *g, GenH *gen_h, TypeTableEntry *type_entry, Buf
73547354 case TypeTableEntryIdPointer:
73557355 {
73567356 Buf child_buf = BUF_INIT;
7357 TypeTableEntry *child_type = type_entry->data.pointer.child_type;
7357 ZigType *child_type = type_entry->data.pointer.child_type;
73587358 get_c_type(g, gen_h, child_type, &child_buf);
73597359
73607360 const char *const_str = type_entry->data.pointer.is_const ? "const " : "";
......@@ -7364,7 +7364,7 @@ static void get_c_type(CodeGen *g, GenH *gen_h, TypeTableEntry *type_entry, Buf
73647364 }
73657365 case TypeTableEntryIdOptional:
73667366 {
7367 TypeTableEntry *child_type = type_entry->data.maybe.child_type;
7367 ZigType *child_type = type_entry->data.maybe.child_type;
73687368 if (child_type->zero_bits) {
73697369 buf_init_from_str(out_buf, "bool");
73707370 return;
......@@ -7555,7 +7555,7 @@ static void gen_h_file(CodeGen *g) {
75557555 fprintf(out_h, "\n");
75567556
75577557 for (size_t type_i = 0; type_i < gen_h->types_to_declare.length; type_i += 1) {
7558 TypeTableEntry *type_entry = gen_h->types_to_declare.at(type_i);
7558 ZigType *type_entry = gen_h->types_to_declare.at(type_i);
75597559 switch (type_entry->id) {
75607560 case TypeTableEntryIdInvalid:
75617561 case TypeTableEntryIdMetaType:
src/ir.cpp+553-553
......@@ -33,7 +33,7 @@ struct IrAnalyze {
3333 IrExecContext exec_context;
3434 size_t old_bb_index;
3535 size_t instruction_index;
36 TypeTableEntry *explicit_return_type;
36 ZigType *explicit_return_type;
3737 ZigList<IrInstruction *> src_implicit_return_type_list;
3838 IrBasicBlock *const_predecessor_bb;
3939};
......@@ -99,38 +99,38 @@ struct ConstCastOnly {
9999};
100100
101101struct ConstCastTypeMismatch {
102 TypeTableEntry *wanted_type;
103 TypeTableEntry *actual_type;
102 ZigType *wanted_type;
103 ZigType *actual_type;
104104};
105105
106106struct ConstCastOptionalMismatch {
107107 ConstCastOnly child;
108 TypeTableEntry *wanted_child;
109 TypeTableEntry *actual_child;
108 ZigType *wanted_child;
109 ZigType *actual_child;
110110};
111111
112112struct ConstCastPointerMismatch {
113113 ConstCastOnly child;
114 TypeTableEntry *wanted_child;
115 TypeTableEntry *actual_child;
114 ZigType *wanted_child;
115 ZigType *actual_child;
116116};
117117
118118struct ConstCastSliceMismatch {
119119 ConstCastOnly child;
120 TypeTableEntry *wanted_child;
121 TypeTableEntry *actual_child;
120 ZigType *wanted_child;
121 ZigType *actual_child;
122122};
123123
124124struct ConstCastErrUnionErrSetMismatch {
125125 ConstCastOnly child;
126 TypeTableEntry *wanted_err_set;
127 TypeTableEntry *actual_err_set;
126 ZigType *wanted_err_set;
127 ZigType *actual_err_set;
128128};
129129
130130struct ConstCastErrUnionPayloadMismatch {
131131 ConstCastOnly child;
132 TypeTableEntry *wanted_payload;
133 TypeTableEntry *actual_payload;
132 ZigType *wanted_payload;
133 ZigType *actual_payload;
134134};
135135
136136struct ConstCastErrSetMismatch {
......@@ -139,17 +139,17 @@ struct ConstCastErrSetMismatch {
139139
140140static IrInstruction *ir_gen_node(IrBuilder *irb, AstNode *node, Scope *scope);
141141static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, Scope *scope, LVal lval);
142static TypeTableEntry *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *instruction);
143static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, TypeTableEntry *expected_type);
142static ZigType *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *instruction);
143static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, ZigType *expected_type);
144144static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr);
145145static ErrorMsg *exec_add_error_node(CodeGen *codegen, IrExecutable *exec, AstNode *source_node, Buf *msg);
146146static 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);
148148static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, VariableTableEntry *var);
149static TypeTableEntry *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op);
149static ZigType *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op);
150150static IrInstruction *ir_lval_wrap(IrBuilder *irb, Scope *scope, IrInstruction *value, LVal lval);
151static TypeTableEntry *adjust_ptr_align(CodeGen *g, TypeTableEntry *ptr_type, uint32_t new_align);
152static TypeTableEntry *adjust_slice_align(CodeGen *g, TypeTableEntry *slice_type, uint32_t new_align);
151static ZigType *adjust_ptr_align(CodeGen *g, ZigType *ptr_type, uint32_t new_align);
152static ZigType *adjust_slice_align(CodeGen *g, ZigType *slice_type, uint32_t new_align);
153153static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue *val);
154154static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue *val);
155155
......@@ -183,7 +183,7 @@ static ConstExprValue *const_ptr_pointee_unchecked(CodeGen *g, ConstExprValue *c
183183 return result;
184184}
185185
186static bool types_have_same_zig_comptime_repr(TypeTableEntry *a, TypeTableEntry *b) {
186static bool types_have_same_zig_comptime_repr(ZigType *a, ZigType *b) {
187187 if (a == b)
188188 return true;
189189
......@@ -878,7 +878,7 @@ static T *ir_build_instruction(IrBuilder *irb, Scope *scope, AstNode *source_nod
878878 return special_instruction;
879879}
880880
881static IrInstruction *ir_build_cast(IrBuilder *irb, Scope *scope, AstNode *source_node, TypeTableEntry *dest_type,
881static IrInstruction *ir_build_cast(IrBuilder *irb, Scope *scope, AstNode *source_node, ZigType *dest_type,
882882 IrInstruction *value, CastOp cast_op)
883883{
884884 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
931931}
932932
933933static IrInstruction *ir_create_const(IrBuilder *irb, Scope *scope, AstNode *source_node,
934 TypeTableEntry *type_entry)
934 ZigType *type_entry)
935935{
936936 assert(type_entry);
937937 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
10021002}
10031003
10041004static IrInstruction *ir_create_const_type(IrBuilder *irb, Scope *scope, AstNode *source_node,
1005 TypeTableEntry *type_entry)
1005 ZigType *type_entry)
10061006{
10071007 IrInstructionConst *const_instruction = ir_create_instruction<IrInstructionConst>(irb, scope, source_node);
10081008 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
10121012}
10131013
10141014static IrInstruction *ir_build_const_type(IrBuilder *irb, Scope *scope, AstNode *source_node,
1015 TypeTableEntry *type_entry)
1015 ZigType *type_entry)
10161016{
10171017 IrInstruction *instruction = ir_create_const_type(irb, scope, source_node, type_entry);
10181018 ir_instruction_append(irb->current_basic_block, instruction);
......@@ -1376,7 +1376,7 @@ static IrInstruction *ir_build_container_init_fields(IrBuilder *irb, Scope *scop
13761376}
13771377
13781378static 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)
13801380{
13811381 IrInstructionStructInit *struct_init_instruction = ir_build_instruction<IrInstructionStructInit>(irb, scope, source_node);
13821382 struct_init_instruction->struct_type = struct_type;
......@@ -1390,7 +1390,7 @@ static IrInstruction *ir_build_struct_init(IrBuilder *irb, Scope *scope, AstNode
13901390}
13911391
13921392static 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)
13941394{
13951395 IrInstruction *new_instruction = ir_build_struct_init(irb, old_instruction->scope,
13961396 old_instruction->source_node, struct_type, field_count, fields);
......@@ -1399,7 +1399,7 @@ static IrInstruction *ir_build_struct_init_from(IrBuilder *irb, IrInstruction *o
13991399}
14001400
14011401static 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)
14031403{
14041404 IrInstructionUnionInit *union_init_instruction = ir_build_instruction<IrInstructionUnionInit>(irb, scope, source_node);
14051405 union_init_instruction->union_type = union_type;
......@@ -1412,7 +1412,7 @@ static IrInstruction *ir_build_union_init(IrBuilder *irb, Scope *scope, AstNode
14121412}
14131413
14141414static 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)
14161416{
14171417 IrInstruction *new_instruction = ir_build_union_init(irb, old_instruction->scope,
14181418 old_instruction->source_node, union_type, field, init_value);
......@@ -1973,7 +1973,7 @@ static IrInstruction *ir_build_cmpxchg(IrBuilder *irb, Scope *scope, AstNode *so
19731973 IrInstruction *ptr, IrInstruction *cmp_value, IrInstruction *new_value,
19741974 IrInstruction *success_order_value, IrInstruction *failure_order_value,
19751975 bool is_weak,
1976 TypeTableEntry *type, AtomicOrder success_order, AtomicOrder failure_order)
1976 ZigType *type, AtomicOrder success_order, AtomicOrder failure_order)
19771977{
19781978 IrInstructionCmpxchg *instruction = ir_build_instruction<IrInstructionCmpxchg>(irb, scope, source_node);
19791979 instruction->type_value = type_value;
......@@ -2286,7 +2286,7 @@ static IrInstruction *ir_build_handle_from(IrBuilder *irb, IrInstruction *old_in
22862286
22872287static IrInstruction *ir_build_overflow_op(IrBuilder *irb, Scope *scope, AstNode *source_node,
22882288 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)
22902290{
22912291 IrInstructionOverflowOp *instruction = ir_build_instruction<IrInstructionOverflowOp>(irb, scope, source_node);
22922292 instruction->op = op;
......@@ -2306,7 +2306,7 @@ static IrInstruction *ir_build_overflow_op(IrBuilder *irb, Scope *scope, AstNode
23062306
23072307static IrInstruction *ir_build_overflow_op_from(IrBuilder *irb, IrInstruction *old_instruction,
23082308 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)
23102310{
23112311 IrInstruction *new_instruction = ir_build_overflow_op(irb, old_instruction->scope, old_instruction->source_node,
23122312 op, type_value, op1, op2, result_ptr, result_ptr_type);
......@@ -3343,7 +3343,7 @@ static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Sco
33433343 add_error_note(codegen, msg, existing_var->decl_node, buf_sprintf("previous declaration is here"));
33443344 variable_entry->value->type = codegen->builtin_types.entry_invalid;
33453345 } else {
3346 TypeTableEntry *type = get_primitive_type(codegen, name);
3346 ZigType *type = get_primitive_type(codegen, name);
33473347 if (type != nullptr) {
33483348 add_node_error(codegen, node,
33493349 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,
37893789 return &const_instruction->base;
37903790 }
37913791
3792 TypeTableEntry *primitive_type = get_primitive_type(irb->codegen, variable_name);
3792 ZigType *primitive_type = get_primitive_type(irb->codegen, variable_name);
37933793 if (primitive_type != nullptr) {
37943794 IrInstruction *value = ir_build_const_type(irb, scope, node, primitive_type);
37953795 if (lval == LValPtr) {
......@@ -5696,7 +5696,7 @@ static IrInstruction *ir_gen_this_literal(IrBuilder *irb, Scope *scope, AstNode
56965696
56975697 if (scope->id == ScopeIdDecls) {
56985698 ScopeDecls *decls_scope = (ScopeDecls *)scope;
5699 TypeTableEntry *container_type = decls_scope->container_type;
5699 ZigType *container_type = decls_scope->container_type;
57005700 assert(container_type);
57015701 return ir_build_const_type(irb, scope, node, container_type);
57025702 }
......@@ -6566,7 +6566,7 @@ static IrInstruction *ir_gen_container_decl(IrBuilder *irb, Scope *parent_scope,
65666566 init_tld(&tld_container->base, TldIdContainer, name, visib_mod, node, parent_scope);
65676567
65686568 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,
65706570 kind, node, buf_ptr(name), layout);
65716571 ScopeDecls *child_scope = get_container_scope(container_type);
65726572
......@@ -6586,11 +6586,11 @@ static IrInstruction *ir_gen_container_decl(IrBuilder *irb, Scope *parent_scope,
65866586}
65876587
65886588// errors should be populated with set1's values
6589static TypeTableEntry *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, TypeTableEntry *set1, TypeTableEntry *set2) {
6589static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigType *set1, ZigType *set2) {
65906590 assert(set1->id == TypeTableEntryIdErrorSet);
65916591 assert(set2->id == TypeTableEntryIdErrorSet);
65926592
6593 TypeTableEntry *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
6593 ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
65946594 buf_resize(&err_set_type->name, 0);
65956595 buf_appendf(&err_set_type->name, "error{");
65966596
......@@ -6639,10 +6639,10 @@ static TypeTableEntry *get_error_set_union(CodeGen *g, ErrorTableEntry **errors,
66396639
66406640}
66416641
6642static TypeTableEntry *make_err_set_with_one_item(CodeGen *g, Scope *parent_scope, AstNode *node,
6642static ZigType *make_err_set_with_one_item(CodeGen *g, Scope *parent_scope, AstNode *node,
66436643 ErrorTableEntry *err_entry)
66446644{
6645 TypeTableEntry *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
6645 ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
66466646 buf_resize(&err_set_type->name, 0);
66476647 buf_appendf(&err_set_type->name, "error{%s}", buf_ptr(&err_entry->name));
66486648 err_set_type->is_copyable = true;
......@@ -6664,7 +6664,7 @@ static IrInstruction *ir_gen_err_set_decl(IrBuilder *irb, Scope *parent_scope, A
66646664 uint32_t err_count = node->data.err_set_decl.decls.length;
66656665
66666666 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);
66686668 buf_init_from_buf(&err_set_type->name, type_name);
66696669 err_set_type->is_copyable = true;
66706670 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
73867386 IrInstruction *const_bool_false;
73877387 IrInstruction *coro_promise_ptr;
73887388 IrInstruction *err_ret_trace_ptr;
7389 TypeTableEntry *return_type;
7389 ZigType *return_type;
73907390 Buf *result_ptr_field_name;
73917391 VariableTableEntry *coro_size_var;
73927392 if (is_async) {
......@@ -7397,7 +7397,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec
73977397
73987398 return_type = fn_entry->type_entry->data.fn.fn_type_id.return_type;
73997399 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);
74017401 IrInstruction *coro_frame_type_value = ir_build_const_type(irb, coro_scope, node, coro_frame_type);
74027402 // TODO mark this var decl as "no safety" e.g. disable initializing the undef value to 0xaa
74037403 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
76297629 ConstExprValue *val = const_ptr_pointee_unchecked(ira->codegen, const_val);
76307630 assert(val != nullptr);
76317631 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;
76337633 if (!types_have_same_zig_comptime_repr(val->type, expected_type)) {
76347634 ir_add_error_node(ira, source_node,
76357635 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
76687668 return true;
76697669}
76707670
7671static bool const_val_fits_in_num_lit(ConstExprValue *const_val, TypeTableEntry *num_lit_type) {
7671static bool const_val_fits_in_num_lit(ConstExprValue *const_val, ZigType *num_lit_type) {
76727672 return ((num_lit_type->id == TypeTableEntryIdComptimeFloat &&
76737673 (const_val->type->id == TypeTableEntryIdFloat || const_val->type->id == TypeTableEntryIdComptimeFloat)) ||
76747674 (num_lit_type->id == TypeTableEntryIdComptimeInt &&
......@@ -8365,7 +8365,7 @@ void float_read_ieee597(ConstExprValue *val, uint8_t *buf, bool is_big_endian) {
83658365 }
83668366}
83678367
8368static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruction, TypeTableEntry *other_type,
8368static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruction, ZigType *other_type,
83698369 bool explicit_cast)
83708370{
83718371 if (type_is_invalid(other_type)) {
......@@ -8399,7 +8399,7 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc
83998399 } else if (const_val_fits_in_num_lit(const_val, other_type)) {
84008400 return true;
84018401 } 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;
84038403 if (const_val_fits_in_num_lit(const_val, child_type)) {
84048404 return true;
84058405 } 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
84678467 return false;
84688468}
84698469
8470static bool is_slice(TypeTableEntry *type) {
8470static bool is_slice(ZigType *type) {
84718471 return type->id == TypeTableEntryIdStruct && type->data.structure.is_slice;
84728472}
84738473
8474static bool slice_is_const(TypeTableEntry *type) {
8474static bool slice_is_const(ZigType *type) {
84758475 assert(is_slice(type));
84768476 return type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const;
84778477}
84788478
8479static TypeTableEntry *get_error_set_intersection(IrAnalyze *ira, TypeTableEntry *set1, TypeTableEntry *set2,
8479static ZigType *get_error_set_intersection(IrAnalyze *ira, ZigType *set1, ZigType *set2,
84808480 AstNode *source_node)
84818481{
84828482 assert(set1->id == TypeTableEntryIdErrorSet);
......@@ -8502,7 +8502,7 @@ static TypeTableEntry *get_error_set_intersection(IrAnalyze *ira, TypeTableEntry
85028502 }
85038503 ZigList<ErrorTableEntry *> intersection_list = {};
85048504
8505 TypeTableEntry *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
8505 ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
85068506 buf_resize(&err_set_type->name, 0);
85078507 buf_appendf(&err_set_type->name, "error{");
85088508
......@@ -8531,8 +8531,8 @@ static TypeTableEntry *get_error_set_intersection(IrAnalyze *ira, TypeTableEntry
85318531}
85328532
85338533
8534static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, TypeTableEntry *wanted_type,
8535 TypeTableEntry *actual_type, AstNode *source_node, bool wanted_is_mutable)
8534static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted_type,
8535 ZigType *actual_type, AstNode *source_node, bool wanted_is_mutable)
85368536{
85378537 CodeGen *g = ira->codegen;
85388538 ConstCastOnly result = {};
......@@ -8595,8 +8595,8 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, TypeTableEntry
85958595
85968596 // slice const
85978597 if (is_slice(wanted_type) && is_slice(actual_type)) {
8598 TypeTableEntry *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;
8598 ZigType *actual_ptr_type = actual_type->data.structure.fields[slice_ptr_index].type_entry;
8599 ZigType *wanted_ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
86008600 if ((!actual_ptr_type->data.pointer.is_const || wanted_ptr_type->data.pointer.is_const) &&
86018601 (!actual_ptr_type->data.pointer.is_volatile || wanted_ptr_type->data.pointer.is_volatile) &&
86028602 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
86578657
86588658 // error set
86598659 if (wanted_type->id == TypeTableEntryIdErrorSet && actual_type->id == TypeTableEntryIdErrorSet) {
8660 TypeTableEntry *contained_set = actual_type;
8661 TypeTableEntry *container_set = wanted_type;
8660 ZigType *contained_set = actual_type;
8661 ZigType *container_set = wanted_type;
86628662
86638663 // if the container set is inferred, then this will always work.
86648664 if (container_set->data.error_set.infer_fn != nullptr) {
......@@ -8797,7 +8797,7 @@ static void update_errors_helper(CodeGen *g, ErrorTableEntry ***errors, size_t *
87978797 *errors = reallocate(*errors, old_errors_count, *errors_count);
87988798}
87998799
8800static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, TypeTableEntry *expected_type, IrInstruction **instructions, size_t instruction_count) {
8800static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigType *expected_type, IrInstruction **instructions, size_t instruction_count) {
88018801 Error err;
88028802 assert(instruction_count >= 1);
88038803 IrInstruction *prev_inst = instructions[0];
......@@ -8806,7 +8806,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
88068806 }
88078807 ErrorTableEntry **errors = nullptr;
88088808 size_t errors_count = 0;
8809 TypeTableEntry *err_set_type = nullptr;
8809 ZigType *err_set_type = nullptr;
88108810 if (prev_inst->value.type->id == TypeTableEntryIdErrorSet) {
88118811 if (type_is_global_error_set(prev_inst->value.type)) {
88128812 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
88298829 bool convert_to_const_slice = false;
88308830 for (size_t i = 1; i < instruction_count; i += 1) {
88318831 IrInstruction *cur_inst = instructions[i];
8832 TypeTableEntry *cur_type = cur_inst->value.type;
8833 TypeTableEntry *prev_type = prev_inst->value.type;
8832 ZigType *cur_type = cur_inst->value.type;
8833 ZigType *prev_type = prev_inst->value.type;
88348834
88358835 if (type_is_invalid(cur_type)) {
88368836 return cur_type;
......@@ -8916,7 +8916,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
89168916 prev_inst = cur_inst;
89178917 continue;
89188918 }
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;
89208920 if (!resolve_inferred_error_set(ira->codegen, cur_err_set_type, cur_inst->source_node)) {
89218921 return ira->codegen->builtin_types.entry_invalid;
89228922 }
......@@ -9021,8 +9021,8 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
90219021 }
90229022
90239023 if (prev_type->id == TypeTableEntryIdErrorUnion && cur_type->id == TypeTableEntryIdErrorUnion) {
9024 TypeTableEntry *prev_payload_type = prev_type->data.error_union.payload_type;
9025 TypeTableEntry *cur_payload_type = cur_type->data.error_union.payload_type;
9024 ZigType *prev_payload_type = prev_type->data.error_union.payload_type;
9025 ZigType *cur_payload_type = cur_type->data.error_union.payload_type;
90269026
90279027 bool const_cast_prev = types_match_const_cast_only(ira, prev_payload_type, cur_payload_type,
90289028 source_node, false).id == ConstCastResultIdOk;
......@@ -9034,8 +9034,8 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
90349034 prev_inst = cur_inst;
90359035 }
90369036
9037 TypeTableEntry *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;
9037 ZigType *prev_err_set_type = (err_set_type == nullptr) ? prev_type->data.error_union.err_set_type : err_set_type;
9038 ZigType *cur_err_set_type = cur_type->data.error_union.err_set_type;
90399039
90409040 if (!resolve_inferred_error_set(ira->codegen, prev_err_set_type, cur_inst->source_node)) {
90419041 return ira->codegen->builtin_types.entry_invalid;
......@@ -9152,7 +9152,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
91529152 source_node, false).id == ConstCastResultIdOk)
91539153 {
91549154 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;
91569156 if (!resolve_inferred_error_set(ira->codegen, cur_err_set_type, cur_inst->source_node)) {
91579157 return ira->codegen->builtin_types.entry_invalid;
91589158 }
......@@ -9293,12 +9293,12 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
92939293
92949294 if (convert_to_const_slice) {
92959295 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(
92979297 ira->codegen, prev_inst->value.type->data.array.child_type,
92989298 true, false, PtrLenUnknown,
92999299 get_abi_alignment(ira->codegen, prev_inst->value.type->data.array.child_type),
93009300 0, 0);
9301 TypeTableEntry *slice_type = get_slice_type(ira->codegen, ptr_type);
9301 ZigType *slice_type = get_slice_type(ira->codegen, ptr_type);
93029302 if (err_set_type != nullptr) {
93039303 return get_error_union_type(ira->codegen, err_set_type, slice_type);
93049304 } else {
......@@ -9343,7 +9343,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
93439343 }
93449344}
93459345
9346static void ir_add_alloca(IrAnalyze *ira, IrInstruction *instruction, TypeTableEntry *type_entry) {
9346static void ir_add_alloca(IrAnalyze *ira, IrInstruction *instruction, ZigType *type_entry) {
93479347 if (type_has_bits(type_entry) && handle_is_ptr(type_entry)) {
93489348 FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec);
93499349 if (fn_entry != nullptr) {
......@@ -9366,8 +9366,8 @@ static void copy_const_val(ConstExprValue *dest, ConstExprValue *src, bool same_
93669366
93679367static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_instr,
93689368 CastOp cast_op,
9369 ConstExprValue *other_val, TypeTableEntry *other_type,
9370 ConstExprValue *const_val, TypeTableEntry *new_type)
9369 ConstExprValue *other_val, ZigType *other_type,
9370 ConstExprValue *const_val, ZigType *new_type)
93719371{
93729372 const_val->special = other_val->special;
93739373
......@@ -9467,7 +9467,7 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_
94679467 return true;
94689468}
94699469static 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)
94719471{
94729472 if ((instr_is_comptime(value) || !type_has_bits(wanted_type)) &&
94739473 cast_op != CastOpResizeSlice && cast_op != CastOpBytesToSlice)
......@@ -9491,7 +9491,7 @@ static IrInstruction *ir_resolve_cast(IrAnalyze *ira, IrInstruction *source_inst
94919491}
94929492
94939493static 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)
94959495{
94969496 assert(value->value.type->id == TypeTableEntryIdPointer);
94979497 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,
95209520}
95219521
95229522static 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)
95249524{
95259525 wanted_type = adjust_slice_align(ira->codegen, wanted_type, value->value.type->data.pointer.alignment);
95269526
......@@ -9530,7 +9530,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc
95309530 return ira->codegen->invalid_instruction;
95319531 if (pointee->special != ConstValSpecialRuntime) {
95329532 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;
95349534 assert(is_slice(wanted_type));
95359535 bool is_const = wanted_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const;
95369536
......@@ -9551,7 +9551,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc
95519551 return result;
95529552}
95539553
9554static bool is_container(TypeTableEntry *type) {
9554static bool is_container(ZigType *type) {
95559555 return type->id == TypeTableEntryIdStruct ||
95569556 type->id == TypeTableEntryIdEnum ||
95579557 type->id == TypeTableEntryIdUnion;
......@@ -9630,7 +9630,7 @@ static void ir_finish_bb(IrAnalyze *ira) {
96309630 }
96319631}
96329632
9633static TypeTableEntry *ir_unreach_error(IrAnalyze *ira) {
9633static ZigType *ir_unreach_error(IrAnalyze *ira) {
96349634 ira->old_bb_index = SIZE_MAX;
96359635 ira->new_irb.exec->invalid = true;
96369636 return ira->codegen->builtin_types.entry_unreachable;
......@@ -9653,7 +9653,7 @@ static bool ir_emit_backward_branch(IrAnalyze *ira, IrInstruction *source_instru
96539653 return true;
96549654}
96559655
9656static TypeTableEntry *ir_inline_bb(IrAnalyze *ira, IrInstruction *source_instruction, IrBasicBlock *old_bb) {
9656static ZigType *ir_inline_bb(IrAnalyze *ira, IrInstruction *source_instruction, IrBasicBlock *old_bb) {
96579657 if (old_bb->debug_id <= ira->old_irb.current_basic_block->debug_id) {
96589658 if (!ir_emit_backward_branch(ira, source_instruction))
96599659 return ir_unreach_error(ira);
......@@ -9664,7 +9664,7 @@ static TypeTableEntry *ir_inline_bb(IrAnalyze *ira, IrInstruction *source_instru
96649664 return ira->codegen->builtin_types.entry_unreachable;
96659665}
96669666
9667static TypeTableEntry *ir_finish_anal(IrAnalyze *ira, TypeTableEntry *result_type) {
9667static ZigType *ir_finish_anal(IrAnalyze *ira, ZigType *result_type) {
96689668 if (result_type->id == TypeTableEntryIdUnreachable)
96699669 ir_finish_bb(ira);
96709670 return result_type;
......@@ -9684,16 +9684,16 @@ static ConstExprValue *ir_build_const_from(IrAnalyze *ira, IrInstruction *old_in
96849684 return &new_instruction->value;
96859685}
96869686
9687static TypeTableEntry *ir_analyze_void(IrAnalyze *ira, IrInstruction *instruction) {
9687static ZigType *ir_analyze_void(IrAnalyze *ira, IrInstruction *instruction) {
96889688 ir_build_const_from(ira, instruction);
96899689 return ira->codegen->builtin_types.entry_void;
96909690}
96919691
96929692static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instruction,
9693 ConstExprValue *pointee, TypeTableEntry *pointee_type,
9693 ConstExprValue *pointee, ZigType *pointee_type,
96949694 ConstPtrMut ptr_mut, bool ptr_is_const, bool ptr_is_volatile, uint32_t ptr_align)
96959695{
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,
96979697 ptr_is_const, ptr_is_volatile, PtrLenSingle, ptr_align, 0, 0);
96989698 IrInstruction *const_instr = ir_get_const(ira, instruction);
96999699 ConstExprValue *const_val = &const_instr->value;
......@@ -9704,8 +9704,8 @@ static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instructio
97049704 return const_instr;
97059705}
97069706
9707static TypeTableEntry *ir_analyze_const_ptr(IrAnalyze *ira, IrInstruction *instruction,
9708 ConstExprValue *pointee, TypeTableEntry *pointee_type,
9707static ZigType *ir_analyze_const_ptr(IrAnalyze *ira, IrInstruction *instruction,
9708 ConstExprValue *pointee, ZigType *pointee_type,
97099709 ConstPtrMut ptr_mut, bool ptr_is_const, bool ptr_is_volatile)
97109710{
97119711 IrInstruction *const_instr = ir_get_const_ptr(ira, instruction, pointee,
......@@ -9715,7 +9715,7 @@ static TypeTableEntry *ir_analyze_const_ptr(IrAnalyze *ira, IrInstruction *instr
97159715 return const_instr->value.type;
97169716}
97179717
9718static TypeTableEntry *ir_analyze_const_usize(IrAnalyze *ira, IrInstruction *instruction, uint64_t value) {
9718static ZigType *ir_analyze_const_usize(IrAnalyze *ira, IrInstruction *instruction, uint64_t value) {
97199719 ConstExprValue *const_val = ir_build_const_from(ira, instruction);
97209720 bigint_init_unsigned(&const_val->data.x_bigint, value);
97219721 return ira->codegen->builtin_types.entry_usize;
......@@ -9748,7 +9748,7 @@ static ConstExprValue *ir_resolve_const(IrAnalyze *ira, IrInstruction *value, Un
97489748}
97499749
97509750IrInstruction *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,
97529752 FnTableEntry *fn_entry, Buf *c_import_buf, AstNode *source_node, Buf *exec_name,
97539753 IrExecutable *parent_exec)
97549754{
......@@ -9786,7 +9786,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node
97869786 analyzed_executable->backward_branch_count = backward_branch_count;
97879787 analyzed_executable->backward_branch_quota = backward_branch_quota;
97889788 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);
97909790 if (type_is_invalid(result_type))
97919791 return codegen->invalid_instruction;
97929792
......@@ -9799,7 +9799,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node
97999799 return ir_exec_const_result(codegen, analyzed_executable);
98009800}
98019801
9802static TypeTableEntry *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) {
9802static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) {
98039803 if (type_is_invalid(type_value->value.type))
98049804 return ira->codegen->builtin_types.entry_invalid;
98059805
......@@ -9837,11 +9837,11 @@ static FnTableEntry *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) {
98379837 return const_val->data.x_ptr.data.fn.fn_entry;
98389838}
98399839
9840static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, TypeTableEntry *wanted_type) {
9840static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, ZigType *wanted_type) {
98419841 assert(wanted_type->id == TypeTableEntryIdOptional);
98429842
98439843 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;
98459845 IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type);
98469846 if (type_is_invalid(casted_payload->value.type))
98479847 return ira->codegen->invalid_instruction;
......@@ -9870,12 +9870,12 @@ static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *sourc
98709870}
98719871
98729872static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction *source_instr,
9873 IrInstruction *value, TypeTableEntry *wanted_type)
9873 IrInstruction *value, ZigType *wanted_type)
98749874{
98759875 assert(wanted_type->id == TypeTableEntryIdErrorUnion);
98769876
98779877 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;
98799879 IrInstruction *casted_payload = ir_implicit_cast(ira, value, payload_type);
98809880 if (type_is_invalid(casted_payload->value.type))
98819881 return ira->codegen->invalid_instruction;
......@@ -9901,7 +9901,7 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction
99019901}
99029902
99039903static IrInstruction *ir_analyze_err_set_cast(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value,
9904 TypeTableEntry *wanted_type)
9904 ZigType *wanted_type)
99059905{
99069906 assert(value->value.type->id == TypeTableEntryIdErrorSet);
99079907 assert(wanted_type->id == TypeTableEntryIdErrorSet);
......@@ -9943,7 +9943,7 @@ static IrInstruction *ir_analyze_err_set_cast(IrAnalyze *ira, IrInstruction *sou
99439943 return result;
99449944}
99459945
9946static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, TypeTableEntry *wanted_type) {
9946static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, ZigType *wanted_type) {
99479947 assert(wanted_type->id == TypeTableEntryIdErrorUnion);
99489948
99499949 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
99709970}
99719971
99729972static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_instr,
9973 IrInstruction *value, TypeTableEntry *wanted_type)
9973 IrInstruction *value, ZigType *wanted_type)
99749974{
99759975 if (instr_is_comptime(value)) {
99769976 ConstExprValue *val = ir_resolve_const(ira, value, UndefBad);
......@@ -9994,7 +9994,7 @@ static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_
99949994 source_instr->source_node, value, true, false);
99959995 new_instruction->value.type = wanted_type;
99969996
9997 TypeTableEntry *child_type = wanted_type->data.pointer.child_type;
9997 ZigType *child_type = wanted_type->data.pointer.child_type;
99989998 if (type_has_bits(child_type)) {
99999999 FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec);
1000010000 assert(fn_entry);
......@@ -10005,7 +10005,7 @@ static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_
1000510005 }
1000610006}
1000710007
10008static IrInstruction *ir_analyze_null_to_maybe(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, TypeTableEntry *wanted_type) {
10008static IrInstruction *ir_analyze_null_to_maybe(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, ZigType *wanted_type) {
1000910009 assert(wanted_type->id == TypeTableEntryIdOptional);
1001010010 assert(instr_is_comptime(value));
1001110011
......@@ -10039,7 +10039,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi
1003910039 get_abi_alignment(ira->codegen, value->value.type));
1004010040 }
1004110041
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,
1004310043 is_const, is_volatile, PtrLenSingle, get_abi_alignment(ira->codegen, value->value.type), 0, 0);
1004410044 IrInstruction *new_instruction = ir_build_ref(&ira->new_irb, source_instruction->scope,
1004510045 source_instruction->source_node, value, is_const, is_volatile);
......@@ -10054,7 +10054,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi
1005410054}
1005510055
1005610056static 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)
1005810058{
1005910059 assert(is_slice(wanted_type));
1006010060 // 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
1006810068 } else {
1006910069 array = array_arg;
1007010070 }
10071 TypeTableEntry *array_type = array->value.type;
10071 ZigType *array_type = array->value.type;
1007210072 assert(array_type->id == TypeTableEntryIdArray);
1007310073
1007410074 if (instr_is_comptime(array)) {
......@@ -10100,12 +10100,12 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s
1010010100}
1010110101
1010210102static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *source_instr,
10103 IrInstruction *target, TypeTableEntry *wanted_type)
10103 IrInstruction *target, ZigType *wanted_type)
1010410104{
1010510105 Error err;
1010610106 assert(wanted_type->id == TypeTableEntryIdInt);
1010710107
10108 TypeTableEntry *actual_type = target->value.type;
10108 ZigType *actual_type = target->value.type;
1010910109 if ((err = ensure_complete_type(ira->codegen, actual_type)))
1011010110 return ira->codegen->invalid_instruction;
1011110111
......@@ -10136,7 +10136,7 @@ static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *sour
1013610136}
1013710137
1013810138static IrInstruction *ir_analyze_union_to_tag(IrAnalyze *ira, IrInstruction *source_instr,
10139 IrInstruction *target, TypeTableEntry *wanted_type)
10139 IrInstruction *target, ZigType *wanted_type)
1014010140{
1014110141 assert(target->value.type->id == TypeTableEntryIdUnion);
1014210142 assert(wanted_type->id == TypeTableEntryIdEnum);
......@@ -10161,7 +10161,7 @@ static IrInstruction *ir_analyze_union_to_tag(IrAnalyze *ira, IrInstruction *sou
1016110161}
1016210162
1016310163static IrInstruction *ir_analyze_undefined_to_anything(IrAnalyze *ira, IrInstruction *source_instr,
10164 IrInstruction *target, TypeTableEntry *wanted_type)
10164 IrInstruction *target, ZigType *wanted_type)
1016510165{
1016610166 IrInstruction *result = ir_create_const(&ira->new_irb, source_instr->scope,
1016710167 source_instr->source_node, wanted_type);
......@@ -10170,7 +10170,7 @@ static IrInstruction *ir_analyze_undefined_to_anything(IrAnalyze *ira, IrInstruc
1017010170}
1017110171
1017210172static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *source_instr,
10173 IrInstruction *target, TypeTableEntry *wanted_type)
10173 IrInstruction *target, ZigType *wanted_type)
1017410174{
1017510175 Error err;
1017610176 assert(wanted_type->id == TypeTableEntryIdUnion);
......@@ -10229,7 +10229,7 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so
1022910229}
1023010230
1023110231static IrInstruction *ir_analyze_widen_or_shorten(IrAnalyze *ira, IrInstruction *source_instr,
10232 IrInstruction *target, TypeTableEntry *wanted_type)
10232 IrInstruction *target, ZigType *wanted_type)
1023310233{
1023410234 assert(wanted_type->id == TypeTableEntryIdInt || wanted_type->id == TypeTableEntryIdFloat);
1023510235
......@@ -10270,12 +10270,12 @@ static IrInstruction *ir_analyze_widen_or_shorten(IrAnalyze *ira, IrInstruction
1027010270}
1027110271
1027210272static IrInstruction *ir_analyze_int_to_enum(IrAnalyze *ira, IrInstruction *source_instr,
10273 IrInstruction *target, TypeTableEntry *wanted_type)
10273 IrInstruction *target, ZigType *wanted_type)
1027410274{
1027510275 Error err;
1027610276 assert(wanted_type->id == TypeTableEntryIdEnum);
1027710277
10278 TypeTableEntry *actual_type = target->value.type;
10278 ZigType *actual_type = target->value.type;
1027910279
1028010280 if ((err = ensure_complete_type(ira->codegen, wanted_type)))
1028110281 return ira->codegen->invalid_instruction;
......@@ -10320,7 +10320,7 @@ static IrInstruction *ir_analyze_int_to_enum(IrAnalyze *ira, IrInstruction *sour
1032010320}
1032110321
1032210322static IrInstruction *ir_analyze_number_to_literal(IrAnalyze *ira, IrInstruction *source_instr,
10323 IrInstruction *target, TypeTableEntry *wanted_type)
10323 IrInstruction *target, ZigType *wanted_type)
1032410324{
1032510325 ConstExprValue *val = ir_resolve_const(ira, target, UndefBad);
1032610326 if (!val)
......@@ -10339,7 +10339,7 @@ static IrInstruction *ir_analyze_number_to_literal(IrAnalyze *ira, IrInstruction
1033910339}
1034010340
1034110341static IrInstruction *ir_analyze_int_to_err(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target,
10342 TypeTableEntry *wanted_type)
10342 ZigType *wanted_type)
1034310343{
1034410344 assert(target->value.type->id == TypeTableEntryIdInt);
1034510345 assert(!target->value.type->data.integral.is_signed);
......@@ -10404,11 +10404,11 @@ static IrInstruction *ir_analyze_int_to_err(IrAnalyze *ira, IrInstruction *sourc
1040410404}
1040510405
1040610406static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target,
10407 TypeTableEntry *wanted_type)
10407 ZigType *wanted_type)
1040810408{
1040910409 assert(wanted_type->id == TypeTableEntryIdInt);
1041010410
10411 TypeTableEntry *err_type = target->value.type;
10411 ZigType *err_type = target->value.type;
1041210412
1041310413 if (instr_is_comptime(target)) {
1041410414 ConstExprValue *val = ir_resolve_const(ira, target, UndefBad);
......@@ -10442,7 +10442,7 @@ static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *sourc
1044210442 return result;
1044310443 }
1044410444
10445 TypeTableEntry *err_set_type;
10445 ZigType *err_set_type;
1044610446 if (err_type->id == TypeTableEntryIdErrorUnion) {
1044710447 err_set_type = err_type->data.error_union.err_set_type;
1044810448 } else if (err_type->id == TypeTableEntryIdErrorSet) {
......@@ -10484,11 +10484,11 @@ static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *sourc
1048410484}
1048510485
1048610486static IrInstruction *ir_analyze_ptr_to_array(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target,
10487 TypeTableEntry *wanted_type)
10487 ZigType *wanted_type)
1048810488{
1048910489 assert(wanted_type->id == TypeTableEntryIdPointer);
1049010490 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;
1049210492 assert(array_type->id == TypeTableEntryIdArray);
1049310493 assert(array_type->data.array.len == 1);
1049410494
......@@ -10620,10 +10620,10 @@ static void report_recursive_error(IrAnalyze *ira, AstNode *source_node, ConstCa
1062010620}
1062110621
1062210622static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_instr,
10623 TypeTableEntry *wanted_type, IrInstruction *value)
10623 ZigType *wanted_type, IrInstruction *value)
1062410624{
1062510625 Error err;
10626 TypeTableEntry *actual_type = value->value.type;
10626 ZigType *actual_type = value->value.type;
1062710627 AstNode *source_node = source_instr->source_node;
1062810628
1062910629 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
1066510665
1066610666 // cast from [N]T to []const T
1066710667 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;
1066910669 assert(ptr_type->id == TypeTableEntryIdPointer);
1067010670 if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) &&
1067110671 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
1068110681 actual_type->data.pointer.is_const &&
1068210682 actual_type->data.pointer.child_type->id == TypeTableEntryIdArray)
1068310683 {
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;
1068510685 assert(ptr_type->id == TypeTableEntryIdPointer);
1068610686
10687 TypeTableEntry *array_type = actual_type->data.pointer.child_type;
10687 ZigType *array_type = actual_type->data.pointer.child_type;
1068810688
1068910689 if ((ptr_type->data.pointer.is_const || array_type->data.array.len == 0) &&
1069010690 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
1070010700 is_slice(wanted_type->data.pointer.child_type) &&
1070110701 actual_type->id == TypeTableEntryIdArray)
1070210702 {
10703 TypeTableEntry *ptr_type =
10703 ZigType *ptr_type =
1070410704 wanted_type->data.pointer.child_type->data.structure.fields[slice_ptr_index].type_entry;
1070510705 assert(ptr_type->id == TypeTableEntryIdPointer);
1070610706 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
1072410724 is_slice(wanted_type->data.maybe.child_type) &&
1072510725 actual_type->id == TypeTableEntryIdArray)
1072610726 {
10727 TypeTableEntry *ptr_type =
10727 ZigType *ptr_type =
1072810728 wanted_type->data.maybe.child_type->data.structure.fields[slice_ptr_index].type_entry;
1072910729 assert(ptr_type->id == TypeTableEntryIdPointer);
1073010730 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
1076310763 actual_type->data.pointer.ptr_len == PtrLenSingle &&
1076410764 actual_type->data.pointer.child_type->id == TypeTableEntryIdArray)
1076510765 {
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;
1076710767 assert(slice_ptr_type->id == TypeTableEntryIdPointer);
1076810768 if (types_match_const_cast_only(ira, slice_ptr_type->data.pointer.child_type,
1076910769 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
1077710777 // cast from T to ?T
1077810778 // note that the *T to ?*T case is handled via the "ConstCastOnly" mechanism
1077910779 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;
1078110781 if (types_match_const_cast_only(ira, wanted_child_type, actual_type, source_node,
1078210782 false).id == ConstCastResultIdOk)
1078310783 {
......@@ -10850,7 +10850,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1085010850 is_slice(wanted_type->data.error_union.payload_type) &&
1085110851 actual_type->id == TypeTableEntryIdArray)
1085210852 {
10853 TypeTableEntry *ptr_type =
10853 ZigType *ptr_type =
1085410854 wanted_type->data.error_union.payload_type->data.structure.fields[slice_ptr_index].type_entry;
1085510855 assert(ptr_type->id == TypeTableEntryIdPointer);
1085610856 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
1088110881 wanted_type->data.error_union.payload_type->id == TypeTableEntryIdOptional &&
1088210882 actual_type->id != TypeTableEntryIdOptional)
1088310883 {
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;
1088510885 if (types_match_const_cast_only(ira, wanted_child_type, actual_type, source_node, false).id == ConstCastResultIdOk ||
1088610886 actual_type->id == TypeTableEntryIdNull ||
1088710887 actual_type->id == TypeTableEntryIdComptimeInt ||
......@@ -10983,7 +10983,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1098310983
1098410984 // enum to &const union which has the enum as the tag type
1098510985 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;
1098710987 if (union_type->data.unionation.decl_node->data.container_decl.auto_enum ||
1098810988 union_type->data.unionation.decl_node->data.container_decl.init_arg_expr != nullptr)
1098910989 {
......@@ -11008,7 +11008,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1100811008 if (wanted_type->id == TypeTableEntryIdPointer && wanted_type->data.pointer.ptr_len == PtrLenSingle &&
1100911009 actual_type->id == TypeTableEntryIdPointer && actual_type->data.pointer.ptr_len == PtrLenSingle)
1101011010 {
11011 TypeTableEntry *array_type = wanted_type->data.pointer.child_type;
11011 ZigType *array_type = wanted_type->data.pointer.child_type;
1101211012 if (array_type->id == TypeTableEntryIdArray && array_type->data.array.len == 1 &&
1101311013 types_match_const_cast_only(ira, array_type->data.array.child_type,
1101411014 actual_type->data.pointer.child_type, source_node,
......@@ -11049,7 +11049,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1104911049
1105011050 // cast from something to const pointer of it
1105111051 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);
1105311053 if (types_match_const_cast_only(ira, wanted_type, const_ptr_actual, source_node, false).id == ConstCastResultIdOk) {
1105411054 return ir_analyze_cast_ref(ira, source_instr, value, wanted_type);
1105511055 }
......@@ -11063,7 +11063,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1106311063 return ira->codegen->invalid_instruction;
1106411064}
1106511065
11066static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, TypeTableEntry *expected_type) {
11066static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, ZigType *expected_type) {
1106711067 assert(value);
1106811068 assert(value != ira->codegen->invalid_instruction);
1106911069 assert(!expected_type || !type_is_invalid(expected_type));
......@@ -11080,11 +11080,11 @@ static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, Typ
1108011080}
1108111081
1108211082static 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;
1108411084 if (type_is_invalid(type_entry)) {
1108511085 return ira->codegen->invalid_instruction;
1108611086 } 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;
1108811088 if (instr_is_comptime(ptr)) {
1108911089 if (ptr->value.data.x_ptr.mut == ConstPtrMutComptimeConst ||
1109011090 ptr->value.data.x_ptr.mut == ConstPtrMutComptimeVar)
......@@ -11114,7 +11114,7 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc
1111411114 }
1111511115}
1111611116
11117static TypeTableEntry *ir_analyze_ref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *value,
11117static ZigType *ir_analyze_ref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *value,
1111811118 bool is_const, bool is_volatile)
1111911119{
1112011120 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
1114911149 return true;
1115011150}
1115111151
11152static bool ir_resolve_unsigned(IrAnalyze *ira, IrInstruction *value, TypeTableEntry *int_type, uint64_t *out) {
11152static bool ir_resolve_unsigned(IrAnalyze *ira, IrInstruction *value, ZigType *int_type, uint64_t *out) {
1115311153 if (type_is_invalid(value->value.type))
1115411154 return false;
1115511155
......@@ -11199,7 +11199,7 @@ static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, Atomic
1119911199
1120011200 ConstExprValue *atomic_order_val = get_builtin_value(ira->codegen, "AtomicOrder");
1120111201 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;
1120311203
1120411204 IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_order_type);
1120511205 if (type_is_invalid(casted_value->value.type))
......@@ -11219,7 +11219,7 @@ static bool ir_resolve_atomic_rmw_op(IrAnalyze *ira, IrInstruction *value, Atomi
1121911219
1122011220 ConstExprValue *atomic_rmw_op_val = get_builtin_value(ira->codegen, "AtomicRmwOp");
1122111221 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;
1122311223
1122411224 IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_rmw_op_type);
1122511225 if (type_is_invalid(casted_value->value.type))
......@@ -11239,7 +11239,7 @@ static bool ir_resolve_global_linkage(IrAnalyze *ira, IrInstruction *value, Glob
1123911239
1124011240 ConstExprValue *global_linkage_val = get_builtin_value(ira->codegen, "GlobalLinkage");
1124111241 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;
1124311243
1124411244 IrInstruction *casted_value = ir_implicit_cast(ira, value, global_linkage_type);
1124511245 if (type_is_invalid(casted_value->value.type))
......@@ -11259,7 +11259,7 @@ static bool ir_resolve_float_mode(IrAnalyze *ira, IrInstruction *value, FloatMod
1125911259
1126011260 ConstExprValue *float_mode_val = get_builtin_value(ira->codegen, "FloatMode");
1126111261 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;
1126311263
1126411264 IrInstruction *casted_value = ir_implicit_cast(ira, value, float_mode_type);
1126511265 if (type_is_invalid(casted_value->value.type))
......@@ -11278,10 +11278,10 @@ static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) {
1127811278 if (type_is_invalid(value->value.type))
1127911279 return nullptr;
1128011280
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,
1128211282 true, false, PtrLenUnknown,
1128311283 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);
1128511285 IrInstruction *casted_value = ir_implicit_cast(ira, value, str_type);
1128611286 if (type_is_invalid(casted_value->value.type))
1128711287 return nullptr;
......@@ -11314,7 +11314,7 @@ static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) {
1131411314 return result;
1131511315}
1131611316
11317static TypeTableEntry *ir_analyze_instruction_add_implicit_return_type(IrAnalyze *ira,
11317static ZigType *ir_analyze_instruction_add_implicit_return_type(IrAnalyze *ira,
1131811318 IrInstructionAddImplicitReturnType *instruction)
1131911319{
1132011320 IrInstruction *value = instruction->value->other;
......@@ -11328,7 +11328,7 @@ static TypeTableEntry *ir_analyze_instruction_add_implicit_return_type(IrAnalyze
1132811328 return out_val->type;
1132911329}
1133011330
11331static TypeTableEntry *ir_analyze_instruction_return(IrAnalyze *ira,
11331static ZigType *ir_analyze_instruction_return(IrAnalyze *ira,
1133211332 IrInstructionReturn *return_instruction)
1133311333{
1133411334 IrInstruction *value = return_instruction->value->other;
......@@ -11353,13 +11353,13 @@ static TypeTableEntry *ir_analyze_instruction_return(IrAnalyze *ira,
1135311353 return ir_finish_anal(ira, result->value.type);
1135411354}
1135511355
11356static TypeTableEntry *ir_analyze_instruction_const(IrAnalyze *ira, IrInstructionConst *const_instruction) {
11356static ZigType *ir_analyze_instruction_const(IrAnalyze *ira, IrInstructionConst *const_instruction) {
1135711357 ConstExprValue *out_val = ir_build_const_from(ira, &const_instruction->base);
1135811358 *out_val = const_instruction->base.value;
1135911359 return const_instruction->base.value.type;
1136011360}
1136111361
11362static TypeTableEntry *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
11362static ZigType *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
1136311363 IrInstruction *op1 = bin_op_instruction->op1->other;
1136411364 if (type_is_invalid(op1->value.type))
1136511365 return ira->codegen->builtin_types.entry_invalid;
......@@ -11368,7 +11368,7 @@ static TypeTableEntry *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp
1136811368 if (type_is_invalid(op2->value.type))
1136911369 return ira->codegen->builtin_types.entry_invalid;
1137011370
11371 TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool;
11371 ZigType *bool_type = ira->codegen->builtin_types.entry_bool;
1137211372
1137311373 IrInstruction *casted_op1 = ir_implicit_cast(ira, op1, bool_type);
1137411374 if (casted_op1 == ira->codegen->invalid_instruction)
......@@ -11433,7 +11433,7 @@ static bool optional_value_is_null(ConstExprValue *val) {
1143311433 }
1143411434}
1143511435
11436static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
11436static ZigType *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
1143711437 Error err;
1143811438 IrInstruction *op1 = bin_op_instruction->op1->other;
1143911439 IrInstruction *op2 = bin_op_instruction->op2->other;
......@@ -11486,7 +11486,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp
1148611486 ir_add_error_node(ira, source_node, buf_sprintf("operator not allowed for errors"));
1148711487 return ira->codegen->builtin_types.entry_invalid;
1148811488 }
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);
1149011490 if (type_is_invalid(intersect_type)) {
1149111491 return ira->codegen->builtin_types.entry_invalid;
1149211492 }
......@@ -11567,7 +11567,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp
1156711567 }
1156811568
1156911569 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);
1157111571 if (type_is_invalid(resolved_type))
1157211572 return resolved_type;
1157311573 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
1170511705 return ira->codegen->builtin_types.entry_bool;
1170611706}
1170711707
11708static int ir_eval_math_op(TypeTableEntry *type_entry, ConstExprValue *op1_val,
11708static int ir_eval_math_op(ZigType *type_entry, ConstExprValue *op1_val,
1170911709 IrBinOp op_id, ConstExprValue *op2_val, ConstExprValue *out_val)
1171011710{
1171111711 bool is_int;
......@@ -11885,7 +11885,7 @@ static int ir_eval_math_op(TypeTableEntry *type_entry, ConstExprValue *op1_val,
1188511885 return 0;
1188611886}
1188711887
11888static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
11888static ZigType *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
1188911889 IrInstruction *op1 = bin_op_instruction->op1->other;
1189011890 if (type_is_invalid(op1->value.type))
1189111891 return ira->codegen->builtin_types.entry_invalid;
......@@ -11917,7 +11917,7 @@ static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *
1191711917 return ira->codegen->builtin_types.entry_invalid;
1191811918 }
1191911919 } 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,
1192111921 op1->value.type->data.integral.bit_count - 1);
1192211922 if (bin_op_instruction->op_id == IrBinOpBitShiftLeftLossy &&
1192311923 op2->value.type->id == TypeTableEntryIdComptimeInt) {
......@@ -11985,7 +11985,7 @@ static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *
1198511985 return op1->value.type;
1198611986}
1198711987
11988static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
11988static ZigType *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
1198911989 IrInstruction *op1 = bin_op_instruction->op1->other;
1199011990 if (type_is_invalid(op1->value.type))
1199111991 return ira->codegen->builtin_types.entry_invalid;
......@@ -12012,7 +12012,7 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp
1201212012 }
1201312013
1201412014 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);
1201612016 if (type_is_invalid(resolved_type))
1201712017 return resolved_type;
1201812018
......@@ -12206,14 +12206,14 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp
1220612206}
1220712207
1220812208
12209static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruction) {
12209static ZigType *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruction) {
1221012210 IrInstruction *op1 = instruction->op1->other;
12211 TypeTableEntry *op1_type = op1->value.type;
12211 ZigType *op1_type = op1->value.type;
1221212212 if (type_is_invalid(op1_type))
1221312213 return ira->codegen->builtin_types.entry_invalid;
1221412214
1221512215 IrInstruction *op2 = instruction->op2->other;
12216 TypeTableEntry *op2_type = op2->value.type;
12216 ZigType *op2_type = op2->value.type;
1221712217 if (type_is_invalid(op2_type))
1221812218 return ira->codegen->builtin_types.entry_invalid;
1221912219
......@@ -12228,7 +12228,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *
1222812228 ConstExprValue *op1_array_val;
1222912229 size_t op1_array_index;
1223012230 size_t op1_array_end;
12231 TypeTableEntry *child_type;
12231 ZigType *child_type;
1223212232 if (op1_type->id == TypeTableEntryIdArray) {
1223312233 child_type = op1_type->data.array.child_type;
1223412234 op1_array_val = op1_val;
......@@ -12244,7 +12244,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *
1224412244 op1_array_index = op1_val->data.x_ptr.data.base_array.elem_index;
1224512245 op1_array_end = op1_array_val->type->data.array.len - 1;
1224612246 } 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;
1224812248 child_type = ptr_type->data.pointer.child_type;
1224912249 ConstExprValue *ptr_val = &op1_val->data.x_struct.fields[slice_ptr_index];
1225012250 assert(ptr_val->data.x_ptr.special == ConstPtrSpecialBaseArray);
......@@ -12285,7 +12285,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *
1228512285 op2_array_index = op2_val->data.x_ptr.data.base_array.elem_index;
1228612286 op2_array_end = op2_array_val->type->data.array.len - 1;
1228712287 } 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;
1228912289 if (ptr_type->data.pointer.child_type != child_type) {
1229012290 ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'",
1229112291 buf_ptr(&child_type->name),
......@@ -12305,7 +12305,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *
1230512305
1230612306 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
1230712307
12308 TypeTableEntry *result_type;
12308 ZigType *result_type;
1230912309 ConstExprValue *out_array_val;
1231012310 size_t new_len = (op1_array_end - op1_array_index) + (op2_array_end - op2_array_index);
1231112311 if (op1_type->id == TypeTableEntryIdArray || op2_type->id == TypeTableEntryIdArray) {
......@@ -12313,7 +12313,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *
1231312313
1231412314 out_array_val = out_val;
1231512315 } 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,
1231712317 true, false, PtrLenUnknown, get_abi_alignment(ira->codegen, child_type), 0, 0);
1231812318 result_type = get_slice_type(ira->codegen, ptr_type);
1231912319 out_array_val = create_const_vals(1);
......@@ -12374,7 +12374,7 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *
1237412374 return result_type;
1237512375}
1237612376
12377static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp *instruction) {
12377static ZigType *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp *instruction) {
1237812378 IrInstruction *op1 = instruction->op1->other;
1237912379 if (type_is_invalid(op1->value.type))
1238012380 return ira->codegen->builtin_types.entry_invalid;
......@@ -12391,7 +12391,7 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp
1239112391 if (!ir_resolve_usize(ira, op2, &mult_amt))
1239212392 return ira->codegen->builtin_types.entry_invalid;
1239312393
12394 TypeTableEntry *array_type = op1->value.type;
12394 ZigType *array_type = op1->value.type;
1239512395 if (array_type->id != TypeTableEntryIdArray) {
1239612396 ir_add_error(ira, op1, buf_sprintf("expected array type, found '%s'", buf_ptr(&op1->value.type->name)));
1239712397 return ira->codegen->builtin_types.entry_invalid;
......@@ -12410,7 +12410,7 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp
1241012410 if (array_val->data.x_array.special == ConstArraySpecialUndef) {
1241112411 out_val->data.x_array.special = ConstArraySpecialUndef;
1241212412
12413 TypeTableEntry *child_type = array_type->data.array.child_type;
12413 ZigType *child_type = array_type->data.array.child_type;
1241412414 return get_array_type(ira->codegen, child_type, new_array_len);
1241512415 }
1241612416
......@@ -12425,16 +12425,16 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp
1242512425 }
1242612426 assert(i == new_array_len);
1242712427
12428 TypeTableEntry *child_type = array_type->data.array.child_type;
12428 ZigType *child_type = array_type->data.array.child_type;
1242912429 return get_array_type(ira->codegen, child_type, new_array_len);
1243012430}
1243112431
12432static TypeTableEntry *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstructionBinOp *instruction) {
12433 TypeTableEntry *op1_type = ir_resolve_type(ira, instruction->op1->other);
12432static ZigType *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstructionBinOp *instruction) {
12433 ZigType *op1_type = ir_resolve_type(ira, instruction->op1->other);
1243412434 if (type_is_invalid(op1_type))
1243512435 return ira->codegen->builtin_types.entry_invalid;
1243612436
12437 TypeTableEntry *op2_type = ir_resolve_type(ira, instruction->op2->other);
12437 ZigType *op2_type = ir_resolve_type(ira, instruction->op2->other);
1243812438 if (type_is_invalid(op2_type))
1243912439 return ira->codegen->builtin_types.entry_invalid;
1244012440
......@@ -12460,7 +12460,7 @@ static TypeTableEntry *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstruction
1246012460 assert(errors[error_entry->value] == nullptr);
1246112461 errors[error_entry->value] = error_entry;
1246212462 }
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);
1246412464 free(errors);
1246512465
1246612466
......@@ -12469,7 +12469,7 @@ static TypeTableEntry *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstruction
1246912469 return ira->codegen->builtin_types.entry_type;
1247012470}
1247112471
12472static TypeTableEntry *ir_analyze_instruction_bin_op(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
12472static ZigType *ir_analyze_instruction_bin_op(IrAnalyze *ira, IrInstructionBinOp *bin_op_instruction) {
1247312473 IrBinOp op_id = bin_op_instruction->op_id;
1247412474 switch (op_id) {
1247512475 case IrBinOpInvalid:
......@@ -12516,7 +12516,7 @@ static TypeTableEntry *ir_analyze_instruction_bin_op(IrAnalyze *ira, IrInstructi
1251612516 zig_unreachable();
1251712517}
1251812518
12519static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDeclVar *decl_var_instruction) {
12519static ZigType *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDeclVar *decl_var_instruction) {
1252012520 Error err;
1252112521 VariableTableEntry *var = decl_var_instruction->var;
1252212522
......@@ -12526,11 +12526,11 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc
1252612526 return var->value->type;
1252712527 }
1252812528
12529 TypeTableEntry *explicit_type = nullptr;
12529 ZigType *explicit_type = nullptr;
1253012530 IrInstruction *var_type = nullptr;
1253112531 if (decl_var_instruction->var_type != nullptr) {
1253212532 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);
1253412534 explicit_type = validate_var_type(ira->codegen, var_type->source_node, proposed_type);
1253512535 if (type_is_invalid(explicit_type)) {
1253612536 var->value->type = ira->codegen->builtin_types.entry_invalid;
......@@ -12545,7 +12545,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc
1254512545
1254612546 bool var_class_requires_const = false;
1254712547
12548 TypeTableEntry *result_type = casted_init_value->value.type;
12548 ZigType *result_type = casted_init_value->value.type;
1254912549 if (type_is_invalid(result_type)) {
1255012550 result_type = ira->codegen->builtin_types.entry_invalid;
1255112551 } else {
......@@ -12651,7 +12651,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc
1265112651 return ira->codegen->builtin_types.entry_void;
1265212652}
1265312653
12654static TypeTableEntry *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructionExport *instruction) {
12654static ZigType *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructionExport *instruction) {
1265512655 IrInstruction *name = instruction->name->other;
1265612656 Buf *symbol_name = ir_resolve_str(ira, name);
1265712657 if (symbol_name == nullptr) {
......@@ -12731,7 +12731,7 @@ static TypeTableEntry *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructi
1273112731 }
1273212732 break;
1273312733 case TypeTableEntryIdMetaType: {
12734 TypeTableEntry *type_value = target->value.data.x_type;
12734 ZigType *type_value = target->value.data.x_type;
1273512735 switch (type_value->id) {
1273612736 case TypeTableEntryIdInvalid:
1273712737 zig_unreachable();
......@@ -12826,12 +12826,12 @@ static bool exec_has_err_ret_trace(CodeGen *g, IrExecutable *exec) {
1282612826 return fn_entry != nullptr && fn_entry->calls_or_awaits_errorable_fn && g->have_err_ret_tracing;
1282712827}
1282812828
12829static TypeTableEntry *ir_analyze_instruction_error_return_trace(IrAnalyze *ira,
12829static ZigType *ir_analyze_instruction_error_return_trace(IrAnalyze *ira,
1283012830 IrInstructionErrorReturnTrace *instruction)
1283112831{
1283212832 if (instruction->optional == IrInstructionErrorReturnTrace::Null) {
12833 TypeTableEntry *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);
12833 ZigType *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(ira->codegen);
12834 ZigType *optional_type = get_optional_type(ira->codegen, ptr_to_stack_trace_type);
1283512835 if (!exec_has_err_ret_trace(ira->codegen, ira->new_irb.exec)) {
1283612836 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
1283712837 assert(get_codegen_ptr_type(optional_type) != nullptr);
......@@ -12852,14 +12852,14 @@ static TypeTableEntry *ir_analyze_instruction_error_return_trace(IrAnalyze *ira,
1285212852 }
1285312853}
1285412854
12855static TypeTableEntry *ir_analyze_instruction_error_union(IrAnalyze *ira,
12855static ZigType *ir_analyze_instruction_error_union(IrAnalyze *ira,
1285612856 IrInstructionErrorUnion *instruction)
1285712857{
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);
1285912859 if (type_is_invalid(err_set_type))
1286012860 return ira->codegen->builtin_types.entry_invalid;
1286112861
12862 TypeTableEntry *payload_type = ir_resolve_type(ira, instruction->payload->other);
12862 ZigType *payload_type = ir_resolve_type(ira, instruction->payload->other);
1286312863 if (type_is_invalid(payload_type))
1286412864 return ira->codegen->builtin_types.entry_invalid;
1286512865
......@@ -12870,7 +12870,7 @@ static TypeTableEntry *ir_analyze_instruction_error_union(IrAnalyze *ira,
1287012870 return ira->codegen->builtin_types.entry_invalid;
1287112871 }
1287212872
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);
1287412874
1287512875 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
1287612876 out_val->data.x_type = result_type;
......@@ -12913,38 +12913,38 @@ IrInstruction *ir_get_implicit_allocator(IrAnalyze *ira, IrInstruction *source_i
1291312913 zig_unreachable();
1291412914}
1291512915
12916static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCall *call_instruction, FnTableEntry *fn_entry, TypeTableEntry *fn_type,
12916static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCall *call_instruction, FnTableEntry *fn_entry, ZigType *fn_type,
1291712917 IrInstruction *fn_ref, IrInstruction **casted_args, size_t arg_count, IrInstruction *async_allocator_inst)
1291812918{
1291912919 Buf *alloc_field_name = buf_create_from_str(ASYNC_ALLOC_FIELD_NAME);
1292012920 //Buf *free_field_name = buf_create_from_str("freeFn");
1292112921 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;
1292312923 IrInstruction *field_ptr_inst = ir_analyze_container_field_ptr(ira, alloc_field_name, &call_instruction->base,
1292412924 async_allocator_inst, container_type);
1292512925 if (type_is_invalid(field_ptr_inst->value.type)) {
1292612926 return ira->codegen->invalid_instruction;
1292712927 }
12928 TypeTableEntry *ptr_to_alloc_fn_type = field_ptr_inst->value.type;
12928 ZigType *ptr_to_alloc_fn_type = field_ptr_inst->value.type;
1292912929 assert(ptr_to_alloc_fn_type->id == TypeTableEntryIdPointer);
1293012930
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;
1293212932 if (alloc_fn_type->id != TypeTableEntryIdFn) {
1293312933 ir_add_error(ira, &call_instruction->base,
1293412934 buf_sprintf("expected allocation function, found '%s'", buf_ptr(&alloc_fn_type->name)));
1293512935 return ira->codegen->invalid_instruction;
1293612936 }
1293712937
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;
1293912939 if (alloc_fn_return_type->id != TypeTableEntryIdErrorUnion) {
1294012940 ir_add_error(ira, fn_ref,
1294112941 buf_sprintf("expected allocation function to return error union, but it returns '%s'", buf_ptr(&alloc_fn_return_type->name)));
1294212942 return ira->codegen->invalid_instruction;
1294312943 }
12944 TypeTableEntry *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;
12946 TypeTableEntry *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);
12944 ZigType *alloc_fn_error_set_type = alloc_fn_return_type->data.error_union.err_set_type;
12945 ZigType *return_type = fn_type->data.fn.fn_type_id.return_type;
12946 ZigType *promise_type = get_promise_type(ira->codegen, return_type);
12947 ZigType *async_return_type = get_error_union_type(ira->codegen, alloc_fn_error_set_type, promise_type);
1294812948
1294912949 IrInstruction *result = ir_build_call(&ira->new_irb, call_instruction->base.scope, call_instruction->base.source_node,
1295012950 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
1296112961 IrInstruction *casted_arg;
1296212962 if (param_decl_node->data.param_decl.var_token == nullptr) {
1296312963 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);
1296512965 if (type_is_invalid(param_type))
1296612966 return false;
1296712967
......@@ -13001,7 +13001,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod
1300113001 } else {
1300213002 if (param_decl_node->data.param_decl.var_token == nullptr) {
1300313003 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);
1300513005 if (type_is_invalid(param_type))
1300613006 return false;
1300713007
......@@ -13156,8 +13156,8 @@ no_mem_slot:
1315613156 return var_ptr_instruction;
1315713157}
1315813158
13159static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instruction,
13160 FnTableEntry *fn_entry, TypeTableEntry *fn_type, IrInstruction *fn_ref,
13159static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instruction,
13160 FnTableEntry *fn_entry, ZigType *fn_type, IrInstruction *fn_ref,
1316113161 IrInstruction *first_arg_ptr, bool comptime_fn_call, FnInline fn_inline)
1316213162{
1316313163 Error err;
......@@ -13249,7 +13249,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1324913249
1325013250 bool first_arg_known_bare = false;
1325113251 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;
1325313253 if (type_is_invalid(param_type))
1325413254 return ira->codegen->builtin_types.entry_invalid;
1325513255 first_arg_known_bare = param_type->id != TypeTableEntryIdPointer;
......@@ -13285,11 +13285,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1328513285 }
1328613286
1328713287 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);
1328913289 if (type_is_invalid(specified_return_type))
1329013290 return ira->codegen->builtin_types.entry_invalid;
13291 TypeTableEntry *return_type;
13292 TypeTableEntry *inferred_err_set_type = nullptr;
13291 ZigType *return_type;
13292 ZigType *inferred_err_set_type = nullptr;
1329313293 if (fn_proto_node->data.fn_proto.auto_err_set) {
1329413294 inferred_err_set_type = get_auto_err_set_type(ira->codegen, fn_entry);
1329513295 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
1332013320 inferred_err_set_type->data.error_set.errors = allocate<ErrorTableEntry *>(1);
1332113321 inferred_err_set_type->data.error_set.errors[0] = result->value.data.x_err_union.err;
1332213322 }
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;
1332413324 inferred_err_set_type->data.error_set.err_count = fn_inferred_err_set_type->data.error_set.err_count;
1332513325 inferred_err_set_type->data.error_set.errors = fn_inferred_err_set_type->data.error_set.errors;
1332613326 } else if (result->value.type->id == TypeTableEntryIdErrorSet) {
......@@ -13344,10 +13344,10 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1334413344
1334513345 IrInstruction *casted_new_stack = nullptr;
1334613346 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,
1334813348 false, false, PtrLenUnknown,
1334913349 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);
1335113351 IrInstruction *new_stack = call_instruction->new_stack->other;
1335213352 if (type_is_invalid(new_stack->value.type))
1335313353 return ira->codegen->builtin_types.entry_invalid;
......@@ -13405,7 +13405,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1340513405
1340613406 bool first_arg_known_bare = false;
1340713407 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;
1340913409 if (type_is_invalid(param_type))
1341013410 return ira->codegen->builtin_types.entry_invalid;
1341113411 first_arg_known_bare = param_type->id != TypeTableEntryIdPointer;
......@@ -13515,11 +13515,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1351513515
1351613516 if (fn_proto_node->data.fn_proto.return_var_token == nullptr) {
1351713517 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);
1351913519 if (type_is_invalid(specified_return_type))
1352013520 return ira->codegen->builtin_types.entry_invalid;
1352113521 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);
1352313523 inst_fn_type_id.return_type = get_error_union_type(ira->codegen, inferred_err_set_type, specified_return_type);
1352413524 } else {
1352513525 inst_fn_type_id.return_type = specified_return_type;
......@@ -13537,7 +13537,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1353713537 if (call_instruction->is_async) {
1353813538 AstNode *async_allocator_type_node = fn_proto_node->data.fn_proto.async_allocator_type;
1353913539 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);
1354113541 if (type_is_invalid(async_allocator_type))
1354213542 return ira->codegen->builtin_types.entry_invalid;
1354313543 inst_fn_type_id.async_allocator_type = async_allocator_type;
......@@ -13581,7 +13581,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1358113581 ira->codegen->fn_defs.append(impl_fn);
1358213582 }
1358313583
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;
1358513585 if (fn_type_can_fail(&impl_fn->type_entry->data.fn.fn_type_id)) {
1358613586 parent_fn_entry->calls_or_awaits_errorable_fn = true;
1358713587 }
......@@ -13618,7 +13618,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1361813618 if (first_arg_ptr) {
1361913619 assert(first_arg_ptr->value.type->id == TypeTableEntryIdPointer);
1362013620
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;
1362213622 if (type_is_invalid(param_type))
1362313623 return ira->codegen->builtin_types.entry_invalid;
1362413624
......@@ -13646,7 +13646,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1364613646 return ira->codegen->builtin_types.entry_invalid;
1364713647 IrInstruction *casted_arg;
1364813648 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;
1365013650 if (type_is_invalid(param_type))
1365113651 return ira->codegen->builtin_types.entry_invalid;
1365213652 casted_arg = ir_implicit_cast(ira, old_arg, param_type);
......@@ -13662,7 +13662,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1366213662
1366313663 assert(next_arg_index == call_param_count);
1366413664
13665 TypeTableEntry *return_type = fn_type_id->return_type;
13665 ZigType *return_type = fn_type_id->return_type;
1366613666 if (type_is_invalid(return_type))
1366713667 return ira->codegen->builtin_types.entry_invalid;
1366813668
......@@ -13703,7 +13703,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1370313703 return ir_finish_anal(ira, return_type);
1370413704}
1370513705
13706static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionCall *call_instruction) {
13706static ZigType *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionCall *call_instruction) {
1370713707 IrInstruction *fn_ref = call_instruction->fn_ref->other;
1370813708 if (type_is_invalid(fn_ref->value.type))
1370913709 return ira->codegen->builtin_types.entry_invalid;
......@@ -13713,7 +13713,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction
1371313713
1371413714 if (is_comptime || instr_is_comptime(fn_ref)) {
1371513715 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);
1371713717 if (type_is_invalid(dest_type))
1371813718 return ira->codegen->builtin_types.entry_invalid;
1371913719
......@@ -13793,12 +13793,12 @@ static Error ir_read_const_ptr(IrAnalyze *ira, AstNode *source_node,
1379313793 return ErrorNone;
1379413794}
1379513795
13796static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
13796static ZigType *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
1379713797 Error err;
1379813798 IrInstruction *value = un_op_instruction->value->other;
1379913799
13800 TypeTableEntry *ptr_type = value->value.type;
13801 TypeTableEntry *child_type;
13800 ZigType *ptr_type = value->value.type;
13801 ZigType *child_type;
1380213802 if (type_is_invalid(ptr_type)) {
1380313803 return ira->codegen->builtin_types.entry_invalid;
1380413804 } else if (ptr_type->id == TypeTableEntryIdPointer) {
......@@ -13835,10 +13835,10 @@ static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp
1383513835 return child_type;
1383613836}
1383713837
13838static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
13838static ZigType *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
1383913839 Error err;
1384013840 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);
1384213842 if (type_is_invalid(type_entry))
1384313843 return ira->codegen->builtin_types.entry_invalid;
1384413844 if ((err = ensure_complete_type(ira->codegen, type_entry)))
......@@ -13884,9 +13884,9 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op
1388413884 zig_unreachable();
1388513885}
1388613886
13887static TypeTableEntry *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
13887static ZigType *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
1388813888 IrInstruction *value = un_op_instruction->value->other;
13889 TypeTableEntry *expr_type = value->value.type;
13889 ZigType *expr_type = value->value.type;
1389013890 if (type_is_invalid(expr_type))
1389113891 return ira->codegen->builtin_types.entry_invalid;
1389213892
......@@ -13931,9 +13931,9 @@ static TypeTableEntry *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un
1393113931 return ira->codegen->builtin_types.entry_invalid;
1393213932}
1393313933
13934static TypeTableEntry *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *instruction) {
13934static ZigType *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *instruction) {
1393513935 IrInstruction *value = instruction->value->other;
13936 TypeTableEntry *expr_type = value->value.type;
13936 ZigType *expr_type = value->value.type;
1393713937 if (type_is_invalid(expr_type))
1393813938 return ira->codegen->builtin_types.entry_invalid;
1393913939
......@@ -13958,7 +13958,7 @@ static TypeTableEntry *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *ins
1395813958 return ira->codegen->builtin_types.entry_invalid;
1395913959}
1396013960
13961static TypeTableEntry *ir_analyze_instruction_un_op(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
13961static ZigType *ir_analyze_instruction_un_op(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
1396213962 IrUnOp op_id = un_op_instruction->op_id;
1396313963 switch (op_id) {
1396413964 case IrUnOpInvalid:
......@@ -13976,7 +13976,7 @@ static TypeTableEntry *ir_analyze_instruction_un_op(IrAnalyze *ira, IrInstructio
1397613976 zig_unreachable();
1397713977}
1397813978
13979static TypeTableEntry *ir_analyze_instruction_br(IrAnalyze *ira, IrInstructionBr *br_instruction) {
13979static ZigType *ir_analyze_instruction_br(IrAnalyze *ira, IrInstructionBr *br_instruction) {
1398013980 IrBasicBlock *old_dest_block = br_instruction->dest_block;
1398113981
1398213982 bool is_comptime;
......@@ -13994,7 +13994,7 @@ static TypeTableEntry *ir_analyze_instruction_br(IrAnalyze *ira, IrInstructionBr
1399413994 return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable);
1399513995}
1399613996
13997static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstructionCondBr *cond_br_instruction) {
13997static ZigType *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstructionCondBr *cond_br_instruction) {
1399813998 IrInstruction *condition = cond_br_instruction->condition->other;
1399913999 if (type_is_invalid(condition->value.type))
1400014000 return ir_unreach_error(ira);
......@@ -14022,7 +14022,7 @@ static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstruct
1402214022 return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable);
1402314023 }
1402414024
14025 TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool;
14025 ZigType *bool_type = ira->codegen->builtin_types.entry_bool;
1402614026 IrInstruction *casted_condition = ir_implicit_cast(ira, condition, bool_type);
1402714027 if (casted_condition == ira->codegen->invalid_instruction)
1402814028 return ir_unreach_error(ira);
......@@ -14041,14 +14041,14 @@ static TypeTableEntry *ir_analyze_instruction_cond_br(IrAnalyze *ira, IrInstruct
1404114041 return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable);
1404214042}
1404314043
14044static TypeTableEntry *ir_analyze_instruction_unreachable(IrAnalyze *ira,
14044static ZigType *ir_analyze_instruction_unreachable(IrAnalyze *ira,
1404514045 IrInstructionUnreachable *unreachable_instruction)
1404614046{
1404714047 ir_build_unreachable_from(&ira->new_irb, &unreachable_instruction->base);
1404814048 return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable);
1404914049}
1405014050
14051static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPhi *phi_instruction) {
14051static ZigType *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPhi *phi_instruction) {
1405214052 if (ira->const_predecessor_bb) {
1405314053 for (size_t i = 0; i < phi_instruction->incoming_count; i += 1) {
1405414054 IrBasicBlock *predecessor = phi_instruction->incoming_blocks[i];
......@@ -14105,7 +14105,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP
1410514105 return first_value->value.type;
1410614106 }
1410714107
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,
1410914109 new_incoming_values.items, new_incoming_values.length);
1411014110 if (type_is_invalid(resolved_type))
1411114111 return resolved_type;
......@@ -14157,7 +14157,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP
1415714157 return resolved_type;
1415814158}
1415914159
14160static TypeTableEntry *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
14160static ZigType *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
1416114161 VariableTableEntry *var)
1416214162{
1416314163 IrInstruction *result = ir_get_var_ptr(ira, instruction, var);
......@@ -14165,12 +14165,12 @@ static TypeTableEntry *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruc
1416514165 return result->value.type;
1416614166}
1416714167
14168static TypeTableEntry *ir_analyze_instruction_var_ptr(IrAnalyze *ira, IrInstructionVarPtr *var_ptr_instruction) {
14168static ZigType *ir_analyze_instruction_var_ptr(IrAnalyze *ira, IrInstructionVarPtr *var_ptr_instruction) {
1416914169 VariableTableEntry *var = var_ptr_instruction->var;
1417014170 return ir_analyze_var_ptr(ira, &var_ptr_instruction->base, var);
1417114171}
1417214172
14173static TypeTableEntry *adjust_ptr_align(CodeGen *g, TypeTableEntry *ptr_type, uint32_t new_align) {
14173static ZigType *adjust_ptr_align(CodeGen *g, ZigType *ptr_type, uint32_t new_align) {
1417414174 assert(ptr_type->id == TypeTableEntryIdPointer);
1417514175 return get_pointer_to_type_extra(g,
1417614176 ptr_type->data.pointer.child_type,
......@@ -14180,14 +14180,14 @@ static TypeTableEntry *adjust_ptr_align(CodeGen *g, TypeTableEntry *ptr_type, ui
1418014180 ptr_type->data.pointer.bit_offset, ptr_type->data.pointer.unaligned_bit_count);
1418114181}
1418214182
14183static TypeTableEntry *adjust_slice_align(CodeGen *g, TypeTableEntry *slice_type, uint32_t new_align) {
14183static ZigType *adjust_slice_align(CodeGen *g, ZigType *slice_type, uint32_t new_align) {
1418414184 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,
1418614186 new_align);
1418714187 return get_slice_type(g, ptr_type);
1418814188}
1418914189
14190static TypeTableEntry *adjust_ptr_len(CodeGen *g, TypeTableEntry *ptr_type, PtrLen ptr_len) {
14190static ZigType *adjust_ptr_len(CodeGen *g, ZigType *ptr_type, PtrLen ptr_len) {
1419114191 assert(ptr_type->id == TypeTableEntryIdPointer);
1419214192 return get_pointer_to_type_extra(g,
1419314193 ptr_type->data.pointer.child_type,
......@@ -14197,7 +14197,7 @@ static TypeTableEntry *adjust_ptr_len(CodeGen *g, TypeTableEntry *ptr_type, PtrL
1419714197 ptr_type->data.pointer.bit_offset, ptr_type->data.pointer.unaligned_bit_count);
1419814198}
1419914199
14200static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionElemPtr *elem_ptr_instruction) {
14200static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionElemPtr *elem_ptr_instruction) {
1420114201 Error err;
1420214202 IrInstruction *array_ptr = elem_ptr_instruction->array_ptr->other;
1420314203 if (type_is_invalid(array_ptr->value.type))
......@@ -14209,14 +14209,14 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc
1420914209 if (type_is_invalid(elem_index->value.type))
1421014210 return ira->codegen->builtin_types.entry_invalid;
1421114211
14212 TypeTableEntry *ptr_type = orig_array_ptr_val->type;
14212 ZigType *ptr_type = orig_array_ptr_val->type;
1421314213 assert(ptr_type->id == TypeTableEntryIdPointer);
1421414214
14215 TypeTableEntry *array_type = ptr_type->data.pointer.child_type;
14215 ZigType *array_type = ptr_type->data.pointer.child_type;
1421614216
1421714217 // At first return_type will be the pointer type we want to return, except with an optimistic alignment.
1421814218 // We will adjust return_type's alignment before returning it.
14219 TypeTableEntry *return_type;
14219 ZigType *return_type;
1422014220
1422114221 if (type_is_invalid(array_type)) {
1422214222 return array_type;
......@@ -14240,7 +14240,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc
1424014240 buf_sprintf("index 0 outside array of size 0"));
1424114241 return ira->codegen->builtin_types.entry_invalid;
1424214242 }
14243 TypeTableEntry *child_type = array_type->data.array.child_type;
14243 ZigType *child_type = array_type->data.array.child_type;
1424414244 if (ptr_type->data.pointer.unaligned_bit_count == 0) {
1424514245 return_type = get_pointer_to_type_extra(ira->codegen, child_type,
1424614246 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
1430614306 return ira->codegen->builtin_types.entry_invalid;
1430714307 }
1430814308
14309 TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
14309 ZigType *usize = ira->codegen->builtin_types.entry_usize;
1431014310 IrInstruction *casted_elem_index = ir_implicit_cast(ira, elem_index, usize);
1431114311 if (casted_elem_index == ira->codegen->invalid_instruction)
1431214312 return ira->codegen->builtin_types.entry_invalid;
......@@ -14496,8 +14496,8 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc
1449614496}
1449714497
1449814498static IrInstruction *ir_analyze_container_member_access_inner(IrAnalyze *ira,
14499 TypeTableEntry *bare_struct_type, Buf *field_name, IrInstruction *source_instr,
14500 IrInstruction *container_ptr, TypeTableEntry *container_type)
14499 ZigType *bare_struct_type, Buf *field_name, IrInstruction *source_instr,
14500 IrInstruction *container_ptr, ZigType *container_type)
1450114501{
1450214502 if (!is_slice(bare_struct_type)) {
1450314503 ScopeDecls *container_scope = get_container_scope(bare_struct_type);
......@@ -14536,11 +14536,11 @@ static IrInstruction *ir_analyze_container_member_access_inner(IrAnalyze *ira,
1453614536}
1453714537
1453814538static 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)
1454014540{
1454114541 Error err;
1454214542
14543 TypeTableEntry *bare_type = container_ref_type(container_type);
14543 ZigType *bare_type = container_ref_type(container_type);
1454414544 if ((err = ensure_complete_type(ira->codegen, bare_type)))
1454514545 return ira->codegen->invalid_instruction;
1454614546
......@@ -14568,7 +14568,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
1456814568 if (type_is_invalid(struct_val->type))
1456914569 return ira->codegen->invalid_instruction;
1457014570 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,
1457214572 is_const, is_volatile, PtrLenSingle, align_bytes,
1457314573 (uint32_t)(ptr_bit_offset + field->packed_bits_offset),
1457414574 (uint32_t)unaligned_bit_count_for_result_type);
......@@ -14625,7 +14625,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
1462514625
1462614626 ConstExprValue *payload_val = union_val->data.x_union.payload;
1462714627
14628 TypeTableEntry *field_type = field->type_entry;
14628 ZigType *field_type = field->type_entry;
1462914629 if (field_type->id == TypeTableEntryIdVoid) {
1463014630 assert(payload_val == nullptr);
1463114631 payload_val = create_const_vals(1);
......@@ -14633,7 +14633,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
1463314633 payload_val->type = field_type;
1463414634 }
1463514635
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,
1463714637 is_const, is_volatile,
1463814638 PtrLenSingle,
1463914639 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,
1468014680}
1468114681
1468214682
14683static TypeTableEntry *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source_instruction, Tld *tld) {
14683static ZigType *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source_instruction, Tld *tld) {
1468414684 bool pointer_only = false;
1468514685 resolve_top_level_decl(ira->codegen, tld, pointer_only, source_instruction->source_node);
1468614686 if (tld->resolution == TldResolutionInvalid)
......@@ -14731,7 +14731,7 @@ static TypeTableEntry *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source
1473114731 zig_unreachable();
1473214732}
1473314733
14734static ErrorTableEntry *find_err_table_entry(TypeTableEntry *err_set_type, Buf *field_name) {
14734static ErrorTableEntry *find_err_table_entry(ZigType *err_set_type, Buf *field_name) {
1473514735 assert(err_set_type->id == TypeTableEntryIdErrorSet);
1473614736 for (uint32_t i = 0; i < err_set_type->data.error_set.err_count; i += 1) {
1473714737 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 *
1474214742 return nullptr;
1474314743}
1474414744
14745static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFieldPtr *field_ptr_instruction) {
14745static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFieldPtr *field_ptr_instruction) {
1474614746 Error err;
1474714747 IrInstruction *container_ptr = field_ptr_instruction->container_ptr->other;
1474814748 if (type_is_invalid(container_ptr->value.type))
1474914749 return ira->codegen->builtin_types.entry_invalid;
1475014750
14751 TypeTableEntry *container_type = container_ptr->value.type->data.pointer.child_type;
14751 ZigType *container_type = container_ptr->value.type->data.pointer.child_type;
1475214752 assert(container_ptr->value.type->id == TypeTableEntryIdPointer);
1475314753
1475414754 Buf *field_name = field_ptr_instruction->field_name_buffer;
......@@ -14767,7 +14767,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru
1476714767 } else if (is_container_ref(container_type)) {
1476814768 assert(container_ptr->value.type->id == TypeTableEntryIdPointer);
1476914769 if (container_type->id == TypeTableEntryIdPointer) {
14770 TypeTableEntry *bare_type = container_ref_type(container_type);
14770 ZigType *bare_type = container_ref_type(container_type);
1477114771 IrInstruction *container_child = ir_get_deref(ira, &field_ptr_instruction->base, container_ptr);
1477214772 IrInstruction *result = ir_analyze_container_field_ptr(ira, field_name, &field_ptr_instruction->base, container_child, bare_type);
1477314773 ir_link_new_instruction(result, &field_ptr_instruction->base);
......@@ -14786,7 +14786,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru
1478614786 init_const_usize(ira->codegen, len_val, container_type->data.array.len);
1478714787 }
1478814788
14789 TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
14789 ZigType *usize = ira->codegen->builtin_types.entry_usize;
1479014790 bool ptr_is_const = true;
1479114791 bool ptr_is_volatile = false;
1479214792 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
1481214812 size_t len = child_val->data.x_arg_tuple.end_index - child_val->data.x_arg_tuple.start_index;
1481314813 init_const_usize(ira->codegen, len_val, len);
1481414814
14815 TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
14815 ZigType *usize = ira->codegen->builtin_types.entry_usize;
1481614816 bool ptr_is_const = true;
1481714817 bool ptr_is_volatile = false;
1481814818 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
1483214832 ConstExprValue *child_val = ir_const_ptr_pointee(ira, container_ptr_val, source_node);
1483314833 if (child_val == nullptr)
1483414834 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;
1483614836
1483714837 if (type_is_invalid(child_type)) {
1483814838 return ira->codegen->builtin_types.entry_invalid;
......@@ -14842,7 +14842,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru
1484214842 bool ptr_is_volatile = false;
1484314843 TypeStructField *ptr_field = &child_type->data.structure.fields[slice_ptr_index];
1484414844 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;
1484614846 return ir_analyze_const_ptr(ira, &field_ptr_instruction->base,
1484714847 create_const_type(ira->codegen, child_type),
1484814848 ira->codegen->builtin_types.entry_type,
......@@ -14877,7 +14877,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru
1487714877 return ira->codegen->builtin_types.entry_invalid;
1487814878 TypeUnionField *field = find_union_type_field(child_type, field_name);
1487914879 if (field) {
14880 TypeTableEntry *enum_type = child_type->data.unionation.tag_type;
14880 ZigType *enum_type = child_type->data.unionation.tag_type;
1488114881 bool ptr_is_const = true;
1488214882 bool ptr_is_volatile = false;
1488314883 return ir_analyze_const_ptr(ira, &field_ptr_instruction->base,
......@@ -14891,7 +14891,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru
1489114891 return ira->codegen->builtin_types.entry_invalid;
1489214892 } else if (child_type->id == TypeTableEntryIdErrorSet) {
1489314893 ErrorTableEntry *err_entry;
14894 TypeTableEntry *err_set_type;
14894 ZigType *err_set_type;
1489514895 if (type_is_global_error_set(child_type)) {
1489614896 auto existing_entry = ira->codegen->error_table.maybe_get(field_name);
1489714897 if (existing_entry) {
......@@ -15131,7 +15131,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru
1513115131 }
1513215132}
1513315133
15134static TypeTableEntry *ir_analyze_instruction_load_ptr(IrAnalyze *ira, IrInstructionLoadPtr *load_ptr_instruction) {
15134static ZigType *ir_analyze_instruction_load_ptr(IrAnalyze *ira, IrInstructionLoadPtr *load_ptr_instruction) {
1513515135 IrInstruction *ptr = load_ptr_instruction->ptr->other;
1513615136 if (type_is_invalid(ptr->value.type))
1513715137 return ira->codegen->builtin_types.entry_invalid;
......@@ -15142,7 +15142,7 @@ static TypeTableEntry *ir_analyze_instruction_load_ptr(IrAnalyze *ira, IrInstruc
1514215142 return result->value.type;
1514315143}
1514415144
15145static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstructionStorePtr *store_ptr_instruction) {
15145static ZigType *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstructionStorePtr *store_ptr_instruction) {
1514615146 IrInstruction *ptr = store_ptr_instruction->ptr->other;
1514715147 if (type_is_invalid(ptr->value.type))
1514815148 return ptr->value.type;
......@@ -15166,7 +15166,7 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru
1516615166 return ira->codegen->builtin_types.entry_invalid;
1516715167 }
1516815168
15169 TypeTableEntry *child_type = ptr->value.type->data.pointer.child_type;
15169 ZigType *child_type = ptr->value.type->data.pointer.child_type;
1517015170 IrInstruction *casted_value = ir_implicit_cast(ira, value, child_type);
1517115171 if (casted_value == ira->codegen->invalid_instruction)
1517215172 return ira->codegen->builtin_types.entry_invalid;
......@@ -15202,9 +15202,9 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru
1520215202 return ira->codegen->builtin_types.entry_void;
1520315203}
1520415204
15205static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructionTypeOf *typeof_instruction) {
15205static ZigType *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructionTypeOf *typeof_instruction) {
1520615206 IrInstruction *expr_value = typeof_instruction->value->other;
15207 TypeTableEntry *type_entry = expr_value->value.type;
15207 ZigType *type_entry = expr_value->value.type;
1520815208 if (type_is_invalid(type_entry))
1520915209 return ira->codegen->builtin_types.entry_invalid;
1521015210 switch (type_entry->id) {
......@@ -15246,15 +15246,15 @@ static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructi
1524615246 zig_unreachable();
1524715247}
1524815248
15249static TypeTableEntry *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira,
15249static ZigType *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira,
1525015250 IrInstructionToPtrType *to_ptr_type_instruction)
1525115251{
1525215252 IrInstruction *value = to_ptr_type_instruction->value->other;
15253 TypeTableEntry *type_entry = value->value.type;
15253 ZigType *type_entry = value->value.type;
1525415254 if (type_is_invalid(type_entry))
1525515255 return type_entry;
1525615256
15257 TypeTableEntry *ptr_type;
15257 ZigType *ptr_type;
1525815258 if (type_entry->id == TypeTableEntryIdArray) {
1525915259 ptr_type = get_pointer_to_type(ira->codegen, type_entry->data.array.child_type, false);
1526015260 } else if (is_slice(type_entry)) {
......@@ -15275,11 +15275,11 @@ static TypeTableEntry *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira,
1527515275 return ira->codegen->builtin_types.entry_type;
1527615276}
1527715277
15278static TypeTableEntry *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira,
15278static ZigType *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira,
1527915279 IrInstructionPtrTypeChild *ptr_type_child_instruction)
1528015280{
1528115281 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);
1528315283 if (type_is_invalid(type_entry))
1528415284 return type_entry;
1528515285
......@@ -15294,7 +15294,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira,
1529415294 return ira->codegen->builtin_types.entry_type;
1529515295}
1529615296
15297static TypeTableEntry *ir_analyze_instruction_set_cold(IrAnalyze *ira, IrInstructionSetCold *instruction) {
15297static ZigType *ir_analyze_instruction_set_cold(IrAnalyze *ira, IrInstructionSetCold *instruction) {
1529815298 if (ira->new_irb.exec->is_inline) {
1529915299 // ignore setCold when running functions at compile time
1530015300 ir_build_const_from(ira, &instruction->base);
......@@ -15324,7 +15324,7 @@ static TypeTableEntry *ir_analyze_instruction_set_cold(IrAnalyze *ira, IrInstruc
1532415324 ir_build_const_from(ira, &instruction->base);
1532515325 return ira->codegen->builtin_types.entry_void;
1532615326}
15327static TypeTableEntry *ir_analyze_instruction_set_runtime_safety(IrAnalyze *ira,
15327static ZigType *ir_analyze_instruction_set_runtime_safety(IrAnalyze *ira,
1532815328 IrInstructionSetRuntimeSafety *set_runtime_safety_instruction)
1532915329{
1533015330 if (ira->new_irb.exec->is_inline) {
......@@ -15381,11 +15381,11 @@ static TypeTableEntry *ir_analyze_instruction_set_runtime_safety(IrAnalyze *ira,
1538115381 return ira->codegen->builtin_types.entry_void;
1538215382}
1538315383
15384static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira,
15384static ZigType *ir_analyze_instruction_set_float_mode(IrAnalyze *ira,
1538515385 IrInstructionSetFloatMode *instruction)
1538615386{
1538715387 IrInstruction *target_instruction = instruction->scope_value->other;
15388 TypeTableEntry *target_type = target_instruction->value.type;
15388 ZigType *target_type = target_instruction->value.type;
1538915389 if (type_is_invalid(target_type))
1539015390 return ira->codegen->builtin_types.entry_invalid;
1539115391 ConstExprValue *target_val = ir_resolve_const(ira, target_instruction, UndefBad);
......@@ -15412,7 +15412,7 @@ static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira,
1541215412 fast_math_set_node_ptr = &target_fn->def_scope->fast_math_set_node;
1541315413 } else if (target_type->id == TypeTableEntryIdMetaType) {
1541415414 ScopeDecls *decls_scope;
15415 TypeTableEntry *type_arg = target_val->data.x_type;
15415 ZigType *type_arg = target_val->data.x_type;
1541615416 if (type_arg->id == TypeTableEntryIdStruct) {
1541715417 decls_scope = type_arg->data.structure.decls_scope;
1541815418 } else if (type_arg->id == TypeTableEntryIdEnum) {
......@@ -15452,7 +15452,7 @@ static TypeTableEntry *ir_analyze_instruction_set_float_mode(IrAnalyze *ira,
1545215452 return ira->codegen->builtin_types.entry_void;
1545315453}
1545415454
15455static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira,
15455static ZigType *ir_analyze_instruction_slice_type(IrAnalyze *ira,
1545615456 IrInstructionSliceType *slice_type_instruction)
1545715457{
1545815458 Error err;
......@@ -15462,7 +15462,7 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira,
1546215462 return ira->codegen->builtin_types.entry_invalid;
1546315463 }
1546415464
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);
1546615466 if (type_is_invalid(child_type))
1546715467 return ira->codegen->builtin_types.entry_invalid;
1546815468
......@@ -15509,9 +15509,9 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira,
1550915509 {
1551015510 if ((err = type_ensure_zero_bits_known(ira->codegen, child_type)))
1551115511 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,
1551315513 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);
1551515515 ConstExprValue *out_val = ir_build_const_from(ira, &slice_type_instruction->base);
1551615516 out_val->data.x_type = result_type;
1551715517 return ira->codegen->builtin_types.entry_type;
......@@ -15520,7 +15520,7 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira,
1552015520 zig_unreachable();
1552115521}
1552215522
15523static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionAsm *asm_instruction) {
15523static ZigType *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionAsm *asm_instruction) {
1552415524 assert(asm_instruction->base.source_node->type == NodeTypeAsmExpr);
1552515525
1552615526 AstNodeAsmExpr *asm_expr = &asm_instruction->base.source_node->data.asm_expr;
......@@ -15550,7 +15550,7 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA
1555015550 IrInstruction **input_list = allocate<IrInstruction *>(asm_expr->input_list.length);
1555115551 IrInstruction **output_types = allocate<IrInstruction *>(asm_expr->output_list.length);
1555215552
15553 TypeTableEntry *return_type = ira->codegen->builtin_types.entry_void;
15553 ZigType *return_type = ira->codegen->builtin_types.entry_void;
1555415554 for (size_t i = 0; i < asm_expr->output_list.length; i += 1) {
1555515555 AsmOutput *asm_output = asm_expr->output_list.at(i);
1555615556 if (asm_output->return_type) {
......@@ -15572,7 +15572,7 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA
1557215572 return return_type;
1557315573}
1557415574
15575static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira,
15575static ZigType *ir_analyze_instruction_array_type(IrAnalyze *ira,
1557615576 IrInstructionArrayType *array_type_instruction)
1557715577{
1557815578 Error err;
......@@ -15583,7 +15583,7 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira,
1558315583 return ira->codegen->builtin_types.entry_invalid;
1558415584
1558515585 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);
1558715587 if (type_is_invalid(child_type))
1558815588 return ira->codegen->builtin_types.entry_invalid;
1558915589 switch (child_type->id) {
......@@ -15620,7 +15620,7 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira,
1562015620 {
1562115621 if ((err = ensure_complete_type(ira->codegen, child_type)))
1562215622 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);
1562415624 ConstExprValue *out_val = ir_build_const_from(ira, &array_type_instruction->base);
1562515625 out_val->data.x_type = result_type;
1562615626 return ira->codegen->builtin_types.entry_type;
......@@ -15629,13 +15629,13 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira,
1562915629 zig_unreachable();
1563015630}
1563115631
15632static TypeTableEntry *ir_analyze_instruction_promise_type(IrAnalyze *ira, IrInstructionPromiseType *instruction) {
15633 TypeTableEntry *promise_type;
15632static ZigType *ir_analyze_instruction_promise_type(IrAnalyze *ira, IrInstructionPromiseType *instruction) {
15633 ZigType *promise_type;
1563415634
1563515635 if (instruction->payload_type == nullptr) {
1563615636 promise_type = ira->codegen->builtin_types.entry_promise;
1563715637 } 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);
1563915639 if (type_is_invalid(payload_type))
1564015640 return ira->codegen->builtin_types.entry_invalid;
1564115641
......@@ -15647,12 +15647,12 @@ static TypeTableEntry *ir_analyze_instruction_promise_type(IrAnalyze *ira, IrIns
1564715647 return ira->codegen->builtin_types.entry_type;
1564815648}
1564915649
15650static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira,
15650static ZigType *ir_analyze_instruction_size_of(IrAnalyze *ira,
1565115651 IrInstructionSizeOf *size_of_instruction)
1565215652{
1565315653 Error err;
1565415654 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);
1565615656
1565715657 if ((err = ensure_complete_type(ira->codegen, type_entry)))
1565815658 return ira->codegen->builtin_types.entry_invalid;
......@@ -15698,12 +15698,12 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira,
1569815698 zig_unreachable();
1569915699}
1570015700
15701static TypeTableEntry *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrInstructionTestNonNull *instruction) {
15701static ZigType *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrInstructionTestNonNull *instruction) {
1570215702 IrInstruction *value = instruction->value->other;
1570315703 if (type_is_invalid(value->value.type))
1570415704 return ira->codegen->builtin_types.entry_invalid;
1570515705
15706 TypeTableEntry *type_entry = value->value.type;
15706 ZigType *type_entry = value->value.type;
1570715707
1570815708 if (type_entry->id == TypeTableEntryIdOptional) {
1570915709 if (instr_is_comptime(value)) {
......@@ -15729,17 +15729,17 @@ static TypeTableEntry *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrIn
1572915729 }
1573015730}
1573115731
15732static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira,
15732static ZigType *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira,
1573315733 IrInstructionUnwrapOptional *unwrap_maybe_instruction)
1573415734{
1573515735 IrInstruction *value = unwrap_maybe_instruction->value->other;
1573615736 if (type_is_invalid(value->value.type))
1573715737 return ira->codegen->builtin_types.entry_invalid;
1573815738
15739 TypeTableEntry *ptr_type = value->value.type;
15739 ZigType *ptr_type = value->value.type;
1574015740 assert(ptr_type->id == TypeTableEntryIdPointer);
1574115741
15742 TypeTableEntry *type_entry = ptr_type->data.pointer.child_type;
15742 ZigType *type_entry = ptr_type->data.pointer.child_type;
1574315743 if (type_is_invalid(type_entry)) {
1574415744 return ira->codegen->builtin_types.entry_invalid;
1574515745 } else if (type_entry->id != TypeTableEntryIdOptional) {
......@@ -15747,8 +15747,8 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira,
1574715747 buf_sprintf("expected optional type, found '%s'", buf_ptr(&type_entry->name)));
1574815748 return ira->codegen->builtin_types.entry_invalid;
1574915749 }
15750 TypeTableEntry *child_type = type_entry->data.maybe.child_type;
15751 TypeTableEntry *result_type = get_pointer_to_type_extra(ira->codegen, child_type,
15750 ZigType *child_type = type_entry->data.maybe.child_type;
15751 ZigType *result_type = get_pointer_to_type_extra(ira->codegen, child_type,
1575215752 ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile,
1575315753 PtrLenSingle,
1575415754 get_abi_alignment(ira->codegen, child_type), 0, 0);
......@@ -15783,12 +15783,12 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira,
1578315783 return result_type;
1578415784}
1578515785
15786static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionCtz *ctz_instruction) {
15786static ZigType *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionCtz *ctz_instruction) {
1578715787 IrInstruction *value = ctz_instruction->value->other;
1578815788 if (type_is_invalid(value->value.type)) {
1578915789 return ira->codegen->builtin_types.entry_invalid;
1579015790 } 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,
1579215792 value->value.type->data.integral.bit_count);
1579315793 if (value->value.special != ConstValSpecialRuntime) {
1579415794 size_t result = bigint_ctz(&value->value.data.x_bigint,
......@@ -15807,12 +15807,12 @@ static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionC
1580715807 }
1580815808}
1580915809
15810static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionClz *clz_instruction) {
15810static ZigType *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionClz *clz_instruction) {
1581115811 IrInstruction *value = clz_instruction->value->other;
1581215812 if (type_is_invalid(value->value.type)) {
1581315813 return ira->codegen->builtin_types.entry_invalid;
1581415814 } 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,
1581615816 value->value.type->data.integral.bit_count);
1581715817 if (value->value.special != ConstValSpecialRuntime) {
1581815818 size_t result = bigint_clz(&value->value.data.x_bigint,
......@@ -15831,7 +15831,7 @@ static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionC
1583115831 }
1583215832}
1583315833
15834static TypeTableEntry *ir_analyze_instruction_pop_count(IrAnalyze *ira, IrInstructionPopCount *instruction) {
15834static ZigType *ir_analyze_instruction_pop_count(IrAnalyze *ira, IrInstructionPopCount *instruction) {
1583515835 IrInstruction *value = instruction->value->other;
1583615836 if (type_is_invalid(value->value.type))
1583715837 return ira->codegen->builtin_types.entry_invalid;
......@@ -15895,7 +15895,7 @@ static IrInstruction *ir_analyze_union_tag(IrAnalyze *ira, IrInstruction *source
1589515895 return ira->codegen->invalid_instruction;
1589615896 }
1589715897
15898 TypeTableEntry *tag_type = value->value.type->data.unionation.tag_type;
15898 ZigType *tag_type = value->value.type->data.unionation.tag_type;
1589915899 assert(tag_type->id == TypeTableEntryIdEnum);
1590015900
1590115901 if (instr_is_comptime(value)) {
......@@ -15916,7 +15916,7 @@ static IrInstruction *ir_analyze_union_tag(IrAnalyze *ira, IrInstruction *source
1591615916 return result;
1591715917}
1591815918
15919static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira,
15919static ZigType *ir_analyze_instruction_switch_br(IrAnalyze *ira,
1592015920 IrInstructionSwitchBr *switch_br_instruction)
1592115921{
1592215922 IrInstruction *target_value = switch_br_instruction->target_value->other;
......@@ -16024,7 +16024,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira,
1602416024 return ir_finish_anal(ira, ira->codegen->builtin_types.entry_unreachable);
1602516025}
1602616026
16027static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira,
16027static ZigType *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1602816028 IrInstructionSwitchTarget *switch_target_instruction)
1602916029{
1603016030 Error err;
......@@ -16034,7 +16034,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1603416034
1603516035 if (target_value_ptr->value.type->id == TypeTableEntryIdMetaType) {
1603616036 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;
1603816038 assert(ptr_type->id == TypeTableEntryIdPointer);
1603916039 ConstExprValue *out_val = ir_build_const_from(ira, &switch_target_instruction->base);
1604016040 out_val->type = ira->codegen->builtin_types.entry_type;
......@@ -16047,7 +16047,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1604716047 return ira->codegen->builtin_types.entry_invalid;
1604816048 }
1604916049
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;
1605116051 ConstExprValue *pointee_val = nullptr;
1605216052 if (instr_is_comptime(target_value_ptr)) {
1605316053 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,
1609516095 buf_sprintf("consider 'union(enum)' here"));
1609616096 return ira->codegen->builtin_types.entry_invalid;
1609716097 }
16098 TypeTableEntry *tag_type = target_type->data.unionation.tag_type;
16098 ZigType *tag_type = target_type->data.unionation.tag_type;
1609916099 assert(tag_type != nullptr);
1610016100 assert(tag_type->id == TypeTableEntryIdEnum);
1610116101 if (pointee_val) {
......@@ -16160,7 +16160,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1616016160 zig_unreachable();
1616116161}
1616216162
16163static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstructionSwitchVar *instruction) {
16163static ZigType *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstructionSwitchVar *instruction) {
1616416164 IrInstruction *target_value_ptr = instruction->target_value_ptr->other;
1616516165 if (type_is_invalid(target_value_ptr->value.type))
1616616166 return ira->codegen->builtin_types.entry_invalid;
......@@ -16170,7 +16170,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstr
1617016170 return ira->codegen->builtin_types.entry_invalid;
1617116171
1617216172 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;
1617416174 if (target_type->id == TypeTableEntryIdUnion) {
1617516175 ConstExprValue *prong_val = ir_resolve_const(ira, prong_value, UndefBad);
1617616176 if (!prong_val)
......@@ -16205,14 +16205,14 @@ static TypeTableEntry *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstr
1620516205 }
1620616206}
1620716207
16208static TypeTableEntry *ir_analyze_instruction_union_tag(IrAnalyze *ira, IrInstructionUnionTag *instruction) {
16208static ZigType *ir_analyze_instruction_union_tag(IrAnalyze *ira, IrInstructionUnionTag *instruction) {
1620916209 IrInstruction *value = instruction->value->other;
1621016210 IrInstruction *new_instruction = ir_analyze_union_tag(ira, &instruction->base, value);
1621116211 ir_link_new_instruction(new_instruction, &instruction->base);
1621216212 return new_instruction->value.type;
1621316213}
1621416214
16215static TypeTableEntry *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructionImport *import_instruction) {
16215static ZigType *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructionImport *import_instruction) {
1621616216 IrInstruction *name_value = import_instruction->name->other;
1621716217 Buf *import_target_str = ir_resolve_str(ira, name_value);
1621816218 if (!import_target_str)
......@@ -16278,11 +16278,11 @@ static TypeTableEntry *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructi
1627816278
1627916279}
1628016280
16281static TypeTableEntry *ir_analyze_instruction_array_len(IrAnalyze *ira,
16281static ZigType *ir_analyze_instruction_array_len(IrAnalyze *ira,
1628216282 IrInstructionArrayLen *array_len_instruction)
1628316283{
1628416284 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;
1628616286 if (type_is_invalid(type_entry)) {
1628716287 return ira->codegen->builtin_types.entry_invalid;
1628816288 } else if (type_entry->id == TypeTableEntryIdArray) {
......@@ -16309,13 +16309,13 @@ static TypeTableEntry *ir_analyze_instruction_array_len(IrAnalyze *ira,
1630916309 }
1631016310}
1631116311
16312static TypeTableEntry *ir_analyze_instruction_ref(IrAnalyze *ira, IrInstructionRef *ref_instruction) {
16312static ZigType *ir_analyze_instruction_ref(IrAnalyze *ira, IrInstructionRef *ref_instruction) {
1631316313 IrInstruction *value = ref_instruction->value->other;
1631416314 return ir_analyze_ref(ira, &ref_instruction->base, value, ref_instruction->is_const, ref_instruction->is_volatile);
1631516315}
1631616316
16317static TypeTableEntry *ir_analyze_container_init_fields_union(IrAnalyze *ira, IrInstruction *instruction,
16318 TypeTableEntry *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields)
16317static ZigType *ir_analyze_container_init_fields_union(IrAnalyze *ira, IrInstruction *instruction,
16318 ZigType *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields)
1631916319{
1632016320 Error err;
1632116321 assert(container_type->id == TypeTableEntryIdUnion);
......@@ -16380,8 +16380,8 @@ static TypeTableEntry *ir_analyze_container_init_fields_union(IrAnalyze *ira, Ir
1638016380 return container_type;
1638116381}
1638216382
16383static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstruction *instruction,
16384 TypeTableEntry *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields)
16383static ZigType *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstruction *instruction,
16384 ZigType *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields)
1638516385{
1638616386 Error err;
1638716387 if (container_type->id == TypeTableEntryIdUnion) {
......@@ -16500,7 +16500,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru
1650016500 return container_type;
1650116501}
1650216502
16503static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira,
16503static ZigType *ir_analyze_instruction_container_init_list(IrAnalyze *ira,
1650416504 IrInstructionContainerInitList *instruction)
1650516505{
1650616506 IrInstruction *container_type_value = instruction->container_type->other;
......@@ -16509,7 +16509,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira
1650916509
1651016510 size_t elem_count = instruction->item_count;
1651116511 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);
1651316513 if (type_is_invalid(container_type))
1651416514 return ira->codegen->builtin_types.entry_invalid;
1651516515
......@@ -16518,11 +16518,11 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira
1651816518 0, nullptr);
1651916519 } else if (is_slice(container_type) || container_type->id == TypeTableEntryIdArray) {
1652016520 // 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;
1652216522 if (container_type->id == TypeTableEntryIdArray) {
1652316523 child_type = container_type->data.array.child_type;
1652416524 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);
1652616526
1652716527 ir_add_error(ira, &instruction->base,
1652816528 buf_sprintf("expected %s literal, found %s literal",
......@@ -16530,12 +16530,12 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira
1653016530 return ira->codegen->builtin_types.entry_invalid;
1653116531 }
1653216532 } 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;
1653416534 assert(pointer_type->id == TypeTableEntryIdPointer);
1653516535 child_type = pointer_type->data.pointer.child_type;
1653616536 }
1653716537
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);
1653916539
1654016540 ConstExprValue const_val = {};
1654116541 const_val.special = ConstValSpecialStatic;
......@@ -16618,9 +16618,9 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira
1661816618 }
1661916619}
1662016620
16621static TypeTableEntry *ir_analyze_instruction_container_init_fields(IrAnalyze *ira, IrInstructionContainerInitFields *instruction) {
16621static ZigType *ir_analyze_instruction_container_init_fields(IrAnalyze *ira, IrInstructionContainerInitFields *instruction) {
1662216622 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);
1662416624 if (type_is_invalid(container_type))
1662516625 return ira->codegen->builtin_types.entry_invalid;
1662616626
......@@ -16628,10 +16628,10 @@ static TypeTableEntry *ir_analyze_instruction_container_init_fields(IrAnalyze *i
1662816628 instruction->field_count, instruction->fields);
1662916629}
1663016630
16631static TypeTableEntry *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_instruction,
16631static ZigType *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_instruction,
1663216632 IrInstruction *target_type_value, bool is_max)
1663316633{
16634 TypeTableEntry *target_type = ir_resolve_type(ira, target_type_value);
16634 ZigType *target_type = ir_resolve_type(ira, target_type_value);
1663516635 if (type_is_invalid(target_type))
1663616636 return ira->codegen->builtin_types.entry_invalid;
1663716637 switch (target_type->id) {
......@@ -16684,19 +16684,19 @@ static TypeTableEntry *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_
1668416684 zig_unreachable();
1668516685}
1668616686
16687static TypeTableEntry *ir_analyze_instruction_min_value(IrAnalyze *ira,
16687static ZigType *ir_analyze_instruction_min_value(IrAnalyze *ira,
1668816688 IrInstructionMinValue *instruction)
1668916689{
1669016690 return ir_analyze_min_max(ira, &instruction->base, instruction->value->other, false);
1669116691}
1669216692
16693static TypeTableEntry *ir_analyze_instruction_max_value(IrAnalyze *ira,
16693static ZigType *ir_analyze_instruction_max_value(IrAnalyze *ira,
1669416694 IrInstructionMaxValue *instruction)
1669516695{
1669616696 return ir_analyze_min_max(ira, &instruction->base, instruction->value->other, true);
1669716697}
1669816698
16699static TypeTableEntry *ir_analyze_instruction_compile_err(IrAnalyze *ira,
16699static ZigType *ir_analyze_instruction_compile_err(IrAnalyze *ira,
1670016700 IrInstructionCompileErr *instruction)
1670116701{
1670216702 IrInstruction *msg_value = instruction->msg->other;
......@@ -16720,7 +16720,7 @@ static TypeTableEntry *ir_analyze_instruction_compile_err(IrAnalyze *ira,
1672016720 return ira->codegen->builtin_types.entry_invalid;
1672116721}
1672216722
16723static TypeTableEntry *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInstructionCompileLog *instruction) {
16723static ZigType *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInstructionCompileLog *instruction) {
1672416724 Buf buf = BUF_INIT;
1672516725 fprintf(stderr, "| ");
1672616726 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
1674016740 return ira->codegen->builtin_types.entry_void;
1674116741}
1674216742
16743static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstructionErrName *instruction) {
16743static ZigType *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstructionErrName *instruction) {
1674416744 IrInstruction *value = instruction->value->other;
1674516745 if (type_is_invalid(value->value.type))
1674616746 return ira->codegen->builtin_types.entry_invalid;
......@@ -16749,9 +16749,9 @@ static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstruc
1674916749 if (type_is_invalid(casted_value->value.type))
1675016750 return ira->codegen->builtin_types.entry_invalid;
1675116751
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,
1675316753 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);
1675516755 if (casted_value->value.special == ConstValSpecialStatic) {
1675616756 ErrorTableEntry *err = casted_value->value.data.x_err_set;
1675716757 if (!err->cached_error_name_val) {
......@@ -16768,7 +16768,7 @@ static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstruc
1676816768 return str_type;
1676916769}
1677016770
16771static TypeTableEntry *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrInstructionTagName *instruction) {
16771static ZigType *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrInstructionTagName *instruction) {
1677216772 Error err;
1677316773 IrInstruction *target = instruction->target->other;
1677416774 if (type_is_invalid(target->value.type))
......@@ -16789,7 +16789,7 @@ static TypeTableEntry *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrIn
1678916789 IrInstruction *result = ir_build_tag_name(&ira->new_irb, instruction->base.scope,
1679016790 instruction->base.source_node, target);
1679116791 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(
1679316793 ira->codegen, ira->codegen->builtin_types.entry_u8,
1679416794 true, false, PtrLenUnknown,
1679516795 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
1679816798 return result->value.type;
1679916799}
1680016800
16801static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
16801static ZigType *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
1680216802 IrInstructionFieldParentPtr *instruction)
1680316803{
1680416804 Error err;
1680516805 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);
1680716807 if (type_is_invalid(container_type))
1680816808 return ira->codegen->builtin_types.entry_invalid;
1680916809
......@@ -16843,7 +16843,7 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
1684316843 uint32_t field_ptr_align = is_packed ? 1 : get_abi_alignment(ira->codegen, field->type_entry);
1684416844 uint32_t parent_ptr_align = is_packed ? 1 : get_abi_alignment(ira->codegen, container_type);
1684516845
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,
1684716847 field_ptr->value.type->data.pointer.is_const,
1684816848 field_ptr->value.type->data.pointer.is_volatile,
1684916849 PtrLenSingle,
......@@ -16852,7 +16852,7 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
1685216852 if (type_is_invalid(casted_field_ptr->value.type))
1685316853 return ira->codegen->builtin_types.entry_invalid;
1685416854
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,
1685616856 casted_field_ptr->value.type->data.pointer.is_const,
1685716857 casted_field_ptr->value.type->data.pointer.is_volatile,
1685816858 PtrLenSingle,
......@@ -16891,12 +16891,12 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
1689116891 return result_type;
1689216892}
1689316893
16894static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira,
16894static ZigType *ir_analyze_instruction_offset_of(IrAnalyze *ira,
1689516895 IrInstructionOffsetOf *instruction)
1689616896{
1689716897 Error err;
1689816898 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);
1690016900 if (type_is_invalid(container_type))
1690116901 return ira->codegen->builtin_types.entry_invalid;
1690216902
......@@ -16934,7 +16934,7 @@ static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira,
1693416934 return ira->codegen->builtin_types.entry_num_lit_int;
1693516935}
1693616936
16937static void ensure_field_index(TypeTableEntry *type, const char *field_name, size_t index)
16937static void ensure_field_index(ZigType *type, const char *field_name, size_t index)
1693816938{
1693916939 Buf *field_name_buf;
1694016940
......@@ -16945,10 +16945,10 @@ static void ensure_field_index(TypeTableEntry *type, const char *field_name, siz
1694516945 (buf_deinit(field_name_buf), true));
1694616946}
1694716947
16948static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, TypeTableEntry *root) {
16948static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, ZigType *root) {
1694916949 Error err;
1695016950 static ConstExprValue *type_info_var = nullptr;
16951 static TypeTableEntry *type_info_type = nullptr;
16951 static ZigType *type_info_type = nullptr;
1695216952 if (type_info_var == nullptr) {
1695316953 type_info_var = get_builtin_value(ira->codegen, "TypeInfo");
1695416954 assert(type_info_var->type->id == TypeTableEntryIdMetaType);
......@@ -16963,7 +16963,7 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na
1696316963 else if (type_name == nullptr)
1696416964 return root;
1696516965
16966 TypeTableEntry *root_type = (root == nullptr) ? type_info_type : root;
16966 ZigType *root_type = (root == nullptr) ? type_info_type : root;
1696716967
1696816968 ScopeDecls *type_info_scope = get_container_scope(root_type);
1696916969 assert(type_info_scope != nullptr);
......@@ -16986,7 +16986,7 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na
1698616986
1698716987static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, ScopeDecls *decls_scope) {
1698816988 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);
1699016990 if ((err = ensure_complete_type(ira->codegen, type_info_definition_type)))
1699116991 return err;
1699216992
......@@ -16994,15 +16994,15 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco
1699416994 ensure_field_index(type_info_definition_type, "is_pub", 1);
1699516995 ensure_field_index(type_info_definition_type, "data", 2);
1699616996
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);
1699816998 if ((err = ensure_complete_type(ira->codegen, type_info_definition_data_type)))
1699916999 return err;
1700017000
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);
1700217002 if ((err = ensure_complete_type(ira->codegen, type_info_fn_def_type)))
1700317003 return err;
1700417004
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);
1700617006 if ((err = ensure_complete_type(ira->codegen, type_info_fn_def_inline_type)))
1700717007 return err;
1700817008
......@@ -17153,7 +17153,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco
1715317153 // lib_name: ?[]const u8
1715417154 ensure_field_index(fn_def_val->type, "lib_name", 6);
1715517155 fn_def_fields[6].special = ConstValSpecialStatic;
17156 TypeTableEntry *u8_ptr = get_pointer_to_type_extra(
17156 ZigType *u8_ptr = get_pointer_to_type_extra(
1715717157 ira->codegen, ira->codegen->builtin_types.entry_u8,
1715817158 true, false, PtrLenUnknown,
1715917159 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
1720517205 }
1720617206 case TldIdContainer:
1720717207 {
17208 TypeTableEntry *type_entry = ((TldContainer *)curr_entry->value)->type_entry;
17208 ZigType *type_entry = ((TldContainer *)curr_entry->value)->type_entry;
1720917209 if ((err = ensure_complete_type(ira->codegen, type_entry)))
1721017210 return ErrorSemanticAnalyzeFail;
1721117211
......@@ -17232,8 +17232,8 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco
1723217232 return ErrorNone;
1723317233}
1723417234
17235static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry *ptr_type_entry) {
17236 TypeTableEntry *attrs_type;
17235static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, ZigType *ptr_type_entry) {
17236 ZigType *attrs_type;
1723717237 uint32_t size_enum_index;
1723817238 if (is_slice(ptr_type_entry)) {
1723917239 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
1724517245 zig_unreachable();
1724617246 }
1724717247
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);
1724917249 assertNoError(ensure_complete_type(ira->codegen, type_info_pointer_type));
1725017250
1725117251 ConstExprValue *result = create_const_vals(1);
......@@ -17257,7 +17257,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry
1725717257
1725817258 // size: Size
1725917259 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);
1726117261 assertNoError(ensure_complete_type(ira->codegen, type_info_pointer_size_type));
1726217262 fields[0].special = ConstValSpecialStatic;
1726317263 fields[0].type = type_info_pointer_size_type;
......@@ -17288,7 +17288,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, TypeTableEntry
1728817288};
1728917289
1729017290static 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)
1729217292{
1729317293 enum_field_val->special = ConstValSpecialStatic;
1729417294 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,
1730517305 enum_field_val->data.x_struct.fields = inner_fields;
1730617306}
1730717307
17308static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry, ConstExprValue **out) {
17308static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstExprValue **out) {
1730917309 Error err;
1731017310 assert(type_entry != nullptr);
1731117311 assert(!type_is_invalid(type_entry));
......@@ -17478,7 +17478,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry,
1747817478 // fields: []TypeInfo.EnumField
1747917479 ensure_field_index(result->type, "fields", 2);
1748017480
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);
1748217482 uint32_t enum_field_count = type_entry->data.enumeration.src_field_count;
1748317483
1748417484 ConstExprValue *enum_field_array = create_const_vals(1);
......@@ -17518,7 +17518,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry,
1751817518 // errors: []TypeInfo.Error
1751917519 ensure_field_index(result->type, "errors", 0);
1752017520
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);
1752217522 uint32_t error_count = type_entry->data.error_set.err_count;
1752317523 ConstExprValue *error_array = create_const_vals(1);
1752417524 error_array->special = ConstValSpecialStatic;
......@@ -17612,7 +17612,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry,
1761217612 // fields: []TypeInfo.UnionField
1761317613 ensure_field_index(result->type, "fields", 2);
1761417614
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);
1761617616 uint32_t union_field_count = type_entry->data.unionation.src_field_count;
1761717617
1761817618 ConstExprValue *union_field_array = create_const_vals(1);
......@@ -17624,7 +17624,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry,
1762417624
1762517625 init_const_slice(ira->codegen, &fields[2], union_field_array, 0, union_field_count, false);
1762617626
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);
1762817628
1762917629 for (uint32_t union_field_index = 0; union_field_index < union_field_count; union_field_index++) {
1763017630 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,
1768517685 // fields: []TypeInfo.StructField
1768617686 ensure_field_index(result->type, "fields", 1);
1768717687
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);
1768917689 uint32_t struct_field_count = type_entry->data.structure.src_field_count;
1769017690
1769117691 ConstExprValue *struct_field_array = create_const_vals(1);
......@@ -17790,7 +17790,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry,
1779017790 fields[4].data.x_optional = async_alloc_type;
1779117791 }
1779217792 // 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);
1779417794 size_t fn_arg_count = type_entry->data.fn.fn_type_id.param_count -
1779517795 (is_varargs && type_entry->data.fn.fn_type_id.cc != CallingConventionC);
1779617796
......@@ -17844,7 +17844,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry,
1784417844 }
1784517845 case TypeTableEntryIdBoundFn:
1784617846 {
17847 TypeTableEntry *fn_type = type_entry->data.bound_fn.fn_type;
17847 ZigType *fn_type = type_entry->data.bound_fn.fn_type;
1784817848 assert(fn_type->id == TypeTableEntryIdFn);
1784917849 if ((err = ir_make_type_info_value(ira, fn_type, &result)))
1785017850 return err;
......@@ -17859,16 +17859,16 @@ static Error ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry,
1785917859 return ErrorNone;
1786017860}
1786117861
17862static TypeTableEntry *ir_analyze_instruction_type_info(IrAnalyze *ira,
17862static ZigType *ir_analyze_instruction_type_info(IrAnalyze *ira,
1786317863 IrInstructionTypeInfo *instruction)
1786417864{
1786517865 Error err;
1786617866 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);
1786817868 if (type_is_invalid(type_entry))
1786917869 return ira->codegen->builtin_types.entry_invalid;
1787017870
17871 TypeTableEntry *result_type = ir_type_info_get_type(ira, nullptr, nullptr);
17871 ZigType *result_type = ir_type_info_get_type(ira, nullptr, nullptr);
1787217872
1787317873 ConstExprValue *payload;
1787417874 if ((err = ir_make_type_info_value(ira, type_entry, &payload)))
......@@ -17888,24 +17888,24 @@ static TypeTableEntry *ir_analyze_instruction_type_info(IrAnalyze *ira,
1788817888 return result_type;
1788917889}
1789017890
17891static TypeTableEntry *ir_analyze_instruction_type_id(IrAnalyze *ira,
17891static ZigType *ir_analyze_instruction_type_id(IrAnalyze *ira,
1789217892 IrInstructionTypeId *instruction)
1789317893{
1789417894 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);
1789617896 if (type_is_invalid(type_entry))
1789717897 return ira->codegen->builtin_types.entry_invalid;
1789817898
1789917899 ConstExprValue *var_value = get_builtin_value(ira->codegen, "TypeId");
1790017900 assert(var_value->type->id == TypeTableEntryIdMetaType);
17901 TypeTableEntry *result_type = var_value->data.x_type;
17901 ZigType *result_type = var_value->data.x_type;
1790217902
1790317903 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
1790417904 bigint_init_unsigned(&out_val->data.x_enum_tag, type_id_index(type_entry));
1790517905 return result_type;
1790617906}
1790717907
17908static TypeTableEntry *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ira,
17908static ZigType *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ira,
1790917909 IrInstructionSetEvalBranchQuota *instruction)
1791017910{
1791117911 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
1792617926 return ira->codegen->builtin_types.entry_void;
1792717927}
1792817928
17929static TypeTableEntry *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstructionTypeName *instruction) {
17929static ZigType *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstructionTypeName *instruction) {
1793017930 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);
1793217932 if (type_is_invalid(type_entry))
1793317933 return ira->codegen->builtin_types.entry_invalid;
1793417934
......@@ -17940,7 +17940,7 @@ static TypeTableEntry *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstru
1794017940 return out_val->type;
1794117941}
1794217942
17943static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstructionCImport *instruction) {
17943static ZigType *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstructionCImport *instruction) {
1794417944 AstNode *node = instruction->base.source_node;
1794517945 assert(node->type == NodeTypeFnCallExpr);
1794617946 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
1794817948 ScopeCImport *cimport_scope = create_cimport_scope(node, instruction->base.scope);
1794917949
1795017950 // 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;
1795217952 IrInstruction *result = ir_eval_const_value(ira->codegen, &cimport_scope->base, block_node, void_type,
1795317953 ira->new_irb.exec->backward_branch_count, ira->new_irb.exec->backward_branch_quota, nullptr,
1795417954 &cimport_scope->buf, block_node, nullptr, nullptr);
......@@ -17999,7 +17999,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc
1799917999 return ira->codegen->builtin_types.entry_namespace;
1800018000}
1800118001
18002static TypeTableEntry *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstructionCInclude *instruction) {
18002static ZigType *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstructionCInclude *instruction) {
1800318003 IrInstruction *name_value = instruction->name->other;
1800418004 if (type_is_invalid(name_value->value.type))
1800518005 return ira->codegen->builtin_types.entry_invalid;
......@@ -18018,7 +18018,7 @@ static TypeTableEntry *ir_analyze_instruction_c_include(IrAnalyze *ira, IrInstru
1801818018 return ira->codegen->builtin_types.entry_void;
1801918019}
1802018020
18021static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstructionCDefine *instruction) {
18021static ZigType *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstructionCDefine *instruction) {
1802218022 IrInstruction *name = instruction->name->other;
1802318023 if (type_is_invalid(name->value.type))
1802418024 return ira->codegen->builtin_types.entry_invalid;
......@@ -18045,7 +18045,7 @@ static TypeTableEntry *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstruc
1804518045 return ira->codegen->builtin_types.entry_void;
1804618046}
1804718047
18048static TypeTableEntry *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstructionCUndef *instruction) {
18048static ZigType *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstructionCUndef *instruction) {
1804918049 IrInstruction *name = instruction->name->other;
1805018050 if (type_is_invalid(name->value.type))
1805118051 return ira->codegen->builtin_types.entry_invalid;
......@@ -18064,7 +18064,7 @@ static TypeTableEntry *ir_analyze_instruction_c_undef(IrAnalyze *ira, IrInstruct
1806418064 return ira->codegen->builtin_types.entry_void;
1806518065}
1806618066
18067static TypeTableEntry *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstructionEmbedFile *instruction) {
18067static ZigType *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstructionEmbedFile *instruction) {
1806818068 IrInstruction *name = instruction->name->other;
1806918069 if (type_is_invalid(name->value.type))
1807018070 return ira->codegen->builtin_types.entry_invalid;
......@@ -18106,8 +18106,8 @@ static TypeTableEntry *ir_analyze_instruction_embed_file(IrAnalyze *ira, IrInstr
1810618106 return get_array_type(ira->codegen, ira->codegen->builtin_types.entry_u8, buf_len(file_contents));
1810718107}
1810818108
18109static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructionCmpxchg *instruction) {
18110 TypeTableEntry *operand_type = ir_resolve_atomic_operand_type(ira, instruction->type_value->other);
18109static ZigType *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructionCmpxchg *instruction) {
18110 ZigType *operand_type = ir_resolve_atomic_operand_type(ira, instruction->type_value->other);
1811118111 if (type_is_invalid(operand_type))
1811218112 return ira->codegen->builtin_types.entry_invalid;
1811318113
......@@ -18116,7 +18116,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct
1811618116 return ira->codegen->builtin_types.entry_invalid;
1811718117
1811818118 // 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);
1812018120 IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr, ptr_type);
1812118121 if (type_is_invalid(casted_ptr->value.type))
1812218122 return ira->codegen->builtin_types.entry_invalid;
......@@ -18187,7 +18187,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct
1818718187 return result->value.type;
1818818188}
1818918189
18190static TypeTableEntry *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructionFence *instruction) {
18190static ZigType *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructionFence *instruction) {
1819118191 IrInstruction *order_value = instruction->order_value->other;
1819218192 if (type_is_invalid(order_value->value.type))
1819318193 return ira->codegen->builtin_types.entry_invalid;
......@@ -18200,9 +18200,9 @@ static TypeTableEntry *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstructio
1820018200 return ira->codegen->builtin_types.entry_void;
1820118201}
1820218202
18203static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstructionTruncate *instruction) {
18203static ZigType *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstructionTruncate *instruction) {
1820418204 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);
1820618206 if (type_is_invalid(dest_type))
1820718207 return ira->codegen->builtin_types.entry_invalid;
1820818208
......@@ -18214,7 +18214,7 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc
1821418214 }
1821518215
1821618216 IrInstruction *target = instruction->target->other;
18217 TypeTableEntry *src_type = target->value.type;
18217 ZigType *src_type = target->value.type;
1821818218 if (type_is_invalid(src_type))
1821918219 return ira->codegen->builtin_types.entry_invalid;
1822018220
......@@ -18248,8 +18248,8 @@ static TypeTableEntry *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruc
1824818248 return dest_type;
1824918249}
1825018250
18251static TypeTableEntry *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstructionIntCast *instruction) {
18252 TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
18251static ZigType *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstructionIntCast *instruction) {
18252 ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
1825318253 if (type_is_invalid(dest_type))
1825418254 return ira->codegen->builtin_types.entry_invalid;
1825518255
......@@ -18289,8 +18289,8 @@ static TypeTableEntry *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstruc
1828918289 return dest_type;
1829018290}
1829118291
18292static TypeTableEntry *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstructionFloatCast *instruction) {
18293 TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
18292static ZigType *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstructionFloatCast *instruction) {
18293 ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
1829418294 if (type_is_invalid(dest_type))
1829518295 return ira->codegen->builtin_types.entry_invalid;
1829618296
......@@ -18337,8 +18337,8 @@ static TypeTableEntry *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstr
1833718337 return dest_type;
1833818338}
1833918339
18340static TypeTableEntry *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrInstructionErrSetCast *instruction) {
18341 TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
18340static ZigType *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrInstructionErrSetCast *instruction) {
18341 ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
1834218342 if (type_is_invalid(dest_type))
1834318343 return ira->codegen->builtin_types.entry_invalid;
1834418344
......@@ -18365,8 +18365,8 @@ static TypeTableEntry *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrIns
1836518365 return dest_type;
1836618366}
1836718367
18368static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstructionFromBytes *instruction) {
18369 TypeTableEntry *dest_child_type = ir_resolve_type(ira, instruction->dest_child_type->other);
18368static ZigType *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstructionFromBytes *instruction) {
18369 ZigType *dest_child_type = ir_resolve_type(ira, instruction->dest_child_type->other);
1837018370 if (type_is_invalid(dest_child_type))
1837118371 return ira->codegen->builtin_types.entry_invalid;
1837218372
......@@ -18382,7 +18382,7 @@ static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstr
1838218382 src_ptr_volatile = target->value.type->data.pointer.is_volatile;
1838318383 src_ptr_align = target->value.type->data.pointer.alignment;
1838418384 } 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;
1838618386 src_ptr_const = src_ptr_type->data.pointer.is_const;
1838718387 src_ptr_volatile = src_ptr_type->data.pointer.is_volatile;
1838818388 src_ptr_align = src_ptr_type->data.pointer.alignment;
......@@ -18392,15 +18392,15 @@ static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstr
1839218392 src_ptr_align = get_abi_alignment(ira->codegen, target->value.type);
1839318393 }
1839418394
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,
1839618396 src_ptr_const, src_ptr_volatile, PtrLenUnknown,
1839718397 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);
1839918399
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,
1840118401 src_ptr_const, src_ptr_volatile, PtrLenUnknown,
1840218402 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);
1840418404
1840518405 IrInstruction *casted_value = ir_implicit_cast(ira, target, u8_slice);
1840618406 if (type_is_invalid(casted_value->value.type))
......@@ -18445,7 +18445,7 @@ static TypeTableEntry *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstr
1844518445 return dest_slice_type;
1844618446}
1844718447
18448static TypeTableEntry *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstructionToBytes *instruction) {
18448static ZigType *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstructionToBytes *instruction) {
1844918449 IrInstruction *target = instruction->target->other;
1845018450 if (type_is_invalid(target->value.type))
1845118451 return ira->codegen->builtin_types.entry_invalid;
......@@ -18456,20 +18456,20 @@ static TypeTableEntry *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstruc
1845618456 return ira->codegen->builtin_types.entry_invalid;
1845718457 }
1845818458
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;
1846018460
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,
1846218462 src_ptr_type->data.pointer.is_const, src_ptr_type->data.pointer.is_volatile, PtrLenUnknown,
1846318463 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);
1846518465
1846618466 IrInstruction *result = ir_resolve_cast(ira, &instruction->base, target, dest_slice_type, CastOpResizeSlice, true);
1846718467 ir_link_new_instruction(result, &instruction->base);
1846818468 return dest_slice_type;
1846918469}
1847018470
18471static TypeTableEntry *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrInstructionIntToFloat *instruction) {
18472 TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
18471static ZigType *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrInstructionIntToFloat *instruction) {
18472 ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
1847318473 if (type_is_invalid(dest_type))
1847418474 return ira->codegen->builtin_types.entry_invalid;
1847518475
......@@ -18488,8 +18488,8 @@ static TypeTableEntry *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrIns
1848818488 return dest_type;
1848918489}
1849018490
18491static TypeTableEntry *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrInstructionFloatToInt *instruction) {
18492 TypeTableEntry *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
18491static ZigType *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrInstructionFloatToInt *instruction) {
18492 ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->other);
1849318493 if (type_is_invalid(dest_type))
1849418494 return ira->codegen->builtin_types.entry_invalid;
1849518495
......@@ -18516,7 +18516,7 @@ static TypeTableEntry *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrIns
1851618516 return dest_type;
1851718517}
1851818518
18519static TypeTableEntry *ir_analyze_instruction_err_to_int(IrAnalyze *ira, IrInstructionErrToInt *instruction) {
18519static ZigType *ir_analyze_instruction_err_to_int(IrAnalyze *ira, IrInstructionErrToInt *instruction) {
1852018520 IrInstruction *target = instruction->target->other;
1852118521 if (type_is_invalid(target->value.type))
1852218522 return ira->codegen->builtin_types.entry_invalid;
......@@ -18535,7 +18535,7 @@ static TypeTableEntry *ir_analyze_instruction_err_to_int(IrAnalyze *ira, IrInstr
1853518535 return result->value.type;
1853618536}
1853718537
18538static TypeTableEntry *ir_analyze_instruction_int_to_err(IrAnalyze *ira, IrInstructionIntToErr *instruction) {
18538static ZigType *ir_analyze_instruction_int_to_err(IrAnalyze *ira, IrInstructionIntToErr *instruction) {
1853918539 IrInstruction *target = instruction->target->other;
1854018540 if (type_is_invalid(target->value.type))
1854118541 return ira->codegen->builtin_types.entry_invalid;
......@@ -18549,7 +18549,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_err(IrAnalyze *ira, IrInstr
1854918549 return result->value.type;
1855018550}
1855118551
18552static TypeTableEntry *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInstructionBoolToInt *instruction) {
18552static ZigType *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInstructionBoolToInt *instruction) {
1855318553 IrInstruction *target = instruction->target->other;
1855418554 if (type_is_invalid(target->value.type))
1855518555 return ira->codegen->builtin_types.entry_invalid;
......@@ -18570,13 +18570,13 @@ static TypeTableEntry *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInst
1857018570 return ira->codegen->builtin_types.entry_num_lit_int;
1857118571 }
1857218572
18573 TypeTableEntry *u1_type = get_int_type(ira->codegen, false, 1);
18573 ZigType *u1_type = get_int_type(ira->codegen, false, 1);
1857418574 IrInstruction *result = ir_resolve_cast(ira, &instruction->base, target, u1_type, CastOpBoolToInt, false);
1857518575 ir_link_new_instruction(result, &instruction->base);
1857618576 return u1_type;
1857718577}
1857818578
18579static TypeTableEntry *ir_analyze_instruction_int_type(IrAnalyze *ira, IrInstructionIntType *instruction) {
18579static ZigType *ir_analyze_instruction_int_type(IrAnalyze *ira, IrInstructionIntType *instruction) {
1858018580 IrInstruction *is_signed_value = instruction->is_signed->other;
1858118581 bool is_signed;
1858218582 if (!ir_resolve_bool(ira, is_signed_value, &is_signed))
......@@ -18592,12 +18592,12 @@ static TypeTableEntry *ir_analyze_instruction_int_type(IrAnalyze *ira, IrInstruc
1859218592 return ira->codegen->builtin_types.entry_type;
1859318593}
1859418594
18595static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstructionBoolNot *instruction) {
18595static ZigType *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstructionBoolNot *instruction) {
1859618596 IrInstruction *value = instruction->value->other;
1859718597 if (type_is_invalid(value->value.type))
1859818598 return ira->codegen->builtin_types.entry_invalid;
1859918599
18600 TypeTableEntry *bool_type = ira->codegen->builtin_types.entry_bool;
18600 ZigType *bool_type = ira->codegen->builtin_types.entry_bool;
1860118601
1860218602 IrInstruction *casted_value = ir_implicit_cast(ira, value, bool_type);
1860318603 if (type_is_invalid(casted_value->value.type))
......@@ -18617,7 +18617,7 @@ static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstruc
1861718617 return bool_type;
1861818618}
1861918619
18620static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructionMemset *instruction) {
18620static ZigType *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructionMemset *instruction) {
1862118621 IrInstruction *dest_ptr = instruction->dest_ptr->other;
1862218622 if (type_is_invalid(dest_ptr->value.type))
1862318623 return ira->codegen->builtin_types.entry_invalid;
......@@ -18630,15 +18630,15 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi
1863018630 if (type_is_invalid(count_value->value.type))
1863118631 return ira->codegen->builtin_types.entry_invalid;
1863218632
18633 TypeTableEntry *dest_uncasted_type = dest_ptr->value.type;
18633 ZigType *dest_uncasted_type = dest_ptr->value.type;
1863418634 bool dest_is_volatile = (dest_uncasted_type->id == TypeTableEntryIdPointer) &&
1863518635 dest_uncasted_type->data.pointer.is_volatile;
1863618636
18637 TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
18638 TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8;
18637 ZigType *usize = ira->codegen->builtin_types.entry_usize;
18638 ZigType *u8 = ira->codegen->builtin_types.entry_u8;
1863918639 uint32_t dest_align = (dest_uncasted_type->id == TypeTableEntryIdPointer) ?
1864018640 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,
1864218642 PtrLenUnknown, dest_align, 0, 0);
1864318643
1864418644 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
1870918709 return ira->codegen->builtin_types.entry_void;
1871018710}
1871118711
18712static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructionMemcpy *instruction) {
18712static ZigType *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructionMemcpy *instruction) {
1871318713 IrInstruction *dest_ptr = instruction->dest_ptr->other;
1871418714 if (type_is_invalid(dest_ptr->value.type))
1871518715 return ira->codegen->builtin_types.entry_invalid;
......@@ -18722,9 +18722,9 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi
1872218722 if (type_is_invalid(count_value->value.type))
1872318723 return ira->codegen->builtin_types.entry_invalid;
1872418724
18725 TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8;
18726 TypeTableEntry *dest_uncasted_type = dest_ptr->value.type;
18727 TypeTableEntry *src_uncasted_type = src_ptr->value.type;
18725 ZigType *u8 = ira->codegen->builtin_types.entry_u8;
18726 ZigType *dest_uncasted_type = dest_ptr->value.type;
18727 ZigType *src_uncasted_type = src_ptr->value.type;
1872818728 bool dest_is_volatile = (dest_uncasted_type->id == TypeTableEntryIdPointer) &&
1872918729 dest_uncasted_type->data.pointer.is_volatile;
1873018730 bool src_is_volatile = (src_uncasted_type->id == TypeTableEntryIdPointer) &&
......@@ -18734,10 +18734,10 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi
1873418734 uint32_t src_align = (src_uncasted_type->id == TypeTableEntryIdPointer) ?
1873518735 src_uncasted_type->data.pointer.alignment : get_abi_alignment(ira->codegen, u8);
1873618736
18737 TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
18738 TypeTableEntry *u8_ptr_mut = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile,
18737 ZigType *usize = ira->codegen->builtin_types.entry_usize;
18738 ZigType *u8_ptr_mut = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile,
1873918739 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,
1874118741 PtrLenUnknown, src_align, 0, 0);
1874218742
1874318743 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
1884418844 return ira->codegen->builtin_types.entry_void;
1884518845}
1884618846
18847static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice *instruction) {
18847static ZigType *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice *instruction) {
1884818848 IrInstruction *ptr_ptr = instruction->ptr->other;
1884918849 if (type_is_invalid(ptr_ptr->value.type))
1885018850 return ira->codegen->builtin_types.entry_invalid;
1885118851
18852 TypeTableEntry *ptr_type = ptr_ptr->value.type;
18852 ZigType *ptr_type = ptr_ptr->value.type;
1885318853 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;
1885518855
1885618856 IrInstruction *start = instruction->start->other;
1885718857 if (type_is_invalid(start->value.type))
1885818858 return ira->codegen->builtin_types.entry_invalid;
1885918859
18860 TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
18860 ZigType *usize = ira->codegen->builtin_types.entry_usize;
1886118861 IrInstruction *casted_start = ir_implicit_cast(ira, start, usize);
1886218862 if (type_is_invalid(casted_start->value.type))
1886318863 return ira->codegen->builtin_types.entry_invalid;
......@@ -18874,7 +18874,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio
1887418874 end = nullptr;
1887518875 }
1887618876
18877 TypeTableEntry *return_type;
18877 ZigType *return_type;
1887818878
1887918879 if (array_type->id == TypeTableEntryIdArray) {
1888018880 uint32_t byte_alignment = ptr_type->data.pointer.alignment;
......@@ -18883,7 +18883,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio
1888318883 }
1888418884 bool is_comptime_const = ptr_ptr->value.special == ConstValSpecialStatic &&
1888518885 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,
1888718887 ptr_type->data.pointer.is_const || is_comptime_const,
1888818888 ptr_type->data.pointer.is_volatile,
1888918889 PtrLenUnknown,
......@@ -18891,9 +18891,9 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio
1889118891 return_type = get_slice_type(ira->codegen, slice_ptr_type);
1889218892 } else if (array_type->id == TypeTableEntryIdPointer) {
1889318893 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;
1889518895 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,
1889718897 main_type->data.pointer.child_type,
1889818898 array_type->data.pointer.is_const, array_type->data.pointer.is_volatile,
1889918899 PtrLenUnknown,
......@@ -18904,7 +18904,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio
1890418904 return ira->codegen->builtin_types.entry_invalid;
1890518905 }
1890618906 } 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,
1890818908 array_type->data.pointer.is_const, array_type->data.pointer.is_volatile,
1890918909 PtrLenUnknown,
1891018910 array_type->data.pointer.alignment, 0, 0);
......@@ -18915,7 +18915,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio
1891518915 }
1891618916 }
1891718917 } 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;
1891918919 return_type = get_slice_type(ira->codegen, ptr_type);
1892018920 } else {
1892118921 ir_add_error(ira, &instruction->base,
......@@ -18936,7 +18936,7 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio
1893618936 (array_type->id == TypeTableEntryIdPointer && array_type->data.pointer.ptr_len == PtrLenSingle))
1893718937 {
1893818938 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;
1894018940 assert(child_array_type->id == TypeTableEntryIdArray);
1894118941 parent_ptr = ir_const_ptr_pointee(ira, &ptr_ptr->value, instruction->base.source_node);
1894218942 if (parent_ptr == nullptr)
......@@ -19109,12 +19109,12 @@ static TypeTableEntry *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructio
1910919109 return return_type;
1911019110}
1911119111
19112static TypeTableEntry *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstructionMemberCount *instruction) {
19112static ZigType *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstructionMemberCount *instruction) {
1911319113 Error err;
1911419114 IrInstruction *container = instruction->container->other;
1911519115 if (type_is_invalid(container->value.type))
1911619116 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);
1911819118
1911919119 if ((err = ensure_complete_type(ira->codegen, container_type)))
1912019120 return ira->codegen->builtin_types.entry_invalid;
......@@ -19147,10 +19147,10 @@ static TypeTableEntry *ir_analyze_instruction_member_count(IrAnalyze *ira, IrIns
1914719147 return ira->codegen->builtin_types.entry_num_lit_int;
1914819148}
1914919149
19150static TypeTableEntry *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInstructionMemberType *instruction) {
19150static ZigType *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInstructionMemberType *instruction) {
1915119151 Error err;
1915219152 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);
1915419154 if (type_is_invalid(container_type))
1915519155 return ira->codegen->builtin_types.entry_invalid;
1915619156
......@@ -19194,10 +19194,10 @@ static TypeTableEntry *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInst
1919419194 }
1919519195}
1919619196
19197static TypeTableEntry *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInstructionMemberName *instruction) {
19197static ZigType *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInstructionMemberName *instruction) {
1919819198 Error err;
1919919199 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);
1920119201 if (type_is_invalid(container_type))
1920219202 return ira->codegen->builtin_types.entry_invalid;
1920319203
......@@ -19252,28 +19252,28 @@ static TypeTableEntry *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInst
1925219252 }
1925319253}
1925419254
19255static TypeTableEntry *ir_analyze_instruction_breakpoint(IrAnalyze *ira, IrInstructionBreakpoint *instruction) {
19255static ZigType *ir_analyze_instruction_breakpoint(IrAnalyze *ira, IrInstructionBreakpoint *instruction) {
1925619256 ir_build_breakpoint_from(&ira->new_irb, &instruction->base);
1925719257 return ira->codegen->builtin_types.entry_void;
1925819258}
1925919259
19260static TypeTableEntry *ir_analyze_instruction_return_address(IrAnalyze *ira, IrInstructionReturnAddress *instruction) {
19260static ZigType *ir_analyze_instruction_return_address(IrAnalyze *ira, IrInstructionReturnAddress *instruction) {
1926119261 ir_build_return_address_from(&ira->new_irb, &instruction->base);
1926219262
19263 TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8;
19264 TypeTableEntry *u8_ptr_const = get_pointer_to_type(ira->codegen, u8, true);
19263 ZigType *u8 = ira->codegen->builtin_types.entry_u8;
19264 ZigType *u8_ptr_const = get_pointer_to_type(ira->codegen, u8, true);
1926519265 return u8_ptr_const;
1926619266}
1926719267
19268static TypeTableEntry *ir_analyze_instruction_frame_address(IrAnalyze *ira, IrInstructionFrameAddress *instruction) {
19268static ZigType *ir_analyze_instruction_frame_address(IrAnalyze *ira, IrInstructionFrameAddress *instruction) {
1926919269 ir_build_frame_address_from(&ira->new_irb, &instruction->base);
1927019270
19271 TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8;
19272 TypeTableEntry *u8_ptr_const = get_pointer_to_type(ira->codegen, u8, true);
19271 ZigType *u8 = ira->codegen->builtin_types.entry_u8;
19272 ZigType *u8_ptr_const = get_pointer_to_type(ira->codegen, u8, true);
1927319273 return u8_ptr_const;
1927419274}
1927519275
19276static TypeTableEntry *ir_analyze_instruction_handle(IrAnalyze *ira, IrInstructionHandle *instruction) {
19276static ZigType *ir_analyze_instruction_handle(IrAnalyze *ira, IrInstructionHandle *instruction) {
1927719277 ir_build_handle_from(&ira->new_irb, &instruction->base);
1927819278
1927919279 FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec);
......@@ -19281,12 +19281,12 @@ static TypeTableEntry *ir_analyze_instruction_handle(IrAnalyze *ira, IrInstructi
1928119281 return get_promise_type(ira->codegen, fn_entry->type_entry->data.fn.fn_type_id.return_type);
1928219282}
1928319283
19284static TypeTableEntry *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstructionAlignOf *instruction) {
19284static ZigType *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstructionAlignOf *instruction) {
1928519285 Error err;
1928619286 IrInstruction *type_value = instruction->type_value->other;
1928719287 if (type_is_invalid(type_value->value.type))
1928819288 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);
1929019290
1929119291 if ((err = type_ensure_zero_bits_known(ira->codegen, type_entry)))
1929219292 return ira->codegen->builtin_types.entry_invalid;
......@@ -19332,12 +19332,12 @@ static TypeTableEntry *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstruc
1933219332 zig_unreachable();
1933319333}
1933419334
19335static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstructionOverflowOp *instruction) {
19335static ZigType *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstructionOverflowOp *instruction) {
1933619336 IrInstruction *type_value = instruction->type_value->other;
1933719337 if (type_is_invalid(type_value->value.type))
1933819338 return ira->codegen->builtin_types.entry_invalid;
1933919339
19340 TypeTableEntry *dest_type = ir_resolve_type(ira, type_value);
19340 ZigType *dest_type = ir_resolve_type(ira, type_value);
1934119341 if (type_is_invalid(dest_type))
1934219342 return ira->codegen->builtin_types.entry_invalid;
1934319343
......@@ -19361,7 +19361,7 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst
1936119361
1936219362 IrInstruction *casted_op2;
1936319363 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,
1936519365 dest_type->data.integral.bit_count - 1);
1936619366 casted_op2 = ir_implicit_cast(ira, op2, shift_amt_type);
1936719367 } else {
......@@ -19374,7 +19374,7 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst
1937419374 if (type_is_invalid(result_ptr->value.type))
1937519375 return ira->codegen->builtin_types.entry_invalid;
1937619376
19377 TypeTableEntry *expected_ptr_type;
19377 ZigType *expected_ptr_type;
1937819378 if (result_ptr->value.type->id == TypeTableEntryIdPointer) {
1937919379 expected_ptr_type = get_pointer_to_type_extra(ira->codegen, dest_type,
1938019380 false, result_ptr->value.type->data.pointer.is_volatile,
......@@ -19431,12 +19431,12 @@ static TypeTableEntry *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInst
1943119431 return ira->codegen->builtin_types.entry_bool;
1943219432}
1943319433
19434static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstructionTestErr *instruction) {
19434static ZigType *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstructionTestErr *instruction) {
1943519435 IrInstruction *value = instruction->value->other;
1943619436 if (type_is_invalid(value->value.type))
1943719437 return ira->codegen->builtin_types.entry_invalid;
1943819438
19439 TypeTableEntry *type_entry = value->value.type;
19439 ZigType *type_entry = value->value.type;
1944019440 if (type_is_invalid(type_entry)) {
1944119441 return ira->codegen->builtin_types.entry_invalid;
1944219442 } else if (type_entry->id == TypeTableEntryIdErrorUnion) {
......@@ -19452,7 +19452,7 @@ static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruc
1945219452 }
1945319453 }
1945419454
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;
1945619456 if (!resolve_inferred_error_set(ira->codegen, err_set_type, instruction->base.source_node)) {
1945719457 return ira->codegen->builtin_types.entry_invalid;
1945819458 }
......@@ -19478,18 +19478,18 @@ static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruc
1947819478 }
1947919479}
1948019480
19481static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira,
19481static ZigType *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira,
1948219482 IrInstructionUnwrapErrCode *instruction)
1948319483{
1948419484 IrInstruction *value = instruction->value->other;
1948519485 if (type_is_invalid(value->value.type))
1948619486 return ira->codegen->builtin_types.entry_invalid;
19487 TypeTableEntry *ptr_type = value->value.type;
19487 ZigType *ptr_type = value->value.type;
1948819488
1948919489 // This will be a pointer type because unwrap err payload IR instruction operates on a pointer to a thing.
1949019490 assert(ptr_type->id == TypeTableEntryIdPointer);
1949119491
19492 TypeTableEntry *type_entry = ptr_type->data.pointer.child_type;
19492 ZigType *type_entry = ptr_type->data.pointer.child_type;
1949319493 if (type_is_invalid(type_entry)) {
1949419494 return ira->codegen->builtin_types.entry_invalid;
1949519495 } else if (type_entry->id == TypeTableEntryIdErrorUnion) {
......@@ -19519,27 +19519,27 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira,
1951919519 }
1952019520}
1952119521
19522static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira,
19522static ZigType *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira,
1952319523 IrInstructionUnwrapErrPayload *instruction)
1952419524{
1952519525 assert(instruction->value->other);
1952619526 IrInstruction *value = instruction->value->other;
1952719527 if (type_is_invalid(value->value.type))
1952819528 return ira->codegen->builtin_types.entry_invalid;
19529 TypeTableEntry *ptr_type = value->value.type;
19529 ZigType *ptr_type = value->value.type;
1953019530
1953119531 // This will be a pointer type because unwrap err payload IR instruction operates on a pointer to a thing.
1953219532 assert(ptr_type->id == TypeTableEntryIdPointer);
1953319533
19534 TypeTableEntry *type_entry = ptr_type->data.pointer.child_type;
19534 ZigType *type_entry = ptr_type->data.pointer.child_type;
1953519535 if (type_is_invalid(type_entry)) {
1953619536 return ira->codegen->builtin_types.entry_invalid;
1953719537 } 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;
1953919539 if (type_is_invalid(payload_type)) {
1954019540 return ira->codegen->builtin_types.entry_invalid;
1954119541 }
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,
1954319543 ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile,
1954419544 PtrLenSingle,
1954519545 get_abi_alignment(ira->codegen, payload_type), 0, 0);
......@@ -19575,7 +19575,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira,
1957519575
1957619576}
1957719577
19578static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstructionFnProto *instruction) {
19578static ZigType *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstructionFnProto *instruction) {
1957919579 AstNode *proto_node = instruction->base.source_node;
1958019580 assert(proto_node->type == NodeTypeFnProto);
1958119581
......@@ -19656,7 +19656,7 @@ static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruc
1965619656 return ira->codegen->builtin_types.entry_type;
1965719657}
1965819658
19659static TypeTableEntry *ir_analyze_instruction_test_comptime(IrAnalyze *ira, IrInstructionTestComptime *instruction) {
19659static ZigType *ir_analyze_instruction_test_comptime(IrAnalyze *ira, IrInstructionTestComptime *instruction) {
1966019660 IrInstruction *value = instruction->value->other;
1966119661 if (type_is_invalid(value->value.type))
1966219662 return ira->codegen->builtin_types.entry_invalid;
......@@ -19666,11 +19666,11 @@ static TypeTableEntry *ir_analyze_instruction_test_comptime(IrAnalyze *ira, IrIn
1966619666 return ira->codegen->builtin_types.entry_bool;
1966719667}
1966819668
19669static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
19669static ZigType *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
1967019670 IrInstructionCheckSwitchProngs *instruction)
1967119671{
1967219672 IrInstruction *target_value = instruction->target_value->other;
19673 TypeTableEntry *switch_type = target_value->value.type;
19673 ZigType *switch_type = target_value->value.type;
1967419674 if (type_is_invalid(switch_type))
1967519675 return ira->codegen->builtin_types.entry_invalid;
1967619676
......@@ -19846,11 +19846,11 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira
1984619846 return ira->codegen->builtin_types.entry_void;
1984719847}
1984819848
19849static TypeTableEntry *ir_analyze_instruction_check_statement_is_void(IrAnalyze *ira,
19849static ZigType *ir_analyze_instruction_check_statement_is_void(IrAnalyze *ira,
1985019850 IrInstructionCheckStatementIsVoid *instruction)
1985119851{
1985219852 IrInstruction *statement_value = instruction->statement_value->other;
19853 TypeTableEntry *statement_type = statement_value->value.type;
19853 ZigType *statement_type = statement_value->value.type;
1985419854 if (type_is_invalid(statement_type))
1985519855 return ira->codegen->builtin_types.entry_invalid;
1985619856
......@@ -19862,7 +19862,7 @@ static TypeTableEntry *ir_analyze_instruction_check_statement_is_void(IrAnalyze
1986219862 return ira->codegen->builtin_types.entry_void;
1986319863}
1986419864
19865static TypeTableEntry *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructionPanic *instruction) {
19865static ZigType *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructionPanic *instruction) {
1986619866 IrInstruction *msg = instruction->msg->other;
1986719867 if (type_is_invalid(msg->value.type))
1986819868 return ir_unreach_error(ira);
......@@ -19872,9 +19872,9 @@ static TypeTableEntry *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructio
1987219872 return ir_unreach_error(ira);
1987319873 }
1987419874
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,
1987619876 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);
1987819878 IrInstruction *casted_msg = ir_implicit_cast(ira, msg, str_type);
1987919879 if (type_is_invalid(casted_msg->value.type))
1988019880 return ir_unreach_error(ira);
......@@ -19886,10 +19886,10 @@ static TypeTableEntry *ir_analyze_instruction_panic(IrAnalyze *ira, IrInstructio
1988619886}
1988719887
1988819888static 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;
1989019890 assert(!type_is_invalid(target_type));
1989119891
19892 TypeTableEntry *result_type;
19892 ZigType *result_type;
1989319893 uint32_t old_align_bytes;
1989419894
1989519895 if (target_type->id == TypeTableEntryIdPointer) {
......@@ -19903,9 +19903,9 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3
1990319903 } else if (target_type->id == TypeTableEntryIdOptional &&
1990419904 target_type->data.maybe.child_type->id == TypeTableEntryIdPointer)
1990519905 {
19906 TypeTableEntry *ptr_type = target_type->data.maybe.child_type;
19906 ZigType *ptr_type = target_type->data.maybe.child_type;
1990719907 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);
1990919909
1991019910 result_type = get_optional_type(ira->codegen, better_ptr_type);
1991119911 } else if (target_type->id == TypeTableEntryIdOptional &&
......@@ -19914,12 +19914,12 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3
1991419914 FnTypeId fn_type_id = target_type->data.maybe.child_type->data.fn.fn_type_id;
1991519915 old_align_bytes = fn_type_id.alignment;
1991619916 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);
1991819918 result_type = get_optional_type(ira->codegen, fn_type);
1991919919 } 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;
1992119921 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);
1992319923 result_type = get_slice_type(ira->codegen, result_ptr_type);
1992419924 } else {
1992519925 ir_add_error(ira, target,
......@@ -19957,16 +19957,16 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3
1995719957 return result;
1995819958}
1995919959
19960static TypeTableEntry *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstructionPtrCast *instruction) {
19960static ZigType *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstructionPtrCast *instruction) {
1996119961 Error err;
1996219962
1996319963 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);
1996519965 if (type_is_invalid(dest_type))
1996619966 return ira->codegen->builtin_types.entry_invalid;
1996719967
1996819968 IrInstruction *ptr = instruction->ptr->other;
19969 TypeTableEntry *src_type = ptr->value.type;
19969 ZigType *src_type = ptr->value.type;
1997019970 if (type_is_invalid(src_type))
1997119971 return ira->codegen->builtin_types.entry_invalid;
1997219972
......@@ -20155,15 +20155,15 @@ static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
2015520155 zig_unreachable();
2015620156}
2015720157
20158static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstructionBitCast *instruction) {
20158static ZigType *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstructionBitCast *instruction) {
2015920159 Error err;
2016020160 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);
2016220162 if (type_is_invalid(dest_type))
2016320163 return ira->codegen->builtin_types.entry_invalid;
2016420164
2016520165 IrInstruction *value = instruction->value->other;
20166 TypeTableEntry *src_type = value->value.type;
20166 ZigType *src_type = value->value.type;
2016720167 if (type_is_invalid(src_type))
2016820168 return ira->codegen->builtin_types.entry_invalid;
2016920169
......@@ -20255,10 +20255,10 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc
2025520255 return dest_type;
2025620256}
2025720257
20258static TypeTableEntry *ir_analyze_instruction_int_to_ptr(IrAnalyze *ira, IrInstructionIntToPtr *instruction) {
20258static ZigType *ir_analyze_instruction_int_to_ptr(IrAnalyze *ira, IrInstructionIntToPtr *instruction) {
2025920259 Error err;
2026020260 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);
2026220262 if (type_is_invalid(dest_type))
2026320263 return ira->codegen->builtin_types.entry_invalid;
2026420264
......@@ -20300,7 +20300,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_ptr(IrAnalyze *ira, IrInstr
2030020300 return dest_type;
2030120301}
2030220302
20303static TypeTableEntry *ir_analyze_instruction_decl_ref(IrAnalyze *ira,
20303static ZigType *ir_analyze_instruction_decl_ref(IrAnalyze *ira,
2030420304 IrInstructionDeclRef *instruction)
2030520305{
2030620306 Tld *tld = instruction->tld;
......@@ -20361,12 +20361,12 @@ static TypeTableEntry *ir_analyze_instruction_decl_ref(IrAnalyze *ira,
2036120361 zig_unreachable();
2036220362}
2036320363
20364static TypeTableEntry *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstructionPtrToInt *instruction) {
20364static ZigType *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstructionPtrToInt *instruction) {
2036520365 IrInstruction *target = instruction->target->other;
2036620366 if (type_is_invalid(target->value.type))
2036720367 return ira->codegen->builtin_types.entry_invalid;
2036820368
20369 TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
20369 ZigType *usize = ira->codegen->builtin_types.entry_usize;
2037020370
2037120371 if (get_codegen_ptr_type(target->value.type) == nullptr) {
2037220372 ir_add_error(ira, target,
......@@ -20400,9 +20400,9 @@ static TypeTableEntry *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstr
2040020400 return usize;
2040120401}
2040220402
20403static TypeTableEntry *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstructionPtrType *instruction) {
20403static ZigType *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstructionPtrType *instruction) {
2040420404 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);
2040620406 if (type_is_invalid(child_type))
2040720407 return ira->codegen->builtin_types.entry_invalid;
2040820408
......@@ -20433,7 +20433,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstruc
2043320433 return ira->codegen->builtin_types.entry_type;
2043420434}
2043520435
20436static TypeTableEntry *ir_analyze_instruction_align_cast(IrAnalyze *ira, IrInstructionAlignCast *instruction) {
20436static ZigType *ir_analyze_instruction_align_cast(IrAnalyze *ira, IrInstructionAlignCast *instruction) {
2043720437 uint32_t align_bytes;
2043820438 IrInstruction *align_bytes_inst = instruction->align_bytes->other;
2043920439 if (!ir_resolve_align(ira, align_bytes_inst, &align_bytes))
......@@ -20451,7 +20451,7 @@ static TypeTableEntry *ir_analyze_instruction_align_cast(IrAnalyze *ira, IrInstr
2045120451 return result->value.type;
2045220452}
2045320453
20454static TypeTableEntry *ir_analyze_instruction_opaque_type(IrAnalyze *ira, IrInstructionOpaqueType *instruction) {
20454static ZigType *ir_analyze_instruction_opaque_type(IrAnalyze *ira, IrInstructionOpaqueType *instruction) {
2045520455 Buf *name = get_anon_type_name(ira->codegen, ira->new_irb.exec, "opaque", instruction->base.source_node);
2045620456 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
2045720457 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
2045920459 return ira->codegen->builtin_types.entry_type;
2046020460}
2046120461
20462static TypeTableEntry *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, IrInstructionSetAlignStack *instruction) {
20462static ZigType *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, IrInstructionSetAlignStack *instruction) {
2046320463 uint32_t align_bytes;
2046420464 IrInstruction *align_bytes_inst = instruction->align_bytes->other;
2046520465 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
2049920499 return ira->codegen->builtin_types.entry_void;
2050020500}
2050120501
20502static TypeTableEntry *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstructionArgType *instruction) {
20502static ZigType *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstructionArgType *instruction) {
2050320503 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);
2050520505 if (type_is_invalid(fn_type))
2050620506 return ira->codegen->builtin_types.entry_invalid;
2050720507
......@@ -20538,10 +20538,10 @@ static TypeTableEntry *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstruc
2053820538 return ira->codegen->builtin_types.entry_type;
2053920539}
2054020540
20541static TypeTableEntry *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstructionTagType *instruction) {
20541static ZigType *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstructionTagType *instruction) {
2054220542 Error err;
2054320543 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);
2054520545 if (type_is_invalid(enum_type))
2054620546 return ira->codegen->builtin_types.entry_invalid;
2054720547
......@@ -20576,7 +20576,7 @@ static TypeTableEntry *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstruc
2057620576 }
2057720577}
2057820578
20579static TypeTableEntry *ir_analyze_instruction_cancel(IrAnalyze *ira, IrInstructionCancel *instruction) {
20579static ZigType *ir_analyze_instruction_cancel(IrAnalyze *ira, IrInstructionCancel *instruction) {
2058020580 IrInstruction *target_inst = instruction->target->other;
2058120581 if (type_is_invalid(target_inst->value.type))
2058220582 return ira->codegen->builtin_types.entry_invalid;
......@@ -20591,7 +20591,7 @@ static TypeTableEntry *ir_analyze_instruction_cancel(IrAnalyze *ira, IrInstructi
2059120591 return result->value.type;
2059220592}
2059320593
20594static TypeTableEntry *ir_analyze_instruction_coro_id(IrAnalyze *ira, IrInstructionCoroId *instruction) {
20594static ZigType *ir_analyze_instruction_coro_id(IrAnalyze *ira, IrInstructionCoroId *instruction) {
2059520595 IrInstruction *promise_ptr = instruction->promise_ptr->other;
2059620596 if (type_is_invalid(promise_ptr->value.type))
2059720597 return ira->codegen->builtin_types.entry_invalid;
......@@ -20603,7 +20603,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_id(IrAnalyze *ira, IrInstruct
2060320603 return result->value.type;
2060420604}
2060520605
20606static TypeTableEntry *ir_analyze_instruction_coro_alloc(IrAnalyze *ira, IrInstructionCoroAlloc *instruction) {
20606static ZigType *ir_analyze_instruction_coro_alloc(IrAnalyze *ira, IrInstructionCoroAlloc *instruction) {
2060720607 IrInstruction *coro_id = instruction->coro_id->other;
2060820608 if (type_is_invalid(coro_id->value.type))
2060920609 return ira->codegen->builtin_types.entry_invalid;
......@@ -20615,14 +20615,14 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc(IrAnalyze *ira, IrInstr
2061520615 return result->value.type;
2061620616}
2061720617
20618static TypeTableEntry *ir_analyze_instruction_coro_size(IrAnalyze *ira, IrInstructionCoroSize *instruction) {
20618static ZigType *ir_analyze_instruction_coro_size(IrAnalyze *ira, IrInstructionCoroSize *instruction) {
2061920619 IrInstruction *result = ir_build_coro_size(&ira->new_irb, instruction->base.scope, instruction->base.source_node);
2062020620 ir_link_new_instruction(result, &instruction->base);
2062120621 result->value.type = ira->codegen->builtin_types.entry_usize;
2062220622 return result->value.type;
2062320623}
2062420624
20625static TypeTableEntry *ir_analyze_instruction_coro_begin(IrAnalyze *ira, IrInstructionCoroBegin *instruction) {
20625static ZigType *ir_analyze_instruction_coro_begin(IrAnalyze *ira, IrInstructionCoroBegin *instruction) {
2062620626 IrInstruction *coro_id = instruction->coro_id->other;
2062720627 if (type_is_invalid(coro_id->value.type))
2062820628 return ira->codegen->builtin_types.entry_invalid;
......@@ -20640,13 +20640,13 @@ static TypeTableEntry *ir_analyze_instruction_coro_begin(IrAnalyze *ira, IrInstr
2064020640 return result->value.type;
2064120641}
2064220642
20643static TypeTableEntry *ir_analyze_instruction_get_implicit_allocator(IrAnalyze *ira, IrInstructionGetImplicitAllocator *instruction) {
20643static ZigType *ir_analyze_instruction_get_implicit_allocator(IrAnalyze *ira, IrInstructionGetImplicitAllocator *instruction) {
2064420644 IrInstruction *result = ir_get_implicit_allocator(ira, &instruction->base, instruction->id);
2064520645 ir_link_new_instruction(result, &instruction->base);
2064620646 return result->value.type;
2064720647}
2064820648
20649static TypeTableEntry *ir_analyze_instruction_coro_alloc_fail(IrAnalyze *ira, IrInstructionCoroAllocFail *instruction) {
20649static ZigType *ir_analyze_instruction_coro_alloc_fail(IrAnalyze *ira, IrInstructionCoroAllocFail *instruction) {
2065020650 IrInstruction *err_val = instruction->err_val->other;
2065120651 if (type_is_invalid(err_val->value.type))
2065220652 return ir_unreach_error(ira);
......@@ -20657,7 +20657,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc_fail(IrAnalyze *ira, Ir
2065720657 return ir_finish_anal(ira, result->value.type);
2065820658}
2065920659
20660static TypeTableEntry *ir_analyze_instruction_coro_suspend(IrAnalyze *ira, IrInstructionCoroSuspend *instruction) {
20660static ZigType *ir_analyze_instruction_coro_suspend(IrAnalyze *ira, IrInstructionCoroSuspend *instruction) {
2066120661 IrInstruction *save_point = nullptr;
2066220662 if (instruction->save_point != nullptr) {
2066320663 save_point = instruction->save_point->other;
......@@ -20676,7 +20676,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_suspend(IrAnalyze *ira, IrIns
2067620676 return result->value.type;
2067720677}
2067820678
20679static TypeTableEntry *ir_analyze_instruction_coro_end(IrAnalyze *ira, IrInstructionCoroEnd *instruction) {
20679static ZigType *ir_analyze_instruction_coro_end(IrAnalyze *ira, IrInstructionCoroEnd *instruction) {
2068020680 IrInstruction *result = ir_build_coro_end(&ira->new_irb, instruction->base.scope,
2068120681 instruction->base.source_node);
2068220682 ir_link_new_instruction(result, &instruction->base);
......@@ -20684,7 +20684,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_end(IrAnalyze *ira, IrInstruc
2068420684 return result->value.type;
2068520685}
2068620686
20687static TypeTableEntry *ir_analyze_instruction_coro_free(IrAnalyze *ira, IrInstructionCoroFree *instruction) {
20687static ZigType *ir_analyze_instruction_coro_free(IrAnalyze *ira, IrInstructionCoroFree *instruction) {
2068820688 IrInstruction *coro_id = instruction->coro_id->other;
2068920689 if (type_is_invalid(coro_id->value.type))
2069020690 return ira->codegen->builtin_types.entry_invalid;
......@@ -20696,12 +20696,12 @@ static TypeTableEntry *ir_analyze_instruction_coro_free(IrAnalyze *ira, IrInstru
2069620696 IrInstruction *result = ir_build_coro_free(&ira->new_irb, instruction->base.scope,
2069720697 instruction->base.source_node, coro_id, coro_handle);
2069820698 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);
2070020700 result->value.type = get_optional_type(ira->codegen, ptr_type);
2070120701 return result->value.type;
2070220702}
2070320703
20704static TypeTableEntry *ir_analyze_instruction_coro_resume(IrAnalyze *ira, IrInstructionCoroResume *instruction) {
20704static ZigType *ir_analyze_instruction_coro_resume(IrAnalyze *ira, IrInstructionCoroResume *instruction) {
2070520705 IrInstruction *awaiter_handle = instruction->awaiter_handle->other;
2070620706 if (type_is_invalid(awaiter_handle->value.type))
2070720707 return ira->codegen->builtin_types.entry_invalid;
......@@ -20717,7 +20717,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_resume(IrAnalyze *ira, IrInst
2071720717 return result->value.type;
2071820718}
2071920719
20720static TypeTableEntry *ir_analyze_instruction_coro_save(IrAnalyze *ira, IrInstructionCoroSave *instruction) {
20720static ZigType *ir_analyze_instruction_coro_save(IrAnalyze *ira, IrInstructionCoroSave *instruction) {
2072120721 IrInstruction *coro_handle = instruction->coro_handle->other;
2072220722 if (type_is_invalid(coro_handle->value.type))
2072320723 return ira->codegen->builtin_types.entry_invalid;
......@@ -20729,7 +20729,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_save(IrAnalyze *ira, IrInstru
2072920729 return result->value.type;
2073020730}
2073120731
20732static TypeTableEntry *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrInstructionCoroPromise *instruction) {
20732static ZigType *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrInstructionCoroPromise *instruction) {
2073320733 IrInstruction *coro_handle = instruction->coro_handle->other;
2073420734 if (type_is_invalid(coro_handle->value.type))
2073520735 return ira->codegen->builtin_types.entry_invalid;
......@@ -20742,7 +20742,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrIns
2074220742 return ira->codegen->builtin_types.entry_invalid;
2074320743 }
2074420744
20745 TypeTableEntry *coro_frame_type = get_promise_frame_type(ira->codegen,
20745 ZigType *coro_frame_type = get_promise_frame_type(ira->codegen,
2074620746 coro_handle->value.type->data.promise.result_type);
2074720747
2074820748 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
2075220752 return result->value.type;
2075320753}
2075420754
20755static TypeTableEntry *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira, IrInstructionCoroAllocHelper *instruction) {
20755static ZigType *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira, IrInstructionCoroAllocHelper *instruction) {
2075620756 IrInstruction *alloc_fn = instruction->alloc_fn->other;
2075720757 if (type_is_invalid(alloc_fn->value.type))
2075820758 return ira->codegen->builtin_types.entry_invalid;
......@@ -20764,13 +20764,13 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira,
2076420764 IrInstruction *result = ir_build_coro_alloc_helper(&ira->new_irb, instruction->base.scope,
2076520765 instruction->base.source_node, alloc_fn, coro_size);
2076620766 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);
2076820768 result->value.type = get_optional_type(ira->codegen, u8_ptr_type);
2076920769 return result->value.type;
2077020770}
2077120771
20772static TypeTableEntry *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op) {
20773 TypeTableEntry *operand_type = ir_resolve_type(ira, op);
20772static ZigType *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op) {
20773 ZigType *operand_type = ir_resolve_type(ira, op);
2077420774 if (type_is_invalid(operand_type))
2077520775 return ira->codegen->builtin_types.entry_invalid;
2077620776
......@@ -20801,8 +20801,8 @@ static TypeTableEntry *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruct
2080120801 return operand_type;
2080220802}
2080320803
20804static TypeTableEntry *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstructionAtomicRmw *instruction) {
20805 TypeTableEntry *operand_type = ir_resolve_atomic_operand_type(ira, instruction->operand_type->other);
20804static ZigType *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstructionAtomicRmw *instruction) {
20805 ZigType *operand_type = ir_resolve_atomic_operand_type(ira, instruction->operand_type->other);
2080620806 if (type_is_invalid(operand_type))
2080720807 return ira->codegen->builtin_types.entry_invalid;
2080820808
......@@ -20811,7 +20811,7 @@ static TypeTableEntry *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstr
2081120811 return ira->codegen->builtin_types.entry_invalid;
2081220812
2081320813 // 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);
2081520815 IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr_inst, ptr_type);
2081620816 if (type_is_invalid(casted_ptr->value.type))
2081720817 return ira->codegen->builtin_types.entry_invalid;
......@@ -20859,8 +20859,8 @@ static TypeTableEntry *ir_analyze_instruction_atomic_rmw(IrAnalyze *ira, IrInstr
2085920859 return result->value.type;
2086020860}
2086120861
20862static TypeTableEntry *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInstructionAtomicLoad *instruction) {
20863 TypeTableEntry *operand_type = ir_resolve_atomic_operand_type(ira, instruction->operand_type->other);
20862static ZigType *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInstructionAtomicLoad *instruction) {
20863 ZigType *operand_type = ir_resolve_atomic_operand_type(ira, instruction->operand_type->other);
2086420864 if (type_is_invalid(operand_type))
2086520865 return ira->codegen->builtin_types.entry_invalid;
2086620866
......@@ -20868,7 +20868,7 @@ static TypeTableEntry *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInst
2086820868 if (type_is_invalid(ptr_inst->value.type))
2086920869 return ira->codegen->builtin_types.entry_invalid;
2087020870
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);
2087220872 IrInstruction *casted_ptr = ir_implicit_cast(ira, ptr_inst, ptr_type);
2087320873 if (type_is_invalid(casted_ptr->value.type))
2087420874 return ira->codegen->builtin_types.entry_invalid;
......@@ -20902,8 +20902,8 @@ static TypeTableEntry *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInst
2090220902 return result->value.type;
2090320903}
2090420904
20905static TypeTableEntry *ir_analyze_instruction_promise_result_type(IrAnalyze *ira, IrInstructionPromiseResultType *instruction) {
20906 TypeTableEntry *promise_type = ir_resolve_type(ira, instruction->promise_type->other);
20905static ZigType *ir_analyze_instruction_promise_result_type(IrAnalyze *ira, IrInstructionPromiseResultType *instruction) {
20906 ZigType *promise_type = ir_resolve_type(ira, instruction->promise_type->other);
2090720907 if (type_is_invalid(promise_type))
2090820908 return ira->codegen->builtin_types.entry_invalid;
2090920909
......@@ -20918,8 +20918,8 @@ static TypeTableEntry *ir_analyze_instruction_promise_result_type(IrAnalyze *ira
2091820918 return ira->codegen->builtin_types.entry_type;
2091920919}
2092020920
20921static TypeTableEntry *ir_analyze_instruction_await_bookkeeping(IrAnalyze *ira, IrInstructionAwaitBookkeeping *instruction) {
20922 TypeTableEntry *promise_result_type = ir_resolve_type(ira, instruction->promise_result_type->other);
20921static ZigType *ir_analyze_instruction_await_bookkeeping(IrAnalyze *ira, IrInstructionAwaitBookkeeping *instruction) {
20922 ZigType *promise_result_type = ir_resolve_type(ira, instruction->promise_result_type->other);
2092320923 if (type_is_invalid(promise_result_type))
2092420924 return ira->codegen->builtin_types.entry_invalid;
2092520925
......@@ -20935,7 +20935,7 @@ static TypeTableEntry *ir_analyze_instruction_await_bookkeeping(IrAnalyze *ira,
2093520935 return out_val->type;
2093620936}
2093720937
20938static TypeTableEntry *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ira,
20938static ZigType *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ira,
2093920939 IrInstructionMergeErrRetTraces *instruction)
2094020940{
2094120941 IrInstruction *coro_promise_ptr = instruction->coro_promise_ptr->other;
......@@ -20943,9 +20943,9 @@ static TypeTableEntry *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ir
2094320943 return ira->codegen->builtin_types.entry_invalid;
2094420944
2094520945 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;
2094720947 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;
2094920949
2095020950 if (!type_can_fail(promise_result_type)) {
2095120951 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
2096820968 return result->value.type;
2096920969}
2097020970
20971static TypeTableEntry *ir_analyze_instruction_save_err_ret_addr(IrAnalyze *ira, IrInstructionSaveErrRetAddr *instruction) {
20971static ZigType *ir_analyze_instruction_save_err_ret_addr(IrAnalyze *ira, IrInstructionSaveErrRetAddr *instruction) {
2097220972 IrInstruction *result = ir_build_save_err_ret_addr(&ira->new_irb, instruction->base.scope,
2097320973 instruction->base.source_node);
2097420974 ir_link_new_instruction(result, &instruction->base);
......@@ -20976,7 +20976,7 @@ static TypeTableEntry *ir_analyze_instruction_save_err_ret_addr(IrAnalyze *ira,
2097620976 return result->value.type;
2097720977}
2097820978
20979static TypeTableEntry *ir_analyze_instruction_mark_err_ret_trace_ptr(IrAnalyze *ira, IrInstructionMarkErrRetTracePtr *instruction) {
20979static ZigType *ir_analyze_instruction_mark_err_ret_trace_ptr(IrAnalyze *ira, IrInstructionMarkErrRetTracePtr *instruction) {
2098020980 IrInstruction *err_ret_trace_ptr = instruction->err_ret_trace_ptr->other;
2098120981 if (type_is_invalid(err_ret_trace_ptr->value.type))
2098220982 return ira->codegen->builtin_types.entry_invalid;
......@@ -20988,8 +20988,8 @@ static TypeTableEntry *ir_analyze_instruction_mark_err_ret_trace_ptr(IrAnalyze *
2098820988 return result->value.type;
2098920989}
2099020990
20991static TypeTableEntry *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstructionSqrt *instruction) {
20992 TypeTableEntry *float_type = ir_resolve_type(ira, instruction->type->other);
20991static ZigType *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstructionSqrt *instruction) {
20992 ZigType *float_type = ir_resolve_type(ira, instruction->type->other);
2099320993 if (type_is_invalid(float_type))
2099420994 return ira->codegen->builtin_types.entry_invalid;
2099520995
......@@ -21055,7 +21055,7 @@ static TypeTableEntry *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstruction
2105521055 return result->value.type;
2105621056}
2105721057
21058static TypeTableEntry *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInstructionEnumToInt *instruction) {
21058static ZigType *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInstructionEnumToInt *instruction) {
2105921059 Error err;
2106021060 IrInstruction *target = instruction->target->other;
2106121061 if (type_is_invalid(target->value.type))
......@@ -21070,17 +21070,17 @@ static TypeTableEntry *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInst
2107021070 if ((err = type_ensure_zero_bits_known(ira->codegen, target->value.type)))
2107121071 return ira->codegen->builtin_types.entry_invalid;
2107221072
21073 TypeTableEntry *tag_type = target->value.type->data.enumeration.tag_int_type;
21073 ZigType *tag_type = target->value.type->data.enumeration.tag_int_type;
2107421074
2107521075 IrInstruction *result = ir_analyze_enum_to_int(ira, &instruction->base, target, tag_type);
2107621076 ir_link_new_instruction(result, &instruction->base);
2107721077 return result->value.type;
2107821078}
2107921079
21080static TypeTableEntry *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInstructionIntToEnum *instruction) {
21080static ZigType *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInstructionIntToEnum *instruction) {
2108121081 Error err;
2108221082 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);
2108421084 if (type_is_invalid(dest_type))
2108521085 return ira->codegen->builtin_types.entry_invalid;
2108621086
......@@ -21093,7 +21093,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInst
2109321093 if ((err = type_ensure_zero_bits_known(ira->codegen, dest_type)))
2109421094 return ira->codegen->builtin_types.entry_invalid;
2109521095
21096 TypeTableEntry *tag_type = dest_type->data.enumeration.tag_int_type;
21096 ZigType *tag_type = dest_type->data.enumeration.tag_int_type;
2109721097
2109821098 IrInstruction *target = instruction->target->other;
2109921099 if (type_is_invalid(target->value.type))
......@@ -21108,7 +21108,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInst
2110821108 return result->value.type;
2110921109}
2111021110
21111static TypeTableEntry *ir_analyze_instruction_check_runtime_scope(IrAnalyze *ira, IrInstructionCheckRuntimeScope *instruction) {
21111static ZigType *ir_analyze_instruction_check_runtime_scope(IrAnalyze *ira, IrInstructionCheckRuntimeScope *instruction) {
2111221112 IrInstruction *block_comptime_inst = instruction->scope_is_comptime->other;
2111321113 bool scope_is_comptime;
2111421114 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
2113121131 return ira->codegen->builtin_types.entry_void;
2113221132}
2113321133
21134static TypeTableEntry *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstruction *instruction) {
21134static ZigType *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstruction *instruction) {
2113521135 switch (instruction->id) {
2113621136 case IrInstructionIdInvalid:
2113721137 case IrInstructionIdWidenOrShorten:
......@@ -21413,8 +21413,8 @@ static TypeTableEntry *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstructi
2141321413 zig_unreachable();
2141421414}
2141521415
21416static TypeTableEntry *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *instruction) {
21417 TypeTableEntry *instruction_type = ir_analyze_instruction_nocast(ira, instruction);
21416static ZigType *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *instruction) {
21417 ZigType *instruction_type = ir_analyze_instruction_nocast(ira, instruction);
2141821418 instruction->value.type = instruction_type;
2141921419
2142021420 if (instruction->other) {
......@@ -21430,8 +21430,8 @@ static TypeTableEntry *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *ins
2143021430
2143121431// This function attempts to evaluate IR code while doing type checking and other analysis.
2143221432// It emits a new IrExecutable which is partially evaluated IR code.
21433TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_exec,
21434 TypeTableEntry *expected_type, AstNode *expected_type_source_node)
21433ZigType *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_exec,
21434 ZigType *expected_type, AstNode *expected_type_source_node)
2143521435{
2143621436 assert(!old_exec->invalid);
2143721437 assert(expected_type == nullptr || !type_is_invalid(expected_type));
......@@ -21472,7 +21472,7 @@ TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutabl
2147221472 continue;
2147321473 }
2147421474
21475 TypeTableEntry *return_type = ir_analyze_instruction(ira, old_instruction);
21475 ZigType *return_type = ir_analyze_instruction(ira, old_instruction);
2147621476 if (type_is_invalid(return_type) && ir_should_inline(new_exec, old_instruction->scope)) {
2147721477 return ira->codegen->builtin_types.entry_invalid;
2147821478 }
src/ir.hpp+3-3
......@@ -14,12 +14,12 @@ bool ir_gen(CodeGen *g, AstNode *node, Scope *scope, IrExecutable *ir_executable
1414bool ir_gen_fn(CodeGen *g, FnTableEntry *fn_entry);
1515
1616IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node,
17 TypeTableEntry *expected_type, size_t *backward_branch_count, size_t backward_branch_quota,
17 ZigType *expected_type, size_t *backward_branch_count, size_t backward_branch_quota,
1818 FnTableEntry *fn_entry, Buf *c_import_buf, AstNode *source_node, Buf *exec_name,
1919 IrExecutable *parent_exec);
2020
21TypeTableEntry *ir_analyze(CodeGen *g, IrExecutable *old_executable, IrExecutable *new_executable,
22 TypeTableEntry *expected_type, AstNode *expected_type_source_node);
21ZigType *ir_analyze(CodeGen *g, IrExecutable *old_executable, IrExecutable *new_executable,
22 ZigType *expected_type, AstNode *expected_type_source_node);
2323
2424bool ir_has_side_effects(IrInstruction *instruction);
2525ConstExprValue *const_ptr_pointee(CodeGen *codegen, ConstExprValue *const_val);