authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-27 21:01:03-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-28 12:58:40-07:00
log4ea421f8cb3afc01f6822227b48123dd4844ec07
treed8a9005b080669a97a3719dfc6cd793395983ed4
parent42f4ee0aebf274e74ece73157a63bbc0c6383c31

stage1: move the ZigFn from Stage1Zir to Stage1AstGen

Part of an effort to make Stage1Zir immutable.

7 files changed, 51 insertions(+), 60 deletions(-)

src/stage1/all_types.hpp-2
......@@ -114,7 +114,6 @@ struct Stage1Zir {
114114 ZigList<IrBasicBlockSrc *> basic_block_list;
115115 Buf *name;
116116 ZigFn *name_fn;
117 ZigFn *fn_entry;
118117 Buf *c_import_buf;
119118 AstNode *source_node;
120119 Scope *begin_scope;
......@@ -135,7 +134,6 @@ struct Stage1Air {
135134 ZigFn *name_fn;
136135 size_t mem_slot_count;
137136 size_t next_debug_id;
138 ZigFn *fn_entry;
139137 Buf *c_import_buf;
140138 AstNode *source_node;
141139 Stage1Air *parent_exec;
src/stage1/analyze.cpp+2-5
......@@ -3654,9 +3654,6 @@ static void get_fully_qualified_decl_name(CodeGen *g, Buf *buf, Tld *tld, bool i
36543654static ZigFn *create_fn_raw(CodeGen *g, bool is_noinline) {
36553655 ZigFn *fn_entry = heap::c_allocator.create<ZigFn>();
36563656 fn_entry->ir_executable = heap::c_allocator.create<Stage1Zir>();
3657
3658 fn_entry->analyzed_executable.fn_entry = fn_entry;
3659 fn_entry->ir_executable->fn_entry = fn_entry;
36603657 fn_entry->is_noinline = is_noinline;
36613658
36623659 return fn_entry;
......@@ -5134,7 +5131,7 @@ static void analyze_fn_ir(CodeGen *g, ZigFn *fn, AstNode *return_type_node) {
51345131 size_t backward_branch_quota = max(fn->branch_quota, default_backward_branch_quota);
51355132 ZigType *block_return_type = ir_analyze(g, fn->ir_executable, &fn->analyzed_executable,
51365133 &backward_branch_count, &backward_branch_quota,
5137 fn_type_id->return_type, return_type_node, nullptr);
5134 fn_type_id->return_type, return_type_node, nullptr, fn);
51385135 fn->src_implicit_return_type = block_return_type;
51395136
51405137 if (type_is_invalid(block_return_type) || fn->analyzed_executable.first_err_trace_msg != nullptr) {
......@@ -5231,7 +5228,7 @@ static void analyze_fn_body(CodeGen *g, ZigFn *fn_table_entry) {
52315228 ZigType *fn_type = fn_table_entry->type_entry;
52325229 assert(!fn_type->data.fn.is_generic);
52335230
5234 if (!ir_gen_fn(g, fn_table_entry)) {
5231 if (!stage1_astgen_fn(g, fn_table_entry)) {
52355232 fn_table_entry->anal_state = FnAnalStateInvalid;
52365233 return;
52375234 }
src/stage1/astgen.cpp+16-22
......@@ -17,6 +17,7 @@ struct Stage1AstGen {
1717 IrBasicBlockSrc *current_basic_block;
1818 AstNode *main_block_node;
1919 size_t next_debug_id;
20 ZigFn *fn;
2021};
2122
2223static IrInstSrc *ir_gen_node(Stage1AstGen *ag, AstNode *node, Scope *scope);
......@@ -368,10 +369,6 @@ static size_t irb_next_debug_id(Stage1AstGen *ag) {
368369 return result;
369370}
370371
371static ZigFn *exec_fn_entry(Stage1Zir *exec) {
372 return exec->fn_entry;
373}
374
375372static Buf *exec_c_import_buf(Stage1Zir *exec) {
376373 return exec->c_import_buf;
377374}
......@@ -3043,7 +3040,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L
30433040 if (expr_node) {
30443041 // Temporarily set this so that if we return a type it gets the name of the function
30453042 ZigFn *prev_name_fn = ag->exec->name_fn;
3046 ag->exec->name_fn = exec_fn_entry(ag->exec);
3043 ag->exec->name_fn = ag->fn;
30473044 return_value = ir_gen_node_extra(ag, expr_node, scope, LValNone, &result_loc_ret->base);
30483045 ag->exec->name_fn = prev_name_fn;
30493046 if (return_value == ag->codegen->invalid_inst_src)
......@@ -4771,8 +4768,9 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode
47714768 case BuiltinFnIdFrameAddress:
47724769 return ir_lval_wrap(ag, scope, ir_build_frame_address_src(ag, scope, node), lval, result_loc);
47734770 case BuiltinFnIdFrameHandle:
4774 if (!ag->exec->fn_entry) {
4775 add_node_error(ag->codegen, node, buf_sprintf("@frame() called outside of function definition"));
4771 if (ag->fn == nullptr) {
4772 add_node_error(ag->codegen, node,
4773 buf_sprintf("@frame() called outside of function definition"));
47764774 return ag->codegen->invalid_inst_src;
47774775 }
47784776 return ir_lval_wrap(ag, scope, ir_build_handle_src(ag, scope, node), lval, result_loc);
......@@ -7700,8 +7698,7 @@ static IrInstSrc *ir_gen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod
77007698 }
77017699 }
77027700
7703 ZigFn *fn_entry = exec_fn_entry(ag->exec);
7704 if (!fn_entry) {
7701 if (!ag->fn) {
77057702 add_node_error(ag->codegen, node, buf_sprintf("await outside function definition"));
77067703 return ag->codegen->invalid_inst_src;
77077704 }
......@@ -7726,8 +7723,7 @@ static IrInstSrc *ir_gen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod
77267723static IrInstSrc *ir_gen_suspend(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) {
77277724 assert(node->type == NodeTypeSuspend);
77287725
7729 ZigFn *fn_entry = exec_fn_entry(ag->exec);
7730 if (!fn_entry) {
7726 if (!ag->fn) {
77317727 add_node_error(ag->codegen, node, buf_sprintf("suspend outside function definition"));
77327728 return ag->codegen->invalid_inst_src;
77337729 }
......@@ -8019,7 +8015,7 @@ static IrInstSrc *ir_gen_node_extra(Stage1AstGen *ag, AstNode *node, Scope *scop
80198015 }
80208016 Scope *child_scope;
80218017 if (ag->exec->is_inline ||
8022 (ag->exec->fn_entry != nullptr && ag->exec->fn_entry->child_scope == scope))
8018 (ag->fn != nullptr && ag->fn->child_scope == scope))
80238019 {
80248020 child_scope = scope;
80258021 } else {
......@@ -8038,13 +8034,16 @@ static IrInstSrc *ir_gen_node(Stage1AstGen *ag, AstNode *node, Scope *scope) {
80388034 return ir_gen_node_extra(ag, node, scope, LValNone, nullptr);
80398035}
80408036
8041bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, Stage1Zir *ir_executable) {
8037bool stage1_astgen(CodeGen *codegen, AstNode *node, Scope *scope, Stage1Zir *ir_executable,
8038 ZigFn *fn)
8039{
80428040 assert(node->owner);
80438041
80448042 Stage1AstGen ir_builder = {0};
80458043 Stage1AstGen *ag = &ir_builder;
80468044
80478045 ag->codegen = codegen;
8046 ag->fn = fn;
80488047 ag->exec = ir_executable;
80498048 ag->main_block_node = node;
80508049
......@@ -8076,15 +8075,10 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, Stage1Zir *ir_executa
80768075 return true;
80778076}
80788077
8079bool ir_gen_fn(CodeGen *codegen, ZigFn *fn_entry) {
8080 assert(fn_entry);
8081
8082 Stage1Zir *ir_executable = fn_entry->ir_executable;
8083 AstNode *body_node = fn_entry->body_node;
8084
8085 assert(fn_entry->child_scope);
8086
8087 return ir_gen(codegen, body_node, fn_entry->child_scope, ir_executable);
8078bool stage1_astgen_fn(CodeGen *codegen, ZigFn *fn) {
8079 assert(fn != nullptr);
8080 assert(fn->child_scope != nullptr);
8081 return stage1_astgen(codegen, fn->body_node, fn->child_scope, fn->ir_executable, fn);
80888082}
80898083
80908084void invalidate_exec(Stage1Zir *exec, ErrorMsg *msg) {
src/stage1/astgen.hpp+2-2
......@@ -10,8 +10,8 @@
1010
1111#include "all_types.hpp"
1212
13bool ir_gen(CodeGen *g, AstNode *node, Scope *scope, Stage1Zir *ir_executable);
14bool ir_gen_fn(CodeGen *g, ZigFn *fn_entry);
13bool stage1_astgen(CodeGen *g, AstNode *node, Scope *scope, Stage1Zir *ir_executable, ZigFn *fn);
14bool stage1_astgen_fn(CodeGen *g, ZigFn *fn_entry);
1515
1616bool ir_inst_src_has_side_effects(IrInstSrc *inst);
1717
src/stage1/ir.cpp+28-27
......@@ -49,6 +49,7 @@ struct IrAnalyze {
4949 Stage1Air *parent_exec;
5050 size_t *backward_branch_count;
5151 size_t *backward_branch_quota;
52 ZigFn *fn;
5253
5354 // For the purpose of using in a debugger
5455 void dump();
......@@ -4259,7 +4260,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
42594260 continue;
42604261 }
42614262 bool allow_infer = cur_type->data.error_set.infer_fn != nullptr &&
4262 cur_type->data.error_set.infer_fn == ira->new_irb.exec->fn_entry;
4263 cur_type->data.error_set.infer_fn == ira->fn;
42634264 if (!allow_infer && !resolve_inferred_error_set(ira->codegen, cur_type, cur_inst->base.source_node)) {
42644265 return ira->codegen->builtin_types.entry_invalid;
42654266 }
......@@ -4327,7 +4328,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
43274328 }
43284329 ZigType *cur_err_set_type = cur_type->data.error_union.err_set_type;
43294330 bool allow_infer = cur_err_set_type->data.error_set.infer_fn != nullptr &&
4330 cur_err_set_type->data.error_set.infer_fn == ira->new_irb.exec->fn_entry;
4331 cur_err_set_type->data.error_set.infer_fn == ira->fn;
43314332 if (!allow_infer && !resolve_inferred_error_set(ira->codegen, cur_err_set_type, cur_inst->base.source_node)) {
43324333 return ira->codegen->builtin_types.entry_invalid;
43334334 }
......@@ -4382,7 +4383,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
43824383
43834384 if (cur_type->id == ZigTypeIdErrorSet) {
43844385 bool allow_infer = cur_type->data.error_set.infer_fn != nullptr &&
4385 cur_type->data.error_set.infer_fn == ira->new_irb.exec->fn_entry;
4386 cur_type->data.error_set.infer_fn == ira->fn;
43864387 if (!allow_infer && !resolve_inferred_error_set(ira->codegen, cur_type, cur_inst->base.source_node)) {
43874388 return ira->codegen->builtin_types.entry_invalid;
43884389 }
......@@ -4401,7 +4402,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
44014402 if (prev_type->id == ZigTypeIdErrorUnion) {
44024403 err_set_type = prev_type->data.error_union.err_set_type;
44034404 allow_infer = err_set_type->data.error_set.infer_fn != nullptr &&
4404 err_set_type->data.error_set.infer_fn == ira->new_irb.exec->fn_entry;
4405 err_set_type->data.error_set.infer_fn == ira->fn;
44054406 } else {
44064407 err_set_type = cur_type;
44074408 }
......@@ -4465,9 +4466,9 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
44654466 continue;
44664467
44674468 bool allow_infer_prev = prev_err_set_type->data.error_set.infer_fn != nullptr &&
4468 prev_err_set_type->data.error_set.infer_fn == ira->new_irb.exec->fn_entry;
4469 prev_err_set_type->data.error_set.infer_fn == ira->fn;
44694470 bool allow_infer_cur = cur_err_set_type->data.error_set.infer_fn != nullptr &&
4470 cur_err_set_type->data.error_set.infer_fn == ira->new_irb.exec->fn_entry;
4471 cur_err_set_type->data.error_set.infer_fn == ira->fn;
44714472
44724473 if (!allow_infer_prev && !resolve_inferred_error_set(ira->codegen, prev_err_set_type, cur_inst->base.source_node)) {
44734474 return ira->codegen->builtin_types.entry_invalid;
......@@ -4651,7 +4652,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
46514652 if (err_set_type != nullptr) {
46524653 ZigType *cur_err_set_type = cur_type->data.error_union.err_set_type;
46534654 bool allow_infer = cur_err_set_type->data.error_set.infer_fn != nullptr &&
4654 cur_err_set_type->data.error_set.infer_fn == ira->new_irb.exec->fn_entry;
4655 cur_err_set_type->data.error_set.infer_fn == ira->fn;
46554656 if (!allow_infer && !resolve_inferred_error_set(ira->codegen, cur_err_set_type, cur_inst->base.source_node)) {
46564657 return ira->codegen->builtin_types.entry_invalid;
46574658 }
......@@ -5595,11 +5596,10 @@ Error ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node,
55955596 ir_executable->source_node = source_node;
55965597 ir_executable->name = exec_name;
55975598 ir_executable->is_inline = true;
5598 ir_executable->fn_entry = fn_entry;
55995599 ir_executable->c_import_buf = c_import_buf;
56005600 ir_executable->begin_scope = scope;
56015601
5602 if (!ir_gen(codegen, node, scope, ir_executable))
5602 if (!stage1_astgen(codegen, node, scope, ir_executable, fn_entry))
56035603 return ErrorSemanticAnalyzeFail;
56045604
56055605 if (ir_executable->first_err_trace_msg != nullptr) {
......@@ -5618,12 +5618,12 @@ Error ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node,
56185618 analyzed_executable->source_exec = ir_executable;
56195619 analyzed_executable->name = exec_name;
56205620 analyzed_executable->is_inline = true;
5621 analyzed_executable->fn_entry = fn_entry;
56225621 analyzed_executable->c_import_buf = c_import_buf;
56235622 analyzed_executable->begin_scope = scope;
56245623 ZigType *result_type = ir_analyze(codegen, ir_executable, analyzed_executable,
56255624 backward_branch_count, backward_branch_quota,
5626 return_ptr->type->data.pointer.child_type, expected_type_source_node, return_ptr);
5625 return_ptr->type->data.pointer.child_type, expected_type_source_node, return_ptr,
5626 fn_entry);
56275627 if (type_is_invalid(result_type)) {
56285628 return ErrorSemanticAnalyzeFail;
56295629 }
......@@ -11025,7 +11025,7 @@ static IrInstGen *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstSrcDeclV
1102511025 return ira->codegen->invalid_inst_gen;
1102611026 }
1102711027
11028 ZigFn *fn_entry = ira->new_irb.exec->fn_entry;
11028 ZigFn *fn_entry = ira->fn;
1102911029 if (fn_entry)
1103011030 fn_entry->variable_list.append(var);
1103111031
......@@ -11421,9 +11421,9 @@ static IrInstGen *ir_analyze_instruction_extern(IrAnalyze *ira, IrInstSrcExtern
1142111421 is_thread_local, expr_type);
1142211422}
1142311423
11424static bool exec_has_err_ret_trace(CodeGen *g, Stage1Zir *exec) {
11425 ZigFn *fn_entry = exec->fn_entry;
11426 return fn_entry != nullptr && fn_entry->calls_or_awaits_errorable_fn && g->have_err_ret_tracing;
11424static bool ira_has_err_ret_trace(IrAnalyze *ira) {
11425 ZigFn *fn = ira->fn;
11426 return fn != nullptr && fn->calls_or_awaits_errorable_fn && ira->codegen->have_err_ret_tracing;
1142711427}
1142811428
1142911429static IrInstGen *ir_analyze_instruction_error_return_trace(IrAnalyze *ira,
......@@ -11432,7 +11432,7 @@ static IrInstGen *ir_analyze_instruction_error_return_trace(IrAnalyze *ira,
1143211432 ZigType *ptr_to_stack_trace_type = get_pointer_to_type(ira->codegen, get_stack_trace_type(ira->codegen), false);
1143311433 if (instruction->optional == IrInstErrorReturnTraceNull) {
1143411434 ZigType *optional_type = get_optional_type(ira->codegen, ptr_to_stack_trace_type);
11435 if (!exec_has_err_ret_trace(ira->codegen, ira->zir)) {
11435 if (!ira_has_err_ret_trace(ira)) {
1143611436 IrInstGen *result = ir_const(ira, &instruction->base.base, optional_type);
1143711437 ZigValue *out_val = result->value;
1143811438 assert(get_src_ptr_type(optional_type) != nullptr);
......@@ -11504,7 +11504,7 @@ static IrInstGen *ir_analyze_alloca(IrAnalyze *ira, IrInst *source_inst, ZigType
1150411504 PtrLenSingle, align, 0, 0, false);
1150511505
1150611506 if (!force_comptime) {
11507 ZigFn *fn_entry = ira->new_irb.exec->fn_entry;
11507 ZigFn *fn_entry = ira->fn;
1150811508 if (fn_entry != nullptr) {
1150911509 fn_entry->alloca_gen_list.append(result);
1151011510 }
......@@ -11603,7 +11603,7 @@ static IrInstGen *ir_resolve_no_result_loc(IrAnalyze *ira, IrInst *suspend_sourc
1160311603 alloca_gen->base.value->type = get_pointer_to_type_extra(ira->codegen, value_type, false, false,
1160411604 PtrLenSingle, 0, 0, 0, false);
1160511605 set_up_result_loc_for_inferred_comptime(ira, &alloca_gen->base);
11606 ZigFn *fn_entry = ira->new_irb.exec->fn_entry;
11606 ZigFn *fn_entry = ira->fn;
1160711607 if (fn_entry != nullptr && get_scope_typeof(suspend_source_instr->scope) == nullptr) {
1160811608 fn_entry->alloca_gen_list.append(alloca_gen);
1160911609 }
......@@ -12131,7 +12131,7 @@ static IrInstGen *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrInstSr
1213112131 if (result_loc != nullptr)
1213212132 return result_loc;
1213312133
12134 ZigFn *fn = ira->new_irb.exec->fn_entry;
12134 ZigFn *fn = ira->fn;
1213512135 if (fn != nullptr && fn->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync &&
1213612136 instruction->result_loc->id == ResultLocIdReturn)
1213712137 {
......@@ -12849,7 +12849,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,
1284912849 }
1285012850 }
1285112851
12852 ZigFn *parent_fn_entry = ira->new_irb.exec->fn_entry;
12852 ZigFn *parent_fn_entry = ira->fn;
1285312853 assert(parent_fn_entry);
1285412854 for (size_t call_i = 0; call_i < args_len; call_i += 1) {
1285512855 IrInstGen *arg = args_ptr[call_i];
......@@ -13017,7 +13017,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,
1301713017 return ir_finish_anal(ira, &new_call_instruction->base);
1301813018 }
1301913019
13020 ZigFn *parent_fn_entry = ira->new_irb.exec->fn_entry;
13020 ZigFn *parent_fn_entry = ira->fn;
1302113021 assert(fn_type_id->return_type != nullptr);
1302213022 assert(parent_fn_entry != nullptr);
1302313023 if (fn_type_can_fail(fn_type_id)) {
......@@ -21069,7 +21069,7 @@ static IrInstGen *ir_analyze_instruction_frame_address(IrAnalyze *ira, IrInstSrc
2106921069}
2107021070
2107121071static IrInstGen *ir_analyze_instruction_frame_handle(IrAnalyze *ira, IrInstSrcFrameHandle *instruction) {
21072 ZigFn *fn = ira->new_irb.exec->fn_entry;
21072 ZigFn *fn = ira->fn;
2107321073 ir_assert(fn != nullptr, &instruction->base.base);
2107421074
2107521075 if (fn->inferred_async_node == nullptr) {
......@@ -22932,7 +22932,7 @@ static IrInstGen *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, IrInstS
2293222932 return ira->codegen->invalid_inst_gen;
2293322933 }
2293422934
22935 ZigFn *fn_entry = ira->new_irb.exec->fn_entry;
22935 ZigFn *fn_entry = ira->fn;
2293622936 if (fn_entry == nullptr) {
2293722937 ir_add_error(ira, &instruction->base.base, buf_sprintf("@setAlignStack outside function"));
2293822938 return ira->codegen->invalid_inst_gen;
......@@ -23952,7 +23952,7 @@ static IrInstGen *ir_analyze_instruction_suspend_finish(IrAnalyze *ira, IrInstSr
2395223952 ir_assert(begin_base->id == IrInstGenIdSuspendBegin, &instruction->base.base);
2395323953 IrInstGenSuspendBegin *begin = reinterpret_cast<IrInstGenSuspendBegin *>(begin_base);
2395423954
23955 ZigFn *fn_entry = ira->new_irb.exec->fn_entry;
23955 ZigFn *fn_entry = ira->fn;
2395623956 ir_assert(fn_entry != nullptr, &instruction->base.base);
2395723957
2395823958 if (fn_entry->inferred_async_node == nullptr) {
......@@ -24019,7 +24019,7 @@ static IrInstGen *ir_analyze_instruction_await(IrAnalyze *ira, IrInstSrcAwait *i
2401924019
2402024020 ZigType *result_type = frame->value->type->data.any_frame.result_type;
2402124021
24022 ZigFn *fn_entry = ira->new_irb.exec->fn_entry;
24022 ZigFn *fn_entry = ira->fn;
2402324023 ir_assert(fn_entry != nullptr, &instruction->base.base);
2402424024
2402524025 // If it's not @Frame(func) then it's definitely a suspend point
......@@ -24465,16 +24465,17 @@ static IrInstGen *ir_analyze_instruction_base(IrAnalyze *ira, IrInstSrc *instruc
2446524465 zig_unreachable();
2446624466}
2446724467
24468// This function attempts to evaluate IR code while doing type checking and other analysis.
24468// This function attempts to evaluate stage1 ZIR code while doing type checking and other analysis.
2446924469// It emits to a new Stage1Air which is partially evaluated IR code.
2447024470ZigType *ir_analyze(CodeGen *codegen, Stage1Zir *stage1_zir, Stage1Air *stage1_air,
2447124471 size_t *backward_branch_count, size_t *backward_branch_quota,
24472 ZigType *expected_type, AstNode *expected_type_source_node, ZigValue *result_ptr)
24472 ZigType *expected_type, AstNode *expected_type_source_node, ZigValue *result_ptr, ZigFn *fn)
2447324473{
2447424474 assert(stage1_zir->first_err_trace_msg == nullptr);
2447524475 assert(expected_type == nullptr || !type_is_invalid(expected_type));
2447624476
2447724477 IrAnalyze *ira = heap::c_allocator.create<IrAnalyze>();
24478 ira->fn = fn;
2447824479 ira->backward_branch_count = backward_branch_count;
2447924480 ira->backward_branch_quota = backward_branch_quota;
2448024481 ira->ref_count = 1;
src/stage1/ir.hpp+2-2
......@@ -22,10 +22,10 @@ Error ir_resolve_lazy(CodeGen *codegen, AstNode *source_node, ZigValue *val);
2222
2323ZigType *ir_analyze(CodeGen *codegen, Stage1Zir *stage1_zir, Stage1Air *stage1_air,
2424 size_t *backward_branch_count, size_t *backward_branch_quota,
25 ZigType *expected_type, AstNode *expected_type_source_node, ZigValue *result_ptr);
25 ZigType *expected_type, AstNode *expected_type_source_node, ZigValue *result_ptr,
26 ZigFn *fn);
2627
2728bool ir_inst_gen_has_side_effects(IrInstGen *inst);
28bool ir_inst_src_has_side_effects(IrInstSrc *inst);
2929
3030struct IrAnalyze;
3131ZigValue *const_ptr_pointee(IrAnalyze *ira, CodeGen *codegen, ZigValue *const_val,
src/stage1/ir_print.cpp+1
......@@ -8,6 +8,7 @@
88#include "all_types.hpp"
99#include "analyze.hpp"
1010#include "ir.hpp"
11#include "astgen.hpp"
1112#include "ir_print.hpp"
1213#include "os.hpp"
1314