Skip to content

Commit 2cd83c7

Browse files
committed
Allow fetching target instruction index in LLIL branches from the Rust API
1 parent 7c04b4b commit 2cd83c7

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

rust/src/llil/operation.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ pub struct Syscall;
8989
pub struct Intrinsic;
9090

9191
impl<'func, A, M, V> Operation<'func, A, M, NonSSA<V>, Intrinsic>
92-
where
93-
A: 'func + Architecture,
94-
M: FunctionMutability,
95-
V: NonSSAVariant,
92+
where
93+
A: 'func + Architecture,
94+
M: FunctionMutability,
95+
V: NonSSAVariant,
9696
{
9797
// TODO: Support register and expression lists
9898
pub fn intrinsic(&self) -> Option<A::Intrinsic> {
@@ -382,12 +382,20 @@ where
382382
}
383383
}
384384

385+
pub fn true_target_idx(&self) -> usize {
386+
self.op.operands[1] as usize
387+
}
388+
385389
pub fn false_target(&self) -> Instruction<'func, A, M, F> {
386390
Instruction {
387391
function: self.function,
388392
instr_idx: self.op.operands[2] as usize,
389393
}
390394
}
395+
396+
pub fn false_target_idx(&self) -> usize {
397+
self.op.operands[2] as usize
398+
}
391399
}
392400

393401
// LLIL_GOTO
@@ -405,6 +413,10 @@ where
405413
instr_idx: self.op.operands[0] as usize,
406414
}
407415
}
416+
417+
pub fn target_idx(&self) -> usize {
418+
self.op.operands[0] as usize
419+
}
408420
}
409421

410422
// LLIL_FLAG_COND

0 commit comments

Comments
 (0)