| ... | @@ -4209,15 +4209,19 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr | ... | @@ -4209,15 +4209,19 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 4209 | } else if (instruction->modifier == CallModifierAsync) { | 4209 | } else if (instruction->modifier == CallModifierAsync) { |
| 4210 | zig_panic("TODO @asyncCall of non-async function"); | 4210 | zig_panic("TODO @asyncCall of non-async function"); |
| 4211 | } else { | 4211 | } else { |
| 4212 | LLVMValueRef stacksave_fn_val = get_stacksave_fn_val(g); | | |
| 4213 | LLVMValueRef stackrestore_fn_val = get_stackrestore_fn_val(g); | | |
| 4214 | | | |
| 4215 | LLVMValueRef new_stack_addr = get_new_stack_addr(g, ir_llvm_value(g, instruction->new_stack)); | 4212 | LLVMValueRef new_stack_addr = get_new_stack_addr(g, ir_llvm_value(g, instruction->new_stack)); |
| 4216 | LLVMValueRef old_stack_ref = LLVMBuildCall(g->builder, stacksave_fn_val, nullptr, 0, ""); | 4213 | LLVMValueRef old_stack_ref; |
| | 4214 | if (src_return_type->id != ZigTypeIdUnreachable) { |
| | 4215 | LLVMValueRef stacksave_fn_val = get_stacksave_fn_val(g); |
| | 4216 | old_stack_ref = LLVMBuildCall(g->builder, stacksave_fn_val, nullptr, 0, ""); |
| | 4217 | } |
| 4217 | gen_set_stack_pointer(g, new_stack_addr); | 4218 | gen_set_stack_pointer(g, new_stack_addr); |
| 4218 | result = ZigLLVMBuildCall(g->builder, fn_val, | 4219 | result = ZigLLVMBuildCall(g->builder, fn_val, |
| 4219 | gen_param_values.items, (unsigned)gen_param_values.length, llvm_cc, fn_inline, ""); | 4220 | gen_param_values.items, (unsigned)gen_param_values.length, llvm_cc, fn_inline, ""); |
| 4220 | LLVMBuildCall(g->builder, stackrestore_fn_val, &old_stack_ref, 1, ""); | 4221 | if (src_return_type->id != ZigTypeIdUnreachable) { |
| | 4222 | LLVMValueRef stackrestore_fn_val = get_stackrestore_fn_val(g); |
| | 4223 | LLVMBuildCall(g->builder, stackrestore_fn_val, &old_stack_ref, 1, ""); |
| | 4224 | } |
| 4221 | } | 4225 | } |
| 4222 | | 4226 | |
| 4223 | if (src_return_type->id == ZigTypeIdUnreachable) { | 4227 | if (src_return_type->id == ZigTypeIdUnreachable) { |
| ... | @@ -10409,4 +10413,3 @@ void codegen_switch_sub_prog_node(CodeGen *g, Stage2ProgressNode *node) { | ... | @@ -10409,4 +10413,3 @@ void codegen_switch_sub_prog_node(CodeGen *g, Stage2ProgressNode *node) { |
| 10409 | } | 10413 | } |
| 10410 | g->sub_progress_node = node; | 10414 | g->sub_progress_node = node; |
| 10411 | } | 10415 | } |
| 10412 | | | |