diff options
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/codegen.cpp | 7 | ||||
| -rw-r--r-- | src/codegen/ssa.cpp | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/codegen/codegen.cpp b/src/codegen/codegen.cpp index e021069b2..4a4a7da46 100644 --- a/src/codegen/codegen.cpp +++ b/src/codegen/codegen.cpp @@ -302,9 +302,12 @@ void ssa_gen_tree(ssaGen *s) { }; - gb_for_array(entry_index, info->type_info_map.entries) { - auto *entry = &info->type_info_map.entries[entry_index]; + gb_for_array(type_info_map_index, info->type_info_map.entries) { + auto *entry = &info->type_info_map.entries[type_info_map_index]; Type *t = cast(Type *)cast(uintptr)entry->key.key; + t = default_type(t); + isize entry_index = entry->value; + ssaValue *tag = NULL; diff --git a/src/codegen/ssa.cpp b/src/codegen/ssa.cpp index 959e3faf8..66d00ed0f 100644 --- a/src/codegen/ssa.cpp +++ b/src/codegen/ssa.cpp @@ -1327,6 +1327,8 @@ ssaValue *ssa_emit_deep_field_ev(ssaProcedure *proc, Type *type, ssaValue *e, Se isize ssa_type_info_index(CheckerInfo *info, Type *type) { + type = default_type(type); + isize entry_index = -1; HashKey key = hash_pointer(type); auto *found_entry_index = map_get(&info->type_info_map, key); @@ -1763,6 +1765,8 @@ ssaValue *ssa_emit_conv(ssaProcedure *proc, ssaValue *value, Type *t, b32 is_arg data = ssa_add_local_generated(proc, src_type); ssa_emit_store(proc, data, value); } + GB_ASSERT(is_type_pointer(ssa_type(data))); + GB_ASSERT(is_type_typed(src_type)); data = ssa_emit_conv(proc, data, t_rawptr); @@ -2157,6 +2161,10 @@ ssaValue *ssa_build_single_expr(ssaProcedure *proc, AstNode *expr, TypeAndValue Type *t = default_type(type_of_expr(proc->module->info, ce->args[0])); return ssa_type_info(proc, t); } break; + case BuiltinProc_type_info_of_val: { + Type *t = default_type(type_of_expr(proc->module->info, ce->args[0])); + return ssa_type_info(proc, t); + } break; case BuiltinProc_new: { ssa_emit_comment(proc, make_string("new")); |