diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2024-07-10 13:22:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-10 13:22:57 +0100 |
| commit | 34c6868e7836cc24cca1c8fed84bfc5af20e8843 (patch) | |
| tree | 356416949eac66091b1742c612dd6ddc4ad42cb1 /src/llvm_backend_general.cpp | |
| parent | 38315f83dad49d89277fc3ba459b6e7c28ff098e (diff) | |
| parent | 2d8d0dd8515a4598d6e027f28818614c117ae0c4 (diff) | |
Merge pull request #3895 from laytan/fix-optimization-mode-attribute
remove misleading @(optimization_mode) values and make "none" inhibit optimizations
Diffstat (limited to 'src/llvm_backend_general.cpp')
| -rw-r--r-- | src/llvm_backend_general.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp index bbeff562c..b50ba746a 100644 --- a/src/llvm_backend_general.cpp +++ b/src/llvm_backend_general.cpp @@ -2523,6 +2523,12 @@ gb_internal void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, cha gb_internal void lb_add_attribute_to_proc(lbModule *m, LLVMValueRef proc_value, char const *name, u64 value=0) { LLVMAddAttributeAtIndex(proc_value, LLVMAttributeIndex_FunctionIndex, lb_create_enum_attribute(m->ctx, name, value)); } + +gb_internal bool lb_proc_has_attribute(lbModule *m, LLVMValueRef proc_value, char const *name) { + LLVMAttributeRef ref = LLVMGetEnumAttributeAtIndex(proc_value, LLVMAttributeIndex_FunctionIndex, LLVMGetEnumAttributeKindForName(name, gb_strlen(name))); + return ref != nullptr; +} + gb_internal void lb_add_attribute_to_proc_with_string(lbModule *m, LLVMValueRef proc_value, String const &name, String const &value) { LLVMAttributeRef attr = lb_create_string_attribute(m->ctx, name, value); LLVMAddAttributeAtIndex(proc_value, LLVMAttributeIndex_FunctionIndex, attr); |