summaryrefslogtreecommitdiff
path: root/disasm.h
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2024-02-04 19:51:35 +0300
committerOxore <oxore@protonmail.com>2024-02-04 19:51:35 +0300
commit9fd2eba95beb6c9ce6fb26e1442aa2f68aac9b1f (patch)
tree9d351968b9757ccca48212fc2687d6df996d4fa2 /disasm.h
parent853bda8e4c9210062a1b793f3499270c9e4cf532 (diff)
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.
Diffstat (limited to 'disasm.h')
-rw-r--r--disasm.h17
1 files changed, 14 insertions, 3 deletions
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;
+}