1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Compiler infrastructure for SSA-based code transformations.
//!
//! This module provides the middle layer between analysis and code generation:
//!
//! - [`crate::analysis`] — CIL → SSA construction, CFG, dataflow
//! - [`compiler`](self) — SSA optimization passes, codegen (SSA → CIL)
//! - [`crate::deobfuscation`] — Obfuscator detection, orchestration
//!
//! # Architecture
//!
//! ```text
//! ┌──────────────────────────────────────────────────────────────────┐
//! │ Compiler Pipeline │
//! ├──────────────────────────────────────────────────────────────────┤
//! │ │
//! │ CompilerContext Shared interprocedural state │
//! │ ├─ SSA functions (per-method SSA, call graph, │
//! │ ├─ Method summaries known values, dead methods) │
//! │ └─ EventLog │
//! │ │
//! │ PassScheduler 4-phase fixpoint execution │
//! │ ├─ Phase 1: Structure (CFF unflattening) │
//! │ ├─ Phase 2: Value (decryption) │
//! │ ├─ Phase 3: Simplify (predicates, CFG, threading) │
//! │ └─ Phase 4: Inline (small method inlining) │
//! │ Each phase: run → normalize → repeat until stable │
//! │ │
//! │ SsaPass trait Interface for all passes │
//! │ ├─ run_on_method() Per-method transformation │
//! │ ├─ initialize() One-time setup before pipeline │
//! │ └─ finalize() Cleanup after pipeline completes │
//! │ │
//! │ Passes (16 built-in) Optimization transformations │
//! │ ├─ Value: const prop, copy prop, GVN, strength reduction │
//! │ ├─ CFG: branch simplify, jump threading, loop canon │
//! │ ├─ Cleanup: DCE, block merging, dead method elimination │
//! │ └─ Other: opaque predicates, algebraic, reassociation, LICM │
//! │ │
//! │ SsaCodeGenerator SSA → CIL roundtrip │
//! │ ├─ Register allocation (SSA vars → CIL locals) │
//! │ ├─ Phi elimination (φ nodes → moves) │
//! │ └─ Instruction selection (SSA ops → CIL bytecode) │
//! │ │
//! │ EventLog Change tracking and diagnostics │
//! │ MethodSummary Interprocedural analysis results │
//! │ │
//! └──────────────────────────────────────────────────────────────────┘
//! ```
pub use ;
pub use CompilerContext;
pub use ;
pub use SsaPass;
pub use ;
pub use PassScheduler;
pub use ;