stage2: improve debugging tools

llvm: dump failed module when -femit-llvm-ir set
print_air:
 * print fully qualified name
 * use Type.fmt and Value.fmtValue, fmtDebug is useless

TypedValue
 * handle anon structs and tuples
 * fix bugs
This commit is contained in:
Veikka Tuominen
2022-06-09 17:54:32 +03:00
parent 002df65b6e
commit 0f820d0bdf
5 changed files with 114 additions and 28 deletions

View File

@@ -3790,9 +3790,12 @@ pub fn ensureFuncBodyAnalyzed(mod: *Module, func: *Fn) SemaError!void {
defer liveness.deinit(gpa);
if (builtin.mode == .Debug and mod.comp.verbose_air) {
std.debug.print("# Begin Function AIR: {s}:\n", .{decl.name});
const fqn = try decl.getFullyQualifiedName(mod);
defer mod.gpa.free(fqn);
std.debug.print("# Begin Function AIR: {s}:\n", .{fqn});
@import("print_air.zig").dump(mod, air, liveness);
std.debug.print("# End Function AIR: {s}\n\n", .{decl.name});
std.debug.print("# End Function AIR: {s}\n\n", .{fqn});
}
mod.comp.bin_file.updateFunc(mod, func, air, liveness) catch |err| switch (err) {