aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-11-23 14:35:31 +0000
committergingerBill <bill@gingerbill.org>2020-11-23 14:35:31 +0000
commit0b30c3dc5ad3f3908719af19e9f7e61daae37706 (patch)
tree3f539cada71190a13ccea801a029acc323406325 /src/ir.cpp
parent9e42cb159543546ca549eeba6c943cf0f4c8410b (diff)
Add `flags: Type_Info_Flags,` to `runtime.Type_Info`
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 2d244f62c..ce5dea86d 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -11974,6 +11974,8 @@ void ir_setup_type_info_data(irProcedure *proc) { // NOTE(bill): Setup type_info
// Useful types
Type *t_i64_slice_ptr = alloc_type_pointer(alloc_type_slice(t_i64));
Type *t_string_slice_ptr = alloc_type_pointer(alloc_type_slice(t_string));
+ Entity *type_info_flags_entity = find_core_entity(info->checker, str_lit("Type_Info_Flags"));
+ Type *t_type_info_flags = type_info_flags_entity->type;
i32 type_info_member_types_index = 0;
i32 type_info_member_names_index = 0;
@@ -11993,11 +11995,14 @@ void ir_setup_type_info_data(irProcedure *proc) { // NOTE(bill): Setup type_info
irValue *tag = nullptr;
irValue *ti_ptr = ir_emit_array_epi(proc, ir_global_type_info_data, cast(i32)entry_index);
- irValue *variant_ptr = ir_emit_struct_ep(proc, ti_ptr, 3);
+ irValue *variant_ptr = ir_emit_struct_ep(proc, ti_ptr, 4);
+
+ irValue *type_info_flags = ir_value_constant(t_type_info_flags, exact_value_i64(type_info_flags_of_type(t)));
ir_emit_store(proc, ir_emit_struct_ep(proc, ti_ptr, 0), ir_const_int(type_size_of(t)));
ir_emit_store(proc, ir_emit_struct_ep(proc, ti_ptr, 1), ir_const_int(type_align_of(t)));
- ir_emit_store(proc, ir_emit_struct_ep(proc, ti_ptr, 2), ir_typeid(proc->module, t));
+ ir_emit_store(proc, ir_emit_struct_ep(proc, ti_ptr, 2), type_info_flags);
+ ir_emit_store(proc, ir_emit_struct_ep(proc, ti_ptr, 3), ir_typeid(proc->module, t));
switch (t->kind) {