diff options
Diffstat (limited to 'lib/xixanta/src/node.rs')
| -rw-r--r-- | lib/xixanta/src/node.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/xixanta/src/node.rs b/lib/xixanta/src/node.rs index f55ca11..a28d625 100644 --- a/lib/xixanta/src/node.rs +++ b/lib/xixanta/src/node.rs @@ -164,3 +164,17 @@ pub struct PNode { /// optional arguments. pub args: Option<Vec<PNode>>, } + +impl PNode { + pub fn is_branch(&self) -> bool { + if self.node_type != NodeType::Instruction { + return false; + } + + let opcode = self.value.value.to_lowercase(); + matches!( + opcode.as_str(), + "bcc" | "bcs" | "beq" | "bmi" | "bne" | "bpl" | "bvc" | "bvs" + ) + } +} |
