diff options
| author | gingerBill <bill@gingerbill.org> | 2024-02-27 15:40:45 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-02-27 15:40:45 +0000 |
| commit | 5137d12d36e8631201bbf4fcb8ebacd24e7cc4c5 (patch) | |
| tree | c01d449724b463a47f7cb798a9c8bdf7183c55ed /src | |
| parent | c6ee025063b0b64c8e14cdda702477436b921415 (diff) | |
Fix `lb_type_info` for the new layout
Diffstat (limited to 'src')
| -rw-r--r-- | src/llvm_backend_type.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/llvm_backend_type.cpp b/src/llvm_backend_type.cpp index 336678ce9..881ac3119 100644 --- a/src/llvm_backend_type.cpp +++ b/src/llvm_backend_type.cpp @@ -119,8 +119,14 @@ gb_internal lbValue lb_type_info(lbModule *m, Type *type) { isize index = lb_type_info_index(m->info, type); GB_ASSERT(index >= 0); - lbValue data = lb_global_type_info_data_ptr(m); - return lb_emit_array_epi(m, data, index); + LLVMValueRef global = lb_global_type_info_data_ptr(m).value; + + LLVMValueRef global_array = LLVMGetInitializer(global); + LLVMValueRef index_value = LLVMConstInt(lb_type(m, t_int), index, false); + lbValue res = {}; + res.value = LLVMConstPointerCast(LLVMConstExtractElement(global_array, index_value), lb_type(m, t_type_info_ptr)); + res.type = t_type_info_ptr; + return res; } gb_internal LLVMTypeRef lb_get_procedure_raw_type(lbModule *m, Type *type) { |