| author | |
| committer | |
| log | e80e8a80993734f22e9e9c1b8ba078b0b9b946c3 |
| tree | e9478d4436b275a7eeed841467a50b9054ab8340 |
| parent | 67d565136abd904b67792ae61f195a4054463b00 |
3 files changed, 16 insertions(+), 5 deletions(-)
src/all_types.hpp+1| ... | ... | @@ -36,6 +36,7 @@ struct IrExecutable { |
| 36 | 36 | ZigList<IrBasicBlock *> basic_block_list; |
| 37 | 37 | size_t mem_slot_count; |
| 38 | 38 | size_t next_debug_id; |
| 39 | bool invalid; | |
| 39 | 40 | }; |
| 40 | 41 | |
| 41 | 42 | enum OutType { |
src/analyze.cpp+4-4| ... | ... | @@ -838,9 +838,9 @@ static IrInstruction *analyze_const_value(CodeGen *g, BlockContext *scope, AstNo |
| 838 | 838 | { |
| 839 | 839 | IrExecutable ir_executable = {0}; |
| 840 | 840 | IrExecutable analyzed_executable = {0}; |
| 841 | IrInstruction *pass1 = ir_gen(g, node, scope, &ir_executable); | |
| 841 | ir_gen(g, node, scope, &ir_executable); | |
| 842 | 842 | |
| 843 | if (pass1->type_entry->id == TypeTableEntryIdInvalid) | |
| 843 | if (ir_executable.invalid) | |
| 844 | 844 | return g->invalid_instruction; |
| 845 | 845 | |
| 846 | 846 | if (g->verbose) { |
| ... | ... | @@ -2552,8 +2552,8 @@ static void analyze_fn_body(CodeGen *g, FnTableEntry *fn_table_entry) { |
| 2552 | 2552 | buf_sprintf("byvalue types not yet supported on extern function return values")); |
| 2553 | 2553 | } |
| 2554 | 2554 | |
| 2555 | IrInstruction *result = ir_gen_fn(g, fn_table_entry); | |
| 2556 | if (result == g->invalid_instruction) { | |
| 2555 | ir_gen_fn(g, fn_table_entry); | |
| 2556 | if (fn_table_entry->ir_executable.invalid) { | |
| 2557 | 2557 | fn_proto_node->data.fn_proto.skip = true; |
| 2558 | 2558 | fn_table_entry->anal_state = FnAnalStateSkipped; |
| 2559 | 2559 | return; |
src/ir.cpp+11-1| ... | ... | @@ -2058,7 +2058,7 @@ static IrInstruction *ir_gen_if_var_expr(IrBuilder *irb, AstNode *node) { |
| 2058 | 2058 | return ir_build_phi(irb, node, 2, incoming_blocks, incoming_values); |
| 2059 | 2059 | } |
| 2060 | 2060 | |
| 2061 | static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, BlockContext *block_context, | |
| 2061 | static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, BlockContext *block_context, | |
| 2062 | 2062 | LValPurpose lval) |
| 2063 | 2063 | { |
| 2064 | 2064 | assert(block_context); |
| ... | ... | @@ -2140,6 +2140,14 @@ static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, BlockCont |
| 2140 | 2140 | zig_unreachable(); |
| 2141 | 2141 | } |
| 2142 | 2142 | |
| 2143 | static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, BlockContext *block_context, | |
| 2144 | LValPurpose lval) | |
| 2145 | { | |
| 2146 | IrInstruction *result = ir_gen_node_raw(irb, node, block_context, lval); | |
| 2147 | irb->exec->invalid = irb->exec->invalid || (result == irb->codegen->invalid_instruction); | |
| 2148 | return result; | |
| 2149 | } | |
| 2150 | ||
| 2143 | 2151 | static IrInstruction *ir_gen_node(IrBuilder *irb, AstNode *node, BlockContext *scope) { |
| 2144 | 2152 | return ir_gen_node_extra(irb, node, scope, LValPurposeNone); |
| 2145 | 2153 | } |
| ... | ... | @@ -4881,6 +4889,8 @@ static TypeTableEntry *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *ins |
| 4881 | 4889 | TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_exec, |
| 4882 | 4890 | TypeTableEntry *expected_type, AstNode *expected_type_source_node) |
| 4883 | 4891 | { |
| 4892 | assert(!old_exec->invalid); | |
| 4893 | ||
| 4884 | 4894 | IrAnalyze ir_analyze_data = {}; |
| 4885 | 4895 | IrAnalyze *ira = &ir_analyze_data; |
| 4886 | 4896 | ira->codegen = codegen; |