@@ -2568,6 +2568,11 @@ static LLVMValueRef ir_render_elem_ptr(CodeGen *g, IrExecutable *executable, IrI
2568
2568
}
2569
2569
}
2570
2570
2571
+ static bool get_prefix_arg_err_ret_stack (CodeGen *g, TypeTableEntry *src_return_type) {
2572
+ return g->have_err_ret_tracing &&
2573
+ (src_return_type->id == TypeTableEntryIdErrorUnion || src_return_type->id == TypeTableEntryIdErrorSet);
2574
+ }
2575
+
2571
2576
static LLVMValueRef ir_render_call (CodeGen *g, IrExecutable *executable, IrInstructionCall *instruction) {
2572
2577
LLVMValueRef fn_val;
2573
2578
TypeTableEntry *fn_type;
@@ -2587,7 +2592,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
2587
2592
2588
2593
bool first_arg_ret = ret_has_bits && handle_is_ptr (src_return_type) &&
2589
2594
calling_convention_does_first_arg_return (fn_type->data .fn .fn_type_id .cc );
2590
- bool prefix_arg_err_ret_stack = g-> have_err_ret_tracing && ( src_return_type-> id == TypeTableEntryIdErrorUnion || src_return_type-> id == TypeTableEntryIdErrorSet );
2595
+ bool prefix_arg_err_ret_stack = get_prefix_arg_err_ret_stack (g, src_return_type);
2591
2596
size_t actual_param_count = instruction->arg_count + (first_arg_ret ? 1 : 0 ) + (prefix_arg_err_ret_stack ? 1 : 0 );
2592
2597
bool is_var_args = fn_type_id->is_var_args ;
2593
2598
LLVMValueRef *gen_param_values = allocate<LLVMValueRef>(actual_param_count);
@@ -3178,8 +3183,13 @@ static LLVMValueRef ir_render_cancel(CodeGen *g, IrExecutable *executable, IrIns
3178
3183
return nullptr ;
3179
3184
}
3180
3185
3181
- static LLVMValueRef ir_render_get_implicit_allocator (CodeGen *g, IrExecutable *executable, IrInstructionGetImplicitAllocator *instruction) {
3182
- zig_panic (" TODO ir_render_get_implicit_allocator" );
3186
+ static LLVMValueRef ir_render_get_implicit_allocator (CodeGen *g, IrExecutable *executable,
3187
+ IrInstructionGetImplicitAllocator *instruction)
3188
+ {
3189
+ TypeTableEntry *src_return_type = g->cur_fn ->type_entry ->data .fn .fn_type_id .return_type ;
3190
+ bool prefix_arg_err_ret_stack = get_prefix_arg_err_ret_stack (g, src_return_type);
3191
+ size_t allocator_arg_index = prefix_arg_err_ret_stack ? 1 : 0 ;
3192
+ return LLVMGetParam (g->cur_fn_val , allocator_arg_index);
3183
3193
}
3184
3194
3185
3195
static LLVMAtomicOrdering to_LLVMAtomicOrdering (AtomicOrder atomic_order) {
0 commit comments