aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_utility.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2023-09-28 16:01:26 +0100
committerGitHub <noreply@github.com>2023-09-28 16:01:26 +0100
commit77227c2ff552a81741130ae17d58847c3cfe3ba3 (patch)
treee690e5feae8aad170ce4d18bc11c279ec23cce45 /src/llvm_backend_utility.cpp
parent2370884722c9638cf0ba3916a8a54247096bb4f6 (diff)
parent2afccd7fbdb3a7c440597356fa4c9d635a06a8d2 (diff)
Merge pull request #2805 from odin-lang/llvm-17
Support LLVM 17.0.1
Diffstat (limited to 'src/llvm_backend_utility.cpp')
-rw-r--r--src/llvm_backend_utility.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp
index 8dd6b14b6..d8dbfd736 100644
--- a/src/llvm_backend_utility.cpp
+++ b/src/llvm_backend_utility.cpp
@@ -980,12 +980,12 @@ gb_internal LLVMTypeRef lb_type_padding_filler(lbModule *m, i64 padding, i64 pad
GB_ASSERT_MSG(elem != nullptr, "Invalid lb_type_padding_filler padding and padding_align: %lld", padding_align);
if (len != 1) {
- return LLVMArrayType(elem, cast(unsigned)len);
+ return llvm_array_type(elem, len);
} else {
return elem;
}
} else {
- return LLVMArrayType(lb_type(m, t_u8), cast(unsigned)padding);
+ return llvm_array_type(lb_type(m, t_u8), padding);
}
}
@@ -1437,6 +1437,17 @@ gb_internal lbValue lb_emit_ptr_offset(lbProcedure *p, lbValue ptr, lbValue inde
return res;
}
+gb_internal lbValue lb_const_ptr_offset(lbModule *m, lbValue ptr, lbValue index) {
+ LLVMValueRef indices[1] = {index.value};
+ lbValue res = {};
+ res.type = ptr.type;
+ LLVMTypeRef type = lb_type(m, type_deref(res.type, true));
+
+ GB_ASSERT(lb_is_const(ptr) && lb_is_const(index));
+ res.value = LLVMConstGEP2(type, ptr.value, indices, 1);
+ return res;
+}
+
gb_internal lbValue lb_emit_matrix_epi(lbProcedure *p, lbValue s, isize row, isize column) {
Type *t = s.type;
GB_ASSERT(is_type_pointer(t));