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
//! [`SsaStore<T>`] — host-supplied storage for per-method SSA functions,
//! used by the pass scheduler to hand SSA to passes and reclaim it.
use crate::;
/// Per-method SSA storage that the pass scheduler reads and writes.
///
/// Implementations are interior-mutable (typically `DashMap`-backed) so
/// the scheduler can remove a method's SSA, hand it to a pass for
/// mutation, and reinsert it without acquiring `&mut` on the host.
///
/// # Concurrency
///
/// All methods take `&self` to allow parallel pass execution. Implementations
/// are responsible for thread-safety. The scheduler uses
/// [`take_ssa`](Self::take_ssa) + [`insert_ssa`](Self::insert_ssa)
/// (rather than holding a borrow across the pass call) so peer-reading
/// passes (those that look up other methods' SSA via
/// [`clone_ssa`](Self::clone_ssa)) do not deadlock.
///
/// # Dyn compatibility
///
/// Methods are kept non-generic so the trait can be used as
/// `&dyn SsaStore<T>` and as part of the
/// [`SsaPassHost<T>`](crate::scheduling::SsaPassHost) trait object
/// exposed to passes.