1use crate::{thumb::generated::Opcode, ParseFlags, ParsedIns};
2
3use super::{parse, Cond};
4
5#[derive(Clone, Copy, PartialEq, Eq, Debug)]
6pub struct Ins {
7 pub code: u32,
8 pub op: Opcode,
9}
10
11impl Ins {
12 pub fn new(code: u32, flags: &ParseFlags) -> Self {
13 let op = Opcode::find(code, flags);
14 Self { code, op }
15 }
16
17 pub fn is_half_bl(&self) -> bool {
19 self.op == Opcode::BlH
20 }
21
22 pub fn parse(self, flags: &ParseFlags) -> ParsedIns {
23 let mut out = ParsedIns::default();
24 parse(&mut out, self, flags);
25 out
26 }
27
28 pub fn is_conditional(&self) -> bool {
29 self.has_cond() && self.modifier_cond() != Cond::Al
30 }
31}