1use super::{CsrGraph, FixedPointBatch};
2
3impl<'a, F> FixedPointBatch<'a, F>
4where
5 F: Fn(&vyre::ir::Program, &[&[u8]], Option<[u32; 3]>, &mut Vec<Vec<u8>>) -> Result<(), String>,
6{
7 pub fn live(
8 &mut self,
9 graph: CsrGraph<'_>,
10 seed_bits: &[u32],
11 max_iterations: u32,
12 ) -> Result<Vec<u32>, String> {
13 crate::live::live_closure_borrowed_into_with_scratch_via(
14 self.dispatch,
15 graph.node_count,
16 graph.edge_offsets,
17 graph.edge_targets,
18 graph.edge_kind_mask,
19 seed_bits,
20 max_iterations,
21 &mut self.scratch,
22 )
23 }
24
25 pub fn live_into(
27 &mut self,
28 graph: CsrGraph<'_>,
29 seed_bits: &[u32],
30 max_iterations: u32,
31 result: &mut Vec<u32>,
32 ) -> Result<(), String> {
33 crate::live::live_closure_borrowed_into_result_with_scratch_via(
34 self.dispatch,
35 graph.node_count,
36 graph.edge_offsets,
37 graph.edge_targets,
38 graph.edge_kind_mask,
39 seed_bits,
40 max_iterations,
41 &mut self.scratch,
42 result,
43 )
44 }
45
46 pub fn prepare_live(
48 &mut self,
49 graph: CsrGraph<'_>,
50 ) -> Result<crate::fixed_point_graph::FixedPointForwardGraph, String> {
51 crate::live::prepare_live_graph_with_scratch(
52 graph.node_count,
53 graph.edge_offsets,
54 graph.edge_targets,
55 graph.edge_kind_mask,
56 &mut self.scratch,
57 )
58 }
59
60 pub fn prepare_live_into(
62 &mut self,
63 graph: CsrGraph<'_>,
64 prepared: &mut crate::fixed_point_graph::FixedPointForwardGraph,
65 ) -> Result<(), String> {
66 crate::live::prepare_live_graph_into_with_scratch(
67 prepared,
68 graph.node_count,
69 graph.edge_offsets,
70 graph.edge_targets,
71 graph.edge_kind_mask,
72 &mut self.scratch,
73 )
74 }
75
76 pub fn prepare_live_plan(
78 &mut self,
79 graph: CsrGraph<'_>,
80 ) -> Result<crate::fixed_point_graph::FixedPointAnalysisPlan, String> {
81 crate::live::prepare_live_plan_with_scratch(
82 graph.node_count,
83 graph.edge_offsets,
84 graph.edge_targets,
85 graph.edge_kind_mask,
86 &mut self.scratch,
87 )
88 }
89
90 pub fn prepare_live_plan_into(
92 &mut self,
93 graph: CsrGraph<'_>,
94 plan: &mut crate::fixed_point_graph::FixedPointAnalysisPlan,
95 ) -> Result<(), String> {
96 crate::live::prepare_live_plan_into_with_scratch(
97 plan,
98 graph.node_count,
99 graph.edge_offsets,
100 graph.edge_targets,
101 graph.edge_kind_mask,
102 &mut self.scratch,
103 )
104 }
105
106 pub fn live_prepared(
108 &mut self,
109 graph: &crate::fixed_point_graph::FixedPointForwardGraph,
110 seed_bits: &[u32],
111 max_iterations: u32,
112 ) -> Result<Vec<u32>, String> {
113 crate::live::live_closure_prepared_borrowed_into_with_scratch_via(
114 self.dispatch,
115 graph,
116 seed_bits,
117 max_iterations,
118 &mut self.scratch,
119 )
120 }
121
122 pub fn live_prepared_into(
125 &mut self,
126 graph: &crate::fixed_point_graph::FixedPointForwardGraph,
127 seed_bits: &[u32],
128 max_iterations: u32,
129 result: &mut Vec<u32>,
130 ) -> Result<(), String> {
131 crate::live::live_closure_prepared_borrowed_into_result_with_scratch_via(
132 self.dispatch,
133 graph,
134 seed_bits,
135 max_iterations,
136 &mut self.scratch,
137 result,
138 )
139 }
140
141 pub fn live_plan(
143 &mut self,
144 plan: &crate::fixed_point_graph::FixedPointAnalysisPlan,
145 seed_bits: &[u32],
146 max_iterations: u32,
147 ) -> Result<Vec<u32>, String> {
148 crate::live::live_closure_plan_borrowed_into_with_scratch_via(
149 self.dispatch,
150 plan,
151 seed_bits,
152 max_iterations,
153 &mut self.scratch,
154 )
155 }
156
157 pub fn live_plan_into(
160 &mut self,
161 plan: &crate::fixed_point_graph::FixedPointAnalysisPlan,
162 seed_bits: &[u32],
163 max_iterations: u32,
164 result: &mut Vec<u32>,
165 ) -> Result<(), String> {
166 crate::live::live_closure_plan_borrowed_into_result_with_scratch_via(
167 self.dispatch,
168 plan,
169 seed_bits,
170 max_iterations,
171 &mut self.scratch,
172 result,
173 )
174 }
175}