|
@@ -52,8 +52,8 @@ gb_internal LLVMMetadataRef lb_debug_type_internal_proc(lbModule *m, Type *type)
|
|
|
|
|
|
GB_ASSERT(type != t_invalid);
|
|
GB_ASSERT(type != t_invalid);
|
|
|
|
|
|
- /* unsigned const word_size = cast(unsigned)build_context.word_size;
|
|
|
|
- unsigned const word_bits = cast(unsigned)(8*build_context.word_size); */
|
|
|
|
|
|
+ /* unsigned const ptr_size = cast(unsigned)build_context.ptr_size;
|
|
|
|
+ unsigned const ptr_bits = cast(unsigned)(8*build_context.ptr_size); */
|
|
|
|
|
|
GB_ASSERT(type->kind == Type_Proc);
|
|
GB_ASSERT(type->kind == Type_Proc);
|
|
unsigned parameter_count = 1;
|
|
unsigned parameter_count = 1;
|
|
@@ -131,9 +131,9 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
|
|
|
|
|
|
GB_ASSERT(type != t_invalid);
|
|
GB_ASSERT(type != t_invalid);
|
|
|
|
|
|
- /* unsigned const word_size = cast(unsigned)build_context.word_size; */
|
|
|
|
|
|
+ /* unsigned const ptr_size = cast(unsigned)build_context.ptr_size; */
|
|
unsigned const int_bits = cast(unsigned)(8*build_context.int_size);
|
|
unsigned const int_bits = cast(unsigned)(8*build_context.int_size);
|
|
- unsigned const word_bits = cast(unsigned)(8*build_context.word_size);
|
|
|
|
|
|
+ unsigned const ptr_bits = cast(unsigned)(8*build_context.ptr_size);
|
|
|
|
|
|
switch (type->kind) {
|
|
switch (type->kind) {
|
|
case Type_Basic:
|
|
case Type_Basic:
|
|
@@ -165,10 +165,10 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
|
|
|
|
|
|
case Basic_int: return lb_debug_type_basic_type(m, str_lit("int"), int_bits, LLVMDWARFTypeEncoding_Signed);
|
|
case Basic_int: return lb_debug_type_basic_type(m, str_lit("int"), int_bits, LLVMDWARFTypeEncoding_Signed);
|
|
case Basic_uint: return lb_debug_type_basic_type(m, str_lit("uint"), int_bits, LLVMDWARFTypeEncoding_Unsigned);
|
|
case Basic_uint: return lb_debug_type_basic_type(m, str_lit("uint"), int_bits, LLVMDWARFTypeEncoding_Unsigned);
|
|
- case Basic_uintptr: return lb_debug_type_basic_type(m, str_lit("uintptr"), word_bits, LLVMDWARFTypeEncoding_Unsigned);
|
|
|
|
|
|
+ case Basic_uintptr: return lb_debug_type_basic_type(m, str_lit("uintptr"), ptr_bits, LLVMDWARFTypeEncoding_Unsigned);
|
|
|
|
|
|
case Basic_typeid:
|
|
case Basic_typeid:
|
|
- return lb_debug_type_basic_type(m, str_lit("typeid"), word_bits, LLVMDWARFTypeEncoding_Unsigned);
|
|
|
|
|
|
+ return lb_debug_type_basic_type(m, str_lit("typeid"), ptr_bits, LLVMDWARFTypeEncoding_Unsigned);
|
|
|
|
|
|
// Endian Specific Types
|
|
// Endian Specific Types
|
|
case Basic_i16le: return lb_debug_type_basic_type(m, str_lit("i16le"), 16, LLVMDWARFTypeEncoding_Signed, LLVMDIFlagLittleEndian);
|
|
case Basic_i16le: return lb_debug_type_basic_type(m, str_lit("i16le"), 16, LLVMDWARFTypeEncoding_Signed, LLVMDIFlagLittleEndian);
|
|
@@ -252,7 +252,7 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
|
|
case Basic_rawptr:
|
|
case Basic_rawptr:
|
|
{
|
|
{
|
|
LLVMMetadataRef void_type = lb_debug_type_basic_type(m, str_lit("void"), 8, LLVMDWARFTypeEncoding_Unsigned);
|
|
LLVMMetadataRef void_type = lb_debug_type_basic_type(m, str_lit("void"), 8, LLVMDWARFTypeEncoding_Unsigned);
|
|
- return LLVMDIBuilderCreatePointerType(m->debug_builder, void_type, word_bits, word_bits, LLVMDWARFTypeEncoding_Address, "rawptr", 6);
|
|
|
|
|
|
+ return LLVMDIBuilderCreatePointerType(m->debug_builder, void_type, ptr_bits, ptr_bits, LLVMDWARFTypeEncoding_Address, "rawptr", 6);
|
|
}
|
|
}
|
|
case Basic_string:
|
|
case Basic_string:
|
|
{
|
|
{
|
|
@@ -264,14 +264,14 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
|
|
case Basic_cstring:
|
|
case Basic_cstring:
|
|
{
|
|
{
|
|
LLVMMetadataRef char_type = lb_debug_type_basic_type(m, str_lit("char"), 8, LLVMDWARFTypeEncoding_Unsigned);
|
|
LLVMMetadataRef char_type = lb_debug_type_basic_type(m, str_lit("char"), 8, LLVMDWARFTypeEncoding_Unsigned);
|
|
- return LLVMDIBuilderCreatePointerType(m->debug_builder, char_type, word_bits, word_bits, 0, "cstring", 7);
|
|
|
|
|
|
+ return LLVMDIBuilderCreatePointerType(m->debug_builder, char_type, ptr_bits, ptr_bits, 0, "cstring", 7);
|
|
}
|
|
}
|
|
case Basic_any:
|
|
case Basic_any:
|
|
{
|
|
{
|
|
LLVMMetadataRef elements[2] = {};
|
|
LLVMMetadataRef elements[2] = {};
|
|
elements[0] = lb_debug_struct_field(m, str_lit("data"), t_rawptr, 0);
|
|
elements[0] = lb_debug_struct_field(m, str_lit("data"), t_rawptr, 0);
|
|
- elements[1] = lb_debug_struct_field(m, str_lit("id"), t_typeid, word_bits);
|
|
|
|
- return lb_debug_basic_struct(m, str_lit("any"), 2*word_bits, word_bits, elements, gb_count_of(elements));
|
|
|
|
|
|
+ elements[1] = lb_debug_struct_field(m, str_lit("id"), t_typeid, ptr_bits);
|
|
|
|
+ return lb_debug_basic_struct(m, str_lit("any"), 2*ptr_bits, ptr_bits, elements, gb_count_of(elements));
|
|
}
|
|
}
|
|
|
|
|
|
// Untyped types
|
|
// Untyped types
|
|
@@ -295,9 +295,9 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
|
|
case Type_SoaPointer:
|
|
case Type_SoaPointer:
|
|
return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->SoaPointer.elem), int_bits, int_bits, 0, nullptr, 0);
|
|
return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->SoaPointer.elem), int_bits, int_bits, 0, nullptr, 0);
|
|
case Type_Pointer:
|
|
case Type_Pointer:
|
|
- return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->Pointer.elem), word_bits, word_bits, 0, nullptr, 0);
|
|
|
|
|
|
+ return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->Pointer.elem), ptr_bits, ptr_bits, 0, nullptr, 0);
|
|
case Type_MultiPointer:
|
|
case Type_MultiPointer:
|
|
- return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->MultiPointer.elem), word_bits, word_bits, 0, nullptr, 0);
|
|
|
|
|
|
+ return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->MultiPointer.elem), ptr_bits, ptr_bits, 0, nullptr, 0);
|
|
|
|
|
|
case Type_Array: {
|
|
case Type_Array: {
|
|
LLVMMetadataRef subscripts[1] = {};
|
|
LLVMMetadataRef subscripts[1] = {};
|
|
@@ -417,7 +417,7 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
|
|
case Type_Proc:
|
|
case Type_Proc:
|
|
{
|
|
{
|
|
LLVMMetadataRef proc_underlying_type = lb_debug_type_internal_proc(m, type);
|
|
LLVMMetadataRef proc_underlying_type = lb_debug_type_internal_proc(m, type);
|
|
- LLVMMetadataRef pointer_type = LLVMDIBuilderCreatePointerType(m->debug_builder, proc_underlying_type, word_bits, word_bits, 0, nullptr, 0);
|
|
|
|
|
|
+ LLVMMetadataRef pointer_type = LLVMDIBuilderCreatePointerType(m->debug_builder, proc_underlying_type, ptr_bits, ptr_bits, 0, nullptr, 0);
|
|
gbString name = type_to_string(type, temporary_allocator());
|
|
gbString name = type_to_string(type, temporary_allocator());
|
|
return LLVMDIBuilderCreateTypedef(m->debug_builder, pointer_type, name, gb_string_length(name), nullptr, 0, nullptr, cast(u32)(8*type_align_of(type)));
|
|
return LLVMDIBuilderCreateTypedef(m->debug_builder, pointer_type, name, gb_string_length(name), nullptr, 0, nullptr, cast(u32)(8*type_align_of(type)));
|
|
}
|
|
}
|
|
@@ -618,8 +618,8 @@ gb_internal LLVMMetadataRef lb_debug_type(lbModule *m, Type *type) {
|
|
}
|
|
}
|
|
|
|
|
|
gb_internal void lb_debug_complete_types(lbModule *m) {
|
|
gb_internal void lb_debug_complete_types(lbModule *m) {
|
|
- /* unsigned const word_size = cast(unsigned)build_context.word_size; */
|
|
|
|
- unsigned const word_bits = cast(unsigned)(8*build_context.word_size);
|
|
|
|
|
|
+ /* unsigned const ptr_size = cast(unsigned)build_context.ptr_size; */
|
|
|
|
+ unsigned const ptr_bits = cast(unsigned)(8*build_context.ptr_size);
|
|
unsigned const int_bits = cast(unsigned)(8*build_context.int_size);
|
|
unsigned const int_bits = cast(unsigned)(8*build_context.int_size);
|
|
|
|
|
|
for_array(debug_incomplete_type_index, m->debug_incomplete_types) {
|
|
for_array(debug_incomplete_type_index, m->debug_incomplete_types) {
|