aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_utility.cpp
diff options
context:
space:
mode:
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));