diff options
| author | gingerBill <bill@gingerbill.org> | 2023-09-22 14:39:51 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-09-22 14:39:51 +0100 |
| commit | 082324d7b97e521f5d8dada40629da4e689197c9 (patch) | |
| tree | 6a7e993cd7a7d9428732db3568ae755b73d428c9 /src/llvm_backend_utility.cpp | |
| parent | 5e99289d7afd34cf785b15f727ed2f2d61aa6ffc (diff) | |
Begin work on making the type info table be constantly initialized
Diffstat (limited to 'src/llvm_backend_utility.cpp')
| -rw-r--r-- | src/llvm_backend_utility.cpp | 15 |
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)); |