mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2026-09-11 19:26:15 -05:00
Add TRACE_RETURN (#117)
This commit is contained in:
@@ -476,7 +476,10 @@ void N64Recomp::CGenerator::emit_switch_error(uint32_t instr_vram, uint32_t jtbl
|
||||
fmt::print(output_file, "default: switch_error(__func__, 0x{:08X}, 0x{:08X});\n", instr_vram, jtbl_vram);
|
||||
}
|
||||
|
||||
void N64Recomp::CGenerator::emit_return() const {
|
||||
void N64Recomp::CGenerator::emit_return(const Context& context) const {
|
||||
if (context.trace_mode) {
|
||||
fmt::print(output_file, "TRACE_RETURN()\n ");
|
||||
}
|
||||
fmt::print(output_file, "return;\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ bool process_instruction(GeneratorType& generator, const N64Recomp::Context& con
|
||||
return false;
|
||||
}
|
||||
print_indent();
|
||||
generator.emit_return();
|
||||
generator.emit_return(context);
|
||||
print_link_branch();
|
||||
return true;
|
||||
};
|
||||
@@ -363,7 +363,7 @@ bool process_instruction(GeneratorType& generator, const N64Recomp::Context& con
|
||||
return false;
|
||||
}
|
||||
print_indent();
|
||||
generator.emit_return();
|
||||
generator.emit_return(context);
|
||||
// TODO check if this branch close should exist.
|
||||
// print_indent();
|
||||
// generator.emit_branch_close();
|
||||
@@ -512,7 +512,7 @@ bool process_instruction(GeneratorType& generator, const N64Recomp::Context& con
|
||||
return false;
|
||||
}
|
||||
print_indent();
|
||||
generator.emit_return();
|
||||
generator.emit_return(context);
|
||||
}
|
||||
else {
|
||||
fmt::print(stderr, "Unhandled branch in {} at 0x{:08X} to 0x{:08X}\n", func.name, instr_vram, branch_target);
|
||||
@@ -552,7 +552,7 @@ bool process_instruction(GeneratorType& generator, const N64Recomp::Context& con
|
||||
fmt::print("[Info] Indirect tail call in {}\n", func.name);
|
||||
print_func_call_by_register(rs);
|
||||
print_indent();
|
||||
generator.emit_return();
|
||||
generator.emit_return(context);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -561,7 +561,7 @@ bool process_instruction(GeneratorType& generator, const N64Recomp::Context& con
|
||||
generator.emit_syscall(instr_vram);
|
||||
// syscalls don't link, so treat it like a tail call
|
||||
print_indent();
|
||||
generator.emit_return();
|
||||
generator.emit_return(context);
|
||||
break;
|
||||
case InstrId::cpu_break:
|
||||
print_indent();
|
||||
|
||||
Reference in New Issue
Block a user