Commit 1f5c7ff4d7

Andrew Kelley <superjoe30@gmail.com>
2018-09-06 00:35:57
stage1: rename VariableTableEntry to ZigVar
1 parent 3500d32
src/all_types.hpp
@@ -25,7 +25,7 @@ struct Scope;
 struct ScopeBlock;
 struct ScopeFnDef;
 struct ZigType;
-struct VariableTableEntry;
+struct ZigVar;
 struct ErrorTableEntry;
 struct BuiltinFnEntry;
 struct TypeStructField;
@@ -69,7 +69,7 @@ struct IrExecutable {
     IrBasicBlock *coro_normal_final;
     IrBasicBlock *coro_suspend_block;
     IrBasicBlock *coro_final_cleanup_block;
-    VariableTableEntry *coro_allocator_var;
+    ZigVar *coro_allocator_var;
 };
 
 enum OutType {
@@ -337,7 +337,7 @@ struct Tld {
 struct TldVar {
     Tld base;
 
-    VariableTableEntry *var;
+    ZigVar *var;
     Buf *extern_lib_name;
     Buf *section_name;
 };
@@ -1310,7 +1310,7 @@ struct ZigFn {
     AstNode *fn_static_eval_set_node;
 
     ZigList<IrInstruction *> alloca_list;
-    ZigList<VariableTableEntry *> variable_list;
+    ZigList<ZigVar *> variable_list;
 
     Buf *section_name;
     AstNode *set_alignstack_node;
@@ -1786,7 +1786,7 @@ enum VarLinkage {
     VarLinkageExternal,
 };
 
-struct VariableTableEntry {
+struct ZigVar {
     Buf name;
     ConstExprValue *value;
     LLVMValueRef value_ref;
@@ -1811,7 +1811,7 @@ struct VariableTableEntry {
     // In an inline loop, multiple variables may be created,
     // In this case, a reference to a variable should follow
     // this pointer to the redefined variable.
-    VariableTableEntry *next_var;
+    ZigVar *next_var;
 };
 
 struct ErrorTableEntry {
@@ -1904,7 +1904,7 @@ struct ScopeVarDecl {
     Scope base;
 
     // The variable that creates this scope
-    VariableTableEntry *var;
+    ZigVar *var;
 };
 
 // This scope is created for a @cImport
@@ -2292,7 +2292,7 @@ struct IrInstructionBinOp {
 struct IrInstructionDeclVar {
     IrInstruction base;
 
-    VariableTableEntry *var;
+    ZigVar *var;
     IrInstruction *var_type;
     IrInstruction *align_value;
     IrInstruction *init_value;
@@ -2349,7 +2349,7 @@ struct IrInstructionElemPtr {
 struct IrInstructionVarPtr {
     IrInstruction base;
 
-    VariableTableEntry *var;
+    ZigVar *var;
 };
 
 struct IrInstructionCall {
@@ -2519,7 +2519,7 @@ struct IrInstructionAsm {
     // Most information on inline assembly comes from the source node.
     IrInstruction **input_list;
     IrInstruction **output_types;
-    VariableTableEntry **output_vars;
+    ZigVar **output_vars;
     size_t return_count;
     bool has_side_effects;
 };
src/analyze.cpp
@@ -129,7 +129,7 @@ ScopeDeferExpr *create_defer_expr_scope(AstNode *node, Scope *parent) {
     return scope;
 }
 
-Scope *create_var_scope(AstNode *node, Scope *parent, VariableTableEntry *var) {
+Scope *create_var_scope(AstNode *node, Scope *parent, ZigVar *var) {
     ScopeVarDecl *scope = allocate<ScopeVarDecl>(1);
     init_scope(&scope->base, ScopeIdVarDecl, node, parent);
     scope->var = var;
@@ -3501,12 +3501,12 @@ ZigType *validate_var_type(CodeGen *g, AstNode *source_node, ZigType *type_entry
 
 // Set name to nullptr to make the variable anonymous (not visible to programmer).
 // TODO merge with definition of add_local_var in ir.cpp
-VariableTableEntry *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
+ZigVar *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
     bool is_const, ConstExprValue *value, Tld *src_tld)
 {
     assert(value);
 
-    VariableTableEntry *variable_entry = allocate<VariableTableEntry>(1);
+    ZigVar *variable_entry = allocate<ZigVar>(1);
     variable_entry->value = value;
     variable_entry->parent_scope = parent_scope;
     variable_entry->shadowable = false;
@@ -3519,7 +3519,7 @@ VariableTableEntry *add_variable(CodeGen *g, AstNode *source_node, Scope *parent
     if (!type_is_invalid(value->type)) {
         variable_entry->align_bytes = get_abi_alignment(g, value->type);
 
-        VariableTableEntry *existing_var = find_variable(g, parent_scope, name);
+        ZigVar *existing_var = find_variable(g, parent_scope, name);
         if (existing_var && !existing_var->shadowable) {
             ErrorMsg *msg = add_node_error(g, source_node,
                     buf_sprintf("redeclaration of variable '%s'", buf_ptr(name)));
@@ -3726,7 +3726,7 @@ Tld *find_decl(CodeGen *g, Scope *scope, Buf *name) {
     return nullptr;
 }
 
-VariableTableEntry *find_variable(CodeGen *g, Scope *scope, Buf *name) {
+ZigVar *find_variable(CodeGen *g, Scope *scope, Buf *name) {
     while (scope) {
         if (scope->id == ScopeIdVarDecl) {
             ScopeVarDecl *var_scope = (ScopeVarDecl *)scope;
@@ -4015,7 +4015,7 @@ static void define_local_param_variables(CodeGen *g, ZigFn *fn_table_entry) {
             add_node_error(g, param_decl_node, buf_sprintf("noalias on non-pointer parameter"));
         }
 
-        VariableTableEntry *var = add_variable(g, param_decl_node, fn_table_entry->child_scope,
+        ZigVar *var = add_variable(g, param_decl_node, fn_table_entry->child_scope,
                 param_name, true, create_const_runtime(param_type), nullptr);
         var->src_arg_index = i;
         fn_table_entry->child_scope = var->child_scope;
@@ -5429,7 +5429,7 @@ Error type_ensure_zero_bits_known(CodeGen *g, ZigType *type_entry) {
     return ErrorNone;
 }
 
-bool ir_get_var_is_comptime(VariableTableEntry *var) {
+bool ir_get_var_is_comptime(ZigVar *var) {
     if (!var->is_comptime)
         return false;
     if (var->is_comptime->other)
src/analyze.hpp
@@ -48,7 +48,7 @@ bool type_has_bits(ZigType *type_entry);
 ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *abs_full_path, Buf *source_code);
 
 
-VariableTableEntry *find_variable(CodeGen *g, Scope *orig_context, Buf *name);
+ZigVar *find_variable(CodeGen *g, Scope *orig_context, 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);
 bool type_is_codegen_pointer(ZigType *type);
@@ -80,7 +80,7 @@ void resolve_use_decl(CodeGen *g, AstNode *node);
 ZigFn *scope_fn_entry(Scope *scope);
 ImportTableEntry *get_scope_import(Scope *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,
+ZigVar *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf *name,
     bool is_const, ConstExprValue *init_value, Tld *src_tld);
 ZigType *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node);
 ZigFn *create_fn(AstNode *proto_node);
@@ -92,7 +92,7 @@ bool type_requires_comptime(ZigType *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, ZigType *type_entry);
 void complete_enum(CodeGen *g, ZigType *enum_type);
-bool ir_get_var_is_comptime(VariableTableEntry *var);
+bool ir_get_var_is_comptime(ZigVar *var);
 bool const_values_equal(ConstExprValue *a, ConstExprValue *b);
 void eval_min_max_value(CodeGen *g, ZigType *type_entry, ConstExprValue *const_val, bool is_max);
 void 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)
 ScopeBlock *create_block_scope(AstNode *node, Scope *parent);
 ScopeDefer *create_defer_scope(AstNode *node, Scope *parent);
 ScopeDeferExpr *create_defer_expr_scope(AstNode *node, Scope *parent);
-Scope *create_var_scope(AstNode *node, Scope *parent, VariableTableEntry *var);
+Scope *create_var_scope(AstNode *node, Scope *parent, ZigVar *var);
 ScopeCImport *create_cimport_scope(AstNode *node, Scope *parent);
 ScopeLoop *create_loop_scope(AstNode *node, Scope *parent);
 ScopeSuspend *create_suspend_scope(AstNode *node, Scope *parent);
src/codegen.cpp
@@ -1857,7 +1857,7 @@ static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_ty
     return nullptr;
 }
 
-static void gen_var_debug_decl(CodeGen *g, VariableTableEntry *var) {
+static void gen_var_debug_decl(CodeGen *g, ZigVar *var) {
     AstNode *source_node = var->decl_node;
     ZigLLVMDILocation *debug_loc = ZigLLVMGetDebugLoc((unsigned)source_node->line + 1,
             (unsigned)source_node->column + 1, get_di_scope(g, var->parent_scope));
@@ -2862,7 +2862,7 @@ static LLVMValueRef get_memset_fn_val(CodeGen *g) {
 static LLVMValueRef ir_render_decl_var(CodeGen *g, IrExecutable *executable,
         IrInstructionDeclVar *decl_var_instruction)
 {
-    VariableTableEntry *var = decl_var_instruction->var;
+    ZigVar *var = decl_var_instruction->var;
 
     if (!type_has_bits(var->value->type))
         return nullptr;
@@ -2955,7 +2955,7 @@ static LLVMValueRef ir_render_store_ptr(CodeGen *g, IrExecutable *executable, Ir
 }
 
 static LLVMValueRef ir_render_var_ptr(CodeGen *g, IrExecutable *executable, IrInstructionVarPtr *instruction) {
-    VariableTableEntry *var = instruction->var;
+    ZigVar *var = instruction->var;
     if (type_has_bits(var->value->type)) {
         assert(var->value_ref);
         return var->value_ref;
@@ -3370,7 +3370,7 @@ static LLVMValueRef ir_render_asm(CodeGen *g, IrExecutable *executable, IrInstru
         }
 
         if (!is_return) {
-            VariableTableEntry *variable = instruction->output_vars[i];
+            ZigVar *variable = instruction->output_vars[i];
             assert(variable);
             param_types[param_index] = LLVMTypeOf(variable->value_ref);
             param_values[param_index] = variable->value_ref;
@@ -5699,7 +5699,7 @@ static void build_all_basic_blocks(CodeGen *g, ZigFn *fn) {
     LLVMPositionBuilderAtEnd(g->builder, entry_bb->llvm_block);
 }
 
-static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef init_val,
+static void gen_global_var(CodeGen *g, ZigVar *var, LLVMValueRef init_val,
     ZigType *type_entry)
 {
     if (g->strip_debug_symbols) {
@@ -5788,7 +5788,7 @@ static void do_code_gen(CodeGen *g) {
     // Generate module level variables
     for (size_t i = 0; i < g->global_vars.length; i += 1) {
         TldVar *tld_var = g->global_vars.at(i);
-        VariableTableEntry *var = tld_var->var;
+        ZigVar *var = tld_var->var;
 
         if (var->value->type->id == TypeTableEntryIdComptimeFloat) {
             // Generate debug info for it but that's it.
@@ -5949,7 +5949,7 @@ static void do_code_gen(CodeGen *g) {
 
         // create debug variable declarations for variables and allocate all local variables
         for (size_t var_i = 0; var_i < fn_table_entry->variable_list.length; var_i += 1) {
-            VariableTableEntry *var = fn_table_entry->variable_list.at(var_i);
+            ZigVar *var = fn_table_entry->variable_list.at(var_i);
 
             if (!type_has_bits(var->value->type)) {
                 continue;
@@ -6027,7 +6027,7 @@ static void do_code_gen(CodeGen *g) {
             if (info->gen_index == SIZE_MAX)
                 continue;
 
-            VariableTableEntry *variable = fn_table_entry->variable_list.at(next_var_i);
+            ZigVar *variable = fn_table_entry->variable_list.at(next_var_i);
             assert(variable->src_arg_index != SIZE_MAX);
             next_var_i += 1;
 
src/ir.cpp
@@ -145,7 +145,7 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc
 static ErrorMsg *exec_add_error_node(CodeGen *codegen, IrExecutable *exec, AstNode *source_node, Buf *msg);
 static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_name,
     IrInstruction *source_instr, IrInstruction *container_ptr, ZigType *container_type);
-static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, VariableTableEntry *var);
+static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, ZigVar *var);
 static ZigType *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op);
 static IrInstruction *ir_lval_wrap(IrBuilder *irb, Scope *scope, IrInstruction *value, LVal lval);
 static 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)
         ir_ref_bb(instruction->owner_bb);
 }
 
-static void ir_ref_var(VariableTableEntry *var) {
+static void ir_ref_var(ZigVar *var) {
     var->ref_count += 1;
 }
 
@@ -1114,7 +1114,7 @@ static IrInstruction *ir_build_bin_op_from(IrBuilder *irb, IrInstruction *old_in
     return new_instruction;
 }
 
-static IrInstruction *ir_build_var_ptr(IrBuilder *irb, Scope *scope, AstNode *source_node, VariableTableEntry *var) {
+static IrInstruction *ir_build_var_ptr(IrBuilder *irb, Scope *scope, AstNode *source_node, ZigVar *var) {
     IrInstructionVarPtr *instruction = ir_build_instruction<IrInstructionVarPtr>(irb, scope, source_node);
     instruction->var = var;
 
@@ -1459,7 +1459,7 @@ static IrInstruction *ir_build_store_ptr_from(IrBuilder *irb, IrInstruction *old
 }
 
 static IrInstruction *ir_build_var_decl(IrBuilder *irb, Scope *scope, AstNode *source_node,
-        VariableTableEntry *var, IrInstruction *var_type, IrInstruction *align_value, IrInstruction *init_value)
+        ZigVar *var, IrInstruction *var_type, IrInstruction *align_value, IrInstruction *init_value)
 {
     IrInstructionDeclVar *decl_var_instruction = ir_build_instruction<IrInstructionDeclVar>(irb, scope, source_node);
     decl_var_instruction->base.value.special = ConstValSpecialStatic;
@@ -1477,7 +1477,7 @@ static IrInstruction *ir_build_var_decl(IrBuilder *irb, Scope *scope, AstNode *s
 }
 
 static IrInstruction *ir_build_var_decl_from(IrBuilder *irb, IrInstruction *old_instruction,
-        VariableTableEntry *var, IrInstruction *var_type, IrInstruction *align_value, IrInstruction *init_value)
+        ZigVar *var, IrInstruction *var_type, IrInstruction *align_value, IrInstruction *init_value)
 {
     IrInstruction *new_instruction = ir_build_var_decl(irb, old_instruction->scope,
             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
 }
 
 static IrInstruction *ir_build_asm(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction **input_list,
-        IrInstruction **output_types, VariableTableEntry **output_vars, size_t return_count, bool has_side_effects)
+        IrInstruction **output_types, ZigVar **output_vars, size_t return_count, bool has_side_effects)
 {
     IrInstructionAsm *instruction = ir_build_instruction<IrInstructionAsm>(irb, scope, source_node);
     instruction->input_list = input_list;
@@ -1646,7 +1646,7 @@ static IrInstruction *ir_build_asm(IrBuilder *irb, Scope *scope, AstNode *source
 }
 
 static IrInstruction *ir_build_asm_from(IrBuilder *irb, IrInstruction *old_instruction, IrInstruction **input_list,
-        IrInstruction **output_types, VariableTableEntry **output_vars, size_t return_count, bool has_side_effects)
+        IrInstruction **output_types, ZigVar **output_vars, size_t return_count, bool has_side_effects)
 {
     IrInstruction *new_instruction = ir_build_asm(irb, old_instruction->scope,
             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,
     zig_unreachable();
 }
 
-static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_scope,
+static ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_scope,
         Buf *name, bool src_is_const, bool gen_is_const, bool is_shadowable, IrInstruction *is_comptime,
         bool skip_name_check)
 {
-    VariableTableEntry *variable_entry = allocate<VariableTableEntry>(1);
+    ZigVar *variable_entry = allocate<ZigVar>(1);
     variable_entry->parent_scope = parent_scope;
     variable_entry->shadowable = is_shadowable;
     variable_entry->mem_slot_index = SIZE_MAX;
@@ -3336,7 +3336,7 @@ static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Sco
         buf_init_from_buf(&variable_entry->name, name);
 
         if (!skip_name_check) {
-            VariableTableEntry *existing_var = find_variable(codegen, parent_scope, name);
+            ZigVar *existing_var = find_variable(codegen, parent_scope, name);
             if (existing_var && !existing_var->shadowable) {
                 ErrorMsg *msg = add_node_error(codegen, node,
                         buf_sprintf("redeclaration of variable '%s'", buf_ptr(name)));
@@ -3377,11 +3377,11 @@ static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Sco
 
 // Set name to nullptr to make the variable anonymous (not visible to programmer).
 // After you call this function var->child_scope has the variable in scope
-static VariableTableEntry *ir_create_var(IrBuilder *irb, AstNode *node, Scope *scope, Buf *name,
+static ZigVar *ir_create_var(IrBuilder *irb, AstNode *node, Scope *scope, Buf *name,
         bool src_is_const, bool gen_is_const, bool is_shadowable, IrInstruction *is_comptime)
 {
     bool is_underscored = name ? buf_eql_str(name, "_") : false;
-    VariableTableEntry *var = create_local_var(irb->codegen, node, scope,
+    ZigVar *var = create_local_var(irb->codegen, node, scope,
             (is_underscored ? nullptr : name), src_is_const, gen_is_const,
             (is_underscored ? true : is_shadowable), is_comptime, false);
     if (is_comptime != nullptr || gen_is_const) {
@@ -3799,7 +3799,7 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node,
         }
     }
 
-    VariableTableEntry *var = find_variable(irb->codegen, scope, variable_name);
+    ZigVar *var = find_variable(irb->codegen, scope, variable_name);
     if (var) {
         IrInstruction *var_ptr = ir_build_var_ptr(irb, scope, node, var);
         if (lval == LValPtr)
@@ -5258,7 +5258,7 @@ static IrInstruction *ir_gen_var_decl(IrBuilder *irb, Scope *scope, AstNode *nod
 
     IrInstruction *is_comptime = ir_build_const_bool(irb, scope, node,
         ir_should_inline(irb->exec, scope) || variable_declaration->is_comptime);
-    VariableTableEntry *var = ir_create_var(irb, node, scope, variable_declaration->symbol,
+    ZigVar *var = ir_create_var(irb, node, scope, variable_declaration->symbol,
         is_const, is_const, is_shadowable, is_comptime);
     // we detect IrInstructionIdDeclVar in gen_block to make sure the next node
     // is inside var->child_scope
@@ -5320,7 +5320,7 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n
 
         Scope *payload_scope;
         AstNode *symbol_node = node; // TODO make more accurate
-        VariableTableEntry *payload_var;
+        ZigVar *payload_var;
         if (var_symbol) {
             // TODO make it an error to write to payload variable
             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
 
             // TODO make it an error to write to error variable
             AstNode *err_symbol_node = else_node; // TODO make more accurate
-            VariableTableEntry *err_var = ir_create_var(irb, err_symbol_node, scope, err_symbol,
+            ZigVar *err_var = ir_create_var(irb, err_symbol_node, scope, err_symbol,
                     true, false, false, is_comptime);
             Scope *err_scope = err_var->child_scope;
             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
         // TODO make it an error to write to payload variable
         AstNode *symbol_node = node; // TODO make more accurate
 
-        VariableTableEntry *payload_var = ir_create_var(irb, symbol_node, subexpr_scope, var_symbol,
+        ZigVar *payload_var = ir_create_var(irb, symbol_node, subexpr_scope, var_symbol,
                 true, false, false, is_comptime);
         Scope *child_scope = payload_var->child_scope;
         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
 
     // TODO make it an error to write to element variable or i variable.
     Buf *elem_var_name = elem_node->data.symbol_expr.symbol;
-    VariableTableEntry *elem_var = ir_create_var(irb, elem_node, parent_scope, elem_var_name, true, false, false, is_comptime);
+    ZigVar *elem_var = ir_create_var(irb, elem_node, parent_scope, elem_var_name, true, false, false, is_comptime);
     Scope *child_scope = elem_var->child_scope;
 
     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
     IrInstruction *elem_var_ptr = ir_build_var_ptr(irb, child_scope, node, elem_var);
 
     AstNode *index_var_source_node;
-    VariableTableEntry *index_var;
+    ZigVar *index_var;
     if (index_node) {
         index_var_source_node = index_node;
         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
 
     IrInstruction **input_list = allocate<IrInstruction *>(node->data.asm_expr.input_list.length);
     IrInstruction **output_types = allocate<IrInstruction *>(node->data.asm_expr.output_list.length);
-    VariableTableEntry **output_vars = allocate<VariableTableEntry *>(node->data.asm_expr.output_list.length);
+    ZigVar **output_vars = allocate<ZigVar *>(node->data.asm_expr.output_list.length);
     size_t return_count = 0;
     bool is_volatile = node->data.asm_expr.is_volatile;
     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
             output_types[i] = return_type;
         } else {
             Buf *variable_name = asm_output->variable_name;
-            VariableTableEntry *var = find_variable(irb->codegen, scope, variable_name);
+            ZigVar *var = find_variable(irb->codegen, scope, variable_name);
             if (var) {
                 output_vars[i] = var;
             } else {
@@ -5880,7 +5880,7 @@ static IrInstruction *ir_gen_test_expr(IrBuilder *irb, Scope *scope, AstNode *no
         IrInstruction *var_type = nullptr;
         bool is_shadowable = false;
         bool is_const = true;
-        VariableTableEntry *var = ir_create_var(irb, node, subexpr_scope,
+        ZigVar *var = ir_create_var(irb, node, subexpr_scope,
                 var_symbol, is_const, is_const, is_shadowable, is_comptime);
 
         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 *
         IrInstruction *var_type = nullptr;
         bool is_shadowable = false;
         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);
-        VariableTableEntry *var = ir_create_var(irb, node, subexpr_scope,
+        ZigVar *var = ir_create_var(irb, node, subexpr_scope,
                 var_symbol, var_is_const, var_is_const, is_shadowable, var_is_comptime);
 
         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 *
             IrInstruction *var_type = nullptr;
             bool is_shadowable = false;
             bool is_const = true;
-            VariableTableEntry *var = ir_create_var(irb, node, subexpr_scope,
+            ZigVar *var = ir_create_var(irb, node, subexpr_scope,
                     err_symbol, is_const, is_const, is_shadowable, is_comptime);
 
             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
 
         bool is_shadowable = false;
         bool is_const = true;
-        VariableTableEntry *var = ir_create_var(irb, var_symbol_node, scope,
+        ZigVar *var = ir_create_var(irb, var_symbol_node, scope,
                 var_name, is_const, is_const, is_shadowable, var_is_comptime);
         child_scope = var->child_scope;
         IrInstruction *var_value;
@@ -6494,7 +6494,7 @@ static IrInstruction *ir_gen_err_ok_or(IrBuilder *irb, Scope *parent_scope, AstN
         Buf *var_name = var_node->data.symbol_expr.symbol;
         bool is_const = true;
         bool is_shadowable = false;
-        VariableTableEntry *var = ir_create_var(irb, node, parent_scope, var_name,
+        ZigVar *var = ir_create_var(irb, node, parent_scope, var_name,
             is_const, is_const, is_shadowable, is_comptime);
         err_scope = var->child_scope;
         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
     IrInstruction *is_canceled_mask = ir_build_const_usize(irb, scope, node, 0x1); // 0b001
     IrInstruction *is_suspended_mask = ir_build_const_usize(irb, scope, node, 0x2); // 0b010
 
-    VariableTableEntry *result_var = ir_create_var(irb, node, scope, nullptr,
+    ZigVar *result_var = ir_create_var(irb, node, scope, nullptr,
             false, false, true, const_bool_false);
     IrInstruction *target_promise_type = ir_build_typeof(irb, scope, node, target_inst);
     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
     IrInstruction *err_ret_trace_ptr;
     ZigType *return_type;
     Buf *result_ptr_field_name;
-    VariableTableEntry *coro_size_var;
+    ZigVar *coro_size_var;
     if (is_async) {
         // create the coro promise
         Scope *coro_scope = create_coro_prelude_scope(node, scope);
         const_bool_false = ir_build_const_bool(irb, coro_scope, node, false);
-        VariableTableEntry *promise_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
+        ZigVar *promise_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
 
         return_type = fn_entry->type_entry->data.fn.fn_type_id.return_type;
         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
         ir_build_var_decl(irb, coro_scope, node, promise_var, coro_frame_type_value, nullptr, undef);
         coro_promise_ptr = ir_build_var_ptr(irb, coro_scope, node, promise_var);
 
-        VariableTableEntry *await_handle_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
+        ZigVar *await_handle_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
         IrInstruction *null_value = ir_build_const_null(irb, coro_scope, node);
         IrInstruction *await_handle_type_val = ir_build_const_type(irb, coro_scope, node,
                 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
 
 static ZigType *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDeclVar *decl_var_instruction) {
     Error err;
-    VariableTableEntry *var = decl_var_instruction->var;
+    ZigVar *var = decl_var_instruction->var;
 
     IrInstruction *init_value = decl_var_instruction->init_value->other;
     if (type_is_invalid(init_value->value.type)) {
@@ -12591,7 +12591,7 @@ static ZigType *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDec
         // This means that this is actually a different variable due to, e.g. an inline while loop.
         // We make a new variable so that it can hold a different type, and so the debug info can
         // be distinct.
-        VariableTableEntry *new_var = create_local_var(ira->codegen, var->decl_node, var->child_scope,
+        ZigVar *new_var = create_local_var(ira->codegen, var->decl_node, var->child_scope,
             &var->name, var->src_is_const, var->gen_is_const, var->shadowable, var->is_comptime, true);
         new_var->owner_exec = var->owner_exec;
         new_var->align_bytes = var->align_bytes;
@@ -12902,7 +12902,7 @@ IrInstruction *ir_get_implicit_allocator(IrAnalyze *ira, IrInstruction *source_i
             }
         case ImplicitAllocatorIdLocalVar:
             {
-                VariableTableEntry *coro_allocator_var = ira->old_irb.exec->coro_allocator_var;
+                ZigVar *coro_allocator_var = ira->old_irb.exec->coro_allocator_var;
                 assert(coro_allocator_var != nullptr);
                 IrInstruction *var_ptr_inst = ir_get_var_ptr(ira, source_instr, coro_allocator_var);
                 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
         return false;
 
     Buf *param_name = param_decl_node->data.param_decl.name;
-    VariableTableEntry *var = add_variable(ira->codegen, param_decl_node,
+    ZigVar *var = add_variable(ira->codegen, param_decl_node,
         *exec_scope, param_name, true, arg_val, nullptr);
     *exec_scope = var->child_scope;
     *next_proto_i += 1;
@@ -13035,7 +13035,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod
     Buf *param_name = param_decl_node->data.param_decl.name;
     if (!param_name) return false;
     if (!is_var_args) {
-        VariableTableEntry *var = add_variable(ira->codegen, param_decl_node,
+        ZigVar *var = add_variable(ira->codegen, param_decl_node,
             *child_scope, param_name, true, arg_val, nullptr);
         *child_scope = var->child_scope;
         var->shadowable = !comptime_arg;
@@ -13067,7 +13067,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod
     return true;
 }
 
-static VariableTableEntry *get_fn_var_by_index(ZigFn *fn_entry, size_t index) {
+static ZigVar *get_fn_var_by_index(ZigFn *fn_entry, size_t index) {
     size_t next_var_i = 0;
     FnGenParamInfo *gen_param_info = fn_entry->type_entry->data.fn.gen_param_info;
     assert(gen_param_info != nullptr);
@@ -13086,7 +13086,7 @@ static VariableTableEntry *get_fn_var_by_index(ZigFn *fn_entry, size_t index) {
 }
 
 static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
-        VariableTableEntry *var)
+        ZigVar *var)
 {
     Error err;
     while (var->next_var != nullptr) {
@@ -13449,7 +13449,7 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
                         found_first_var_arg = true;
                     }
 
-                    VariableTableEntry *arg_var = get_fn_var_by_index(parent_fn_entry, arg_tuple_i);
+                    ZigVar *arg_var = get_fn_var_by_index(parent_fn_entry, arg_tuple_i);
                     if (arg_var == nullptr) {
                         ir_add_error(ira, arg,
                             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
 
             ConstExprValue *var_args_val = create_const_arg_tuple(ira->codegen,
                     first_var_arg, inst_fn_type_id.param_count);
-            VariableTableEntry *var = add_variable(ira->codegen, param_decl_node,
+            ZigVar *var = add_variable(ira->codegen, param_decl_node,
                 impl_fn->child_scope, param_name, true, var_args_val, nullptr);
             impl_fn->child_scope = var->child_scope;
         }
@@ -14158,7 +14158,7 @@ static ZigType *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPhi *phi
 }
 
 static ZigType *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
-        VariableTableEntry *var)
+        ZigVar *var)
 {
     IrInstruction *result = ir_get_var_ptr(ira, instruction, var);
     ir_link_new_instruction(result, instruction);
@@ -14166,7 +14166,7 @@ static ZigType *ir_analyze_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
 }
 
 static ZigType *ir_analyze_instruction_var_ptr(IrAnalyze *ira, IrInstructionVarPtr *var_ptr_instruction) {
-    VariableTableEntry *var = var_ptr_instruction->var;
+    ZigVar *var = var_ptr_instruction->var;
     return ir_analyze_var_ptr(ira, &var_ptr_instruction->base, var);
 }
 
@@ -14291,7 +14291,7 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
         size_t abs_index = start + index;
         ZigFn *fn_entry = exec_fn_entry(ira->new_irb.exec);
         assert(fn_entry);
-        VariableTableEntry *var = get_fn_var_by_index(fn_entry, abs_index);
+        ZigVar *var = get_fn_var_by_index(fn_entry, abs_index);
         bool is_const = true;
         bool is_volatile = false;
         if (var) {
@@ -14693,7 +14693,7 @@ static ZigType *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source_instru
         case TldIdVar:
         {
             TldVar *tld_var = (TldVar *)tld;
-            VariableTableEntry *var = tld_var->var;
+            ZigVar *var = tld_var->var;
             if (tld_var->extern_lib_name != nullptr) {
                 add_link_lib_symbol(ira, tld_var->extern_lib_name, &var->name, source_instruction->source_node);
             }
@@ -16976,7 +16976,7 @@ static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, Zig
     TldVar *tld = (TldVar *)entry;
     assert(tld->base.id == TldIdVar);
 
-    VariableTableEntry *var = tld->var;
+    ZigVar *var = tld->var;
 
     if ((err = ensure_complete_type(ira->codegen, var->value->type)))
         return ira->codegen->builtin_types.entry_invalid;
@@ -17074,7 +17074,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco
         switch (curr_entry->value->id) {
             case TldIdVar:
                 {
-                    VariableTableEntry *var = ((TldVar *)curr_entry->value)->var;
+                    ZigVar *var = ((TldVar *)curr_entry->value)->var;
                     if ((err = ensure_complete_type(ira->codegen, var->value->type)))
                         return ErrorSemanticAnalyzeFail;
 
@@ -17191,7 +17191,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco
 
                     for (size_t fn_arg_index = 0; fn_arg_index < fn_arg_count; fn_arg_index++)
                     {
-                        VariableTableEntry *arg_var = fn_entry->variable_list.at(fn_arg_index);
+                        ZigVar *arg_var = fn_entry->variable_list.at(fn_arg_index);
                         ConstExprValue *fn_arg_name_val = &fn_arg_name_array->data.x_array.s_none.elements[fn_arg_index];
                         ConstExprValue *arg_name = create_const_str_lit(ira->codegen, &arg_var->name);
                         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,
         case TldIdVar:
         {
             TldVar *tld_var = (TldVar *)tld;
-            VariableTableEntry *var = tld_var->var;
+            ZigVar *var = tld_var->var;
 
             IrInstruction *var_ptr = ir_get_var_ptr(ira, &instruction->base, var);
             if (type_is_invalid(var_ptr->value.type))