mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 08:51:05 -04:00
5196a6672a
* feat: added guestBranchKind enum to categorize branch types feat: added missingFunctionPolicy enum to define behaviors for missing function scenarios refactor: added handle guest branches and report missing functions feat lookupFunction to utilize new dispatch logic and improve error handling for unregistered functions * fix: fix test conflict * feat: added debug sound driver logs * feat: emmiter for return * feat: added recompiler reporter feat: added strict diagnostics flag for heavy debug calls * feat: staticc table insted of hashmap for runtime * feat: back file to ignore * feat: explode code across helpers and classes * feat: update codegen test feat: better guest nop check * feat: fix link problem on linux * feat: fix Segmentation fault
36 lines
955 B
C++
36 lines
955 B
C++
#ifndef PS2RECOMP_CONTROL_FLOW_UTILS_H
|
|
#define PS2RECOMP_CONTROL_FLOW_UTILS_H
|
|
|
|
#include "ps2recomp/instructions.h"
|
|
|
|
#include <cstdint>
|
|
|
|
namespace ps2recomp
|
|
{
|
|
inline uint32_t buildAbsoluteJumpTarget(uint32_t address, uint32_t target) noexcept
|
|
{
|
|
return ((address + 4u) & 0xF0000000u) | (target << 2);
|
|
}
|
|
|
|
inline bool isGuestNop(const Instruction &inst) noexcept
|
|
{
|
|
const bool sllZero =
|
|
inst.opcode == OPCODE_SPECIAL &&
|
|
inst.function == SPECIAL_SLL &&
|
|
inst.rd == 0u &&
|
|
inst.rt == 0u &&
|
|
inst.sa == 0u;
|
|
|
|
// Some tests and decoded streams represent a no-op as addiu $zero, $zero, 0.
|
|
const bool addiuZero =
|
|
inst.opcode == OPCODE_ADDIU &&
|
|
inst.rs == 0u &&
|
|
inst.rt == 0u &&
|
|
static_cast<int16_t>(inst.simmediate) == 0;
|
|
|
|
return sllZero || addiuZero;
|
|
}
|
|
}
|
|
|
|
#endif // PS2RECOMP_CONTROL_FLOW_UTILS_H
|