authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-05 18:35:57-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-05 18:35:57-04:00
log1f5c7ff4d7360f83f83f422adf167df5d756e3b4
tree9668b510847e1fe9bb8fba9a38acdd7b7048a8e9
parent3500d32db52eaf485b5cff2a26d382b37cfb85a3
signaturelock-open Commit is signed but in an unrecognized format.

stage1: rename VariableTableEntry to ZigVar


5 files changed, 76 insertions(+), 76 deletions(-)

src/all_types.hpp+10-10
......@@ -25,7 +25,7 @@ struct Scope;
2525struct ScopeBlock;
2626struct ScopeFnDef;
2727struct ZigType;
28struct VariableTableEntry;
28struct ZigVar;
2929struct ErrorTableEntry;
3030struct BuiltinFnEntry;
3131struct TypeStructField;
......@@ -69,7 +69,7 @@ struct IrExecutable {
6969 IrBasicBlock *coro_normal_final;
7070 IrBasicBlock *coro_suspend_block;
7171 IrBasicBlock *coro_final_cleanup_block;
72 VariableTableEntry *coro_allocator_var;
72 ZigVar *coro_allocator_var;
7373};
7474
7575enum OutType {
......@@ -337,7 +337,7 @@ struct Tld {
337337struct TldVar {
338338 Tld base;
339339
340 VariableTableEntry *var;
340 ZigVar *var;
341341 Buf *extern_lib_name;
342342 Buf *section_name;
343343};
......@@ -1310,7 +1310,7 @@ struct ZigFn {
13101310 AstNode *fn_static_eval_set_node;
13111311
13121312 ZigList<IrInstruction *> alloca_list;
1313 ZigList<VariableTableEntry *> variable_list;
1313 ZigList<ZigVar *> variable_list;
13141314
13151315 Buf *section_name;
13161316 AstNode *set_alignstack_node;
......@@ -1786,7 +1786,7 @@ enum VarLinkage {
17861786 VarLinkageExternal,
17871787};
17881788
1789struct VariableTableEntry {
1789struct ZigVar {
17901790 Buf name;
17911791 ConstExprValue *value;
17921792 LLVMValueRef value_ref;
......@@ -1811,7 +1811,7 @@ struct VariableTableEntry {
18111811 // In an inline loop, multiple variables may be created,
18121812 // In this case, a reference to a variable should follow
18131813 // this pointer to the redefined variable.
1814 VariableTableEntry *next_var;
1814 ZigVar *next_var;
18151815};
18161816
18171817struct ErrorTableEntry {
......@@ -1904,7 +1904,7 @@ struct ScopeVarDecl {
19041904 Scope base;
19051905
19061906 // The variable that creates this scope
1907 VariableTableEntry *var;
1907 ZigVar *var;
19081908};
19091909
19101910// This scope is created for a @cImport
......@@ -2292,7 +2292,7 @@ struct IrInstructionBinOp {
22922292struct IrInstructionDeclVar {
22932293 IrInstruction base;
22942294
2295 VariableTableEntry *var;
2295 ZigVar *var;
22962296 IrInstruction *var_type;
22972297 IrInstruction *align_value;
22982298 IrInstruction *init_value;
......@@ -2349,7 +2349,7 @@ struct IrInstructionElemPtr {
23492349struct IrInstructionVarPtr {
23502350 IrInstruction base;
23512351
2352 VariableTableEntry *var;
2352 ZigVar *var;
23532353};
23542354
23552355struct IrInstructionCall {
......@@ -2519,7 +2519,7 @@ struct IrInstructionAsm {
25192519 // Most information on inline assembly comes from the source node.
25202520 IrInstruction **input_list;
25212521 IrInstruction **output_types;
2522 VariableTableEntry **output_vars;
2522 ZigVar **output_vars;
25232523 size_t return_count;
25242524 bool has_side_effects;
25252525};
src/analyze.cpp+7-7
......@@ -129,7 +129,7 @@ ScopeDeferExpr *create_defer_expr_scope(AstNode *node, Scope *parent) {
129129 return scope;
130130}
131131
132Scope *create_var_scope(AstNode *node, Scope *parent, VariableTableEntry *var) {
132Scope *create_var_scope(AstNode *node, Scope *parent, ZigVar *var) {
133133 ScopeVarDecl *scope = allocate<ScopeVarDecl>(1);
134134 init_scope(&scope->base, ScopeIdVarDecl, node, parent);
135135 scope->var = var;
......@@ -3501,12 +3501,12 @@ ZigType *validate_var_type(CodeGen *g, AstNode *source_node, ZigType *type_entry
35013501
35023502// Set name to nullptr to make the variable anonymous (not visible to programmer).
35033503// TODO merge with definition of add_local_var in ir.cpp
3504VariableTableEntry *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
3504ZigVar *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
35053505 bool is_const, ConstExprValue *value, Tld *src_tld)
35063506{
35073507 assert(value);
35083508
3509 VariableTableEntry *variable_entry = allocate<VariableTableEntry>(1);
3509 ZigVar *variable_entry = allocate<ZigVar>(1);
35103510 variable_entry->value = value;
35113511 variable_entry->parent_scope = parent_scope;
35123512 variable_entry->shadowable = false;
......@@ -3519,7 +3519,7 @@ VariableTableEntry *add_variable(CodeGen *g, AstNode *source_node, Scope *parent
35193519 if (!type_is_invalid(value->type)) {
35203520 variable_entry->align_bytes = get_abi_alignment(g, value->type);
35213521
3522 VariableTableEntry *existing_var = find_variable(g, parent_scope, name);
3522 ZigVar *existing_var = find_variable(g, parent_scope, name);
35233523 if (existing_var && !existing_var->shadowable) {
35243524 ErrorMsg *msg = add_node_error(g, source_node,
35253525 buf_sprintf("redeclaration of variable '%s'", buf_ptr(name)));
......@@ -3726,7 +3726,7 @@ Tld *find_decl(CodeGen *g, Scope *scope, Buf *name) {
37263726 return nullptr;
37273727}
37283728
3729VariableTableEntry *find_variable(CodeGen *g, Scope *scope, Buf *name) {
3729ZigVar *find_variable(CodeGen *g, Scope *scope, Buf *name) {
37303730 while (scope) {
37313731 if (scope->id == ScopeIdVarDecl) {
37323732 ScopeVarDecl *var_scope = (ScopeVarDecl *)scope;
......@@ -4015,7 +4015,7 @@ static void define_local_param_variables(CodeGen *g, ZigFn *fn_table_entry) {
40154015 add_node_error(g, param_decl_node, buf_sprintf("noalias on non-pointer parameter"));
40164016 }
40174017
4018 VariableTableEntry *var = add_variable(g, param_decl_node, fn_table_entry->child_scope,
4018 ZigVar *var = add_variable(g, param_decl_node, fn_table_entry->child_scope,
40194019 param_name, true, create_const_runtime(param_type), nullptr);
40204020 var->src_arg_index = i;
40214021 fn_table_entry->child_scope = var->child_scope;
......@@ -5429,7 +5429,7 @@ Error type_ensure_zero_bits_known(CodeGen *g, ZigType *type_entry) {
54295429 return ErrorNone;
54305430}
54315431
5432bool ir_get_var_is_comptime(VariableTableEntry *var) {
5432bool ir_get_var_is_comptime(ZigVar *var) {
54335433 if (!var->is_comptime)
54345434 return false;
54355435 if (var->is_comptime->other)
src/analyze.hpp+4-4
......@@ -48,7 +48,7 @@ bool type_has_bits(ZigType *type_entry);
4848ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *abs_full_path, Buf *source_code);
4949
5050
51VariableTableEntry *find_variable(CodeGen *g, Scope *orig_context, Buf *name);
51ZigVar *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);
5454bool type_is_codegen_pointer(ZigType *type);
......@@ -80,7 +80,7 @@ void resolve_use_decl(CodeGen *g, AstNode *node);
8080ZigFn *scope_fn_entry(Scope *scope);
8181ImportTableEntry *get_scope_import(Scope *scope);
8282void init_tld(Tld *tld, TldId id, Buf *name, VisibMod visib_mod, AstNode *source_node, Scope *parent_scope);
83VariableTableEntry *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
83ZigVar *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
8484 bool is_const, ConstExprValue *init_value, Tld *src_tld);
8585ZigType *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node);
8686ZigFn *create_fn(AstNode *proto_node);
......@@ -92,7 +92,7 @@ bool type_requires_comptime(ZigType *type_entry);
9292Error ATTRIBUTE_MUST_USE ensure_complete_type(CodeGen *g, ZigType *type_entry);
9393Error ATTRIBUTE_MUST_USE type_ensure_zero_bits_known(CodeGen *g, ZigType *type_entry);
9494void complete_enum(CodeGen *g, ZigType *enum_type);
95bool ir_get_var_is_comptime(VariableTableEntry *var);
95bool ir_get_var_is_comptime(ZigVar *var);
9696bool const_values_equal(ConstExprValue *a, ConstExprValue *b);
9797void eval_min_max_value(CodeGen *g, ZigType *type_entry, ConstExprValue *const_val, bool is_max);
9898void eval_min_max_value_int(CodeGen *g, ZigType *int_type, BigInt *bigint, bool is_max);
......@@ -103,7 +103,7 @@ void analyze_fn_ir(CodeGen *g, ZigFn *fn_table_entry, AstNode *return_type_node)
103103ScopeBlock *create_block_scope(AstNode *node, Scope *parent);
104104ScopeDefer *create_defer_scope(AstNode *node, Scope *parent);
105105ScopeDeferExpr *create_defer_expr_scope(AstNode *node, Scope *parent);
106Scope *create_var_scope(AstNode *node, Scope *parent, VariableTableEntry *var);
106Scope *create_var_scope(AstNode *node, Scope *parent, ZigVar *var);
107107ScopeCImport *create_cimport_scope(AstNode *node, Scope *parent);
108108ScopeLoop *create_loop_scope(AstNode *node, Scope *parent);
109109ScopeSuspend *create_suspend_scope(AstNode *node, Scope *parent);
src/codegen.cpp+8-8
......@@ -1857,7 +1857,7 @@ static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_ty
18571857 return nullptr;
18581858}
18591859
1860static void gen_var_debug_decl(CodeGen *g, VariableTableEntry *var) {
1860static void gen_var_debug_decl(CodeGen *g, ZigVar *var) {
18611861 AstNode *source_node = var->decl_node;
18621862 ZigLLVMDILocation *debug_loc = ZigLLVMGetDebugLoc((unsigned)source_node->line + 1,
18631863 (unsigned)source_node->column + 1, get_di_scope(g, var->parent_scope));
......@@ -2862,7 +2862,7 @@ static LLVMValueRef get_memset_fn_val(CodeGen *g) {
28622862static LLVMValueRef ir_render_decl_var(CodeGen *g, IrExecutable *executable,
28632863 IrInstructionDeclVar *decl_var_instruction)
28642864{
2865 VariableTableEntry *var = decl_var_instruction->var;
2865 ZigVar *var = decl_var_instruction->var;
28662866
28672867 if (!type_has_bits(var->value->type))
28682868 return nullptr;
......@@ -2955,7 +2955,7 @@ static LLVMValueRef ir_render_store_ptr(CodeGen *g, IrExecutable *executable, Ir
29552955}
29562956
29572957static LLVMValueRef ir_render_var_ptr(CodeGen *g, IrExecutable *executable, IrInstructionVarPtr *instruction) {
2958 VariableTableEntry *var = instruction->var;
2958 ZigVar *var = instruction->var;
29592959 if (type_has_bits(var->value->type)) {
29602960 assert(var->value_ref);
29612961 return var->value_ref;
......@@ -3370,7 +3370,7 @@ static LLVMValueRef ir_render_asm(CodeGen *g, IrExecutable *executable, IrInstru
33703370 }
33713371
33723372 if (!is_return) {
3373 VariableTableEntry *variable = instruction->output_vars[i];
3373 ZigVar *variable = instruction->output_vars[i];
33743374 assert(variable);
33753375 param_types[param_index] = LLVMTypeOf(variable->value_ref);
33763376 param_values[param_index] = variable->value_ref;
......@@ -5699,7 +5699,7 @@ static void build_all_basic_blocks(CodeGen *g, ZigFn *fn) {
56995699 LLVMPositionBuilderAtEnd(g->builder, entry_bb->llvm_block);
57005700}
57015701
5702static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef init_val,
5702static void gen_global_var(CodeGen *g, ZigVar *var, LLVMValueRef init_val,
57035703 ZigType *type_entry)
57045704{
57055705 if (g->strip_debug_symbols) {
......@@ -5788,7 +5788,7 @@ static void do_code_gen(CodeGen *g) {
57885788 // Generate module level variables
57895789 for (size_t i = 0; i < g->global_vars.length; i += 1) {
57905790 TldVar *tld_var = g->global_vars.at(i);
5791 VariableTableEntry *var = tld_var->var;
5791 ZigVar *var = tld_var->var;
57925792
57935793 if (var->value->type->id == TypeTableEntryIdComptimeFloat) {
57945794 // Generate debug info for it but that's it.
......@@ -5949,7 +5949,7 @@ static void do_code_gen(CodeGen *g) {
59495949
59505950 // create debug variable declarations for variables and allocate all local variables
59515951 for (size_t var_i = 0; var_i < fn_table_entry->variable_list.length; var_i += 1) {
5952 VariableTableEntry *var = fn_table_entry->variable_list.at(var_i);
5952 ZigVar *var = fn_table_entry->variable_list.at(var_i);
59535953
59545954 if (!type_has_bits(var->value->type)) {
59555955 continue;
......@@ -6027,7 +6027,7 @@ static void do_code_gen(CodeGen *g) {
60276027 if (info->gen_index == SIZE_MAX)
60286028 continue;
60296029
6030 VariableTableEntry *variable = fn_table_entry->variable_list.at(next_var_i);
6030 ZigVar *variable = fn_table_entry->variable_list.at(next_var_i);
60316031 assert(variable->src_arg_index != SIZE_MAX);
60326032 next_var_i += 1;
60336033
src/ir.cpp+47-47
......@@ -145,7 +145,7 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc
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,
147147 IrInstruction *source_instr, IrInstruction *container_ptr, ZigType *container_type);
148static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, VariableTableEntry *var);
148static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, ZigVar *var);
149149static ZigType *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op);
150150static IrInstruction *ir_lval_wrap(IrBuilder *irb, Scope *scope, IrInstruction *value, LVal lval);
151151static ZigType *adjust_ptr_align(CodeGen *g, ZigType *ptr_type, uint32_t new_align);
......@@ -277,7 +277,7 @@ static void ir_ref_instruction(IrInstruction *instruction, IrBasicBlock *cur_bb)
277277 ir_ref_bb(instruction->owner_bb);
278278}
279279
280static void ir_ref_var(VariableTableEntry *var) {
280static void ir_ref_var(ZigVar *var) {
281281 var->ref_count += 1;
282282}
283283
......@@ -1114,7 +1114,7 @@ static IrInstruction *ir_build_bin_op_from(IrBuilder *irb, IrInstruction *old_in
11141114 return new_instruction;
11151115}
11161116
1117static IrInstruction *ir_build_var_ptr(IrBuilder *irb, Scope *scope, AstNode *source_node, VariableTableEntry *var) {
1117static IrInstruction *ir_build_var_ptr(IrBuilder *irb, Scope *scope, AstNode *source_node, ZigVar *var) {
11181118 IrInstructionVarPtr *instruction = ir_build_instruction<IrInstructionVarPtr>(irb, scope, source_node);
11191119 instruction->var = var;
11201120
......@@ -1459,7 +1459,7 @@ static IrInstruction *ir_build_store_ptr_from(IrBuilder *irb, IrInstruction *old
14591459}
14601460
14611461static IrInstruction *ir_build_var_decl(IrBuilder *irb, Scope *scope, AstNode *source_node,
1462 VariableTableEntry *var, IrInstruction *var_type, IrInstruction *align_value, IrInstruction *init_value)
1462 ZigVar *var, IrInstruction *var_type, IrInstruction *align_value, IrInstruction *init_value)
14631463{
14641464 IrInstructionDeclVar *decl_var_instruction = ir_build_instruction<IrInstructionDeclVar>(irb, scope, source_node);
14651465 decl_var_instruction->base.value.special = ConstValSpecialStatic;
......@@ -1477,7 +1477,7 @@ static IrInstruction *ir_build_var_decl(IrBuilder *irb, Scope *scope, AstNode *s
14771477}
14781478
14791479static IrInstruction *ir_build_var_decl_from(IrBuilder *irb, IrInstruction *old_instruction,
1480 VariableTableEntry *var, IrInstruction *var_type, IrInstruction *align_value, IrInstruction *init_value)
1480 ZigVar *var, IrInstruction *var_type, IrInstruction *align_value, IrInstruction *init_value)
14811481{
14821482 IrInstruction *new_instruction = ir_build_var_decl(irb, old_instruction->scope,
14831483 old_instruction->source_node, var, var_type, align_value, init_value);
......@@ -1622,7 +1622,7 @@ static IrInstruction *ir_build_slice_type(IrBuilder *irb, Scope *scope, AstNode
16221622}
16231623
16241624static IrInstruction *ir_build_asm(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction **input_list,
1625 IrInstruction **output_types, VariableTableEntry **output_vars, size_t return_count, bool has_side_effects)
1625 IrInstruction **output_types, ZigVar **output_vars, size_t return_count, bool has_side_effects)
16261626{
16271627 IrInstructionAsm *instruction = ir_build_instruction<IrInstructionAsm>(irb, scope, source_node);
16281628 instruction->input_list = input_list;
......@@ -1646,7 +1646,7 @@ static IrInstruction *ir_build_asm(IrBuilder *irb, Scope *scope, AstNode *source
16461646}
16471647
16481648static IrInstruction *ir_build_asm_from(IrBuilder *irb, IrInstruction *old_instruction, IrInstruction **input_list,
1649 IrInstruction **output_types, VariableTableEntry **output_vars, size_t return_count, bool has_side_effects)
1649 IrInstruction **output_types, ZigVar **output_vars, size_t return_count, bool has_side_effects)
16501650{
16511651 IrInstruction *new_instruction = ir_build_asm(irb, old_instruction->scope,
16521652 old_instruction->source_node, input_list, output_types, output_vars, return_count, has_side_effects);
......@@ -3320,11 +3320,11 @@ static IrInstruction *ir_gen_return(IrBuilder *irb, Scope *scope, AstNode *node,
33203320 zig_unreachable();
33213321}
33223322
3323static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_scope,
3323static ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_scope,
33243324 Buf *name, bool src_is_const, bool gen_is_const, bool is_shadowable, IrInstruction *is_comptime,
33253325 bool skip_name_check)
33263326{
3327 VariableTableEntry *variable_entry = allocate<VariableTableEntry>(1);
3327 ZigVar *variable_entry = allocate<ZigVar>(1);
33283328 variable_entry->parent_scope = parent_scope;
33293329 variable_entry->shadowable = is_shadowable;
33303330 variable_entry->mem_slot_index = SIZE_MAX;
......@@ -3336,7 +3336,7 @@ static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Sco
33363336 buf_init_from_buf(&variable_entry->name, name);
33373337
33383338 if (!skip_name_check) {
3339 VariableTableEntry *existing_var = find_variable(codegen, parent_scope, name);
3339 ZigVar *existing_var = find_variable(codegen, parent_scope, name);
33403340 if (existing_var && !existing_var->shadowable) {
33413341 ErrorMsg *msg = add_node_error(codegen, node,
33423342 buf_sprintf("redeclaration of variable '%s'", buf_ptr(name)));
......@@ -3377,11 +3377,11 @@ static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Sco
33773377
33783378// Set name to nullptr to make the variable anonymous (not visible to programmer).
33793379// After you call this function var->child_scope has the variable in scope
3380static VariableTableEntry *ir_create_var(IrBuilder *irb, AstNode *node, Scope *scope, Buf *name,
3380static ZigVar *ir_create_var(IrBuilder *irb, AstNode *node, Scope *scope, Buf *name,
33813381 bool src_is_const, bool gen_is_const, bool is_shadowable, IrInstruction *is_comptime)
33823382{
33833383 bool is_underscored = name ? buf_eql_str(name, "_") : false;
3384 VariableTableEntry *var = create_local_var(irb->codegen, node, scope,
3384 ZigVar *var = create_local_var(irb->codegen, node, scope,
33853385 (is_underscored ? nullptr : name), src_is_const, gen_is_const,
33863386 (is_underscored ? true : is_shadowable), is_comptime, false);
33873387 if (is_comptime != nullptr || gen_is_const) {
......@@ -3799,7 +3799,7 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node,
37993799 }
38003800 }
38013801
3802 VariableTableEntry *var = find_variable(irb->codegen, scope, variable_name);
3802 ZigVar *var = find_variable(irb->codegen, scope, variable_name);
38033803 if (var) {
38043804 IrInstruction *var_ptr = ir_build_var_ptr(irb, scope, node, var);
38053805 if (lval == LValPtr)
......@@ -5258,7 +5258,7 @@ static IrInstruction *ir_gen_var_decl(IrBuilder *irb, Scope *scope, AstNode *nod
52585258
52595259 IrInstruction *is_comptime = ir_build_const_bool(irb, scope, node,
52605260 ir_should_inline(irb->exec, scope) || variable_declaration->is_comptime);
5261 VariableTableEntry *var = ir_create_var(irb, node, scope, variable_declaration->symbol,
5261 ZigVar *var = ir_create_var(irb, node, scope, variable_declaration->symbol,
52625262 is_const, is_const, is_shadowable, is_comptime);
52635263 // we detect IrInstructionIdDeclVar in gen_block to make sure the next node
52645264 // is inside var->child_scope
......@@ -5320,7 +5320,7 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n
53205320
53215321 Scope *payload_scope;
53225322 AstNode *symbol_node = node; // TODO make more accurate
5323 VariableTableEntry *payload_var;
5323 ZigVar *payload_var;
53245324 if (var_symbol) {
53255325 // TODO make it an error to write to payload variable
53265326 payload_var = ir_create_var(irb, symbol_node, subexpr_scope, var_symbol,
......@@ -5384,7 +5384,7 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n
53845384
53855385 // TODO make it an error to write to error variable
53865386 AstNode *err_symbol_node = else_node; // TODO make more accurate
5387 VariableTableEntry *err_var = ir_create_var(irb, err_symbol_node, scope, err_symbol,
5387 ZigVar *err_var = ir_create_var(irb, err_symbol_node, scope, err_symbol,
53885388 true, false, false, is_comptime);
53895389 Scope *err_scope = err_var->child_scope;
53905390 IrInstruction *err_var_value = ir_build_unwrap_err_code(irb, err_scope, err_symbol_node, err_val_ptr);
......@@ -5413,7 +5413,7 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n
54135413 // TODO make it an error to write to payload variable
54145414 AstNode *symbol_node = node; // TODO make more accurate
54155415
5416 VariableTableEntry *payload_var = ir_create_var(irb, symbol_node, subexpr_scope, var_symbol,
5416 ZigVar *payload_var = ir_create_var(irb, symbol_node, subexpr_scope, var_symbol,
54175417 true, false, false, is_comptime);
54185418 Scope *child_scope = payload_var->child_scope;
54195419 IrInstruction *maybe_val_ptr = ir_gen_node_extra(irb, node->data.while_expr.condition, subexpr_scope, LValPtr);
......@@ -5585,7 +5585,7 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo
55855585
55865586 // TODO make it an error to write to element variable or i variable.
55875587 Buf *elem_var_name = elem_node->data.symbol_expr.symbol;
5588 VariableTableEntry *elem_var = ir_create_var(irb, elem_node, parent_scope, elem_var_name, true, false, false, is_comptime);
5588 ZigVar *elem_var = ir_create_var(irb, elem_node, parent_scope, elem_var_name, true, false, false, is_comptime);
55895589 Scope *child_scope = elem_var->child_scope;
55905590
55915591 IrInstruction *undefined_value = ir_build_const_undefined(irb, child_scope, elem_node);
......@@ -5593,7 +5593,7 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo
55935593 IrInstruction *elem_var_ptr = ir_build_var_ptr(irb, child_scope, node, elem_var);
55945594
55955595 AstNode *index_var_source_node;
5596 VariableTableEntry *index_var;
5596 ZigVar *index_var;
55975597 if (index_node) {
55985598 index_var_source_node = index_node;
55995599 Buf *index_var_name = index_node->data.symbol_expr.symbol;
......@@ -5798,7 +5798,7 @@ static IrInstruction *ir_gen_asm_expr(IrBuilder *irb, Scope *scope, AstNode *nod
57985798
57995799 IrInstruction **input_list = allocate<IrInstruction *>(node->data.asm_expr.input_list.length);
58005800 IrInstruction **output_types = allocate<IrInstruction *>(node->data.asm_expr.output_list.length);
5801 VariableTableEntry **output_vars = allocate<VariableTableEntry *>(node->data.asm_expr.output_list.length);
5801 ZigVar **output_vars = allocate<ZigVar *>(node->data.asm_expr.output_list.length);
58025802 size_t return_count = 0;
58035803 bool is_volatile = node->data.asm_expr.is_volatile;
58045804 if (!is_volatile && node->data.asm_expr.output_list.length == 0) {
......@@ -5822,7 +5822,7 @@ static IrInstruction *ir_gen_asm_expr(IrBuilder *irb, Scope *scope, AstNode *nod
58225822 output_types[i] = return_type;
58235823 } else {
58245824 Buf *variable_name = asm_output->variable_name;
5825 VariableTableEntry *var = find_variable(irb->codegen, scope, variable_name);
5825 ZigVar *var = find_variable(irb->codegen, scope, variable_name);
58265826 if (var) {
58275827 output_vars[i] = var;
58285828 } else {
......@@ -5880,7 +5880,7 @@ static IrInstruction *ir_gen_test_expr(IrBuilder *irb, Scope *scope, AstNode *no
58805880 IrInstruction *var_type = nullptr;
58815881 bool is_shadowable = false;
58825882 bool is_const = true;
5883 VariableTableEntry *var = ir_create_var(irb, node, subexpr_scope,
5883 ZigVar *var = ir_create_var(irb, node, subexpr_scope,
58845884 var_symbol, is_const, is_const, is_shadowable, is_comptime);
58855885
58865886 IrInstruction *var_ptr_value = ir_build_unwrap_maybe(irb, subexpr_scope, node, maybe_val_ptr, false);
......@@ -5955,7 +5955,7 @@ static IrInstruction *ir_gen_if_err_expr(IrBuilder *irb, Scope *scope, AstNode *
59555955 IrInstruction *var_type = nullptr;
59565956 bool is_shadowable = false;
59575957 IrInstruction *var_is_comptime = force_comptime ? ir_build_const_bool(irb, subexpr_scope, node, true) : ir_build_test_comptime(irb, subexpr_scope, node, err_val);
5958 VariableTableEntry *var = ir_create_var(irb, node, subexpr_scope,
5958 ZigVar *var = ir_create_var(irb, node, subexpr_scope,
59595959 var_symbol, var_is_const, var_is_const, is_shadowable, var_is_comptime);
59605960
59615961 IrInstruction *var_ptr_value = ir_build_unwrap_err_payload(irb, subexpr_scope, node, err_val_ptr, false);
......@@ -5981,7 +5981,7 @@ static IrInstruction *ir_gen_if_err_expr(IrBuilder *irb, Scope *scope, AstNode *
59815981 IrInstruction *var_type = nullptr;
59825982 bool is_shadowable = false;
59835983 bool is_const = true;
5984 VariableTableEntry *var = ir_create_var(irb, node, subexpr_scope,
5984 ZigVar *var = ir_create_var(irb, node, subexpr_scope,
59855985 err_symbol, is_const, is_const, is_shadowable, is_comptime);
59865986
59875987 IrInstruction *var_value = ir_build_unwrap_err_code(irb, subexpr_scope, node, err_val_ptr);
......@@ -6029,7 +6029,7 @@ static bool ir_gen_switch_prong_expr(IrBuilder *irb, Scope *scope, AstNode *swit
60296029
60306030 bool is_shadowable = false;
60316031 bool is_const = true;
6032 VariableTableEntry *var = ir_create_var(irb, var_symbol_node, scope,
6032 ZigVar *var = ir_create_var(irb, var_symbol_node, scope,
60336033 var_name, is_const, is_const, is_shadowable, var_is_comptime);
60346034 child_scope = var->child_scope;
60356035 IrInstruction *var_value;
......@@ -6494,7 +6494,7 @@ static IrInstruction *ir_gen_err_ok_or(IrBuilder *irb, Scope *parent_scope, AstN
64946494 Buf *var_name = var_node->data.symbol_expr.symbol;
64956495 bool is_const = true;
64966496 bool is_shadowable = false;
6497 VariableTableEntry *var = ir_create_var(irb, node, parent_scope, var_name,
6497 ZigVar *var = ir_create_var(irb, node, parent_scope, var_name,
64986498 is_const, is_const, is_shadowable, is_comptime);
64996499 err_scope = var->child_scope;
65006500 IrInstruction *err_val = ir_build_unwrap_err_code(irb, err_scope, node, err_union_ptr);
......@@ -6976,7 +6976,7 @@ static IrInstruction *ir_gen_await_expr(IrBuilder *irb, Scope *scope, AstNode *n
69766976 IrInstruction *is_canceled_mask = ir_build_const_usize(irb, scope, node, 0x1); // 0b001
69776977 IrInstruction *is_suspended_mask = ir_build_const_usize(irb, scope, node, 0x2); // 0b010
69786978
6979 VariableTableEntry *result_var = ir_create_var(irb, node, scope, nullptr,
6979 ZigVar *result_var = ir_create_var(irb, node, scope, nullptr,
69806980 false, false, true, const_bool_false);
69816981 IrInstruction *target_promise_type = ir_build_typeof(irb, scope, node, target_inst);
69826982 IrInstruction *promise_result_type = ir_build_promise_result_type(irb, scope, node, target_promise_type);
......@@ -7388,12 +7388,12 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec
73887388 IrInstruction *err_ret_trace_ptr;
73897389 ZigType *return_type;
73907390 Buf *result_ptr_field_name;
7391 VariableTableEntry *coro_size_var;
7391 ZigVar *coro_size_var;
73927392 if (is_async) {
73937393 // create the coro promise
73947394 Scope *coro_scope = create_coro_prelude_scope(node, scope);
73957395 const_bool_false = ir_build_const_bool(irb, coro_scope, node, false);
7396 VariableTableEntry *promise_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
7396 ZigVar *promise_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
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);
......@@ -7403,7 +7403,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec
74037403 ir_build_var_decl(irb, coro_scope, node, promise_var, coro_frame_type_value, nullptr, undef);
74047404 coro_promise_ptr = ir_build_var_ptr(irb, coro_scope, node, promise_var);
74057405
7406 VariableTableEntry *await_handle_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
7406 ZigVar *await_handle_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
74077407 IrInstruction *null_value = ir_build_const_null(irb, coro_scope, node);
74087408 IrInstruction *await_handle_type_val = ir_build_const_type(irb, coro_scope, node,
74097409 get_optional_type(irb->codegen, irb->codegen->builtin_types.entry_promise));
......@@ -12518,7 +12518,7 @@ static ZigType *ir_analyze_instruction_bin_op(IrAnalyze *ira, IrInstructionBinOp
1251812518
1251912519static ZigType *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDeclVar *decl_var_instruction) {
1252012520 Error err;
12521 VariableTableEntry *var = decl_var_instruction->var;
12521 ZigVar *var = decl_var_instruction->var;
1252212522
1252312523 IrInstruction *init_value = decl_var_instruction->init_value->other;
1252412524 if (type_is_invalid(init_value->value.type)) {
......@@ -12591,7 +12591,7 @@ static ZigType *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDec
1259112591 // This means that this is actually a different variable due to, e.g. an inline while loop.
1259212592 // We make a new variable so that it can hold a different type, and so the debug info can
1259312593 // be distinct.
12594 VariableTableEntry *new_var = create_local_var(ira->codegen, var->decl_node, var->child_scope,
12594 ZigVar *new_var = create_local_var(ira->codegen, var->decl_node, var->child_scope,
1259512595 &var->name, var->src_is_const, var->gen_is_const, var->shadowable, var->is_comptime, true);
1259612596 new_var->owner_exec = var->owner_exec;
1259712597 new_var->align_bytes = var->align_bytes;
......@@ -12902,7 +12902,7 @@ IrInstruction *ir_get_implicit_allocator(IrAnalyze *ira, IrInstruction *source_i
1290212902 }
1290312903 case ImplicitAllocatorIdLocalVar:
1290412904 {
12905 VariableTableEntry *coro_allocator_var = ira->old_irb.exec->coro_allocator_var;
12905 ZigVar *coro_allocator_var = ira->old_irb.exec->coro_allocator_var;
1290612906 assert(coro_allocator_var != nullptr);
1290712907 IrInstruction *var_ptr_inst = ir_get_var_ptr(ira, source_instr, coro_allocator_var);
1290812908 IrInstruction *result = ir_get_deref(ira, source_instr, var_ptr_inst);
......@@ -12977,7 +12977,7 @@ static bool ir_analyze_fn_call_inline_arg(IrAnalyze *ira, AstNode *fn_proto_node
1297712977 return false;
1297812978
1297912979 Buf *param_name = param_decl_node->data.param_decl.name;
12980 VariableTableEntry *var = add_variable(ira->codegen, param_decl_node,
12980 ZigVar *var = add_variable(ira->codegen, param_decl_node,
1298112981 *exec_scope, param_name, true, arg_val, nullptr);
1298212982 *exec_scope = var->child_scope;
1298312983 *next_proto_i += 1;
......@@ -13035,7 +13035,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod
1303513035 Buf *param_name = param_decl_node->data.param_decl.name;
1303613036 if (!param_name) return false;
1303713037 if (!is_var_args) {
13038 VariableTableEntry *var = add_variable(ira->codegen, param_decl_node,
13038 ZigVar *var = add_variable(ira->codegen, param_decl_node,
1303913039 *child_scope, param_name, true, arg_val, nullptr);
1304013040 *child_scope = var->child_scope;
1304113041 var->shadowable = !comptime_arg;
......@@ -13067,7 +13067,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod
1306713067 return true;
1306813068}
1306913069
13070static VariableTableEntry *get_fn_var_by_index(ZigFn *fn_entry, size_t index) {
13070static ZigVar *get_fn_var_by_index(ZigFn *fn_entry, size_t index) {
1307113071 size_t next_var_i = 0;
1307213072 FnGenParamInfo *gen_param_info = fn_entry->type_entry->data.fn.gen_param_info;
1307313073 assert(gen_param_info != nullptr);
......@@ -13086,7 +13086,7 @@ static VariableTableEntry *get_fn_var_by_index(ZigFn *fn_entry, size_t index) {
1308613086}
1308713087
1308813088static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
13089 VariableTableEntry *var)
13089 ZigVar *var)
1309013090{
1309113091 Error err;
1309213092 while (var->next_var != nullptr) {
......@@ -13449,7 +13449,7 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1344913449 found_first_var_arg = true;
1345013450 }
1345113451
13452 VariableTableEntry *arg_var = get_fn_var_by_index(parent_fn_entry, arg_tuple_i);
13452 ZigVar *arg_var = get_fn_var_by_index(parent_fn_entry, arg_tuple_i);
1345313453 if (arg_var == nullptr) {
1345413454 ir_add_error(ira, arg,
1345513455 buf_sprintf("compiler bug: var args can't handle void. https://github.com/ziglang/zig/issues/557"));
......@@ -13496,7 +13496,7 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1349613496
1349713497 ConstExprValue *var_args_val = create_const_arg_tuple(ira->codegen,
1349813498 first_var_arg, inst_fn_type_id.param_count);
13499 VariableTableEntry *var = add_variable(ira->codegen, param_decl_node,
13499 ZigVar *var = add_variable(ira->codegen, param_decl_node,
1350013500 impl_fn->child_scope, param_name, true, var_args_val, nullptr);
1350113501 impl_fn->child_scope = var->child_scope;
1350213502 }
......@@ -14158,7 +14158,7 @@ static ZigType *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPhi *phi
1415814158}
1415914159
1416014160static ZigType *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
14161 VariableTableEntry *var)
14161 ZigVar *var)
1416214162{
1416314163 IrInstruction *result = ir_get_var_ptr(ira, instruction, var);
1416414164 ir_link_new_instruction(result, instruction);
......@@ -14166,7 +14166,7 @@ static ZigType *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
1416614166}
1416714167
1416814168static ZigType *ir_analyze_instruction_var_ptr(IrAnalyze *ira, IrInstructionVarPtr *var_ptr_instruction) {
14169 VariableTableEntry *var = var_ptr_instruction->var;
14169 ZigVar *var = var_ptr_instruction->var;
1417014170 return ir_analyze_var_ptr(ira, &var_ptr_instruction->base, var);
1417114171}
1417214172
......@@ -14291,7 +14291,7 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
1429114291 size_t abs_index = start + index;
1429214292 ZigFn *fn_entry = exec_fn_entry(ira->new_irb.exec);
1429314293 assert(fn_entry);
14294 VariableTableEntry *var = get_fn_var_by_index(fn_entry, abs_index);
14294 ZigVar *var = get_fn_var_by_index(fn_entry, abs_index);
1429514295 bool is_const = true;
1429614296 bool is_volatile = false;
1429714297 if (var) {
......@@ -14693,7 +14693,7 @@ static ZigType *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source_instru
1469314693 case TldIdVar:
1469414694 {
1469514695 TldVar *tld_var = (TldVar *)tld;
14696 VariableTableEntry *var = tld_var->var;
14696 ZigVar *var = tld_var->var;
1469714697 if (tld_var->extern_lib_name != nullptr) {
1469814698 add_link_lib_symbol(ira, tld_var->extern_lib_name, &var->name, source_instruction->source_node);
1469914699 }
......@@ -16976,7 +16976,7 @@ static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, Zig
1697616976 TldVar *tld = (TldVar *)entry;
1697716977 assert(tld->base.id == TldIdVar);
1697816978
16979 VariableTableEntry *var = tld->var;
16979 ZigVar *var = tld->var;
1698016980
1698116981 if ((err = ensure_complete_type(ira->codegen, var->value->type)))
1698216982 return ira->codegen->builtin_types.entry_invalid;
......@@ -17074,7 +17074,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco
1707417074 switch (curr_entry->value->id) {
1707517075 case TldIdVar:
1707617076 {
17077 VariableTableEntry *var = ((TldVar *)curr_entry->value)->var;
17077 ZigVar *var = ((TldVar *)curr_entry->value)->var;
1707817078 if ((err = ensure_complete_type(ira->codegen, var->value->type)))
1707917079 return ErrorSemanticAnalyzeFail;
1708017080
......@@ -17191,7 +17191,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco
1719117191
1719217192 for (size_t fn_arg_index = 0; fn_arg_index < fn_arg_count; fn_arg_index++)
1719317193 {
17194 VariableTableEntry *arg_var = fn_entry->variable_list.at(fn_arg_index);
17194 ZigVar *arg_var = fn_entry->variable_list.at(fn_arg_index);
1719517195 ConstExprValue *fn_arg_name_val = &fn_arg_name_array->data.x_array.s_none.elements[fn_arg_index];
1719617196 ConstExprValue *arg_name = create_const_str_lit(ira->codegen, &arg_var->name);
1719717197 init_const_slice(ira->codegen, fn_arg_name_val, arg_name, 0, buf_len(&arg_var->name), true);
......@@ -20317,7 +20317,7 @@ static ZigType *ir_analyze_instruction_decl_ref(IrAnalyze *ira,
2031720317 case TldIdVar:
2031820318 {
2031920319 TldVar *tld_var = (TldVar *)tld;
20320 VariableTableEntry *var = tld_var->var;
20320 ZigVar *var = tld_var->var;
2032120321
2032220322 IrInstruction *var_ptr = ir_get_var_ptr(ira, &instruction->base, var);
2032320323 if (type_is_invalid(var_ptr->value.type))