[FIR] Introduce new algorithm for building CFG for declarations

This commit is contained in:
Dmitriy Novozhilov
2020-06-05 15:47:57 +03:00
parent 950bbfe3a5
commit 87859b0faa
95 changed files with 16070 additions and 13199 deletions
+234 -161
View File
@@ -6,208 +6,281 @@ digraph lambdas_kt {
subgraph cluster_0 {
color=red
0 [label="Enter function run" style="filled" fillcolor=red];
2 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
subgraph cluster_1 {
color=blue
2 [label="Enter block"];
3 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
4 [label="Exit block"];
}
1 [label="Exit function run" style="filled" fillcolor=red];
}
0 -> {2};
2 -> {1};
2 -> {3};
3 -> {4};
4 -> {1};
subgraph cluster_1 {
subgraph cluster_2 {
color=red
3 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_2 {
5 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
5 [label="Enter when"];
subgraph cluster_3 {
color=blue
7 [label="Enter when branch condition "];
8 [label="Access variable R|<local>/x|"];
9 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
10 [label="Exit when branch condition"];
}
18 [label="Synthetic else branch"];
11 [label="Enter when branch result"];
7 [label="Enter block"];
subgraph cluster_4 {
color=blue
12 [label="Enter block"];
13 [label="Postponed enter to lambda"];
8 [label="Enter when"];
subgraph cluster_5 {
color=blue
19 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
21 [label="Access variable R|<local>/x|"];
22 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
20 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
10 [label="Enter when branch condition "];
11 [label="Access variable R|<local>/x|"];
12 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
13 [label="Exit when branch condition"];
}
14 [label="Postponed exit from lambda"];
15 [label="Function call: R|/run|(...)"];
16 [label="Exit block"];
21 [label="Synthetic else branch"];
14 [label="Enter when branch result"];
subgraph cluster_6 {
color=blue
15 [label="Enter block"];
16 [label="Postponed enter to lambda"];
subgraph cluster_7 {
color=blue
23 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
25 [label="Enter block"];
26 [label="Access variable R|<local>/x|"];
27 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
28 [label="Exit block"];
}
24 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
17 [label="Postponed exit from lambda"];
18 [label="Function call: R|/run|(...)"];
19 [label="Exit block"];
}
20 [label="Exit when branch result"];
9 [label="Exit when"];
}
17 [label="Exit when branch result"];
6 [label="Exit when"];
22 [label="Exit block"];
}
4 [label="Exit function test_1" style="filled" fillcolor=red];
6 [label="Exit function test_1" style="filled" fillcolor=red];
}
3 -> {5};
5 -> {7};
6 -> {4};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11 18};
8 -> {10};
9 -> {22};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {19};
13 -> {14} [color=red];
13 -> {14 21};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {6};
18 -> {6};
19 -> {20 21};
20 -> {14} [color=green];
20 -> {19} [color=green style=dashed];
21 -> {22};
22 -> {20};
16 -> {23};
16 -> {17} [color=red];
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {9};
21 -> {9};
22 -> {6};
23 -> {24 25};
24 -> {17} [color=green];
24 -> {23} [color=green style=dashed];
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {24};
subgraph cluster_6 {
subgraph cluster_9 {
color=red
23 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
25 [label="Enter when"];
subgraph cluster_8 {
color=blue
27 [label="Enter when branch condition "];
28 [label="Access variable R|<local>/x|"];
29 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
30 [label="Exit when branch condition"];
}
36 [label="Synthetic else branch"];
31 [label="Enter when branch result"];
subgraph cluster_9 {
color=blue
32 [label="Enter block"];
33 [label="Variable declaration: lval lambda: R|() -> kotlin/Int|"];
34 [label="Exit block"];
}
35 [label="Exit when branch result"];
26 [label="Exit when"];
}
29 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
37 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
39 [label="Access variable R|<local>/x|"];
40 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
38 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
31 [label="Enter block"];
subgraph cluster_11 {
color=blue
32 [label="Enter when"];
subgraph cluster_12 {
color=blue
34 [label="Enter when branch condition "];
35 [label="Access variable R|<local>/x|"];
36 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
37 [label="Exit when branch condition"];
}
45 [label="Synthetic else branch"];
38 [label="Enter when branch result"];
subgraph cluster_13 {
color=blue
39 [label="Enter block"];
40 [label="Postponed enter to lambda"];
subgraph cluster_14 {
color=blue
47 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
49 [label="Enter block"];
50 [label="Access variable R|<local>/x|"];
51 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
52 [label="Exit block"];
}
48 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
41 [label="Postponed exit from lambda"];
42 [label="Variable declaration: lval lambda: R|() -> kotlin/Int|"];
43 [label="Exit block"];
}
44 [label="Exit when branch result"];
33 [label="Exit when"];
}
46 [label="Exit block"];
}
24 [label="Exit function test_2" style="filled" fillcolor=red];
30 [label="Exit function test_2" style="filled" fillcolor=red];
}
23 -> {25};
25 -> {27};
26 -> {24};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31 36};
29 -> {31};
31 -> {32};
32 -> {33};
32 -> {37} [color=red];
33 -> {34};
32 -> {34};
33 -> {46};
34 -> {35};
35 -> {26};
36 -> {26};
37 -> {39};
35 -> {36};
36 -> {37};
37 -> {38 45};
38 -> {39};
39 -> {40};
40 -> {38};
subgraph cluster_11 {
color=red
41 [label="Enter function getInt" style="filled" fillcolor=red];
43 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
44 [label="Const: Int(1)"];
45 [label="Jump: ^getInt Int(1)"];
46 [label="Stub" style="filled" fillcolor=gray];
42 [label="Exit function getInt" style="filled" fillcolor=red];
}
41 -> {43};
40 -> {41 47};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {42};
45 -> {46} [style=dotted];
46 -> {42} [style=dotted];
subgraph cluster_12 {
color=red
47 [label="Enter function test_3" style="filled" fillcolor=red];
49 [label="Postponed enter to lambda"];
subgraph cluster_13 {
color=blue
54 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
56 [label="Const: Int(1)"];
57 [label="Jump: ^test_3 Int(1)"];
58 [label="Stub" style="filled" fillcolor=gray];
55 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
50 [label="Postponed exit from lambda"];
51 [label="Function call: R|/getInt|(...)"];
52 [label="Jump: ^test_3 R|/getInt|(<L> = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^test_3 Int(1)
}
)"];
53 [label="Stub" style="filled" fillcolor=gray];
48 [label="Exit function test_3" style="filled" fillcolor=red];
}
44 -> {33};
45 -> {33};
46 -> {30};
47 -> {49};
49 -> {54};
49 -> {50} [color=red];
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {48};
52 -> {53} [style=dotted];
53 -> {48} [style=dotted];
54 -> {55 56};
55 -> {50} [color=green];
55 -> {54} [color=green style=dashed];
56 -> {57};
57 -> {48};
57 -> {58} [style=dotted];
58 -> {55} [style=dotted];
subgraph cluster_14 {
subgraph cluster_16 {
color=red
59 [label="Enter function test_4" style="filled" fillcolor=red];
61 [label="Postponed enter to lambda"];
subgraph cluster_15 {
53 [label="Enter function getInt" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
66 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
68 [label="Const: Int(1)"];
69 [label="Jump: ^test_4 Int(1)"];
70 [label="Stub" style="filled" fillcolor=gray];
67 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
55 [label="Enter block"];
56 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
57 [label="Const: Int(1)"];
58 [label="Jump: ^getInt Int(1)"];
59 [label="Stub" style="filled" fillcolor=gray];
60 [label="Exit block" style="filled" fillcolor=gray];
}
62 [label="Postponed exit from lambda"];
63 [label="Function call: R|/getInt|(...)"];
64 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
54 [label="Exit function getInt" style="filled" fillcolor=red];
}
53 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {54};
58 -> {59} [style=dotted];
59 -> {60} [style=dotted];
60 -> {54} [style=dotted];
subgraph cluster_18 {
color=red
61 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
63 [label="Enter block"];
64 [label="Postponed enter to lambda"];
subgraph cluster_20 {
color=blue
70 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
72 [label="Enter block"];
73 [label="Const: Int(1)"];
74 [label="Jump: ^test_3 Int(1)"];
75 [label="Stub" style="filled" fillcolor=gray];
76 [label="Exit block" style="filled" fillcolor=gray];
}
71 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
65 [label="Postponed exit from lambda"];
66 [label="Function call: R|/getInt|(...)"];
67 [label="Jump: ^test_3 R|/getInt|(<L> = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^test_3 Int(1)
}
)"];
68 [label="Stub" style="filled" fillcolor=gray];
69 [label="Exit block" style="filled" fillcolor=gray];
}
62 [label="Exit function test_3" style="filled" fillcolor=red];
}
61 -> {63};
63 -> {64};
64 -> {70};
64 -> {65} [color=red];
65 -> {66};
66 -> {67};
67 -> {62};
67 -> {68} [style=dotted];
68 -> {69} [style=dotted];
69 -> {62} [style=dotted];
70 -> {71 72};
71 -> {65} [color=green];
71 -> {70} [color=green style=dashed];
72 -> {73};
73 -> {74};
74 -> {62};
74 -> {75} [style=dotted];
75 -> {76} [style=dotted];
76 -> {71} [style=dotted];
subgraph cluster_22 {
color=red
77 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_23 {
color=blue
79 [label="Enter block"];
80 [label="Postponed enter to lambda"];
subgraph cluster_24 {
color=blue
86 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_25 {
color=blue
88 [label="Enter block"];
89 [label="Const: Int(1)"];
90 [label="Jump: ^test_4 Int(1)"];
91 [label="Stub" style="filled" fillcolor=gray];
92 [label="Exit block" style="filled" fillcolor=gray];
}
87 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
81 [label="Postponed exit from lambda"];
82 [label="Function call: R|/getInt|(...)"];
83 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^test_4 Int(1)
}
)"];
65 [label="Stub" style="filled" fillcolor=gray];
60 [label="Exit function test_4" style="filled" fillcolor=red];
84 [label="Stub" style="filled" fillcolor=gray];
85 [label="Exit block" style="filled" fillcolor=gray];
}
78 [label="Exit function test_4" style="filled" fillcolor=red];
}
59 -> {61};
61 -> {66};
61 -> {62} [color=red];
62 -> {63};
63 -> {64};
64 -> {60};
64 -> {65} [style=dotted];
65 -> {60} [style=dotted];
66 -> {67 68};
67 -> {62} [color=green];
67 -> {66} [color=green style=dashed];
68 -> {69};
69 -> {60};
69 -> {70} [style=dotted];
70 -> {67} [style=dotted];
77 -> {79};
79 -> {80};
80 -> {86};
80 -> {81} [color=red];
81 -> {82};
82 -> {83};
83 -> {78};
83 -> {84} [style=dotted];
84 -> {85} [style=dotted];
85 -> {78} [style=dotted];
86 -> {87 88};
87 -> {81} [color=green];
87 -> {86} [color=green style=dashed];
88 -> {89};
89 -> {90};
90 -> {78};
90 -> {91} [style=dotted];
91 -> {92} [style=dotted];
92 -> {87} [style=dotted];
}