mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2025-05-18 01:14:54 +00:00
Implemented register state tracking to identify jump tables for jr instructions
This commit is contained in:
parent
84fd433dcc
commit
2300a4b6c9
7 changed files with 346 additions and 30 deletions
|
@ -19,6 +19,15 @@ constexpr uint32_t byteswap(uint32_t val) {
|
|||
|
||||
namespace RecompPort {
|
||||
|
||||
struct JumpTable {
|
||||
uint32_t vram;
|
||||
uint32_t addend_reg;
|
||||
uint32_t rom;
|
||||
uint32_t lw_vram;
|
||||
uint32_t jr_vram;
|
||||
std::vector<uint32_t> entries;
|
||||
};
|
||||
|
||||
struct Function {
|
||||
uint32_t vram;
|
||||
uint32_t rom;
|
||||
|
@ -26,11 +35,17 @@ namespace RecompPort {
|
|||
std::string name;
|
||||
};
|
||||
|
||||
struct FunctionStats {
|
||||
std::vector<JumpTable> jump_tables;
|
||||
};
|
||||
|
||||
struct Context {
|
||||
std::vector<RecompPort::Function> functions;
|
||||
std::unordered_map<uint32_t, std::vector<size_t>> functions_by_vram;
|
||||
std::vector<uint8_t> rom;
|
||||
};
|
||||
|
||||
bool analyze_function(const Context& context, const Function& function, const std::vector<rabbitizer::InstructionCpu>& instructions, FunctionStats& stats);
|
||||
bool recompile_function(const Context& context, const Function& func, std::string_view output_path);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue