mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 16:59:35 -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
44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
#ifndef PS2RECOMP_CONTROL_FLOW_ANALYZER_H
|
|
#define PS2RECOMP_CONTROL_FLOW_ANALYZER_H
|
|
|
|
#include <cstdint>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#include <vector>
|
|
|
|
namespace ps2recomp
|
|
{
|
|
struct Function;
|
|
struct Instruction;
|
|
struct Section;
|
|
class RecompilerReporter;
|
|
|
|
struct ControlFlowAnalysisResult
|
|
{
|
|
std::unordered_set<uint32_t> entryPoints;
|
|
std::unordered_set<uint32_t> externalEntryPoints;
|
|
std::unordered_set<uint32_t> resumeEntryPoints;
|
|
std::unordered_set<uint32_t> indirectFallbackEntryPoints;
|
|
std::unordered_map<uint32_t, std::vector<uint32_t>> jumpTableTargets;
|
|
};
|
|
|
|
class ControlFlowAnalyzer
|
|
{
|
|
public:
|
|
ControlFlowAnalyzer(const std::vector<Section> §ions,
|
|
const std::unordered_map<uint32_t, std::vector<uint32_t>> &configuredJumpTableTargetsByAddress,
|
|
RecompilerReporter *reporter);
|
|
|
|
ControlFlowAnalysisResult analyze(const Function &function,
|
|
const std::vector<Instruction> &instructions,
|
|
const std::vector<Function> *allFunctions = nullptr) const;
|
|
|
|
private:
|
|
const std::vector<Section> &m_sections;
|
|
const std::unordered_map<uint32_t, std::vector<uint32_t>> &m_configJumpTableTargetsByAddress;
|
|
RecompilerReporter *m_reporter = nullptr;
|
|
};
|
|
}
|
|
|
|
#endif // PS2RECOMP_CONTROL_FLOW_ANALYZER_H
|