Skip to content

Commit

Permalink
change index of Sret attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenzek committed May 5, 2022
1 parent 09ff375 commit 09ff3a4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/zig_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,10 +1066,8 @@ void ZigLLVMAddByValAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_v

void ZigLLVMAddSretAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_val) {
Function *func = unwrap<Function>(fn_ref);
AttrBuilder attr_builder(func->getContext());
Type *llvm_type = unwrap<Type>(type_val);
attr_builder.addStructRetAttr(llvm_type);
func->addParamAttrs(ArgNo + 1, attr_builder);
func->addParamAttr(ArgNo, Attribute::getWithStructRetType(func->getContext(), llvm_type));
}

void ZigLLVMAddFunctionAttr(LLVMValueRef fn_ref, const char *attr_name, const char *attr_value) {
Expand Down Expand Up @@ -1174,7 +1172,7 @@ void ZigLLVMSetTailCall(LLVMValueRef Call) {
void ZigLLVMSetCallSret(LLVMValueRef Call, LLVMTypeRef return_type) {
CallInst *call_inst = unwrap<CallInst>(Call);
Type *llvm_type = unwrap<Type>(return_type);
call_inst->addParamAttr(1, Attribute::getWithStructRetType(call_inst->getContext(), llvm_type));
call_inst->addParamAttr(0, Attribute::getWithStructRetType(call_inst->getContext(), llvm_type));
}

void ZigLLVMFunctionSetPrefixData(LLVMValueRef function, LLVMValueRef data) {
Expand Down

0 comments on commit 09ff3a4

Please sign in to comment.