authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-03 20:56:22-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-03 20:56:22-04:00
logd4054e35fe3a6ba4b4f0d1a0da0e0149f21b49a4
tree4318552d331be2a3b8465897dc5e18f52e18e501
parentb6108eed522b7a0122d305dc1a74de8f12f20d5b
signature Commit is signed but in an unrecognized format.

while loops

Note that neither the payload capture variable nor the error capture variable require a stack allocation. ```zig export fn entry() void { var c: anyerror!i32 = 1234; while (c) |hi| {} else |e| {} } ``` ```llvm define void @entry() #2 !dbg !39 { Entry: %c = alloca { i16, i32 }, align 4 %0 = bitcast { i16, i32 }* %c to i8*, !dbg !52 call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 bitcast ({ i16, i32 }* @0 to i8*), i64 8, i1 false), !dbg !52 call void @llvm.dbg.declare(metadata { i16, i32 }* %c, metadata !43, metadata !DIExpression()), !dbg !52 br label %WhileCond, !dbg !53 WhileCond: ; preds = %WhileBody, %Entry %1 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !54 %2 = load i16, i16* %1, align 2, !dbg !54 %3 = icmp ne i16 %2, 0, !dbg !54 br i1 %3, label %WhileElse, label %WhileBody, !dbg !54 WhileBody: ; preds = %WhileCond %4 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 1, !dbg !53 call void @llvm.dbg.declare(metadata i32* %4, metadata !50, metadata !DIExpression()), !dbg !53 br label %WhileCond, !dbg !53 WhileElse: ; preds = %WhileCond %5 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !55 call void @llvm.dbg.declare(metadata i16* %5, metadata !51, metadata !DIExpression()), !dbg !55 ret void, !dbg !56 } ```

5 files changed, 86 insertions(+), 82 deletions(-)

BRANCH_TODO+2-41
......@@ -1,7 +1,8 @@
11Scratch pad for stuff to do before merging master
22=================================================
33
4 * implicit casts
4migrate ir_build_var_decl_src to use ir_build_alloca_src and explicitly initialize
5
56 * for loops
67 * switch expression
78 * struct initializations
......@@ -12,8 +13,6 @@ look at all the ir_gen_node ir_gen_node_extra calls and make sure result locatio
1213
1314migrate all the alloca_list to alloca_gen_list
1415
15migrate ir_build_var_decl_src to use ir_build_alloca_src and explicitly initialize
16
1716inferred comptime
1817
1918
......@@ -30,41 +29,3 @@ inferred comptime
3029
3130handle if with no else
3231
33for loops:
34 IrInstruction *pointer_type = ir_build_to_ptr_type(irb, parent_scope, array_node, array_val_ptr);
35
36 IrInstruction *elem_var_type;
37 if (node->data.for_expr.elem_is_ptr) {
38 elem_var_type = pointer_type;
39 } else {
40 elem_var_type = ir_build_ptr_type_child(irb, parent_scope, elem_node, pointer_type);
41 }
42 IrInstruction *usize = ir_build_const_type(irb, child_scope, node, irb->codegen->builtin_types.entry_usize);
43- do they need to have an implicit cast in there for the elem variable?
44static IrInstruction *ir_build_to_ptr_type(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *ptr) {
45 IrInstructionToPtrType *instruction = ir_build_instruction<IrInstructionToPtrType>(irb, scope, source_node);
46 instruction->ptr = ptr;
47
48 ir_ref_instruction(ptr, irb->current_basic_block);
49
50 return &instruction->base;
51}
52
53static IrInstruction *ir_build_ptr_type_child(IrBuilder *irb, Scope *scope, AstNode *source_node,
54 IrInstruction *value)
55{
56 IrInstructionPtrTypeChild *instruction = ir_build_instruction<IrInstructionPtrTypeChild>(
57 irb, scope, source_node);
58 instruction->value = value;
59
60 ir_ref_instruction(value, irb->current_basic_block);
61
62 return &instruction->base;
63}
64
65coroutines
66 ZigType *coro_frame_type = get_promise_frame_type(irb->codegen, return_type);
67 IrInstruction *coro_frame_type_value = ir_build_const_type(irb, coro_scope, node, coro_frame_type);
68- implicit cast for the var decl
69 IrInstruction *await_handle_type_val = ir_build_const_type(irb, coro_scope, node,
70 get_optional_type(irb->codegen, irb->codegen->builtin_types.entry_promise));
src/all_types.hpp+2-1
......@@ -3087,10 +3087,11 @@ struct IrInstructionTestErr {
30873087 IrInstruction *value;
30883088};
30893089
3090// Takes an error union pointer, returns a pointer to the error code.
30903091struct IrInstructionUnwrapErrCode {
30913092 IrInstruction base;
30923093
3093 IrInstruction *err_union;
3094 IrInstruction *err_union_ptr;
30943095};
30953096
30963097struct IrInstructionUnwrapErrPayload {
src/codegen.cpp+6-8
......@@ -4878,18 +4878,16 @@ static LLVMValueRef ir_render_test_err(CodeGen *g, IrExecutable *executable, IrI
48784878static LLVMValueRef ir_render_unwrap_err_code(CodeGen *g, IrExecutable *executable,
48794879 IrInstructionUnwrapErrCode *instruction)
48804880{
4881 ZigType *ptr_type = instruction->err_union->value.type;
4881 ZigType *ptr_type = instruction->err_union_ptr->value.type;
48824882 assert(ptr_type->id == ZigTypeIdPointer);
48834883 ZigType *err_union_type = ptr_type->data.pointer.child_type;
48844884 ZigType *payload_type = err_union_type->data.error_union.payload_type;
4885 LLVMValueRef err_union_ptr = ir_llvm_value(g, instruction->err_union);
4886 LLVMValueRef err_union_handle = get_handle_value(g, err_union_ptr, err_union_type, ptr_type);
4887
4888 if (type_has_bits(payload_type)) {
4889 LLVMValueRef err_val_ptr = LLVMBuildStructGEP(g->builder, err_union_handle, err_union_err_index, "");
4890 return gen_load_untyped(g, err_val_ptr, 0, false, "");
4885 LLVMValueRef err_union_ptr = ir_llvm_value(g, instruction->err_union_ptr);
4886 if (!type_has_bits(payload_type)) {
4887 return err_union_ptr;
48914888 } else {
4892 return err_union_handle;
4889 LLVMValueRef err_union_handle = get_handle_value(g, err_union_ptr, err_union_type, ptr_type);
4890 return LLVMBuildStructGEP(g->builder, err_union_handle, err_union_err_index, "");
48934891 }
48944892}
48954893
src/ir.cpp+75-31
......@@ -1657,6 +1657,27 @@ static IrInstruction *ir_build_typeof(IrBuilder *irb, Scope *scope, AstNode *sou
16571657 return &instruction->base;
16581658}
16591659
1660static IrInstruction *ir_build_to_ptr_type(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *ptr) {
1661 IrInstructionToPtrType *instruction = ir_build_instruction<IrInstructionToPtrType>(irb, scope, source_node);
1662 instruction->ptr = ptr;
1663
1664 ir_ref_instruction(ptr, irb->current_basic_block);
1665
1666 return &instruction->base;
1667}
1668
1669static IrInstruction *ir_build_ptr_type_child(IrBuilder *irb, Scope *scope, AstNode *source_node,
1670 IrInstruction *value)
1671{
1672 IrInstructionPtrTypeChild *instruction = ir_build_instruction<IrInstructionPtrTypeChild>(
1673 irb, scope, source_node);
1674 instruction->value = value;
1675
1676 ir_ref_instruction(value, irb->current_basic_block);
1677
1678 return &instruction->base;
1679}
1680
16601681static IrInstruction *ir_build_set_cold(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *is_cold) {
16611682 IrInstructionSetCold *instruction = ir_build_instruction<IrInstructionSetCold>(irb, scope, source_node);
16621683 instruction->is_cold = is_cold;
......@@ -2371,12 +2392,12 @@ static IrInstruction *ir_build_test_err(IrBuilder *irb, Scope *scope, AstNode *s
23712392}
23722393
23732394static IrInstruction *ir_build_unwrap_err_code(IrBuilder *irb, Scope *scope, AstNode *source_node,
2374 IrInstruction *err_union)
2395 IrInstruction *err_union_ptr)
23752396{
23762397 IrInstructionUnwrapErrCode *instruction = ir_build_instruction<IrInstructionUnwrapErrCode>(irb, scope, source_node);
2377 instruction->err_union = err_union;
2398 instruction->err_union_ptr = err_union_ptr;
23782399
2379 ir_ref_instruction(err_union, irb->current_basic_block);
2400 ir_ref_instruction(err_union_ptr, irb->current_basic_block);
23802401
23812402 return &instruction->base;
23822403}
......@@ -3505,7 +3526,8 @@ static IrInstruction *ir_gen_return(IrBuilder *irb, Scope *scope, AstNode *node,
35053526
35063527 ir_set_cursor_at_end_and_append_block(irb, return_block);
35073528 if (!ir_gen_defers_for_block(irb, scope, outer_scope, true)) {
3508 IrInstruction *err_val = ir_build_unwrap_err_code(irb, scope, node, err_union_ptr);
3529 IrInstruction *err_val_ptr = ir_build_unwrap_err_code(irb, scope, node, err_union_ptr);
3530 IrInstruction *err_val = ir_build_load_ptr(irb, scope, node, err_val_ptr);
35093531 if (irb->codegen->have_err_ret_tracing && !should_inline) {
35103532 ir_build_save_err_ret_addr(irb, scope, node);
35113533 }
......@@ -5721,11 +5743,11 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n
57215743
57225744 ir_set_cursor_at_end_and_append_block(irb, body_block);
57235745 if (var_symbol) {
5724 IrInstruction *var_ptr_value = ir_build_unwrap_err_payload(irb, payload_scope, symbol_node,
5746 IrInstruction *payload_ptr = ir_build_unwrap_err_payload(irb, payload_scope, symbol_node,
57255747 err_val_ptr, false);
5726 IrInstruction *var_value = node->data.while_expr.var_is_ptr ?
5727 var_ptr_value : ir_build_load_ptr(irb, payload_scope, symbol_node, var_ptr_value);
5728 ir_build_var_decl_src(irb, payload_scope, symbol_node, payload_var, nullptr, var_value);
5748 IrInstruction *var_ptr = node->data.while_expr.var_is_ptr ?
5749 ir_build_ref(irb, payload_scope, symbol_node, payload_ptr, true, false) : payload_ptr;
5750 ir_build_var_decl_src(irb, payload_scope, symbol_node, payload_var, nullptr, var_ptr);
57295751 }
57305752
57315753 ZigList<IrInstruction *> incoming_values = {0};
......@@ -5766,8 +5788,8 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n
57665788 ZigVar *err_var = ir_create_var(irb, err_symbol_node, scope, err_symbol,
57675789 true, false, false, is_comptime);
57685790 Scope *err_scope = err_var->child_scope;
5769 IrInstruction *err_var_value = ir_build_unwrap_err_code(irb, err_scope, err_symbol_node, err_val_ptr);
5770 ir_build_var_decl_src(irb, err_scope, symbol_node, err_var, nullptr, err_var_value);
5791 IrInstruction *err_ptr = ir_build_unwrap_err_code(irb, err_scope, err_symbol_node, err_val_ptr);
5792 ir_build_var_decl_src(irb, err_scope, symbol_node, err_var, nullptr, err_ptr);
57715793
57725794 IrInstruction *else_result = ir_gen_node(irb, else_node, err_scope);
57735795 if (else_result == irb->codegen->invalid_instruction)
......@@ -5808,10 +5830,10 @@ static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *n
58085830 }
58095831
58105832 ir_set_cursor_at_end_and_append_block(irb, body_block);
5811 IrInstruction *var_ptr_value = ir_build_optional_unwrap_ptr(irb, child_scope, symbol_node, maybe_val_ptr, false);
5812 IrInstruction *var_value = node->data.while_expr.var_is_ptr ?
5813 var_ptr_value : ir_build_load_ptr(irb, child_scope, symbol_node, var_ptr_value);
5814 ir_build_var_decl_src(irb, child_scope, symbol_node, payload_var, nullptr, var_value);
5833 IrInstruction *payload_ptr = ir_build_optional_unwrap_ptr(irb, child_scope, symbol_node, maybe_val_ptr, false);
5834 IrInstruction *var_ptr = node->data.while_expr.var_is_ptr ?
5835 ir_build_ref(irb, child_scope, symbol_node, payload_ptr, true, false) : payload_ptr;
5836 ir_build_var_decl_src(irb, child_scope, symbol_node, payload_var, nullptr, var_ptr);
58155837
58165838 ZigList<IrInstruction *> incoming_values = {0};
58175839 ZigList<IrBasicBlock *> incoming_blocks = {0};
......@@ -5953,6 +5975,15 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo
59535975 if (array_val_ptr == irb->codegen->invalid_instruction)
59545976 return array_val_ptr;
59555977
5978 IrInstruction *pointer_type = ir_build_to_ptr_type(irb, parent_scope, array_node, array_val_ptr);
5979
5980 IrInstruction *elem_var_type;
5981 if (node->data.for_expr.elem_is_ptr) {
5982 elem_var_type = pointer_type;
5983 } else {
5984 elem_var_type = ir_build_ptr_type_child(irb, parent_scope, elem_node, pointer_type);
5985 }
5986
59565987 IrInstruction *is_comptime = ir_build_const_bool(irb, parent_scope, node,
59575988 ir_should_inline(irb->exec, parent_scope) || node->data.for_expr.is_inline);
59585989
......@@ -5961,8 +5992,9 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo
59615992 ZigVar *elem_var = ir_create_var(irb, elem_node, parent_scope, elem_var_name, true, false, false, is_comptime);
59625993 Scope *child_scope = elem_var->child_scope;
59635994
5964 IrInstruction *undefined_value = ir_build_const_undefined(irb, child_scope, elem_node);
5965 ir_build_var_decl_src(irb, child_scope, elem_node, elem_var, nullptr, undefined_value);
5995 IrInstruction *undef = ir_build_const_undefined(irb, parent_scope, elem_node);
5996 IrInstruction *undef_elem_var_type = ir_build_implicit_cast(irb, parent_scope, elem_node, elem_var_type, undef);
5997 ir_build_var_decl_src(irb, child_scope, elem_node, elem_var, nullptr, undef_elem_var_type);
59665998 IrInstruction *elem_var_ptr = ir_build_var_ptr(irb, child_scope, node, elem_var);
59675999
59686000 AstNode *index_var_source_node;
......@@ -6475,8 +6507,8 @@ static IrInstruction *ir_gen_if_err_expr(IrBuilder *irb, Scope *scope, AstNode *
64756507 ZigVar *var = ir_create_var(irb, node, subexpr_scope,
64766508 err_symbol, is_const, is_const, is_shadowable, is_comptime);
64776509
6478 IrInstruction *var_value = ir_build_unwrap_err_code(irb, subexpr_scope, node, err_val_ptr);
6479 ir_build_var_decl_src(irb, subexpr_scope, node, var, nullptr, var_value);
6510 IrInstruction *err_ptr = ir_build_unwrap_err_code(irb, subexpr_scope, node, err_val_ptr);
6511 ir_build_var_decl_src(irb, subexpr_scope, node, var, nullptr, err_ptr);
64806512 err_var_scope = var->child_scope;
64816513 } else {
64826514 err_var_scope = subexpr_scope;
......@@ -7004,8 +7036,8 @@ static IrInstruction *ir_gen_catch(IrBuilder *irb, Scope *parent_scope, AstNode
70047036 ZigVar *var = ir_create_var(irb, node, parent_scope, var_name,
70057037 is_const, is_const, is_shadowable, is_comptime);
70067038 err_scope = var->child_scope;
7007 IrInstruction *err_val = ir_build_unwrap_err_code(irb, err_scope, node, err_union_ptr);
7008 ir_build_var_decl_src(irb, err_scope, var_node, var, nullptr, err_val);
7039 IrInstruction *err_ptr = ir_build_unwrap_err_code(irb, err_scope, node, err_union_ptr);
7040 ir_build_var_decl_src(irb, err_scope, var_node, var, nullptr, err_ptr);
70097041 } else {
70107042 err_scope = parent_scope;
70117043 }
......@@ -7482,7 +7514,7 @@ static IrInstruction *ir_gen_await_expr(IrBuilder *irb, Scope *scope, AstNode *n
74827514
74837515 IrInstruction *promise_type_val = ir_build_const_type(irb, scope, node, irb->codegen->builtin_types.entry_promise);
74847516 IrInstruction *const_bool_false = ir_build_const_bool(irb, scope, node, false);
7485 IrInstruction *undefined_value = ir_build_const_undefined(irb, scope, node);
7517 IrInstruction *undef = ir_build_const_undefined(irb, scope, node);
74867518 IrInstruction *usize_type_val = ir_build_const_type(irb, scope, node, irb->codegen->builtin_types.entry_usize);
74877519 IrInstruction *zero = ir_build_const_usize(irb, scope, node, 0);
74887520 IrInstruction *inverted_ptr_mask = ir_build_const_usize(irb, scope, node, 0x7); // 0b111
......@@ -7496,7 +7528,8 @@ static IrInstruction *ir_gen_await_expr(IrBuilder *irb, Scope *scope, AstNode *n
74967528 IrInstruction *target_promise_type = ir_build_typeof(irb, scope, node, target_inst);
74977529 IrInstruction *promise_result_type = ir_build_promise_result_type(irb, scope, node, target_promise_type);
74987530 ir_build_await_bookkeeping(irb, scope, node, promise_result_type);
7499 ir_build_var_decl_src(irb, scope, node, result_var, nullptr, undefined_value);
7531 IrInstruction *undef_promise_result = ir_build_implicit_cast(irb, scope, node, promise_result_type, undef);
7532 ir_build_var_decl_src(irb, scope, node, result_var, nullptr, undef_promise_result);
75007533 IrInstruction *my_result_var_ptr = ir_build_var_ptr(irb, scope, node, result_var);
75017534 ir_build_store_ptr(irb, scope, node, result_ptr_field_ptr, my_result_var_ptr);
75027535 IrInstruction *save_token = ir_build_coro_save(irb, scope, node, irb->exec->coro_handle);
......@@ -7928,12 +7961,18 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec
79287961 return_type = fn_entry->type_entry->data.fn.fn_type_id.return_type;
79297962 IrInstruction *undef = ir_build_const_undefined(irb, coro_scope, node);
79307963 // TODO mark this var decl as "no safety" e.g. disable initializing the undef value to 0xaa
7931 ir_build_var_decl_src(irb, coro_scope, node, promise_var, nullptr, undef);
7964 ZigType *coro_frame_type = get_promise_frame_type(irb->codegen, return_type);
7965 IrInstruction *coro_frame_type_value = ir_build_const_type(irb, coro_scope, node, coro_frame_type);
7966 IrInstruction *undef_coro_frame = ir_build_implicit_cast(irb, coro_scope, node, coro_frame_type_value, undef);
7967 ir_build_var_decl_src(irb, coro_scope, node, promise_var, nullptr, undef_coro_frame);
79327968 coro_promise_ptr = ir_build_var_ptr(irb, coro_scope, node, promise_var);
79337969
79347970 ZigVar *await_handle_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
79357971 IrInstruction *null_value = ir_build_const_null(irb, coro_scope, node);
7936 ir_build_var_decl_src(irb, coro_scope, node, await_handle_var, nullptr, null_value);
7972 IrInstruction *await_handle_type_val = ir_build_const_type(irb, coro_scope, node,
7973 get_optional_type(irb->codegen, irb->codegen->builtin_types.entry_promise));
7974 IrInstruction *null_await_handle = ir_build_implicit_cast(irb, coro_scope, node, await_handle_type_val, null_value);
7975 ir_build_var_decl_src(irb, coro_scope, node, await_handle_var, nullptr, null_await_handle);
79377976 irb->exec->await_handle_var_ptr = ir_build_var_ptr(irb, coro_scope, node, await_handle_var);
79387977
79397978 u8_ptr_type = ir_build_const_type(irb, coro_scope, node,
......@@ -13872,7 +13911,8 @@ static IrInstruction *ir_analyze_instruction_decl_var(IrAnalyze *ira,
1387213911 return ira->codegen->invalid_instruction;
1387313912 }
1387413913
13875 assert(var_ptr->value.type->id == ZigTypeIdPointer);
13914 // The ir_build_var_decl_src call is supposed to pass a pointer to the allocation, not an initialization value.
13915 ir_assert(var_ptr->value.type->id == ZigTypeIdPointer, &decl_var_instruction->base);
1387613916
1387713917 ZigType *result_type = var_ptr->value.type->data.pointer.child_type;
1387813918 if (type_is_invalid(result_type)) {
......@@ -21526,13 +21566,14 @@ static IrInstruction *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruct
2152621566}
2152721567
2152821568static IrInstruction *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, IrInstructionUnwrapErrCode *instruction) {
21529 IrInstruction *base_ptr = instruction->err_union->child;
21569 IrInstruction *base_ptr = instruction->err_union_ptr->child;
2153021570 if (type_is_invalid(base_ptr->value.type))
2153121571 return ira->codegen->invalid_instruction;
2153221572 ZigType *ptr_type = base_ptr->value.type;
2153321573
2153421574 // This will be a pointer type because unwrap err payload IR instruction operates on a pointer to a thing.
2153521575 assert(ptr_type->id == ZigTypeIdPointer);
21576 bool is_ptr_const = ptr_type->data.pointer.is_const;
2153621577
2153721578 ZigType *type_entry = ptr_type->data.pointer.child_type;
2153821579 if (type_is_invalid(type_entry))
......@@ -21554,19 +21595,22 @@ static IrInstruction *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, IrI
2155421595 return ira->codegen->invalid_instruction;
2155521596 if (err_union_val->special != ConstValSpecialRuntime) {
2155621597 ErrorTableEntry *err = err_union_val->data.x_err_union.error_set->data.x_err_set;
21557 assert(err);
21598 assert(err != nullptr);
2155821599
21559 IrInstruction *result = ir_const(ira, &instruction->base,
21600 IrInstruction *err_set_val = ir_const(ira, &instruction->base,
2156021601 type_entry->data.error_union.err_set_type);
21561 result->value.data.x_err_set = err;
21562 return result;
21602 err_set_val->value.data.x_err_set = err;
21603 err_set_val->value.parent.id = ConstParentIdErrUnionCode;
21604 err_set_val->value.parent.data.p_err_union_code.err_union_val = err_union_val;
21605
21606 return ir_get_ref(ira, &instruction->base, err_set_val, is_ptr_const, false);
2156321607 }
2156421608 }
2156521609 }
2156621610
2156721611 IrInstruction *result = ir_build_unwrap_err_code(&ira->new_irb,
2156821612 instruction->base.scope, instruction->base.source_node, base_ptr);
21569 result->value.type = type_entry->data.error_union.err_set_type;
21613 result->value.type = get_pointer_to_type(ira->codegen, type_entry->data.error_union.err_set_type, is_ptr_const);
2157021614 return result;
2157121615}
2157221616
src/ir_print.cpp+1-1
......@@ -957,7 +957,7 @@ static void ir_print_test_err(IrPrint *irp, IrInstructionTestErr *instruction) {
957957
958958static void ir_print_unwrap_err_code(IrPrint *irp, IrInstructionUnwrapErrCode *instruction) {
959959 fprintf(irp->f, "UnwrapErrorCode(");
960 ir_print_other_instruction(irp, instruction->err_union);
960 ir_print_other_instruction(irp, instruction->err_union_ptr);
961961 fprintf(irp->f, ")");
962962}
963963