1
+ use alloc:: {
2
+ boxed:: Box ,
3
+ collections:: { BTreeMap , BTreeSet } ,
4
+ format,
5
+ string:: String ,
6
+ vec:: Vec ,
7
+ } ;
8
+ use core:: {
9
+ ffi:: CStr ,
10
+ ops:: { Index , IndexMut } ,
11
+ } ;
12
+
13
+ use itertools:: Itertools ;
14
+ use ppc750cl:: Simm ;
15
+
1
16
use crate :: {
2
17
arch:: DataType ,
3
18
obj:: { FlowAnalysisResult , FlowAnalysisValue , Object , Relocation , Symbol } ,
4
19
util:: { RawDouble , RawFloat } ,
5
20
} ;
6
- use alloc:: collections:: { BTreeMap , BTreeSet } ;
7
- use alloc:: { boxed:: Box , format, string:: String , vec:: Vec } ;
8
- use core:: ffi:: CStr ;
9
- use core:: ops:: { Index , IndexMut } ;
10
- use itertools:: Itertools ;
11
- use ppc750cl:: Simm ;
12
21
13
22
fn is_store_instruction ( op : ppc750cl:: Opcode ) -> bool {
14
23
use ppc750cl:: Opcode ;
@@ -165,9 +174,8 @@ impl RegisterState {
165
174
166
175
impl Index < ppc750cl:: GPR > for RegisterState {
167
176
type Output = RegisterContent ;
168
- fn index ( & self , gpr : ppc750cl:: GPR ) -> & Self :: Output {
169
- & self . gpr [ gpr. 0 as usize ]
170
- }
177
+
178
+ fn index ( & self , gpr : ppc750cl:: GPR ) -> & Self :: Output { & self . gpr [ gpr. 0 as usize ] }
171
179
}
172
180
impl IndexMut < ppc750cl:: GPR > for RegisterState {
173
181
fn index_mut ( & mut self , gpr : ppc750cl:: GPR ) -> & mut Self :: Output {
@@ -177,9 +185,8 @@ impl IndexMut<ppc750cl::GPR> for RegisterState {
177
185
178
186
impl Index < ppc750cl:: FPR > for RegisterState {
179
187
type Output = RegisterContent ;
180
- fn index ( & self , fpr : ppc750cl:: FPR ) -> & Self :: Output {
181
- & self . fpr [ fpr. 0 as usize ]
182
- }
188
+
189
+ fn index ( & self , fpr : ppc750cl:: FPR ) -> & Self :: Output { & self . fpr [ fpr. 0 as usize ] }
183
190
}
184
191
impl IndexMut < ppc750cl:: FPR > for RegisterState {
185
192
fn index_mut ( & mut self , fpr : ppc750cl:: FPR ) -> & mut Self :: Output {
@@ -296,9 +303,7 @@ impl PPCFlowAnalysisResult {
296
303
self . argument_contents . insert ( ( address, argument) , value) ;
297
304
}
298
305
299
- fn new ( ) -> Self {
300
- PPCFlowAnalysisResult { argument_contents : Default :: default ( ) }
301
- }
306
+ fn new ( ) -> Self { PPCFlowAnalysisResult { argument_contents : Default :: default ( ) } }
302
307
}
303
308
304
309
impl FlowAnalysisResult for PPCFlowAnalysisResult {
@@ -372,9 +377,7 @@ fn fill_registers_from_relocation(
372
377
// See: https://github.com/encounter/decomp-toolkit/blob/main/src/analysis/pass.rs
373
378
const SLEDS : [ & str ; 6 ] = [ "_savefpr_" , "_restfpr_" , "_savegpr_" , "_restgpr_" , "_savev" , "_restv" ] ;
374
379
375
- fn is_sled_function ( name : & str ) -> bool {
376
- SLEDS . iter ( ) . any ( |sled| name. starts_with ( sled) )
377
- }
380
+ fn is_sled_function ( name : & str ) -> bool { SLEDS . iter ( ) . any ( |sled| name. starts_with ( sled) ) }
378
381
379
382
pub fn ppc_data_flow_analysis (
380
383
obj : & Object ,
@@ -383,6 +386,7 @@ pub fn ppc_data_flow_analysis(
383
386
relocations : & [ Relocation ] ,
384
387
) -> Box < dyn FlowAnalysisResult > {
385
388
use alloc:: collections:: VecDeque ;
389
+
386
390
use ppc750cl:: InsIter ;
387
391
let instructions = InsIter :: new ( code, func_symbol. address as u32 )
388
392
. map ( |( _addr, ins) | ( ins. op , ins. basic ( ) . args ) )
0 commit comments