@@ -3,7 +3,7 @@ use std::hash::{Hash, Hasher};
33
44use binaryninjacore_sys:: * ;
55
6- use super :: { HighLevelILBlock , HighLevelILInstruction , HighLevelInstructionIndex } ;
6+ use super :: { HighLevelILBlock , HighLevelInstructionIndex , Instruction } ;
77use crate :: basic_block:: BasicBlock ;
88use crate :: function:: { Function , Location } ;
99use crate :: rc:: { Array , Ref , RefCountable } ;
@@ -23,28 +23,22 @@ impl HighLevelILFunction {
2323 Self { handle, full_ast } . to_owned ( )
2424 }
2525
26- pub fn instruction_from_index (
27- & self ,
28- index : HighLevelInstructionIndex ,
29- ) -> Option < HighLevelILInstruction > {
26+ pub fn instruction_from_index ( & self , index : HighLevelInstructionIndex ) -> Option < Instruction > {
3027 if index. 0 >= self . instruction_count ( ) {
3128 None
3229 } else {
33- Some ( HighLevelILInstruction :: new ( self . to_owned ( ) , index) )
30+ Some ( Instruction :: new ( self . to_owned ( ) , index) )
3431 }
3532 }
3633
3734 pub fn instruction_from_expr_index (
3835 & self ,
3936 expr_index : HighLevelInstructionIndex ,
40- ) -> Option < HighLevelILInstruction > {
37+ ) -> Option < Instruction > {
4138 if expr_index. 0 >= self . expression_count ( ) {
4239 None
4340 } else {
44- Some ( HighLevelILInstruction :: new_expr (
45- self . to_owned ( ) ,
46- expr_index,
47- ) )
41+ Some ( Instruction :: new_expr ( self . to_owned ( ) , expr_index) )
4842 }
4943 }
5044
@@ -53,11 +47,11 @@ impl HighLevelILFunction {
5347 HighLevelInstructionIndex ( unsafe { BNGetHighLevelILRootExpr ( self . handle ) } )
5448 }
5549
56- pub fn root ( & self ) -> HighLevelILInstruction {
57- HighLevelILInstruction :: new_expr ( self . as_ast ( ) , self . root_instruction_index ( ) )
50+ pub fn root ( & self ) -> Instruction {
51+ Instruction :: new_expr ( self . as_ast ( ) , self . root_instruction_index ( ) )
5852 }
5953
60- pub fn set_root ( & self , new_root : & HighLevelILInstruction ) {
54+ pub fn set_root ( & self , new_root : & Instruction ) {
6155 unsafe { BNSetHighLevelILRootExpr ( self . handle , new_root. expr_index . 0 ) }
6256 }
6357
@@ -130,7 +124,7 @@ impl HighLevelILFunction {
130124 ///
131125 /// Since SSA variables can only be defined once, this will return the single instruction where that occurs.
132126 /// For SSA variable version 0s, which don't have definitions, this will return None instead.
133- pub fn ssa_variable_definition ( & self , variable : SSAVariable ) -> Option < HighLevelILInstruction > {
127+ pub fn ssa_variable_definition ( & self , variable : SSAVariable ) -> Option < Instruction > {
134128 let index = unsafe {
135129 BNGetHighLevelILSSAVarDefinition (
136130 self . handle ,
@@ -141,13 +135,13 @@ impl HighLevelILFunction {
141135 self . instruction_from_index ( HighLevelInstructionIndex ( index) )
142136 }
143137
144- pub fn ssa_memory_definition ( & self , version : usize ) -> Option < HighLevelILInstruction > {
138+ pub fn ssa_memory_definition ( & self , version : usize ) -> Option < Instruction > {
145139 let index = unsafe { BNGetHighLevelILSSAMemoryDefinition ( self . handle , version) } ;
146140 self . instruction_from_index ( HighLevelInstructionIndex ( index) )
147141 }
148142
149143 /// Gets all the instructions that use the given SSA variable.
150- pub fn ssa_variable_uses ( & self , variable : SSAVariable ) -> Array < HighLevelILInstruction > {
144+ pub fn ssa_variable_uses ( & self , variable : SSAVariable ) -> Array < Instruction > {
151145 let mut count = 0 ;
152146 let instrs = unsafe {
153147 BNGetHighLevelILSSAVarUses (
@@ -161,7 +155,7 @@ impl HighLevelILFunction {
161155 unsafe { Array :: new ( instrs, count, self . to_owned ( ) ) }
162156 }
163157
164- pub fn ssa_memory_uses ( & self , version : usize ) -> Array < HighLevelILInstruction > {
158+ pub fn ssa_memory_uses ( & self , version : usize ) -> Array < Instruction > {
165159 let mut count = 0 ;
166160 let instrs = unsafe { BNGetHighLevelILSSAMemoryUses ( self . handle , version, & mut count) } ;
167161 assert ! ( !instrs. is_null( ) ) ;
@@ -176,11 +170,7 @@ impl HighLevelILFunction {
176170 }
177171
178172 /// Determines if `variable` is live at a given point in the function
179- pub fn is_ssa_variable_live_at (
180- & self ,
181- variable : SSAVariable ,
182- instr : & HighLevelILInstruction ,
183- ) -> bool {
173+ pub fn is_ssa_variable_live_at ( & self , variable : SSAVariable , instr : & Instruction ) -> bool {
184174 unsafe {
185175 BNIsHighLevelILSSAVarLiveAt (
186176 self . handle ,
@@ -191,7 +181,7 @@ impl HighLevelILFunction {
191181 }
192182 }
193183
194- pub fn variable_definitions ( & self , variable : Variable ) -> Array < HighLevelILInstruction > {
184+ pub fn variable_definitions ( & self , variable : Variable ) -> Array < Instruction > {
195185 let mut count = 0 ;
196186 let defs = unsafe {
197187 BNGetHighLevelILVariableDefinitions ( self . handle , & variable. into ( ) , & mut count)
@@ -200,7 +190,7 @@ impl HighLevelILFunction {
200190 unsafe { Array :: new ( defs, count, self . to_owned ( ) ) }
201191 }
202192
203- pub fn variable_uses ( & self , variable : Variable ) -> Array < HighLevelILInstruction > {
193+ pub fn variable_uses ( & self , variable : Variable ) -> Array < Instruction > {
204194 let mut count = 0 ;
205195 let instrs =
206196 unsafe { BNGetHighLevelILVariableUses ( self . handle , & variable. into ( ) , & mut count) } ;
@@ -209,7 +199,7 @@ impl HighLevelILFunction {
209199 }
210200
211201 /// Determines if `variable` is live at a given point in the function
212- pub fn is_variable_live_at ( & self , variable : Variable , instr : & HighLevelILInstruction ) -> bool {
202+ pub fn is_variable_live_at ( & self , variable : Variable , instr : & Instruction ) -> bool {
213203 unsafe { BNIsHighLevelILVarLiveAt ( self . handle , & variable. into ( ) , instr. expr_index . 0 ) }
214204 }
215205
0 commit comments