| ... | @@ -3811,8 +3811,24 @@ static LLVMValueRef ir_render_coro_begin(CodeGen *g, IrExecutable *executable, I | ... | @@ -3811,8 +3811,24 @@ static LLVMValueRef ir_render_coro_begin(CodeGen *g, IrExecutable *executable, I |
| 3811 | zig_panic("TODO ir_render_coro_begin"); | 3811 | zig_panic("TODO ir_render_coro_begin"); |
| 3812 | } | 3812 | } |
| 3813 | | 3813 | |
| 3814 | static LLVMValueRef ir_render_coro_alloc_fail(CodeGen *g, IrExecutable *executable, IrInstructionCoroAllocFail *instruction) { | 3814 | static LLVMValueRef ir_render_coro_alloc_fail(CodeGen *g, IrExecutable *executable, |
| 3815 | zig_panic("TODO ir_render_coro_alloc_fail"); | 3815 | IrInstructionCoroAllocFail *instruction) |
| | 3816 | { |
| | 3817 | TypeTableEntry *src_return_type = g->cur_fn->type_entry->data.fn.fn_type_id.return_type; |
| | 3818 | bool prefix_arg_err_ret_stack = get_prefix_arg_err_ret_stack(g, src_return_type); |
| | 3819 | size_t err_code_ptr_arg_index = prefix_arg_err_ret_stack ? 2 : 1; |
| | 3820 | LLVMValueRef err_code_ptr_val = LLVMGetParam(g->cur_fn_val, err_code_ptr_arg_index); |
| | 3821 | LLVMValueRef err_code = ir_llvm_value(g, instruction->err_val); |
| | 3822 | LLVMBuildStore(g->builder, err_code, err_code_ptr_val); |
| | 3823 | |
| | 3824 | LLVMValueRef return_value; |
| | 3825 | if (ir_want_runtime_safety(g, &instruction->base)) { |
| | 3826 | return_value = LLVMConstNull(LLVMPointerType(LLVMInt8Type(), 0)); |
| | 3827 | } else { |
| | 3828 | return_value = LLVMGetUndef(LLVMPointerType(LLVMInt8Type(), 0)); |
| | 3829 | } |
| | 3830 | LLVMBuildRet(g->builder, return_value); |
| | 3831 | return nullptr; |
| 3816 | } | 3832 | } |
| 3817 | | 3833 | |
| 3818 | static LLVMValueRef ir_render_coro_suspend(CodeGen *g, IrExecutable *executable, IrInstructionCoroSuspend *instruction) { | 3834 | static LLVMValueRef ir_render_coro_suspend(CodeGen *g, IrExecutable *executable, IrInstructionCoroSuspend *instruction) { |