diff options
| author | VladPavliuk <pavliuk.vlad@gmail.com> | 2024-07-14 18:22:20 +0300 |
|---|---|---|
| committer | VladPavliuk <pavliuk.vlad@gmail.com> | 2024-07-14 18:22:20 +0300 |
| commit | 3f8712edb03390c1eed4dced27f7c2707cf14ecb (patch) | |
| tree | a186834d911e19418836bf2ca3f52f334c11267a /src/llvm_abi.cpp | |
| parent | 79e2f63182581547dcdb7593397d1c3e280a5670 (diff) | |
| parent | e7d37607ef9ce54a80d83230150874b71d628d6d (diff) | |
Merge branch 'master' into json-add-int-key-map-support
Diffstat (limited to 'src/llvm_abi.cpp')
| -rw-r--r-- | src/llvm_abi.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index b2e485d01..c21cd0a46 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -15,6 +15,7 @@ struct lbArgType { LLVMAttributeRef align_attribute; // Optional i64 byval_alignment; bool is_byval; + bool no_capture; }; @@ -159,6 +160,11 @@ gb_internal void lb_add_function_type_attributes(LLVMValueRef fn, lbFunctionType LLVMAddAttributeAtIndex(fn, arg_index+1, arg->align_attribute); } + if (arg->no_capture) { + LLVMAddAttributeAtIndex(fn, arg_index+1, nocapture_attr); + } + + if (ft->multiple_return_original_type) { if (ft->original_arg_count <= i) { LLVMAddAttributeAtIndex(fn, arg_index+1, noalias_attr); @@ -645,10 +651,10 @@ namespace lbAbiAmd64SysV { if (is_mem_cls(cls, attribute_kind)) { LLVMAttributeRef attribute = nullptr; if (attribute_kind == Amd64TypeAttribute_ByVal) { - // if (!is_calling_convention_odin(calling_convention)) { - return lb_arg_type_indirect_byval(c, type); - // } - // attribute = nullptr; + if (is_calling_convention_odin(calling_convention)) { + return lb_arg_type_indirect(type, attribute); + } + return lb_arg_type_indirect_byval(c, type); } else if (attribute_kind == Amd64TypeAttribute_StructRect) { attribute = lb_create_enum_attribute_with_type(c, "sret", type); } |