stage1: Fix emission of sret annotation for LLVM

LLVM12 deprecated `sret` and replaced it with the `sret(<Ty>)` form.

Closes #8075
This commit is contained in:
LemonBoy
2021-02-26 15:24:08 +01:00
committed by Andrew Kelley
parent 431801707f
commit b706b9bce7
3 changed files with 14 additions and 3 deletions

View File

@@ -549,7 +549,7 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) {
} else if (want_first_arg_sret(g, &fn_type->data.fn.fn_type_id)) {
// Sret pointers must not be address 0
addLLVMArgAttr(llvm_fn, 0, "nonnull");
addLLVMArgAttr(llvm_fn, 0, "sret");
ZigLLVMAddSretAttr(llvm_fn, 0, get_llvm_type(g, return_type));
if (cc_want_sret_attr(cc)) {
addLLVMArgAttr(llvm_fn, 0, "noalias");
}
@@ -1972,7 +1972,7 @@ static bool iter_function_params_c_abi(CodeGen *g, ZigType *fn_type, FnWalk *fn_
switch (fn_walk->id) {
case FnWalkIdAttrs:
if (abi_class != X64CABIClass_MEMORY_nobyval) {
ZigLLVMAddByValAttr(llvm_fn, fn_walk->data.attrs.gen_i + 1, get_llvm_type(g, ty));
ZigLLVMAddByValAttr(llvm_fn, fn_walk->data.attrs.gen_i, get_llvm_type(g, ty));
addLLVMArgAttrInt(llvm_fn, fn_walk->data.attrs.gen_i, "align", get_abi_alignment(g, ty));
} else if (g->zig_target->arch == ZigLLVM_aarch64 ||
g->zig_target->arch == ZigLLVM_aarch64_be)