stage1: rename TypeTableEntry to ZigType
This commit is contained in:
parent
a3d384e593
commit
db882e5d63
@ -24,7 +24,7 @@ struct FnTableEntry;
|
|||||||
struct Scope;
|
struct Scope;
|
||||||
struct ScopeBlock;
|
struct ScopeBlock;
|
||||||
struct ScopeFnDef;
|
struct ScopeFnDef;
|
||||||
struct TypeTableEntry;
|
struct ZigType;
|
||||||
struct VariableTableEntry;
|
struct VariableTableEntry;
|
||||||
struct ErrorTableEntry;
|
struct ErrorTableEntry;
|
||||||
struct BuiltinFnEntry;
|
struct BuiltinFnEntry;
|
||||||
@ -251,7 +251,7 @@ struct ConstGlobalRefs {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ConstExprValue {
|
struct ConstExprValue {
|
||||||
TypeTableEntry *type;
|
ZigType *type;
|
||||||
ConstValSpecial special;
|
ConstValSpecial special;
|
||||||
ConstGlobalRefs *global_refs;
|
ConstGlobalRefs *global_refs;
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ struct ConstExprValue {
|
|||||||
float128_t x_f128;
|
float128_t x_f128;
|
||||||
bool x_bool;
|
bool x_bool;
|
||||||
ConstBoundFnValue x_bound_fn;
|
ConstBoundFnValue x_bound_fn;
|
||||||
TypeTableEntry *x_type;
|
ZigType *x_type;
|
||||||
ConstExprValue *x_optional;
|
ConstExprValue *x_optional;
|
||||||
ConstErrValue x_err_union;
|
ConstErrValue x_err_union;
|
||||||
ErrorTableEntry *x_err_set;
|
ErrorTableEntry *x_err_set;
|
||||||
@ -353,7 +353,7 @@ struct TldContainer {
|
|||||||
Tld base;
|
Tld base;
|
||||||
|
|
||||||
ScopeDecls *decls_scope;
|
ScopeDecls *decls_scope;
|
||||||
TypeTableEntry *type_entry;
|
ZigType *type_entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TldCompTime {
|
struct TldCompTime {
|
||||||
@ -370,7 +370,7 @@ struct TypeEnumField {
|
|||||||
struct TypeUnionField {
|
struct TypeUnionField {
|
||||||
Buf *name;
|
Buf *name;
|
||||||
TypeEnumField *enum_field;
|
TypeEnumField *enum_field;
|
||||||
TypeTableEntry *type_entry;
|
ZigType *type_entry;
|
||||||
AstNode *decl_node;
|
AstNode *decl_node;
|
||||||
uint32_t gen_index;
|
uint32_t gen_index;
|
||||||
};
|
};
|
||||||
@ -973,7 +973,7 @@ struct AstNode {
|
|||||||
// this struct is allocated with allocate_nonzero
|
// this struct is allocated with allocate_nonzero
|
||||||
struct FnTypeParamInfo {
|
struct FnTypeParamInfo {
|
||||||
bool is_noalias;
|
bool is_noalias;
|
||||||
TypeTableEntry *type;
|
ZigType *type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GenericFnTypeId {
|
struct GenericFnTypeId {
|
||||||
@ -986,14 +986,14 @@ uint32_t generic_fn_type_id_hash(GenericFnTypeId *id);
|
|||||||
bool generic_fn_type_id_eql(GenericFnTypeId *a, GenericFnTypeId *b);
|
bool generic_fn_type_id_eql(GenericFnTypeId *a, GenericFnTypeId *b);
|
||||||
|
|
||||||
struct FnTypeId {
|
struct FnTypeId {
|
||||||
TypeTableEntry *return_type;
|
ZigType *return_type;
|
||||||
FnTypeParamInfo *param_info;
|
FnTypeParamInfo *param_info;
|
||||||
size_t param_count;
|
size_t param_count;
|
||||||
size_t next_param_index;
|
size_t next_param_index;
|
||||||
bool is_var_args;
|
bool is_var_args;
|
||||||
CallingConvention cc;
|
CallingConvention cc;
|
||||||
uint32_t alignment;
|
uint32_t alignment;
|
||||||
TypeTableEntry *async_allocator_type;
|
ZigType *async_allocator_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t fn_type_id_hash(FnTypeId*);
|
uint32_t fn_type_id_hash(FnTypeId*);
|
||||||
@ -1005,14 +1005,14 @@ enum PtrLen {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntryPointer {
|
struct TypeTableEntryPointer {
|
||||||
TypeTableEntry *child_type;
|
ZigType *child_type;
|
||||||
PtrLen ptr_len;
|
PtrLen ptr_len;
|
||||||
bool is_const;
|
bool is_const;
|
||||||
bool is_volatile;
|
bool is_volatile;
|
||||||
uint32_t alignment;
|
uint32_t alignment;
|
||||||
uint32_t bit_offset;
|
uint32_t bit_offset;
|
||||||
uint32_t unaligned_bit_count;
|
uint32_t unaligned_bit_count;
|
||||||
TypeTableEntry *slice_parent;
|
ZigType *slice_parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntryInt {
|
struct TypeTableEntryInt {
|
||||||
@ -1025,13 +1025,13 @@ struct TypeTableEntryFloat {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntryArray {
|
struct TypeTableEntryArray {
|
||||||
TypeTableEntry *child_type;
|
ZigType *child_type;
|
||||||
uint64_t len;
|
uint64_t len;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypeStructField {
|
struct TypeStructField {
|
||||||
Buf *name;
|
Buf *name;
|
||||||
TypeTableEntry *type_entry;
|
ZigType *type_entry;
|
||||||
size_t src_index;
|
size_t src_index;
|
||||||
size_t gen_index;
|
size_t gen_index;
|
||||||
// offset from the memory at gen_index
|
// offset from the memory at gen_index
|
||||||
@ -1069,12 +1069,12 @@ struct TypeTableEntryStruct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntryOptional {
|
struct TypeTableEntryOptional {
|
||||||
TypeTableEntry *child_type;
|
ZigType *child_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntryErrorUnion {
|
struct TypeTableEntryErrorUnion {
|
||||||
TypeTableEntry *err_set_type;
|
ZigType *err_set_type;
|
||||||
TypeTableEntry *payload_type;
|
ZigType *payload_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntryErrorSet {
|
struct TypeTableEntryErrorSet {
|
||||||
@ -1089,7 +1089,7 @@ struct TypeTableEntryEnum {
|
|||||||
uint32_t src_field_count;
|
uint32_t src_field_count;
|
||||||
TypeEnumField *fields;
|
TypeEnumField *fields;
|
||||||
bool is_invalid; // true if any fields are invalid
|
bool is_invalid; // true if any fields are invalid
|
||||||
TypeTableEntry *tag_int_type;
|
ZigType *tag_int_type;
|
||||||
|
|
||||||
ScopeDecls *decls_scope;
|
ScopeDecls *decls_scope;
|
||||||
|
|
||||||
@ -1107,8 +1107,8 @@ struct TypeTableEntryEnum {
|
|||||||
HashMap<Buf *, TypeEnumField *, buf_hash, buf_eql_buf> fields_by_name;
|
HashMap<Buf *, TypeEnumField *, buf_hash, buf_eql_buf> fields_by_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t type_ptr_hash(const TypeTableEntry *ptr);
|
uint32_t type_ptr_hash(const ZigType *ptr);
|
||||||
bool type_ptr_eql(const TypeTableEntry *a, const TypeTableEntry *b);
|
bool type_ptr_eql(const ZigType *a, const ZigType *b);
|
||||||
|
|
||||||
struct TypeTableEntryUnion {
|
struct TypeTableEntryUnion {
|
||||||
AstNode *decl_node;
|
AstNode *decl_node;
|
||||||
@ -1117,7 +1117,7 @@ struct TypeTableEntryUnion {
|
|||||||
uint32_t gen_field_count;
|
uint32_t gen_field_count;
|
||||||
TypeUnionField *fields;
|
TypeUnionField *fields;
|
||||||
bool is_invalid; // true if any fields are invalid
|
bool is_invalid; // true if any fields are invalid
|
||||||
TypeTableEntry *tag_type; // always an enum or null
|
ZigType *tag_type; // always an enum or null
|
||||||
LLVMTypeRef union_type_ref;
|
LLVMTypeRef union_type_ref;
|
||||||
|
|
||||||
ScopeDecls *decls_scope;
|
ScopeDecls *decls_scope;
|
||||||
@ -1142,7 +1142,7 @@ struct TypeTableEntryUnion {
|
|||||||
bool have_explicit_tag_type;
|
bool have_explicit_tag_type;
|
||||||
|
|
||||||
uint32_t union_size_bytes;
|
uint32_t union_size_bytes;
|
||||||
TypeTableEntry *most_aligned_union_member;
|
ZigType *most_aligned_union_member;
|
||||||
|
|
||||||
HashMap<Buf *, TypeUnionField *, buf_hash, buf_eql_buf> fields_by_name;
|
HashMap<Buf *, TypeUnionField *, buf_hash, buf_eql_buf> fields_by_name;
|
||||||
};
|
};
|
||||||
@ -1151,31 +1151,31 @@ struct FnGenParamInfo {
|
|||||||
size_t src_index;
|
size_t src_index;
|
||||||
size_t gen_index;
|
size_t gen_index;
|
||||||
bool is_byval;
|
bool is_byval;
|
||||||
TypeTableEntry *type;
|
ZigType *type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntryFn {
|
struct TypeTableEntryFn {
|
||||||
FnTypeId fn_type_id;
|
FnTypeId fn_type_id;
|
||||||
bool is_generic;
|
bool is_generic;
|
||||||
TypeTableEntry *gen_return_type;
|
ZigType *gen_return_type;
|
||||||
size_t gen_param_count;
|
size_t gen_param_count;
|
||||||
FnGenParamInfo *gen_param_info;
|
FnGenParamInfo *gen_param_info;
|
||||||
|
|
||||||
LLVMTypeRef raw_type_ref;
|
LLVMTypeRef raw_type_ref;
|
||||||
|
|
||||||
TypeTableEntry *bound_fn_parent;
|
ZigType *bound_fn_parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntryBoundFn {
|
struct TypeTableEntryBoundFn {
|
||||||
TypeTableEntry *fn_type;
|
ZigType *fn_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntryPromise {
|
struct TypeTableEntryPromise {
|
||||||
// null if `promise` instead of `promise->T`
|
// null if `promise` instead of `promise->T`
|
||||||
TypeTableEntry *result_type;
|
ZigType *result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TypeTableEntryId {
|
enum ZigTypeId {
|
||||||
TypeTableEntryIdInvalid,
|
TypeTableEntryIdInvalid,
|
||||||
TypeTableEntryIdMetaType,
|
TypeTableEntryIdMetaType,
|
||||||
TypeTableEntryIdVoid,
|
TypeTableEntryIdVoid,
|
||||||
@ -1204,8 +1204,8 @@ enum TypeTableEntryId {
|
|||||||
TypeTableEntryIdPromise,
|
TypeTableEntryIdPromise,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypeTableEntry {
|
struct ZigType {
|
||||||
TypeTableEntryId id;
|
ZigTypeId id;
|
||||||
Buf name;
|
Buf name;
|
||||||
|
|
||||||
LLVMTypeRef type_ref;
|
LLVMTypeRef type_ref;
|
||||||
@ -1232,10 +1232,10 @@ struct TypeTableEntry {
|
|||||||
} data;
|
} data;
|
||||||
|
|
||||||
// use these fields to make sure we don't duplicate type table entries for the same type
|
// use these fields to make sure we don't duplicate type table entries for the same type
|
||||||
TypeTableEntry *pointer_parent[2]; // [0 - mut, 1 - const]
|
ZigType *pointer_parent[2]; // [0 - mut, 1 - const]
|
||||||
TypeTableEntry *optional_parent;
|
ZigType *optional_parent;
|
||||||
TypeTableEntry *promise_parent;
|
ZigType *promise_parent;
|
||||||
TypeTableEntry *promise_frame_parent;
|
ZigType *promise_frame_parent;
|
||||||
// If we generate a constant name value for this type, we memoize it here.
|
// If we generate a constant name value for this type, we memoize it here.
|
||||||
// The type of this is array
|
// The type of this is array
|
||||||
ConstExprValue *cached_const_name_val;
|
ConstExprValue *cached_const_name_val;
|
||||||
@ -1291,11 +1291,11 @@ struct FnTableEntry {
|
|||||||
Scope *child_scope; // parent is scope for last parameter
|
Scope *child_scope; // parent is scope for last parameter
|
||||||
ScopeBlock *def_scope; // parent is child_scope
|
ScopeBlock *def_scope; // parent is child_scope
|
||||||
Buf symbol_name;
|
Buf symbol_name;
|
||||||
TypeTableEntry *type_entry; // function type
|
ZigType *type_entry; // function type
|
||||||
// in the case of normal functions this is the implicit return type
|
// in the case of normal functions this is the implicit return type
|
||||||
// in the case of async functions this is the implicit return type according to the
|
// in the case of async functions this is the implicit return type according to the
|
||||||
// zig source code, not according to zig ir
|
// zig source code, not according to zig ir
|
||||||
TypeTableEntry *src_implicit_return_type;
|
ZigType *src_implicit_return_type;
|
||||||
bool is_test;
|
bool is_test;
|
||||||
FnInline fn_inline;
|
FnInline fn_inline;
|
||||||
FnAnalState anal_state;
|
FnAnalState anal_state;
|
||||||
@ -1445,11 +1445,11 @@ uint32_t fn_eval_hash(Scope*);
|
|||||||
bool fn_eval_eql(Scope *a, Scope *b);
|
bool fn_eval_eql(Scope *a, Scope *b);
|
||||||
|
|
||||||
struct TypeId {
|
struct TypeId {
|
||||||
TypeTableEntryId id;
|
ZigTypeId id;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
TypeTableEntry *child_type;
|
ZigType *child_type;
|
||||||
PtrLen ptr_len;
|
PtrLen ptr_len;
|
||||||
bool is_const;
|
bool is_const;
|
||||||
bool is_volatile;
|
bool is_volatile;
|
||||||
@ -1458,7 +1458,7 @@ struct TypeId {
|
|||||||
uint32_t unaligned_bit_count;
|
uint32_t unaligned_bit_count;
|
||||||
} pointer;
|
} pointer;
|
||||||
struct {
|
struct {
|
||||||
TypeTableEntry *child_type;
|
ZigType *child_type;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
} array;
|
} array;
|
||||||
struct {
|
struct {
|
||||||
@ -1466,8 +1466,8 @@ struct TypeId {
|
|||||||
uint32_t bit_count;
|
uint32_t bit_count;
|
||||||
} integer;
|
} integer;
|
||||||
struct {
|
struct {
|
||||||
TypeTableEntry *err_set_type;
|
ZigType *err_set_type;
|
||||||
TypeTableEntry *payload_type;
|
ZigType *payload_type;
|
||||||
} error_union;
|
} error_union;
|
||||||
} data;
|
} data;
|
||||||
};
|
};
|
||||||
@ -1563,9 +1563,9 @@ struct CodeGen {
|
|||||||
// reminder: hash tables must be initialized before use
|
// reminder: hash tables must be initialized before use
|
||||||
HashMap<Buf *, ImportTableEntry *, buf_hash, buf_eql_buf> import_table;
|
HashMap<Buf *, ImportTableEntry *, buf_hash, buf_eql_buf> import_table;
|
||||||
HashMap<Buf *, BuiltinFnEntry *, buf_hash, buf_eql_buf> builtin_fn_table;
|
HashMap<Buf *, BuiltinFnEntry *, buf_hash, buf_eql_buf> builtin_fn_table;
|
||||||
HashMap<Buf *, TypeTableEntry *, buf_hash, buf_eql_buf> primitive_type_table;
|
HashMap<Buf *, ZigType *, buf_hash, buf_eql_buf> primitive_type_table;
|
||||||
HashMap<TypeId, TypeTableEntry *, type_id_hash, type_id_eql> type_table;
|
HashMap<TypeId, ZigType *, type_id_hash, type_id_eql> type_table;
|
||||||
HashMap<FnTypeId *, TypeTableEntry *, fn_type_id_hash, fn_type_id_eql> fn_type_table;
|
HashMap<FnTypeId *, ZigType *, fn_type_id_hash, fn_type_id_eql> fn_type_table;
|
||||||
HashMap<Buf *, ErrorTableEntry *, buf_hash, buf_eql_buf> error_table;
|
HashMap<Buf *, ErrorTableEntry *, buf_hash, buf_eql_buf> error_table;
|
||||||
HashMap<GenericFnTypeId *, FnTableEntry *, generic_fn_type_id_hash, generic_fn_type_id_eql> generic_table;
|
HashMap<GenericFnTypeId *, FnTableEntry *, generic_fn_type_id_hash, generic_fn_type_id_eql> generic_table;
|
||||||
HashMap<Scope *, IrInstruction *, fn_eval_hash, fn_eval_eql> memoized_fn_eval_table;
|
HashMap<Scope *, IrInstruction *, fn_eval_hash, fn_eval_eql> memoized_fn_eval_table;
|
||||||
@ -1573,7 +1573,7 @@ struct CodeGen {
|
|||||||
HashMap<Buf *, AstNode *, buf_hash, buf_eql_buf> exported_symbol_names;
|
HashMap<Buf *, AstNode *, buf_hash, buf_eql_buf> exported_symbol_names;
|
||||||
HashMap<Buf *, Tld *, buf_hash, buf_eql_buf> external_prototypes;
|
HashMap<Buf *, Tld *, buf_hash, buf_eql_buf> external_prototypes;
|
||||||
HashMap<Buf *, ConstExprValue *, buf_hash, buf_eql_buf> string_literals_table;
|
HashMap<Buf *, ConstExprValue *, buf_hash, buf_eql_buf> string_literals_table;
|
||||||
HashMap<const TypeTableEntry *, ConstExprValue *, type_ptr_hash, type_ptr_eql> type_info_cache;
|
HashMap<const ZigType *, ConstExprValue *, type_ptr_hash, type_ptr_eql> type_info_cache;
|
||||||
|
|
||||||
|
|
||||||
ZigList<ImportTableEntry *> import_queue;
|
ZigList<ImportTableEntry *> import_queue;
|
||||||
@ -1586,38 +1586,38 @@ struct CodeGen {
|
|||||||
uint32_t next_unresolved_index;
|
uint32_t next_unresolved_index;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
TypeTableEntry *entry_bool;
|
ZigType *entry_bool;
|
||||||
TypeTableEntry *entry_c_int[CIntTypeCount];
|
ZigType *entry_c_int[CIntTypeCount];
|
||||||
TypeTableEntry *entry_c_longdouble;
|
ZigType *entry_c_longdouble;
|
||||||
TypeTableEntry *entry_c_void;
|
ZigType *entry_c_void;
|
||||||
TypeTableEntry *entry_u8;
|
ZigType *entry_u8;
|
||||||
TypeTableEntry *entry_u16;
|
ZigType *entry_u16;
|
||||||
TypeTableEntry *entry_u32;
|
ZigType *entry_u32;
|
||||||
TypeTableEntry *entry_u29;
|
ZigType *entry_u29;
|
||||||
TypeTableEntry *entry_u64;
|
ZigType *entry_u64;
|
||||||
TypeTableEntry *entry_i8;
|
ZigType *entry_i8;
|
||||||
TypeTableEntry *entry_i32;
|
ZigType *entry_i32;
|
||||||
TypeTableEntry *entry_i64;
|
ZigType *entry_i64;
|
||||||
TypeTableEntry *entry_isize;
|
ZigType *entry_isize;
|
||||||
TypeTableEntry *entry_usize;
|
ZigType *entry_usize;
|
||||||
TypeTableEntry *entry_f16;
|
ZigType *entry_f16;
|
||||||
TypeTableEntry *entry_f32;
|
ZigType *entry_f32;
|
||||||
TypeTableEntry *entry_f64;
|
ZigType *entry_f64;
|
||||||
TypeTableEntry *entry_f128;
|
ZigType *entry_f128;
|
||||||
TypeTableEntry *entry_void;
|
ZigType *entry_void;
|
||||||
TypeTableEntry *entry_unreachable;
|
ZigType *entry_unreachable;
|
||||||
TypeTableEntry *entry_type;
|
ZigType *entry_type;
|
||||||
TypeTableEntry *entry_invalid;
|
ZigType *entry_invalid;
|
||||||
TypeTableEntry *entry_namespace;
|
ZigType *entry_namespace;
|
||||||
TypeTableEntry *entry_block;
|
ZigType *entry_block;
|
||||||
TypeTableEntry *entry_num_lit_int;
|
ZigType *entry_num_lit_int;
|
||||||
TypeTableEntry *entry_num_lit_float;
|
ZigType *entry_num_lit_float;
|
||||||
TypeTableEntry *entry_undef;
|
ZigType *entry_undef;
|
||||||
TypeTableEntry *entry_null;
|
ZigType *entry_null;
|
||||||
TypeTableEntry *entry_var;
|
ZigType *entry_var;
|
||||||
TypeTableEntry *entry_global_error_set;
|
ZigType *entry_global_error_set;
|
||||||
TypeTableEntry *entry_arg_tuple;
|
ZigType *entry_arg_tuple;
|
||||||
TypeTableEntry *entry_promise;
|
ZigType *entry_promise;
|
||||||
} builtin_types;
|
} builtin_types;
|
||||||
|
|
||||||
EmitFileType emit_file_type;
|
EmitFileType emit_file_type;
|
||||||
@ -1735,11 +1735,11 @@ struct CodeGen {
|
|||||||
size_t llvm_argv_len;
|
size_t llvm_argv_len;
|
||||||
|
|
||||||
ZigList<FnTableEntry *> test_fns;
|
ZigList<FnTableEntry *> test_fns;
|
||||||
TypeTableEntry *test_fn_type;
|
ZigType *test_fn_type;
|
||||||
|
|
||||||
bool each_lib_rpath;
|
bool each_lib_rpath;
|
||||||
|
|
||||||
TypeTableEntry *err_tag_type;
|
ZigType *err_tag_type;
|
||||||
ZigList<ZigLLVMDIEnumerator *> err_enumerators;
|
ZigList<ZigLLVMDIEnumerator *> err_enumerators;
|
||||||
ZigList<ErrorTableEntry *> errors_by_index;
|
ZigList<ErrorTableEntry *> errors_by_index;
|
||||||
bool generate_error_name_table;
|
bool generate_error_name_table;
|
||||||
@ -1769,9 +1769,9 @@ struct CodeGen {
|
|||||||
ZigList<FnTableEntry *> inline_fns;
|
ZigList<FnTableEntry *> inline_fns;
|
||||||
ZigList<AstNode *> tld_ref_source_node_stack;
|
ZigList<AstNode *> tld_ref_source_node_stack;
|
||||||
|
|
||||||
TypeTableEntry *align_amt_type;
|
ZigType *align_amt_type;
|
||||||
TypeTableEntry *stack_trace_type;
|
ZigType *stack_trace_type;
|
||||||
TypeTableEntry *ptr_to_stack_trace_type;
|
ZigType *ptr_to_stack_trace_type;
|
||||||
|
|
||||||
ZigList<ZigLLVMDIType **> error_di_types;
|
ZigList<ZigLLVMDIType **> error_di_types;
|
||||||
|
|
||||||
@ -1818,7 +1818,7 @@ struct ErrorTableEntry {
|
|||||||
Buf name;
|
Buf name;
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
AstNode *decl_node;
|
AstNode *decl_node;
|
||||||
TypeTableEntry *set_with_only_this_in_it;
|
ZigType *set_with_only_this_in_it;
|
||||||
// If we generate a constant error name value for this error, we memoize it here.
|
// If we generate a constant error name value for this error, we memoize it here.
|
||||||
// The type of this is array
|
// The type of this is array
|
||||||
ConstExprValue *cached_error_name_val;
|
ConstExprValue *cached_error_name_val;
|
||||||
@ -1862,7 +1862,7 @@ struct ScopeDecls {
|
|||||||
AstNode *fast_math_set_node;
|
AstNode *fast_math_set_node;
|
||||||
ImportTableEntry *import;
|
ImportTableEntry *import;
|
||||||
// If this is a scope from a container, this is the type entry, otherwise null
|
// If this is a scope from a container, this is the type entry, otherwise null
|
||||||
TypeTableEntry *container_type;
|
ZigType *container_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This scope comes from a block expression in user code.
|
// This scope comes from a block expression in user code.
|
||||||
@ -2386,7 +2386,7 @@ struct IrInstructionCast {
|
|||||||
IrInstruction base;
|
IrInstruction base;
|
||||||
|
|
||||||
IrInstruction *value;
|
IrInstruction *value;
|
||||||
TypeTableEntry *dest_type;
|
ZigType *dest_type;
|
||||||
CastOp cast_op;
|
CastOp cast_op;
|
||||||
LLVMValueRef tmp_ptr;
|
LLVMValueRef tmp_ptr;
|
||||||
};
|
};
|
||||||
@ -2423,7 +2423,7 @@ struct IrInstructionStructInitField {
|
|||||||
struct IrInstructionStructInit {
|
struct IrInstructionStructInit {
|
||||||
IrInstruction base;
|
IrInstruction base;
|
||||||
|
|
||||||
TypeTableEntry *struct_type;
|
ZigType *struct_type;
|
||||||
size_t field_count;
|
size_t field_count;
|
||||||
IrInstructionStructInitField *fields;
|
IrInstructionStructInitField *fields;
|
||||||
LLVMValueRef tmp_ptr;
|
LLVMValueRef tmp_ptr;
|
||||||
@ -2432,7 +2432,7 @@ struct IrInstructionStructInit {
|
|||||||
struct IrInstructionUnionInit {
|
struct IrInstructionUnionInit {
|
||||||
IrInstruction base;
|
IrInstruction base;
|
||||||
|
|
||||||
TypeTableEntry *union_type;
|
ZigType *union_type;
|
||||||
TypeUnionField *field;
|
TypeUnionField *field;
|
||||||
IrInstruction *init_value;
|
IrInstruction *init_value;
|
||||||
LLVMValueRef tmp_ptr;
|
LLVMValueRef tmp_ptr;
|
||||||
@ -2661,7 +2661,7 @@ struct IrInstructionCmpxchg {
|
|||||||
IrInstruction *failure_order_value;
|
IrInstruction *failure_order_value;
|
||||||
|
|
||||||
// if this instruction gets to runtime then we know these values:
|
// if this instruction gets to runtime then we know these values:
|
||||||
TypeTableEntry *type;
|
ZigType *type;
|
||||||
AtomicOrder success_order;
|
AtomicOrder success_order;
|
||||||
AtomicOrder failure_order;
|
AtomicOrder failure_order;
|
||||||
|
|
||||||
@ -2831,7 +2831,7 @@ struct IrInstructionOverflowOp {
|
|||||||
IrInstruction *op2;
|
IrInstruction *op2;
|
||||||
IrInstruction *result_ptr;
|
IrInstruction *result_ptr;
|
||||||
|
|
||||||
TypeTableEntry *result_ptr_type;
|
ZigType *result_ptr_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IrInstructionAlignOf {
|
struct IrInstructionAlignOf {
|
||||||
|
434
src/analyze.cpp
434
src/analyze.cpp
File diff suppressed because it is too large
Load Diff
166
src/analyze.hpp
166
src/analyze.hpp
@ -14,35 +14,35 @@
|
|||||||
void semantic_analyze(CodeGen *g);
|
void semantic_analyze(CodeGen *g);
|
||||||
ErrorMsg *add_node_error(CodeGen *g, AstNode *node, Buf *msg);
|
ErrorMsg *add_node_error(CodeGen *g, AstNode *node, Buf *msg);
|
||||||
ErrorMsg *add_error_note(CodeGen *g, ErrorMsg *parent_msg, AstNode *node, Buf *msg);
|
ErrorMsg *add_error_note(CodeGen *g, ErrorMsg *parent_msg, AstNode *node, Buf *msg);
|
||||||
TypeTableEntry *new_type_table_entry(TypeTableEntryId id);
|
ZigType *new_type_table_entry(ZigTypeId id);
|
||||||
TypeTableEntry *get_pointer_to_type(CodeGen *g, TypeTableEntry *child_type, bool is_const);
|
ZigType *get_pointer_to_type(CodeGen *g, ZigType *child_type, bool is_const);
|
||||||
TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type, bool is_const,
|
ZigType *get_pointer_to_type_extra(CodeGen *g, ZigType *child_type, bool is_const,
|
||||||
bool is_volatile, PtrLen ptr_len, uint32_t byte_alignment, uint32_t bit_offset, uint32_t unaligned_bit_count);
|
bool is_volatile, PtrLen ptr_len, uint32_t byte_alignment, uint32_t bit_offset, uint32_t unaligned_bit_count);
|
||||||
uint64_t type_size(CodeGen *g, TypeTableEntry *type_entry);
|
uint64_t type_size(CodeGen *g, ZigType *type_entry);
|
||||||
uint64_t type_size_bits(CodeGen *g, TypeTableEntry *type_entry);
|
uint64_t type_size_bits(CodeGen *g, ZigType *type_entry);
|
||||||
TypeTableEntry *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);
|
ZigType *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);
|
||||||
TypeTableEntry **get_c_int_type_ptr(CodeGen *g, CIntType c_int_type);
|
ZigType **get_c_int_type_ptr(CodeGen *g, CIntType c_int_type);
|
||||||
TypeTableEntry *get_c_int_type(CodeGen *g, CIntType c_int_type);
|
ZigType *get_c_int_type(CodeGen *g, CIntType c_int_type);
|
||||||
TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id);
|
ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id);
|
||||||
TypeTableEntry *get_optional_type(CodeGen *g, TypeTableEntry *child_type);
|
ZigType *get_optional_type(CodeGen *g, ZigType *child_type);
|
||||||
TypeTableEntry *get_array_type(CodeGen *g, TypeTableEntry *child_type, uint64_t array_size);
|
ZigType *get_array_type(CodeGen *g, ZigType *child_type, uint64_t array_size);
|
||||||
TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type);
|
ZigType *get_slice_type(CodeGen *g, ZigType *ptr_type);
|
||||||
TypeTableEntry *get_partial_container_type(CodeGen *g, Scope *scope, ContainerKind kind,
|
ZigType *get_partial_container_type(CodeGen *g, Scope *scope, ContainerKind kind,
|
||||||
AstNode *decl_node, const char *name, ContainerLayout layout);
|
AstNode *decl_node, const char *name, ContainerLayout layout);
|
||||||
TypeTableEntry *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x);
|
ZigType *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x);
|
||||||
TypeTableEntry *get_error_union_type(CodeGen *g, TypeTableEntry *err_set_type, TypeTableEntry *payload_type);
|
ZigType *get_error_union_type(CodeGen *g, ZigType *err_set_type, ZigType *payload_type);
|
||||||
TypeTableEntry *get_bound_fn_type(CodeGen *g, FnTableEntry *fn_entry);
|
ZigType *get_bound_fn_type(CodeGen *g, FnTableEntry *fn_entry);
|
||||||
TypeTableEntry *get_opaque_type(CodeGen *g, Scope *scope, AstNode *source_node, const char *name);
|
ZigType *get_opaque_type(CodeGen *g, Scope *scope, AstNode *source_node, const char *name);
|
||||||
TypeTableEntry *get_struct_type(CodeGen *g, const char *type_name, const char *field_names[],
|
ZigType *get_struct_type(CodeGen *g, const char *type_name, const char *field_names[],
|
||||||
TypeTableEntry *field_types[], size_t field_count);
|
ZigType *field_types[], size_t field_count);
|
||||||
TypeTableEntry *get_promise_type(CodeGen *g, TypeTableEntry *result_type);
|
ZigType *get_promise_type(CodeGen *g, ZigType *result_type);
|
||||||
TypeTableEntry *get_promise_frame_type(CodeGen *g, TypeTableEntry *return_type);
|
ZigType *get_promise_frame_type(CodeGen *g, ZigType *return_type);
|
||||||
TypeTableEntry *get_test_fn_type(CodeGen *g);
|
ZigType *get_test_fn_type(CodeGen *g);
|
||||||
bool handle_is_ptr(TypeTableEntry *type_entry);
|
bool handle_is_ptr(ZigType *type_entry);
|
||||||
void find_libc_include_path(CodeGen *g);
|
void find_libc_include_path(CodeGen *g);
|
||||||
void find_libc_lib_path(CodeGen *g);
|
void find_libc_lib_path(CodeGen *g);
|
||||||
|
|
||||||
bool type_has_bits(TypeTableEntry *type_entry);
|
bool type_has_bits(ZigType *type_entry);
|
||||||
|
|
||||||
|
|
||||||
ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *abs_full_path, Buf *source_code);
|
ImportTableEntry *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
|
|||||||
VariableTableEntry *find_variable(CodeGen *g, Scope *orig_context, Buf *name);
|
VariableTableEntry *find_variable(CodeGen *g, Scope *orig_context, Buf *name);
|
||||||
Tld *find_decl(CodeGen *g, Scope *scope, Buf *name);
|
Tld *find_decl(CodeGen *g, Scope *scope, Buf *name);
|
||||||
void resolve_top_level_decl(CodeGen *g, Tld *tld, bool pointer_only, AstNode *source_node);
|
void resolve_top_level_decl(CodeGen *g, Tld *tld, bool pointer_only, AstNode *source_node);
|
||||||
bool type_is_codegen_pointer(TypeTableEntry *type);
|
bool type_is_codegen_pointer(ZigType *type);
|
||||||
|
|
||||||
TypeTableEntry *get_codegen_ptr_type(TypeTableEntry *type);
|
ZigType *get_codegen_ptr_type(ZigType *type);
|
||||||
uint32_t get_ptr_align(TypeTableEntry *type);
|
uint32_t get_ptr_align(ZigType *type);
|
||||||
bool get_ptr_const(TypeTableEntry *type);
|
bool get_ptr_const(ZigType *type);
|
||||||
TypeTableEntry *validate_var_type(CodeGen *g, AstNode *source_node, TypeTableEntry *type_entry);
|
ZigType *validate_var_type(CodeGen *g, AstNode *source_node, ZigType *type_entry);
|
||||||
TypeTableEntry *container_ref_type(TypeTableEntry *type_entry);
|
ZigType *container_ref_type(ZigType *type_entry);
|
||||||
bool type_is_complete(TypeTableEntry *type_entry);
|
bool type_is_complete(ZigType *type_entry);
|
||||||
bool type_is_invalid(TypeTableEntry *type_entry);
|
bool type_is_invalid(ZigType *type_entry);
|
||||||
bool type_is_global_error_set(TypeTableEntry *err_set_type);
|
bool type_is_global_error_set(ZigType *err_set_type);
|
||||||
bool type_has_zero_bits_known(TypeTableEntry *type_entry);
|
bool type_has_zero_bits_known(ZigType *type_entry);
|
||||||
void resolve_container_type(CodeGen *g, TypeTableEntry *type_entry);
|
void resolve_container_type(CodeGen *g, ZigType *type_entry);
|
||||||
ScopeDecls *get_container_scope(TypeTableEntry *type_entry);
|
ScopeDecls *get_container_scope(ZigType *type_entry);
|
||||||
TypeStructField *find_struct_type_field(TypeTableEntry *type_entry, Buf *name);
|
TypeStructField *find_struct_type_field(ZigType *type_entry, Buf *name);
|
||||||
TypeEnumField *find_enum_type_field(TypeTableEntry *enum_type, Buf *name);
|
TypeEnumField *find_enum_type_field(ZigType *enum_type, Buf *name);
|
||||||
TypeUnionField *find_union_type_field(TypeTableEntry *type_entry, Buf *name);
|
TypeUnionField *find_union_type_field(ZigType *type_entry, Buf *name);
|
||||||
TypeEnumField *find_enum_field_by_tag(TypeTableEntry *enum_type, const BigInt *tag);
|
TypeEnumField *find_enum_field_by_tag(ZigType *enum_type, const BigInt *tag);
|
||||||
TypeUnionField *find_union_field_by_tag(TypeTableEntry *type_entry, const BigInt *tag);
|
TypeUnionField *find_union_field_by_tag(ZigType *type_entry, const BigInt *tag);
|
||||||
|
|
||||||
bool is_ref(TypeTableEntry *type_entry);
|
bool is_ref(ZigType *type_entry);
|
||||||
bool is_array_ref(TypeTableEntry *type_entry);
|
bool is_array_ref(ZigType *type_entry);
|
||||||
bool is_container_ref(TypeTableEntry *type_entry);
|
bool is_container_ref(ZigType *type_entry);
|
||||||
void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node);
|
void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node);
|
||||||
void scan_import(CodeGen *g, ImportTableEntry *import);
|
void scan_import(CodeGen *g, ImportTableEntry *import);
|
||||||
void preview_use_decl(CodeGen *g, AstNode *node);
|
void preview_use_decl(CodeGen *g, AstNode *node);
|
||||||
@ -82,20 +82,20 @@ ImportTableEntry *get_scope_import(Scope *scope);
|
|||||||
void init_tld(Tld *tld, TldId id, Buf *name, VisibMod visib_mod, AstNode *source_node, Scope *parent_scope);
|
void init_tld(Tld *tld, TldId id, Buf *name, VisibMod visib_mod, AstNode *source_node, Scope *parent_scope);
|
||||||
VariableTableEntry *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
|
VariableTableEntry *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
|
||||||
bool is_const, ConstExprValue *init_value, Tld *src_tld);
|
bool is_const, ConstExprValue *init_value, Tld *src_tld);
|
||||||
TypeTableEntry *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node);
|
ZigType *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node);
|
||||||
FnTableEntry *create_fn(AstNode *proto_node);
|
FnTableEntry *create_fn(AstNode *proto_node);
|
||||||
FnTableEntry *create_fn_raw(FnInline inline_value, GlobalLinkageId linkage);
|
FnTableEntry *create_fn_raw(FnInline inline_value, GlobalLinkageId linkage);
|
||||||
void init_fn_type_id(FnTypeId *fn_type_id, AstNode *proto_node, size_t param_count_alloc);
|
void init_fn_type_id(FnTypeId *fn_type_id, AstNode *proto_node, size_t param_count_alloc);
|
||||||
AstNode *get_param_decl_node(FnTableEntry *fn_entry, size_t index);
|
AstNode *get_param_decl_node(FnTableEntry *fn_entry, size_t index);
|
||||||
FnTableEntry *scope_get_fn_if_root(Scope *scope);
|
FnTableEntry *scope_get_fn_if_root(Scope *scope);
|
||||||
bool type_requires_comptime(TypeTableEntry *type_entry);
|
bool type_requires_comptime(ZigType *type_entry);
|
||||||
Error ATTRIBUTE_MUST_USE ensure_complete_type(CodeGen *g, TypeTableEntry *type_entry);
|
Error ATTRIBUTE_MUST_USE ensure_complete_type(CodeGen *g, ZigType *type_entry);
|
||||||
Error ATTRIBUTE_MUST_USE type_ensure_zero_bits_known(CodeGen *g, TypeTableEntry *type_entry);
|
Error ATTRIBUTE_MUST_USE type_ensure_zero_bits_known(CodeGen *g, ZigType *type_entry);
|
||||||
void complete_enum(CodeGen *g, TypeTableEntry *enum_type);
|
void complete_enum(CodeGen *g, ZigType *enum_type);
|
||||||
bool ir_get_var_is_comptime(VariableTableEntry *var);
|
bool ir_get_var_is_comptime(VariableTableEntry *var);
|
||||||
bool const_values_equal(ConstExprValue *a, ConstExprValue *b);
|
bool const_values_equal(ConstExprValue *a, ConstExprValue *b);
|
||||||
void eval_min_max_value(CodeGen *g, TypeTableEntry *type_entry, ConstExprValue *const_val, bool is_max);
|
void eval_min_max_value(CodeGen *g, ZigType *type_entry, ConstExprValue *const_val, bool is_max);
|
||||||
void eval_min_max_value_int(CodeGen *g, TypeTableEntry *int_type, BigInt *bigint, bool is_max);
|
void eval_min_max_value_int(CodeGen *g, ZigType *int_type, BigInt *bigint, bool is_max);
|
||||||
|
|
||||||
void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val);
|
void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val);
|
||||||
void analyze_fn_ir(CodeGen *g, FnTableEntry *fn_table_entry, AstNode *return_type_node);
|
void 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);
|
|||||||
ScopeLoop *create_loop_scope(AstNode *node, Scope *parent);
|
ScopeLoop *create_loop_scope(AstNode *node, Scope *parent);
|
||||||
ScopeSuspend *create_suspend_scope(AstNode *node, Scope *parent);
|
ScopeSuspend *create_suspend_scope(AstNode *node, Scope *parent);
|
||||||
ScopeFnDef *create_fndef_scope(AstNode *node, Scope *parent, FnTableEntry *fn_entry);
|
ScopeFnDef *create_fndef_scope(AstNode *node, Scope *parent, FnTableEntry *fn_entry);
|
||||||
ScopeDecls *create_decls_scope(AstNode *node, Scope *parent, TypeTableEntry *container_type, ImportTableEntry *import);
|
ScopeDecls *create_decls_scope(AstNode *node, Scope *parent, ZigType *container_type, ImportTableEntry *import);
|
||||||
Scope *create_comptime_scope(AstNode *node, Scope *parent);
|
Scope *create_comptime_scope(AstNode *node, Scope *parent);
|
||||||
Scope *create_coro_prelude_scope(AstNode *node, Scope *parent);
|
Scope *create_coro_prelude_scope(AstNode *node, Scope *parent);
|
||||||
Scope *create_runtime_scope(AstNode *node, Scope *parent, IrInstruction *is_comptime);
|
Scope *create_runtime_scope(AstNode *node, Scope *parent, IrInstruction *is_comptime);
|
||||||
@ -119,39 +119,39 @@ ConstExprValue *create_const_str_lit(CodeGen *g, Buf *str);
|
|||||||
void init_const_c_str_lit(CodeGen *g, ConstExprValue *const_val, Buf *c_str);
|
void init_const_c_str_lit(CodeGen *g, ConstExprValue *const_val, Buf *c_str);
|
||||||
ConstExprValue *create_const_c_str_lit(CodeGen *g, Buf *c_str);
|
ConstExprValue *create_const_c_str_lit(CodeGen *g, Buf *c_str);
|
||||||
|
|
||||||
void init_const_bigint(ConstExprValue *const_val, TypeTableEntry *type, const BigInt *bigint);
|
void init_const_bigint(ConstExprValue *const_val, ZigType *type, const BigInt *bigint);
|
||||||
ConstExprValue *create_const_bigint(TypeTableEntry *type, const BigInt *bigint);
|
ConstExprValue *create_const_bigint(ZigType *type, const BigInt *bigint);
|
||||||
|
|
||||||
void init_const_unsigned_negative(ConstExprValue *const_val, TypeTableEntry *type, uint64_t x, bool negative);
|
void init_const_unsigned_negative(ConstExprValue *const_val, ZigType *type, uint64_t x, bool negative);
|
||||||
ConstExprValue *create_const_unsigned_negative(TypeTableEntry *type, uint64_t x, bool negative);
|
ConstExprValue *create_const_unsigned_negative(ZigType *type, uint64_t x, bool negative);
|
||||||
|
|
||||||
void init_const_signed(ConstExprValue *const_val, TypeTableEntry *type, int64_t x);
|
void init_const_signed(ConstExprValue *const_val, ZigType *type, int64_t x);
|
||||||
ConstExprValue *create_const_signed(TypeTableEntry *type, int64_t x);
|
ConstExprValue *create_const_signed(ZigType *type, int64_t x);
|
||||||
|
|
||||||
void init_const_usize(CodeGen *g, ConstExprValue *const_val, uint64_t x);
|
void init_const_usize(CodeGen *g, ConstExprValue *const_val, uint64_t x);
|
||||||
ConstExprValue *create_const_usize(CodeGen *g, uint64_t x);
|
ConstExprValue *create_const_usize(CodeGen *g, uint64_t x);
|
||||||
|
|
||||||
void init_const_float(ConstExprValue *const_val, TypeTableEntry *type, double value);
|
void init_const_float(ConstExprValue *const_val, ZigType *type, double value);
|
||||||
ConstExprValue *create_const_float(TypeTableEntry *type, double value);
|
ConstExprValue *create_const_float(ZigType *type, double value);
|
||||||
|
|
||||||
void init_const_enum(ConstExprValue *const_val, TypeTableEntry *type, const BigInt *tag);
|
void init_const_enum(ConstExprValue *const_val, ZigType *type, const BigInt *tag);
|
||||||
ConstExprValue *create_const_enum(TypeTableEntry *type, const BigInt *tag);
|
ConstExprValue *create_const_enum(ZigType *type, const BigInt *tag);
|
||||||
|
|
||||||
void init_const_bool(CodeGen *g, ConstExprValue *const_val, bool value);
|
void init_const_bool(CodeGen *g, ConstExprValue *const_val, bool value);
|
||||||
ConstExprValue *create_const_bool(CodeGen *g, bool value);
|
ConstExprValue *create_const_bool(CodeGen *g, bool value);
|
||||||
|
|
||||||
void init_const_type(CodeGen *g, ConstExprValue *const_val, TypeTableEntry *type_value);
|
void init_const_type(CodeGen *g, ConstExprValue *const_val, ZigType *type_value);
|
||||||
ConstExprValue *create_const_type(CodeGen *g, TypeTableEntry *type_value);
|
ConstExprValue *create_const_type(CodeGen *g, ZigType *type_value);
|
||||||
|
|
||||||
void init_const_runtime(ConstExprValue *const_val, TypeTableEntry *type);
|
void init_const_runtime(ConstExprValue *const_val, ZigType *type);
|
||||||
ConstExprValue *create_const_runtime(TypeTableEntry *type);
|
ConstExprValue *create_const_runtime(ZigType *type);
|
||||||
|
|
||||||
void init_const_ptr_ref(CodeGen *g, ConstExprValue *const_val, ConstExprValue *pointee_val, bool is_const);
|
void init_const_ptr_ref(CodeGen *g, ConstExprValue *const_val, ConstExprValue *pointee_val, bool is_const);
|
||||||
ConstExprValue *create_const_ptr_ref(CodeGen *g, ConstExprValue *pointee_val, bool is_const);
|
ConstExprValue *create_const_ptr_ref(CodeGen *g, ConstExprValue *pointee_val, bool is_const);
|
||||||
|
|
||||||
void init_const_ptr_hard_coded_addr(CodeGen *g, ConstExprValue *const_val, TypeTableEntry *pointee_type,
|
void init_const_ptr_hard_coded_addr(CodeGen *g, ConstExprValue *const_val, ZigType *pointee_type,
|
||||||
size_t addr, bool is_const);
|
size_t addr, bool is_const);
|
||||||
ConstExprValue *create_const_ptr_hard_coded_addr(CodeGen *g, TypeTableEntry *pointee_type,
|
ConstExprValue *create_const_ptr_hard_coded_addr(CodeGen *g, ZigType *pointee_type,
|
||||||
size_t addr, bool is_const);
|
size_t addr, bool is_const);
|
||||||
|
|
||||||
void init_const_ptr_array(CodeGen *g, ConstExprValue *const_val, ConstExprValue *array_val,
|
void 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);
|
|||||||
|
|
||||||
ConstExprValue *create_const_vals(size_t count);
|
ConstExprValue *create_const_vals(size_t count);
|
||||||
|
|
||||||
TypeTableEntry *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);
|
ZigType *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);
|
||||||
ConstParent *get_const_val_parent(CodeGen *g, ConstExprValue *value);
|
ConstParent *get_const_val_parent(CodeGen *g, ConstExprValue *value);
|
||||||
void expand_undef_array(CodeGen *g, ConstExprValue *const_val);
|
void expand_undef_array(CodeGen *g, ConstExprValue *const_val);
|
||||||
void update_compile_var(CodeGen *g, Buf *name, ConstExprValue *value);
|
void update_compile_var(CodeGen *g, Buf *name, ConstExprValue *value);
|
||||||
|
|
||||||
const char *type_id_name(TypeTableEntryId id);
|
const char *type_id_name(ZigTypeId id);
|
||||||
TypeTableEntryId type_id_at_index(size_t index);
|
ZigTypeId type_id_at_index(size_t index);
|
||||||
size_t type_id_len();
|
size_t type_id_len();
|
||||||
size_t type_id_index(TypeTableEntry *entry);
|
size_t type_id_index(ZigType *entry);
|
||||||
TypeTableEntry *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id);
|
ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id);
|
||||||
Result<bool> type_is_copyable(CodeGen *g, TypeTableEntry *type_entry);
|
Result<bool> type_is_copyable(CodeGen *g, ZigType *type_entry);
|
||||||
LinkLib *create_link_lib(Buf *name);
|
LinkLib *create_link_lib(Buf *name);
|
||||||
bool calling_convention_does_first_arg_return(CallingConvention cc);
|
bool calling_convention_does_first_arg_return(CallingConvention cc);
|
||||||
LinkLib *add_link_lib(CodeGen *codegen, Buf *lib);
|
LinkLib *add_link_lib(CodeGen *codegen, Buf *lib);
|
||||||
|
|
||||||
uint32_t get_abi_alignment(CodeGen *g, TypeTableEntry *type_entry);
|
uint32_t get_abi_alignment(CodeGen *g, ZigType *type_entry);
|
||||||
TypeTableEntry *get_align_amt_type(CodeGen *g);
|
ZigType *get_align_amt_type(CodeGen *g);
|
||||||
PackageTableEntry *new_anonymous_package(void);
|
PackageTableEntry *new_anonymous_package(void);
|
||||||
|
|
||||||
Buf *const_value_to_buffer(ConstExprValue *const_val);
|
Buf *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
|
|||||||
|
|
||||||
|
|
||||||
ConstExprValue *get_builtin_value(CodeGen *codegen, const char *name);
|
ConstExprValue *get_builtin_value(CodeGen *codegen, const char *name);
|
||||||
TypeTableEntry *get_ptr_to_stack_trace_type(CodeGen *g);
|
ZigType *get_ptr_to_stack_trace_type(CodeGen *g);
|
||||||
bool resolve_inferred_error_set(CodeGen *g, TypeTableEntry *err_set_type, AstNode *source_node);
|
bool resolve_inferred_error_set(CodeGen *g, ZigType *err_set_type, AstNode *source_node);
|
||||||
|
|
||||||
TypeTableEntry *get_auto_err_set_type(CodeGen *g, FnTableEntry *fn_entry);
|
ZigType *get_auto_err_set_type(CodeGen *g, FnTableEntry *fn_entry);
|
||||||
|
|
||||||
uint32_t get_coro_frame_align_bytes(CodeGen *g);
|
uint32_t get_coro_frame_align_bytes(CodeGen *g);
|
||||||
bool fn_type_can_fail(FnTypeId *fn_type_id);
|
bool fn_type_can_fail(FnTypeId *fn_type_id);
|
||||||
bool type_can_fail(TypeTableEntry *type_entry);
|
bool type_can_fail(ZigType *type_entry);
|
||||||
bool fn_eval_cacheable(Scope *scope, TypeTableEntry *return_type);
|
bool fn_eval_cacheable(Scope *scope, ZigType *return_type);
|
||||||
AstNode *type_decl_node(TypeTableEntry *type_entry);
|
AstNode *type_decl_node(ZigType *type_entry);
|
||||||
|
|
||||||
TypeTableEntry *get_primitive_type(CodeGen *g, Buf *name);
|
ZigType *get_primitive_type(CodeGen *g, Buf *name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
384
src/codegen.cpp
384
src/codegen.cpp
File diff suppressed because it is too large
Load Diff
1106
src/ir.cpp
1106
src/ir.cpp
File diff suppressed because it is too large
Load Diff
@ -14,12 +14,12 @@ bool ir_gen(CodeGen *g, AstNode *node, Scope *scope, IrExecutable *ir_executable
|
|||||||
bool ir_gen_fn(CodeGen *g, FnTableEntry *fn_entry);
|
bool ir_gen_fn(CodeGen *g, FnTableEntry *fn_entry);
|
||||||
|
|
||||||
IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node,
|
IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node,
|
||||||
TypeTableEntry *expected_type, size_t *backward_branch_count, size_t backward_branch_quota,
|
ZigType *expected_type, size_t *backward_branch_count, size_t backward_branch_quota,
|
||||||
FnTableEntry *fn_entry, Buf *c_import_buf, AstNode *source_node, Buf *exec_name,
|
FnTableEntry *fn_entry, Buf *c_import_buf, AstNode *source_node, Buf *exec_name,
|
||||||
IrExecutable *parent_exec);
|
IrExecutable *parent_exec);
|
||||||
|
|
||||||
TypeTableEntry *ir_analyze(CodeGen *g, IrExecutable *old_executable, IrExecutable *new_executable,
|
ZigType *ir_analyze(CodeGen *g, IrExecutable *old_executable, IrExecutable *new_executable,
|
||||||
TypeTableEntry *expected_type, AstNode *expected_type_source_node);
|
ZigType *expected_type, AstNode *expected_type_source_node);
|
||||||
|
|
||||||
bool ir_has_side_effects(IrInstruction *instruction);
|
bool ir_has_side_effects(IrInstruction *instruction);
|
||||||
ConstExprValue *const_ptr_pointee(CodeGen *codegen, ConstExprValue *const_val);
|
ConstExprValue *const_ptr_pointee(CodeGen *codegen, ConstExprValue *const_val);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user