| author | |
| committer | |
| log | 431801707fa661a70660787ee499530d093d513b |
| tree | 2bf0334734b9e2ae30a17f0af31f4066c2b8bbb5 |
| parent | 685b5c26b703d54381a74b71361816ad85ec8584 |
This reverts commit 685b5c26b703d54381a74b71361816ad85ec8584.
@LemonBoy has a better patch, so reverting this to merge that one.3 files changed, 1 insertions(+), 12 deletions(-)
src/stage1/codegen.cpp+1-1| ... | @@ -549,7 +549,7 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { | ... | @@ -549,7 +549,7 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { |
| 549 | } else if (want_first_arg_sret(g, &fn_type->data.fn.fn_type_id)) { | 549 | } else if (want_first_arg_sret(g, &fn_type->data.fn.fn_type_id)) { |
| 550 | // Sret pointers must not be address 0 | 550 | // Sret pointers must not be address 0 |
| 551 | addLLVMArgAttr(llvm_fn, 0, "nonnull"); | 551 | addLLVMArgAttr(llvm_fn, 0, "nonnull"); |
| 552 | ZigLLVMAddSRetAttr(llvm_fn, get_llvm_type(g, fn_type->data.fn.fn_type_id.return_type)); | 552 | addLLVMArgAttr(llvm_fn, 0, "sret"); |
| 553 | if (cc_want_sret_attr(cc)) { | 553 | if (cc_want_sret_attr(cc)) { |
| 554 | addLLVMArgAttr(llvm_fn, 0, "noalias"); | 554 | addLLVMArgAttr(llvm_fn, 0, "noalias"); |
| 555 | } | 555 | } |
src/zig_llvm.cpp-10| ... | @@ -802,16 +802,6 @@ void ZigLLVMAddByValAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_v | ... | @@ -802,16 +802,6 @@ void ZigLLVMAddByValAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_v |
| 802 | func->setAttributes(new_attr_set); | 802 | func->setAttributes(new_attr_set); |
| 803 | } | 803 | } |
| 804 | 804 | ||
| 805 | void ZigLLVMAddSRetAttr(LLVMValueRef fn_ref, LLVMTypeRef type_val) { | ||
| 806 | Function *func = unwrap<Function>(fn_ref); | ||
| 807 | const AttributeList attr_set = func->getAttributes(); | ||
| 808 | AttrBuilder attr_builder; | ||
| 809 | Type *llvm_type = unwrap<Type>(type_val); | ||
| 810 | attr_builder.addStructRetAttr(llvm_type); | ||
| 811 | const AttributeList new_attr_set = attr_set.addAttributes(func->getContext(), 1, attr_builder); | ||
| 812 | func->setAttributes(new_attr_set); | ||
| 813 | } | ||
| 814 | |||
| 815 | void ZigLLVMAddFunctionAttr(LLVMValueRef fn_ref, const char *attr_name, const char *attr_value) { | 805 | void ZigLLVMAddFunctionAttr(LLVMValueRef fn_ref, const char *attr_name, const char *attr_value) { |
| 816 | Function *func = unwrap<Function>(fn_ref); | 806 | Function *func = unwrap<Function>(fn_ref); |
| 817 | const AttributeList attr_set = func->getAttributes(); | 807 | const AttributeList attr_set = func->getAttributes(); |
src/zig_llvm.h-1| ... | @@ -269,7 +269,6 @@ ZIG_EXTERN_C void ZigLLVMFunctionSetCallingConv(LLVMValueRef function, enum ZigL | ... | @@ -269,7 +269,6 @@ ZIG_EXTERN_C void ZigLLVMFunctionSetCallingConv(LLVMValueRef function, enum ZigL |
| 269 | 269 | ||
| 270 | ZIG_EXTERN_C void ZigLLVMAddFunctionAttr(LLVMValueRef fn, const char *attr_name, const char *attr_value); | 270 | ZIG_EXTERN_C void ZigLLVMAddFunctionAttr(LLVMValueRef fn, const char *attr_name, const char *attr_value); |
| 271 | ZIG_EXTERN_C void ZigLLVMAddByValAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_val); | 271 | ZIG_EXTERN_C void ZigLLVMAddByValAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_val); |
| 272 | ZIG_EXTERN_C void ZigLLVMAddSRetAttr(LLVMValueRef fn_ref, LLVMTypeRef type_val); | ||
| 273 | ZIG_EXTERN_C void ZigLLVMAddFunctionAttrCold(LLVMValueRef fn); | 272 | ZIG_EXTERN_C void ZigLLVMAddFunctionAttrCold(LLVMValueRef fn); |
| 274 | 273 | ||
| 275 | ZIG_EXTERN_C void ZigLLVMParseCommandLineOptions(size_t argc, const char *const *argv); | 274 | ZIG_EXTERN_C void ZigLLVMParseCommandLineOptions(size_t argc, const char *const *argv); |