| ... | @@ -1575,14 +1575,14 @@ static LLVMRealPredicate cmp_op_to_real_predicate(IrBinOp cmp_op) { | ... | @@ -1575,14 +1575,14 @@ static LLVMRealPredicate cmp_op_to_real_predicate(IrBinOp cmp_op) { |
| 1575 | } | 1575 | } |
| 1576 | } | 1576 | } |
| 1577 | | 1577 | |
| 1578 | static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type, | 1578 | static void gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type, |
| 1579 | LLVMValueRef value) | 1579 | LLVMValueRef value) |
| 1580 | { | 1580 | { |
| 1581 | assert(ptr_type->id == ZigTypeIdPointer); | 1581 | assert(ptr_type->id == ZigTypeIdPointer); |
| 1582 | ZigType *child_type = ptr_type->data.pointer.child_type; | 1582 | ZigType *child_type = ptr_type->data.pointer.child_type; |
| 1583 | | 1583 | |
| 1584 | if (!type_has_bits(child_type)) | 1584 | if (!type_has_bits(child_type)) |
| 1585 | return nullptr; | 1585 | return; |
| 1586 | | 1586 | |
| 1587 | if (handle_is_ptr(child_type)) { | 1587 | if (handle_is_ptr(child_type)) { |
| 1588 | assert(LLVMGetTypeKind(LLVMTypeOf(value)) == LLVMPointerTypeKind); | 1588 | assert(LLVMGetTypeKind(LLVMTypeOf(value)) == LLVMPointerTypeKind); |
| ... | @@ -1602,13 +1602,13 @@ static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_ty | ... | @@ -1602,13 +1602,13 @@ static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_ty |
| 1602 | ZigLLVMBuildMemCpy(g->builder, dest_ptr, align_bytes, src_ptr, align_bytes, | 1602 | ZigLLVMBuildMemCpy(g->builder, dest_ptr, align_bytes, src_ptr, align_bytes, |
| 1603 | LLVMConstInt(usize->llvm_type, size_bytes, false), | 1603 | LLVMConstInt(usize->llvm_type, size_bytes, false), |
| 1604 | ptr_type->data.pointer.is_volatile); | 1604 | ptr_type->data.pointer.is_volatile); |
| 1605 | return nullptr; | 1605 | return; |
| 1606 | } | 1606 | } |
| 1607 | | 1607 | |
| 1608 | uint32_t host_int_bytes = ptr_type->data.pointer.host_int_bytes; | 1608 | uint32_t host_int_bytes = ptr_type->data.pointer.host_int_bytes; |
| 1609 | if (host_int_bytes == 0) { | 1609 | if (host_int_bytes == 0) { |
| 1610 | gen_store(g, value, ptr, ptr_type); | 1610 | gen_store(g, value, ptr, ptr_type); |
| 1611 | return nullptr; | 1611 | return; |
| 1612 | } | 1612 | } |
| 1613 | | 1613 | |
| 1614 | bool big_endian = g->is_big_endian; | 1614 | bool big_endian = g->is_big_endian; |
| ... | @@ -1638,7 +1638,7 @@ static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_ty | ... | @@ -1638,7 +1638,7 @@ static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_ty |
| 1638 | LLVMValueRef ored_value = LLVMBuildOr(g->builder, shifted_value, anded_containing_int, ""); | 1638 | LLVMValueRef ored_value = LLVMBuildOr(g->builder, shifted_value, anded_containing_int, ""); |
| 1639 | | 1639 | |
| 1640 | gen_store(g, ored_value, ptr, ptr_type); | 1640 | gen_store(g, ored_value, ptr, ptr_type); |
| 1641 | return nullptr; | 1641 | return; |
| 1642 | } | 1642 | } |
| 1643 | | 1643 | |
| 1644 | static void gen_var_debug_decl(CodeGen *g, ZigVar *var) { | 1644 | static void gen_var_debug_decl(CodeGen *g, ZigVar *var) { |
| ... | @@ -1958,6 +1958,7 @@ void walk_function_params(CodeGen *g, ZigType *fn_type, FnWalk *fn_walk) { | ... | @@ -1958,6 +1958,7 @@ void walk_function_params(CodeGen *g, ZigType *fn_type, FnWalk *fn_walk) { |
| 1958 | LLVMValueRef param_value = ir_llvm_value(g, param_instruction); | 1958 | LLVMValueRef param_value = ir_llvm_value(g, param_instruction); |
| 1959 | assert(param_value); | 1959 | assert(param_value); |
| 1960 | fn_walk->data.call.gen_param_values->append(param_value); | 1960 | fn_walk->data.call.gen_param_values->append(param_value); |
| | 1961 | fn_walk->data.call.gen_param_types->append(param_type); |
| 1961 | } | 1962 | } |
| 1962 | } | 1963 | } |
| 1963 | return; | 1964 | return; |
| ... | @@ -3821,6 +3822,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr | ... | @@ -3821,6 +3822,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 3821 | bool prefix_arg_err_ret_stack = codegen_fn_has_err_ret_tracing_arg(g, fn_type_id->return_type); | 3822 | bool prefix_arg_err_ret_stack = codegen_fn_has_err_ret_tracing_arg(g, fn_type_id->return_type); |
| 3822 | bool is_var_args = fn_type_id->is_var_args; | 3823 | bool is_var_args = fn_type_id->is_var_args; |
| 3823 | ZigList<LLVMValueRef> gen_param_values = {}; | 3824 | ZigList<LLVMValueRef> gen_param_values = {}; |
| | 3825 | ZigList<ZigType *> gen_param_types = {}; |
| 3824 | LLVMValueRef result_loc = instruction->result_loc ? ir_llvm_value(g, instruction->result_loc) : nullptr; | 3826 | LLVMValueRef result_loc = instruction->result_loc ? ir_llvm_value(g, instruction->result_loc) : nullptr; |
| 3825 | LLVMValueRef zero = LLVMConstNull(usize_type_ref); | 3827 | LLVMValueRef zero = LLVMConstNull(usize_type_ref); |
| 3826 | LLVMValueRef frame_result_loc; | 3828 | LLVMValueRef frame_result_loc; |
| ... | @@ -3923,6 +3925,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr | ... | @@ -3923,6 +3925,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 3923 | fn_walk.data.call.inst = instruction; | 3925 | fn_walk.data.call.inst = instruction; |
| 3924 | fn_walk.data.call.is_var_args = is_var_args; | 3926 | fn_walk.data.call.is_var_args = is_var_args; |
| 3925 | fn_walk.data.call.gen_param_values = &gen_param_values; | 3927 | fn_walk.data.call.gen_param_values = &gen_param_values; |
| | 3928 | fn_walk.data.call.gen_param_types = &gen_param_types; |
| 3926 | walk_function_params(g, fn_type, &fn_walk); | 3929 | walk_function_params(g, fn_type, &fn_walk); |
| 3927 | | 3930 | |
| 3928 | ZigLLVM_FnInline fn_inline; | 3931 | ZigLLVM_FnInline fn_inline; |
| ... | @@ -3964,7 +3967,8 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr | ... | @@ -3964,7 +3967,8 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 3964 | | 3967 | |
| 3965 | for (size_t arg_i = 0; arg_i < gen_param_values.length; arg_i += 1) { | 3968 | for (size_t arg_i = 0; arg_i < gen_param_values.length; arg_i += 1) { |
| 3966 | LLVMValueRef arg_ptr = LLVMBuildStructGEP(g->builder, casted_frame, arg_start_i + arg_i, ""); | 3969 | LLVMValueRef arg_ptr = LLVMBuildStructGEP(g->builder, casted_frame, arg_start_i + arg_i, ""); |
| 3967 | LLVMBuildStore(g->builder, gen_param_values.at(arg_i), arg_ptr); | 3970 | gen_assign_raw(g, arg_ptr, get_pointer_to_type(g, gen_param_types.at(arg_i), true), |
| | 3971 | gen_param_values.at(arg_i)); |
| 3968 | } | 3972 | } |
| 3969 | } | 3973 | } |
| 3970 | if (instruction->is_async) { | 3974 | if (instruction->is_async) { |