File tree 4 files changed +436
-4
lines changed
4 files changed +436
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ indoc = "2.0.5"
8
8
serde_json = " 1.0"
9
9
smallstr = " 0.3.0"
10
10
smallvec = " 1.13.2"
11
+ brilirs = { version = " 0.1.0" , path = " ../bril/brilirs" }
11
12
12
13
[dependencies .bril-rs ]
13
14
version = " 0.1.0"
Original file line number Diff line number Diff line change
1
+ pub mod ssa;
2
+
1
3
use bril_rs:: Function ;
2
4
use std:: {
3
5
collections:: { HashMap , HashSet } ,
@@ -23,10 +25,12 @@ struct Node<Data: NodeEntry> {
23
25
predecessor_indices : SmallVec < [ usize ; 2 ] > ,
24
26
}
25
27
28
+ #[ derive( Debug , Clone ) ]
26
29
pub struct DirectedGraph < Data : NodeEntry > {
27
30
nodes : Vec < Node < Data > > ,
28
31
}
29
32
33
+ #[ derive( Debug , Clone ) ]
30
34
pub struct Cfg {
31
35
pub dag : DirectedGraph < BasicBlock > ,
32
36
pub function_name : String ,
@@ -223,6 +227,9 @@ impl Cfg {
223
227
pub fn get_basic_block ( & self , index : NodeIndex ) -> & BasicBlock {
224
228
& self . dag . nodes [ index] . data
225
229
}
230
+ pub fn get_basic_block_mut ( & mut self , index : NodeIndex ) -> & mut BasicBlock {
231
+ & mut self . dag . nodes . get_mut ( index) . unwrap ( ) . data
232
+ }
226
233
}
227
234
228
235
impl < ' a > Dominators < ' a > {
@@ -344,11 +351,9 @@ impl<'a> Dominators<'a> {
344
351
345
352
#[ cfg( test) ]
346
353
mod tests {
354
+ use super :: * ;
347
355
use bril_rs:: Program ;
348
356
use indoc:: indoc;
349
-
350
- use super :: * ;
351
-
352
357
use std:: sync:: LazyLock ;
353
358
354
359
static PROGRAM : LazyLock < Program > = LazyLock :: new ( || {
You can’t perform that action at this time.
0 commit comments