From 9fd2eba95beb6c9ce6fb26e1442aa2f68aac9b1f Mon Sep 17 00:00:00 2001 From: Oxore Date: Sun, 4 Feb 2024 19:51:35 +0300 Subject: Impl deep graph walk and distinct jump following option This commit changes the default behavior which technically breaks backwards compatibility. It would be a concern if somebody else besides me is using this tool, but I doubt it would be the case, LOL. --- disasm.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'disasm.h') diff --git a/disasm.h b/disasm.h index be447a3..65429dc 100644 --- a/disasm.h +++ b/disasm.h @@ -304,8 +304,9 @@ struct Arg { uint32_t ref_addr = 0) const; }; -enum class TracedNodeType { - kInstruction, +enum class NodeType { + kTracedInstruction, + kRefInstruction, kData, }; @@ -365,7 +366,7 @@ struct Op { }; struct DisasmNode { - const TracedNodeType type{}; + const NodeType type{}; /// Address of the instruction (PC value basically) const uint32_t address{}; /// Instruction size in bytes @@ -388,3 +389,13 @@ struct DisasmNode { void AddReferencedBy(uint32_t address, ReferenceType); ~DisasmNode(); }; + +static constexpr inline bool IsInstruction(NodeType t) +{ + return t == NodeType::kTracedInstruction || t == NodeType::kRefInstruction; +} + +static constexpr inline bool IsBRA(Op op) +{ + return op.opcode == OpCode::kBcc && op.condition == Condition::kT; +} -- cgit v1.2.3