mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2026-09-07 09:16:06 -05:00
Implemented register state tracking to identify jump tables for jr instructions
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user