@@ -42,16 +42,16 @@ impl Display for MediumLevelInstructionIndex {
4242}
4343
4444#[ derive( Clone ) ]
45- pub struct MediumLevelILInstruction {
45+ pub struct Instruction {
4646 pub function : Ref < MediumLevelILFunction > ,
4747 pub address : u64 ,
4848 // TODO; Because this structure is incorrectly named instruction, we want to make it clear that we actually have the expression index.
4949 pub expr_index : MediumLevelInstructionIndex ,
5050 pub size : usize ,
51- pub kind : MediumLevelILInstructionKind ,
51+ pub kind : InstructionKind ,
5252}
5353
54- impl MediumLevelILInstruction {
54+ impl Instruction {
5555 pub ( crate ) fn new (
5656 function : Ref < MediumLevelILFunction > ,
5757 index : MediumLevelInstructionIndex ,
@@ -69,7 +69,7 @@ impl MediumLevelILInstruction {
6969 // TODO: If op.sourceOperation == BN_INVALID_OPERAND && op.operation == MLIL_NOP return None
7070 let op = unsafe { BNGetMediumLevelILByIndex ( function. handle , expr_index. 0 ) } ;
7171 use BNMediumLevelILOperation :: * ;
72- use MediumLevelILInstructionKind as Op ;
72+ use InstructionKind as Op ;
7373 let kind = match op. operation {
7474 MLIL_NOP => Op :: Nop ,
7575 MLIL_NORET => Op :: Noret ,
@@ -624,7 +624,7 @@ impl MediumLevelILInstruction {
624624 }
625625
626626 pub fn lift ( & self ) -> MediumLevelILLiftedInstruction {
627- use MediumLevelILInstructionKind :: * ;
627+ use InstructionKind :: * ;
628628 use MediumLevelILLiftedInstructionKind as Lifted ;
629629
630630 let kind = match self . kind {
@@ -970,7 +970,7 @@ impl MediumLevelILInstruction {
970970 unsafe { BNGetMediumLevelILExprValue ( self . function . handle , self . expr_index . 0 ) } . into ( )
971971 }
972972
973- /// Returns the [`BasicBlock`] containing the given [`MediumLevelILInstruction `].
973+ /// Returns the [`BasicBlock`] containing the given [`Instruction `].
974974 pub fn basic_block ( & self ) -> Option < Ref < BasicBlock < MediumLevelILBlock > > > {
975975 // TODO: We might be able to .expect this if we guarantee that self.index is valid.
976976 self . function . basic_block_containing_index ( self . expr_index )
@@ -1057,7 +1057,7 @@ impl MediumLevelILInstruction {
10571057 unsafe { Array :: new ( deps, count, self . function . clone ( ) ) }
10581058 }
10591059
1060- pub fn branch_dependence_at ( & self , instruction : MediumLevelILInstruction ) -> BranchDependence {
1060+ pub fn branch_dependence_at ( & self , instruction : Instruction ) -> BranchDependence {
10611061 let deps = unsafe {
10621062 BNGetMediumLevelILBranchDependence (
10631063 self . function . handle ,
@@ -1377,7 +1377,7 @@ impl MediumLevelILInstruction {
13771377 Variable :: new ( var. ty , index, var. storage )
13781378 }
13791379
1380- /// alias for [MediumLevelILInstruction ::split_var_for_definition]
1380+ /// alias for [Instruction ::split_var_for_definition]
13811381 #[ inline]
13821382 pub fn get_split_var_for_definition ( & self , var : & Variable ) -> Variable {
13831383 self . split_var_for_definition ( var)
@@ -1466,7 +1466,7 @@ impl MediumLevelILInstruction {
14661466 }
14671467}
14681468
1469- impl Debug for MediumLevelILInstruction {
1469+ impl Debug for Instruction {
14701470 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
14711471 f. debug_struct ( "MediumLevelILInstruction" )
14721472 . field ( "address" , & self . address )
@@ -1477,13 +1477,13 @@ impl Debug for MediumLevelILInstruction {
14771477 }
14781478}
14791479
1480- impl CoreArrayProvider for MediumLevelILInstruction {
1480+ impl CoreArrayProvider for Instruction {
14811481 type Raw = usize ;
14821482 type Context = Ref < MediumLevelILFunction > ;
14831483 type Wrapped < ' a > = Self ;
14841484}
14851485
1486- unsafe impl CoreArrayProviderInner for MediumLevelILInstruction {
1486+ unsafe impl CoreArrayProviderInner for Instruction {
14871487 unsafe fn free ( raw : * mut Self :: Raw , _count : usize , _context : & Self :: Context ) {
14881488 BNFreeILInstructionList ( raw)
14891489 }
@@ -1498,7 +1498,7 @@ unsafe impl CoreArrayProviderInner for MediumLevelILInstruction {
14981498}
14991499
15001500#[ derive( Debug , Copy , Clone ) ]
1501- pub enum MediumLevelILInstructionKind {
1501+ pub enum InstructionKind {
15021502 Nop ,
15031503 Noret ,
15041504 Bp ,
@@ -1661,7 +1661,7 @@ fn get_call_output(function: &MediumLevelILFunction, idx: usize) -> impl Iterato
16611661fn get_call_params (
16621662 function : & MediumLevelILFunction ,
16631663 idx : usize ,
1664- ) -> impl Iterator < Item = MediumLevelILInstruction > {
1664+ ) -> impl Iterator < Item = Instruction > {
16651665 let op = get_raw_operation ( function, idx) ;
16661666 assert_eq ! ( op. operation, BNMediumLevelILOperation :: MLIL_CALL_PARAM ) ;
16671667 OperandIter :: new ( function, op. operands [ 1 ] as usize , op. operands [ 0 ] as usize ) . exprs ( )
@@ -1679,15 +1679,15 @@ fn get_call_output_ssa(
16791679fn get_call_params_ssa (
16801680 function : & MediumLevelILFunction ,
16811681 idx : usize ,
1682- ) -> impl Iterator < Item = MediumLevelILInstruction > {
1682+ ) -> impl Iterator < Item = Instruction > {
16831683 let op = get_raw_operation ( function, idx) ;
16841684 assert_eq ! ( op. operation, BNMediumLevelILOperation :: MLIL_CALL_PARAM_SSA ) ;
16851685 OperandIter :: new ( function, op. operands [ 2 ] as usize , op. operands [ 1 ] as usize ) . exprs ( )
16861686}
16871687
16881688/// Conditional branching instruction and an expected conditional result
16891689pub struct BranchDependence {
1690- pub instruction : MediumLevelILInstruction ,
1690+ pub instruction : Instruction ,
16911691 pub dependence : ILBranchDependence ,
16921692}
16931693
@@ -1704,10 +1704,7 @@ unsafe impl CoreArrayProviderInner for BranchDependence {
17041704
17051705 unsafe fn wrap_raw < ' a > ( raw : & ' a Self :: Raw , context : & ' a Self :: Context ) -> Self :: Wrapped < ' a > {
17061706 Self {
1707- instruction : MediumLevelILInstruction :: new (
1708- context. clone ( ) ,
1709- MediumLevelInstructionIndex ( raw. branch ) ,
1710- ) ,
1707+ instruction : Instruction :: new ( context. clone ( ) , MediumLevelInstructionIndex ( raw. branch ) ) ,
17111708 dependence : raw. dependence ,
17121709 }
17131710 }
0 commit comments