Files
Sinan ed8b3ebee1 Reduce recompiler output memory usage, and added multi-threading to recomp process (#128)
* feat(recomp): Reduce recompiler output memory usage

Stream output generation, add low-memory config controls, and avoid
pathological indirect-jump switch expansion in generated C++.

Low-memory mode now avoids retaining per-instruction disassembly strings
while still emitting asm comments during output generation. Output workers
are bounded/configurable, combined output is streamed, and decoded buffers
are released after generation.

Also document the new output memory settings.

* fix(recomp): added tests for unregistered JR/JALR, updated fallback logic to cover JR/JALR, moved Rabbitizer formatting into R5900Decoder
2026-06-06 00:15:14 -03:00

60 lines
2.0 KiB
C++

#ifndef PS2RECOMP_R5900_DECODER_H
#define PS2RECOMP_R5900_DECODER_H
#include "ps2recomp/types.h"
#include "ps2recomp/instructions.h"
#include <cstdint>
#include <string>
namespace ps2recomp
{
class R5900Decoder
{
public:
R5900Decoder();
~R5900Decoder();
static std::string disassembleInstruction(uint32_t address, uint32_t rawInstruction);
static std::string disassembleInstruction(const Instruction &inst);
Instruction decodeInstruction(uint32_t address, uint32_t rawInstruction, bool includeDisassembly = true) const;
bool isBranchInstruction(const Instruction &inst) const;
bool isJumpInstruction(const Instruction &inst) const;
bool isCallInstruction(const Instruction &inst) const;
bool isReturnInstruction(const Instruction &inst) const;
bool isMMIInstruction(const Instruction &inst) const;
bool isVUInstruction(const Instruction &inst) const;
bool isStore(const Instruction &inst) const;
bool isLoad(const Instruction &inst) const;
bool hasDelaySlot(const Instruction &inst) const;
uint32_t getBranchTarget(const Instruction &inst) const;
uint32_t getJumpTarget(const Instruction &inst) const;
private:
void decodeRType(Instruction &inst) const;
void decodeIType(Instruction &inst) const;
void decodeJType(Instruction &inst) const;
void decodeSpecial(Instruction &inst) const;
void decodeRegimm(Instruction &inst) const;
void decodeCOP0(Instruction& inst) const;
void decodeCOP1(Instruction &inst) const;
void decodeCOP2(Instruction &inst) const;
void decodeMMI(Instruction &inst) const;
void decodeMMI0(Instruction &inst) const;
void decodeMMI1(Instruction &inst) const;
void decodeMMI2(Instruction &inst) const;
void decodeMMI3(Instruction &inst) const;
void decodePMFHL(Instruction &inst) const;
};
} // namespace ps2recomp
#endif // PS2RECOMP_R5900_DECODER_H