diff options
| author | gingerBill <bill@gingerbill.org> | 2024-09-30 12:32:55 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-09-30 12:32:55 +0100 |
| commit | 4b6410e2253fb7c305c20ba1a55263cab4ec2c5a (patch) | |
| tree | 905059f32f37533c6c2aa73909825573f71a67e3 /src | |
| parent | b173fa1b9a5643d0dff68d5f780351fa21f56630 (diff) | |
ABI BREAKING for SysV: Change how multiple return values are handled to be separate like all other ABIs
Diffstat (limited to 'src')
| -rw-r--r-- | src/llvm_abi.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index d0fe541da..efc3e72c5 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -573,6 +573,15 @@ namespace lbAbiAmd64SysV { gb_internal Array<RegClass> classify(LLVMTypeRef t); gb_internal LLVMTypeRef llreg(LLVMContextRef c, Array<RegClass> const ®_classes, LLVMTypeRef type); + gb_internal LB_ABI_COMPUTE_RETURN_TYPE(compute_return_type) { + if (!return_is_defined) { + return lb_arg_type_direct(LLVMVoidTypeInContext(c)); + } + LB_ABI_MODIFY_RETURN_IF_TUPLE_MACRO(); + + return amd64_type(c, return_type, Amd64TypeAttribute_StructRect, ft->calling_convention); + } + gb_internal LB_ABI_INFO(abi_info) { LLVMContextRef c = m->ctx; lbFunctionType *ft = gb_alloc_item(permanent_allocator(), lbFunctionType); @@ -583,12 +592,7 @@ namespace lbAbiAmd64SysV { for (unsigned i = 0; i < arg_count; i++) { ft->args[i] = amd64_type(c, arg_types[i], Amd64TypeAttribute_ByVal, calling_convention); } - - if (return_is_defined) { - ft->ret = amd64_type(c, return_type, Amd64TypeAttribute_StructRect, calling_convention); - } else { - ft->ret = lb_arg_type_direct(LLVMVoidTypeInContext(c)); - } + ft->ret = compute_return_type(ft, c, return_type, return_is_defined, return_is_tuple); return ft; } |