mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 20:58:15 +00:00
Minor cleanup.
This commit is contained in:
+2
-11
@@ -503,7 +503,7 @@ enum irDebugEncoding {
|
|||||||
irDebugBasicEncoding_unsigned = 6,
|
irDebugBasicEncoding_unsigned = 6,
|
||||||
irDebugBasicEncoding_unsigned_char = 7,
|
irDebugBasicEncoding_unsigned_char = 7,
|
||||||
|
|
||||||
// NOTE(lachsinc): Should the following be renamed from basic -> tag to mirror their DW_TAG_*
|
// TODO(lachsinc): Should the following be renamed from basic -> tag to mirror their DW_TAG_*
|
||||||
// counterparts? Perhaps separate out if they truly have different meaning.
|
// counterparts? Perhaps separate out if they truly have different meaning.
|
||||||
|
|
||||||
irDebugBasicEncoding_member = 13,
|
irDebugBasicEncoding_member = 13,
|
||||||
@@ -527,7 +527,6 @@ enum irDebugInfoKind {
|
|||||||
irDebugInfo_AllProcs,
|
irDebugInfo_AllProcs,
|
||||||
|
|
||||||
irDebugInfo_BasicType, // basic types
|
irDebugInfo_BasicType, // basic types
|
||||||
irDebugInfo_ProcType,
|
|
||||||
irDebugInfo_DerivedType, // pointer, typedef
|
irDebugInfo_DerivedType, // pointer, typedef
|
||||||
irDebugInfo_CompositeType, // array, struct, enum, (raw_)union
|
irDebugInfo_CompositeType, // array, struct, enum, (raw_)union
|
||||||
irDebugInfo_Enumerator, // For irDebugInfo_CompositeType if enum
|
irDebugInfo_Enumerator, // For irDebugInfo_CompositeType if enum
|
||||||
@@ -579,17 +578,12 @@ struct irDebugInfo {
|
|||||||
Array<irDebugInfo *> procs;
|
Array<irDebugInfo *> procs;
|
||||||
} AllProcs; // TODO(lachsinc): Redundant w/ DebugInfoArray. Merge.
|
} AllProcs; // TODO(lachsinc): Redundant w/ DebugInfoArray. Merge.
|
||||||
|
|
||||||
// NOTE(lachsinc): Many of the following fields could be removed/resolved as we print it?
|
|
||||||
struct {
|
struct {
|
||||||
String name;
|
String name;
|
||||||
i32 size;
|
i32 size;
|
||||||
i32 align;
|
i32 align;
|
||||||
irDebugEncoding encoding;
|
irDebugEncoding encoding;
|
||||||
} BasicType;
|
} BasicType;
|
||||||
struct {
|
|
||||||
irDebugInfo * return_type;
|
|
||||||
Array<irDebugInfo *> param_types;
|
|
||||||
} ProcType; // TODO(lachsinc): Unused?
|
|
||||||
struct {
|
struct {
|
||||||
// TODO(lachsinc): Do derived types even need scope/file/line etc. info?
|
// TODO(lachsinc): Do derived types even need scope/file/line etc. info?
|
||||||
irDebugEncoding tag;
|
irDebugEncoding tag;
|
||||||
@@ -641,7 +635,7 @@ struct irDebugInfo {
|
|||||||
irDebugInfo *type;
|
irDebugInfo *type;
|
||||||
} LocalVariable;
|
} LocalVariable;
|
||||||
struct {
|
struct {
|
||||||
Array<irDebugInfo *> elements; // TODO(lachsinc): Never cleaned up?
|
Array<irDebugInfo *> elements; // TODO(lachsinc): Leak?
|
||||||
} DebugInfoArray;
|
} DebugInfoArray;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -1439,9 +1433,6 @@ irValue *ir_add_local(irProcedure *proc, Entity *e, Ast *expr, bool zero_initial
|
|||||||
ir_emit(proc, ir_instr_debug_declare(proc, expr, e, true, instr));
|
ir_emit(proc, ir_instr_debug_declare(proc, expr, e, true, instr));
|
||||||
|
|
||||||
// TODO(lachsinc): "Arg" is not used yet but should be eventually, if applicable, set to param index
|
// TODO(lachsinc): "Arg" is not used yet but should be eventually, if applicable, set to param index
|
||||||
// NOTE(lachsinc): The following call recurses through a type creating or finding the necessary debug info.
|
|
||||||
// This approach may be quite detrimental to perf?
|
|
||||||
// This may not be the most appropriate place to place this? (for proc non-value params etc.)
|
|
||||||
irDebugInfo *di = *map_get(&proc->module->debug_info, hash_entity(proc->entity)); // TODO(lachsinc): Cleanup; lookup di for proc inside ir_add_debug_info_local() ?
|
irDebugInfo *di = *map_get(&proc->module->debug_info, hash_entity(proc->entity)); // TODO(lachsinc): Cleanup; lookup di for proc inside ir_add_debug_info_local() ?
|
||||||
ir_add_debug_info_local(proc->module, e, 0, di, di->Proc.file);
|
ir_add_debug_info_local(proc->module, e, 0, di, di->Proc.file);
|
||||||
ir_pop_debug_location(proc->module);
|
ir_pop_debug_location(proc->module);
|
||||||
|
|||||||
+7
-17
@@ -2073,15 +2073,9 @@ void print_llvm_ir(irGen *ir) {
|
|||||||
} else {
|
} else {
|
||||||
ir_write_str_lit(f, ", baseType: null"); // Valid/required for rawptr
|
ir_write_str_lit(f, ", baseType: null"); // Valid/required for rawptr
|
||||||
}
|
}
|
||||||
if (di->DerivedType.size > 0) {
|
if (di->DerivedType.size > 0) ir_fprintf(f, ", size: %d", di->DerivedType.size);
|
||||||
ir_fprintf(f, ", size: %d", di->DerivedType.size);
|
if (di->DerivedType.align > 0) ir_fprintf(f, ", align: %d", di->DerivedType.align);
|
||||||
}
|
if (di->DerivedType.offset > 0) ir_fprintf(f, ", offset: %d", di->DerivedType.offset);
|
||||||
if (di->DerivedType.align > 0) {
|
|
||||||
ir_fprintf(f, ", align: %d", di->DerivedType.align);
|
|
||||||
}
|
|
||||||
if (di->DerivedType.offset > 0) {
|
|
||||||
ir_fprintf(f, ", offset: %d", di->DerivedType.offset);
|
|
||||||
}
|
|
||||||
ir_write_byte(f, ')');
|
ir_write_byte(f, ')');
|
||||||
break;
|
break;
|
||||||
case irDebugInfo_CompositeType: {
|
case irDebugInfo_CompositeType: {
|
||||||
@@ -2110,12 +2104,8 @@ void print_llvm_ir(irGen *ir) {
|
|||||||
di->CompositeType.file->id,
|
di->CompositeType.file->id,
|
||||||
di->CompositeType.pos.line);
|
di->CompositeType.pos.line);
|
||||||
}
|
}
|
||||||
if (di->CompositeType.size > 0) {
|
if (di->CompositeType.size > 0) ir_fprintf(f, ", size: %d", di->CompositeType.size);
|
||||||
ir_fprintf(f, ", size: %d", di->CompositeType.size);
|
if (di->CompositeType.align > 0) ir_fprintf(f, ", align: %d", di->CompositeType.align);
|
||||||
}
|
|
||||||
if (di->CompositeType.align > 0) {
|
|
||||||
ir_fprintf(f, ", align: %d", di->CompositeType.align);
|
|
||||||
}
|
|
||||||
if (di->CompositeType.base_type != nullptr) {
|
if (di->CompositeType.base_type != nullptr) {
|
||||||
GB_ASSERT(di->CompositeType.tag != irDebugBasicEncoding_structure_type);
|
GB_ASSERT(di->CompositeType.tag != irDebugBasicEncoding_structure_type);
|
||||||
GB_ASSERT(di->CompositeType.tag != irDebugBasicEncoding_union_type);
|
GB_ASSERT(di->CompositeType.tag != irDebugBasicEncoding_union_type);
|
||||||
@@ -2153,8 +2143,8 @@ void print_llvm_ir(irGen *ir) {
|
|||||||
ir_fprintf(f, "!{");
|
ir_fprintf(f, "!{");
|
||||||
for_array(element_index, di->DebugInfoArray.elements) {
|
for_array(element_index, di->DebugInfoArray.elements) {
|
||||||
irDebugInfo *elem = di->DebugInfoArray.elements[element_index];
|
irDebugInfo *elem = di->DebugInfoArray.elements[element_index];
|
||||||
if (element_index > 0) {ir_write_str_lit(f, ", ");}
|
if (element_index > 0) ir_write_str_lit(f, ", ");
|
||||||
if (elem) {
|
if (elem != nullptr) {
|
||||||
ir_fprintf(f, "!%d", elem->id);
|
ir_fprintf(f, "!%d", elem->id);
|
||||||
} else {
|
} else {
|
||||||
ir_fprintf(f, "null"); // NOTE(lachsinc): Proc's can contain "nullptr" entries to represent void return values.
|
ir_fprintf(f, "null"); // NOTE(lachsinc): Proc's can contain "nullptr" entries to represent void return values.
|
||||||
|
|||||||
Reference in New Issue
Block a user