mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 17:34:34 +00:00
Fix Compiler panic with SIMD Vector debug information #481
This commit is contained in:
13
src/ir.cpp
13
src/ir.cpp
@@ -2684,6 +2684,19 @@ irDebugInfo *ir_add_debug_info_type(irModule *module, Type *type, Entity *e, irD
|
||||
return ir_add_debug_info_type_bit_set(module, type, e, scope);
|
||||
}
|
||||
|
||||
if (is_type_simd_vector(type)) {
|
||||
irDebugInfo *di = ir_alloc_debug_info(irDebugInfo_CompositeType);
|
||||
di->CompositeType.size = ir_debug_size_bits(type);
|
||||
di->CompositeType.align = ir_debug_align_bits(type);
|
||||
di->CompositeType.tag = irDebugBasicEncoding_array_type;
|
||||
di->CompositeType.array_count = (i32)type->SimdVector.count;
|
||||
|
||||
map_set(&module->debug_info, hash_type(type), di);
|
||||
di->CompositeType.base_type = ir_add_debug_info_type(module, type->SimdVector.elem, e, scope, file);
|
||||
GB_ASSERT(base->kind != Type_Named);
|
||||
return di;
|
||||
}
|
||||
|
||||
GB_PANIC("Unreachable %s", type_to_string(type));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1955,6 +1955,8 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) {
|
||||
irInstrCall *call = &instr->Call;
|
||||
Type *proc_type = base_type(ir_type(call->value));
|
||||
GB_ASSERT(is_type_proc(proc_type));
|
||||
set_procedure_abi_types(heap_allocator(), proc_type);
|
||||
|
||||
bool is_c_vararg = proc_type->Proc.c_vararg;
|
||||
Type *result_type = call->type;
|
||||
if (result_type) {
|
||||
|
||||
@@ -3008,7 +3008,13 @@ gbString write_type_to_string(gbString str, Type *type) {
|
||||
break;
|
||||
|
||||
case Type_Struct: {
|
||||
str = gb_string_appendc(str, "struct");
|
||||
if (type->Struct.soa_elem != nullptr) {
|
||||
str = gb_string_append_fmt(str, "#soa[%d]", cast(int)type->Struct.soa_count);
|
||||
str = write_type_to_string(str, type->Struct.soa_elem);
|
||||
break;
|
||||
}
|
||||
|
||||
str = gb_string_appendc(str, "struct");
|
||||
if (type->Struct.is_packed) str = gb_string_appendc(str, " #packed");
|
||||
if (type->Struct.is_raw_union) str = gb_string_appendc(str, " #raw_union");
|
||||
str = gb_string_appendc(str, " {");
|
||||
@@ -3179,10 +3185,8 @@ gbString write_type_to_string(gbString str, Type *type) {
|
||||
if (type->SimdVector.is_x86_mmx) {
|
||||
return "intrinsics.x86_mmx";
|
||||
} else {
|
||||
str = gb_string_appendc(str, "intrinsics.vector(");
|
||||
str = gb_string_append_fmt(str, "%d, ", cast(int)type->SimdVector.count);
|
||||
str = gb_string_append_fmt(str, "#vector[%d]", cast(int)type->SimdVector.count);
|
||||
str = write_type_to_string(str, type->SimdVector.elem);
|
||||
str = gb_string_appendc(str, ")");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user