mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 09:24:33 +00:00
Mock out type info initialize stuff
This commit is contained in:
@@ -489,15 +489,14 @@ gb_internal bool cg_global_variables_create(cgModule *m) {
|
||||
char const *name = CG_TYPE_INFO_TYPES_NAME;
|
||||
Type *t = alloc_type_array(t_type_info_ptr, count);
|
||||
TB_Global *g = tb_global_create(m->mod, -1, name, nullptr, TB_LINKAGE_PRIVATE);
|
||||
tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count);
|
||||
tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count*2);
|
||||
cg_global_type_info_member_types = cg_addr(cg_value(g, alloc_type_pointer(t)));
|
||||
|
||||
}
|
||||
{
|
||||
char const *name = CG_TYPE_INFO_NAMES_NAME;
|
||||
Type *t = alloc_type_array(t_string, count);
|
||||
TB_Global *g = tb_global_create(m->mod, -1, name, nullptr, TB_LINKAGE_PRIVATE);
|
||||
tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count);
|
||||
tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count*2);
|
||||
cg_global_type_info_member_names = cg_addr(cg_value(g, alloc_type_pointer(t)));
|
||||
}
|
||||
{
|
||||
@@ -520,10 +519,12 @@ gb_internal bool cg_global_variables_create(cgModule *m) {
|
||||
char const *name = CG_TYPE_INFO_TAGS_NAME;
|
||||
Type *t = alloc_type_array(t_string, count);
|
||||
TB_Global *g = tb_global_create(m->mod, -1, name, nullptr, TB_LINKAGE_PRIVATE);
|
||||
tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count);
|
||||
tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count*2);
|
||||
cg_global_type_info_member_tags = cg_addr(cg_value(g, alloc_type_pointer(t)));
|
||||
}
|
||||
}
|
||||
|
||||
cg_setup_type_info_data(m);
|
||||
}
|
||||
|
||||
return already_has_entry_point;
|
||||
@@ -722,6 +723,7 @@ gb_internal String cg_get_entity_name(cgModule *m, Entity *e) {
|
||||
#include "tilde_debug.cpp"
|
||||
#include "tilde_expr.cpp"
|
||||
#include "tilde_builtin.cpp"
|
||||
#include "tilde_type_info.cpp"
|
||||
#include "tilde_proc.cpp"
|
||||
#include "tilde_stmt.cpp"
|
||||
|
||||
@@ -808,7 +810,7 @@ gb_internal bool cg_generate_code(Checker *c, LinkerData *linker_data) {
|
||||
cgModule *m = cg_module_create(c);
|
||||
defer (cg_module_destroy(m));
|
||||
|
||||
m->do_threading = true;
|
||||
m->do_threading = false;
|
||||
|
||||
TIME_SECTION("Tilde Global Variables");
|
||||
|
||||
|
||||
@@ -199,7 +199,6 @@ struct cgProcedure {
|
||||
isize split_returns_index;
|
||||
bool return_by_ptr;
|
||||
|
||||
|
||||
PtrMap<Entity *, cgAddr> variable_map;
|
||||
};
|
||||
|
||||
@@ -255,6 +254,7 @@ gb_global isize cg_global_type_info_member_tags_index = 0;
|
||||
gb_internal TB_Arena *cg_arena(void);
|
||||
|
||||
gb_internal void cg_add_procedure_to_queue(cgProcedure *p);
|
||||
gb_internal void cg_setup_type_info_data(cgModule *m);
|
||||
|
||||
gb_internal cgValue cg_value(TB_Global * g, Type *type);
|
||||
gb_internal cgValue cg_value(TB_External *e, Type *type);
|
||||
|
||||
BIN
src/tilde/tb.lib
BIN
src/tilde/tb.lib
Binary file not shown.
27
src/tilde_type_info.cpp
Normal file
27
src/tilde_type_info.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
gb_internal void cg_setup_type_info_data(cgModule *m) {
|
||||
if (build_context.no_rtti) {
|
||||
return;
|
||||
}
|
||||
CheckerInfo *info = m->info;
|
||||
gb_unused(info);
|
||||
|
||||
|
||||
// i64 global_type_info_data_entity_count = 0;
|
||||
// {
|
||||
// // NOTE(bill): Set the type_table slice with the global backing array
|
||||
// cgValue global_type_table = cg_find_runtime_value(m, str_lit("type_table"));
|
||||
// Type *type = base_type(cg_global_type_info_data_entity->type);
|
||||
// GB_ASSERT(is_type_array(type));
|
||||
// global_type_info_data_entity_count = type->Array.count;
|
||||
|
||||
// LLVMValueRef indices[2] = {llvm_zero(m), llvm_zero(m)};
|
||||
// LLVMValueRef data = LLVMConstInBoundsGEP2(cg_type(m, cg_global_type_info_data_entity->type), cg_global_type_info_data_ptr(m).value, indices, gb_count_of(indices));
|
||||
// LLVMValueRef len = LLVMConstInt(cg_type(m, t_int), type->Array.count, true);
|
||||
// Type *t = type_deref(global_type_table.type);
|
||||
// GB_ASSERT(is_type_slice(t));
|
||||
// LLVMValueRef slice = llvm_const_slice_internal(m, data, len);
|
||||
|
||||
// LLVMSetInitializer(global_type_table.value, slice);
|
||||
// }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user