@@ -49,13 +49,12 @@ impl Display for LowLevelInstructionIndex {
4949 }
5050}
5151
52- // TODO: Probably want to rename this with a LowLevelIL prefix to avoid collisions when we add handlers for other ILs
5352pub trait InstructionHandler < ' func , M , F >
5453where
5554 M : FunctionMutability ,
5655 F : FunctionForm ,
5756{
58- fn kind ( & self ) -> LowLevelILInstructionKind < ' func , M , F > ;
57+ fn kind ( & self ) -> InstructionKind < ' func , M , F > ;
5958
6059 /// Visit the sub expressions of this instruction.
6160 ///
6564 T : FnMut ( & LowLevelILExpression < ' func , M , F , ValueExpr > ) -> VisitorAction ;
6665}
6766
68- pub struct LowLevelILInstruction < ' func , M , F >
67+ pub struct Instruction < ' func , M , F >
6968where
7069 M : FunctionMutability ,
7170 F : FunctionForm ,
7473 pub index : LowLevelInstructionIndex ,
7574}
7675
77- impl < ' func , M , F > LowLevelILInstruction < ' func , M , F >
76+ impl < ' func , M , F > Instruction < ' func , M , F >
7877where
7978 M : FunctionMutability ,
8079 F : FunctionForm ,
10099 }
101100}
102101
103- impl < ' func , M , F > Debug for LowLevelILInstruction < ' func , M , F >
102+ impl < ' func , M , F > Debug for Instruction < ' func , M , F >
104103where
105104 M : FunctionMutability ,
106105 F : FunctionForm ,
@@ -114,21 +113,19 @@ where
114113 }
115114}
116115
117- impl < ' func , M > InstructionHandler < ' func , M , SSA > for LowLevelILInstruction < ' func , M , SSA >
116+ impl < ' func , M > InstructionHandler < ' func , M , SSA > for Instruction < ' func , M , SSA >
118117where
119118 M : FunctionMutability ,
120119{
121- fn kind ( & self ) -> LowLevelILInstructionKind < ' func , M , SSA > {
120+ fn kind ( & self ) -> InstructionKind < ' func , M , SSA > {
122121 #[ allow( unused_imports) ]
123122 use binaryninjacore_sys:: BNLowLevelILOperation :: * ;
124123 let raw_op = self . into_raw ( ) ;
125124 #[ allow( clippy:: match_single_binding) ]
126125 match raw_op. operation {
127126 // Any invalid ops for Non-Lifted IL will be checked here.
128127 // SAFETY: We have checked for illegal operations.
129- _ => unsafe {
130- LowLevelILInstructionKind :: from_raw ( self . function , self . expr_idx ( ) , raw_op)
131- } ,
128+ _ => unsafe { InstructionKind :: from_raw ( self . function , self . expr_idx ( ) , raw_op) } ,
132129 }
133130 }
134131
@@ -142,21 +139,19 @@ where
142139}
143140
144141impl < ' func , M > InstructionHandler < ' func , M , NonSSA < LiftedNonSSA > >
145- for LowLevelILInstruction < ' func , M , NonSSA < LiftedNonSSA > >
142+ for Instruction < ' func , M , NonSSA < LiftedNonSSA > >
146143where
147144 M : FunctionMutability ,
148145{
149- fn kind ( & self ) -> LowLevelILInstructionKind < ' func , M , NonSSA < LiftedNonSSA > > {
146+ fn kind ( & self ) -> InstructionKind < ' func , M , NonSSA < LiftedNonSSA > > {
150147 #[ allow( unused_imports) ]
151148 use binaryninjacore_sys:: BNLowLevelILOperation :: * ;
152149 let raw_op = self . into_raw ( ) ;
153150 #[ allow( clippy:: match_single_binding) ]
154151 match raw_op. operation {
155152 // Any invalid ops for Non-Lifted IL will be checked here.
156153 // SAFETY: We have checked for illegal operations.
157- _ => unsafe {
158- LowLevelILInstructionKind :: from_raw ( self . function , self . expr_idx ( ) , raw_op)
159- } ,
154+ _ => unsafe { InstructionKind :: from_raw ( self . function , self . expr_idx ( ) , raw_op) } ,
160155 }
161156 }
162157
@@ -170,21 +165,19 @@ where
170165}
171166
172167impl < ' func , M > InstructionHandler < ' func , M , NonSSA < RegularNonSSA > >
173- for LowLevelILInstruction < ' func , M , NonSSA < RegularNonSSA > >
168+ for Instruction < ' func , M , NonSSA < RegularNonSSA > >
174169where
175170 M : FunctionMutability ,
176171{
177- fn kind ( & self ) -> LowLevelILInstructionKind < ' func , M , NonSSA < RegularNonSSA > > {
172+ fn kind ( & self ) -> InstructionKind < ' func , M , NonSSA < RegularNonSSA > > {
178173 #[ allow( unused_imports) ]
179174 use binaryninjacore_sys:: BNLowLevelILOperation :: * ;
180175 let raw_op = self . into_raw ( ) ;
181176 #[ allow( clippy:: match_single_binding) ]
182177 match raw_op. operation {
183178 // Any invalid ops for Non-Lifted IL will be checked here.
184179 // SAFETY: We have checked for illegal operations.
185- _ => unsafe {
186- LowLevelILInstructionKind :: from_raw ( self . function , self . expr_idx ( ) , raw_op)
187- } ,
180+ _ => unsafe { InstructionKind :: from_raw ( self . function , self . expr_idx ( ) , raw_op) } ,
188181 }
189182 }
190183
@@ -200,7 +193,7 @@ where
200193}
201194
202195#[ derive( Debug ) ]
203- pub enum LowLevelILInstructionKind < ' func , M , F >
196+ pub enum InstructionKind < ' func , M , F >
204197where
205198 M : FunctionMutability ,
206199 F : FunctionForm ,
@@ -237,7 +230,7 @@ where
237230 Value ( LowLevelILExpression < ' func , M , F , ValueExpr > ) ,
238231}
239232
240- impl < ' func , M , F > LowLevelILInstructionKind < ' func , M , F >
233+ impl < ' func , M , F > InstructionKind < ' func , M , F >
241234where
242235 M : FunctionMutability ,
243236 F : FunctionForm ,
@@ -250,59 +243,55 @@ where
250243 use binaryninjacore_sys:: BNLowLevelILOperation :: * ;
251244
252245 match op. operation {
253- LLIL_NOP => LowLevelILInstructionKind :: Nop ( Operation :: new ( function, op) ) ,
246+ LLIL_NOP => InstructionKind :: Nop ( Operation :: new ( function, op) ) ,
254247 LLIL_SET_REG | LLIL_SET_REG_SSA => {
255- LowLevelILInstructionKind :: SetReg ( Operation :: new ( function, op) )
248+ InstructionKind :: SetReg ( Operation :: new ( function, op) )
256249 }
257250 LLIL_SET_REG_SPLIT | LLIL_SET_REG_SPLIT_SSA => {
258- LowLevelILInstructionKind :: SetRegSplit ( Operation :: new ( function, op) )
251+ InstructionKind :: SetRegSplit ( Operation :: new ( function, op) )
259252 }
260253 LLIL_SET_FLAG | LLIL_SET_FLAG_SSA => {
261- LowLevelILInstructionKind :: SetFlag ( Operation :: new ( function, op) )
254+ InstructionKind :: SetFlag ( Operation :: new ( function, op) )
262255 }
263- LLIL_STORE | LLIL_STORE_SSA => {
264- LowLevelILInstructionKind :: Store ( Operation :: new ( function, op) )
265- }
266- LLIL_PUSH => LowLevelILInstructionKind :: Push ( Operation :: new ( function, op) ) ,
256+ LLIL_STORE | LLIL_STORE_SSA => InstructionKind :: Store ( Operation :: new ( function, op) ) ,
257+ LLIL_PUSH => InstructionKind :: Push ( Operation :: new ( function, op) ) ,
267258
268- LLIL_REG_STACK_PUSH => {
269- LowLevelILInstructionKind :: RegStackPush ( Operation :: new ( function, op) )
270- }
259+ LLIL_REG_STACK_PUSH => InstructionKind :: RegStackPush ( Operation :: new ( function, op) ) ,
271260
272- LLIL_JUMP => LowLevelILInstructionKind :: Jump ( Operation :: new ( function, op) ) ,
273- LLIL_JUMP_TO => LowLevelILInstructionKind :: JumpTo ( Operation :: new ( function, op) ) ,
261+ LLIL_JUMP => InstructionKind :: Jump ( Operation :: new ( function, op) ) ,
262+ LLIL_JUMP_TO => InstructionKind :: JumpTo ( Operation :: new ( function, op) ) ,
274263
275264 LLIL_CALL | LLIL_CALL_STACK_ADJUST | LLIL_CALL_SSA => {
276- LowLevelILInstructionKind :: Call ( Operation :: new ( function, op) )
265+ InstructionKind :: Call ( Operation :: new ( function, op) )
277266 }
278267 LLIL_TAILCALL | LLIL_TAILCALL_SSA => {
279- LowLevelILInstructionKind :: TailCall ( Operation :: new ( function, op) )
268+ InstructionKind :: TailCall ( Operation :: new ( function, op) )
280269 }
281270
282- LLIL_RET => LowLevelILInstructionKind :: Ret ( Operation :: new ( function, op) ) ,
283- LLIL_NORET => LowLevelILInstructionKind :: NoRet ( Operation :: new ( function, op) ) ,
271+ LLIL_RET => InstructionKind :: Ret ( Operation :: new ( function, op) ) ,
272+ LLIL_NORET => InstructionKind :: NoRet ( Operation :: new ( function, op) ) ,
284273
285- LLIL_IF => LowLevelILInstructionKind :: If ( Operation :: new ( function, op) ) ,
286- LLIL_GOTO => LowLevelILInstructionKind :: Goto ( Operation :: new ( function, op) ) ,
274+ LLIL_IF => InstructionKind :: If ( Operation :: new ( function, op) ) ,
275+ LLIL_GOTO => InstructionKind :: Goto ( Operation :: new ( function, op) ) ,
287276
288277 LLIL_SYSCALL | LLIL_SYSCALL_SSA => {
289- LowLevelILInstructionKind :: Syscall ( Operation :: new ( function, op) )
278+ InstructionKind :: Syscall ( Operation :: new ( function, op) )
290279 }
291280 LLIL_INTRINSIC | LLIL_INTRINSIC_SSA => {
292- LowLevelILInstructionKind :: Intrinsic ( Operation :: new ( function, op) )
281+ InstructionKind :: Intrinsic ( Operation :: new ( function, op) )
293282 }
294- LLIL_BP => LowLevelILInstructionKind :: Bp ( Operation :: new ( function, op) ) ,
295- LLIL_TRAP => LowLevelILInstructionKind :: Trap ( Operation :: new ( function, op) ) ,
296- LLIL_UNDEF => LowLevelILInstructionKind :: Undef ( Operation :: new ( function, op) ) ,
297- _ => LowLevelILInstructionKind :: Value ( LowLevelILExpression :: new ( function, expr_index) ) ,
283+ LLIL_BP => InstructionKind :: Bp ( Operation :: new ( function, op) ) ,
284+ LLIL_TRAP => InstructionKind :: Trap ( Operation :: new ( function, op) ) ,
285+ LLIL_UNDEF => InstructionKind :: Undef ( Operation :: new ( function, op) ) ,
286+ _ => InstructionKind :: Value ( LowLevelILExpression :: new ( function, expr_index) ) ,
298287 }
299288 }
300289
301290 fn visit_sub_expressions < T > ( & self , mut visitor : T ) -> VisitorAction
302291 where
303292 T : FnMut ( & LowLevelILExpression < ' func , M , F , ValueExpr > ) -> VisitorAction ,
304293 {
305- use LowLevelILInstructionKind :: * ;
294+ use InstructionKind :: * ;
306295
307296 macro_rules! visit {
308297 ( $expr: expr) => {
0 commit comments