diff options
| author | gingerBill <bill@gingerbill.org> | 2023-07-24 16:09:01 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-07-24 16:09:01 +0100 |
| commit | 28fca190ee11f5c19d30007f20caa4c7bf89f655 (patch) | |
| tree | 595c387e0d83bec411e346d301c6c6d3e3d65676 /src/tilde.cpp | |
| parent | 78116e0ea24aef3f663832edfb5f9cd6aa7b6e57 (diff) | |
Fix `transmute(uintptr)ptr` etc
Diffstat (limited to 'src/tilde.cpp')
| -rw-r--r-- | src/tilde.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tilde.cpp b/src/tilde.cpp index 89075da75..7574ea6b9 100644 --- a/src/tilde.cpp +++ b/src/tilde.cpp @@ -243,6 +243,24 @@ gb_internal isize cg_type_info_index(CheckerInfo *info, Type *type, bool err_on_ return -1; } +gb_internal cgValue cg_global_type_info_data_ptr(cgProcedure *p) { + cgValue v = cg_find_value_from_entity(p->module, cg_global_type_info_data_entity); + return cg_flatten_value(p, v); +} + + +gb_internal cgValue cg_type_info(cgProcedure *p, Type *type) { + GB_ASSERT(!build_context.no_rtti); + + type = default_type(type); + + isize index = cg_type_info_index(p->module->info, type); + GB_ASSERT(index >= 0); + + cgValue data = cg_global_type_info_data_ptr(p); + return cg_emit_array_epi(p, data, index); +} + gb_internal u64 cg_typeid_as_u64(cgModule *m, Type *type) { GB_ASSERT(!build_context.no_rtti); |