[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
@@ -6,279 +6,418 @@ digraph callsInPlace_kt {
subgraph cluster_0 {
color=red
0 [label="Enter function test" style="filled" fillcolor=red];
2 [label="Variable declaration: lval x: R|kotlin/Int|"];
3 [label="Postponed enter to lambda"];
subgraph cluster_1 {
color=blue
9 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
11 [label="Const: Int(1)"];
12 [label="Assignment: R|<local>/x|"];
10 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
2 [label="Enter block"];
3 [label="Variable declaration: lval x: R|kotlin/Int|"];
4 [label="Postponed enter to lambda"];
subgraph cluster_2 {
color=blue
11 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
13 [label="Enter block"];
14 [label="Const: Int(1)"];
15 [label="Assignment: R|<local>/x|"];
16 [label="Exit block"];
}
12 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
7 [label="Call arguments union" style="filled" fillcolor=yellow];
5 [label="Postponed exit from lambda"];
6 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(...)"];
8 [label="Access variable R|<local>/x|"];
9 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
10 [label="Exit block"];
}
6 [label="Call arguments union" style="filled" fillcolor=yellow];
4 [label="Postponed exit from lambda"];
5 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(...)"];
7 [label="Access variable R|<local>/x|"];
8 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
1 [label="Exit function test" style="filled" fillcolor=red];
}
0 -> {2};
2 -> {3};
3 -> {9};
3 -> {4} [color=red];
4 -> {5} [color=green];
5 -> {7};
6 -> {5} [color=red];
7 -> {8};
8 -> {1};
9 -> {11};
10 -> {4} [color=green];
10 -> {6} [color=red];
11 -> {12};
12 -> {10};
subgraph cluster_2 {
color=red
13 [label="Enter function test_2" style="filled" fillcolor=red];
15 [label="Const: Int(10)"];
16 [label="Postponed enter to lambda"];
subgraph cluster_3 {
color=blue
19 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
21 [label="Const: String(test_2)"];
20 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
17 [label="Postponed exit from lambda"];
18 [label="Function call: R|kotlin/repeat|(...)"];
14 [label="Exit function test_2" style="filled" fillcolor=red];
}
13 -> {15};
3 -> {4};
4 -> {11};
4 -> {5} [color=red];
5 -> {6} [color=green];
6 -> {8};
7 -> {6} [color=red];
8 -> {9};
9 -> {10};
10 -> {1};
11 -> {13};
12 -> {5} [color=green];
12 -> {7} [color=red];
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {19};
16 -> {17} [color=red];
17 -> {18};
18 -> {14};
19 -> {20 21};
20 -> {17} [color=green];
20 -> {19} [color=green style=dashed];
21 -> {20};
16 -> {12};
subgraph cluster_4 {
color=red
22 [label="Enter function test_3" style="filled" fillcolor=red];
24 [label="Postponed enter to lambda"];
17 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
28 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
30 [label="Const: String(test_3)"];
29 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
19 [label="Enter block"];
20 [label="Const: Int(10)"];
21 [label="Postponed enter to lambda"];
subgraph cluster_6 {
color=blue
25 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
27 [label="Enter block"];
28 [label="Const: String(test_2)"];
29 [label="Exit block"];
}
26 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
22 [label="Postponed exit from lambda"];
23 [label="Function call: R|kotlin/repeat|(...)"];
24 [label="Exit block"];
}
25 [label="Postponed exit from lambda"];
26 [label="Const: Int(10)"];
27 [label="Function call: R|kotlin/repeat|(...)"];
23 [label="Exit function test_3" style="filled" fillcolor=red];
18 [label="Exit function test_2" style="filled" fillcolor=red];
}
22 -> {24};
24 -> {28};
24 -> {25} [color=red];
25 -> {26};
26 -> {27};
27 -> {23};
28 -> {29 30};
29 -> {25} [color=green];
29 -> {28} [color=green style=dashed];
30 -> {29};
subgraph cluster_6 {
color=red
31 [label="Enter function test_4" style="filled" fillcolor=red];
33 [label="Const: Int(1)"];
34 [label="Postponed enter to lambda"];
subgraph cluster_7 {
color=blue
38 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
40 [label="Const: String(test_4)"];
41 [label="Access variable R|<local>/it|"];
42 [label="Const: Int(0)"];
43 [label="Function call: R|<local>/it|.R|kotlin/Int.compareTo|(...)"];
44 [label="Comparison >"];
39 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
37 [label="Call arguments union" style="filled" fillcolor=yellow];
35 [label="Postponed exit from lambda"];
36 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(...)"];
32 [label="Exit function test_4" style="filled" fillcolor=red];
}
31 -> {33};
33 -> {34};
34 -> {38};
34 -> {35} [color=red];
35 -> {36} [color=green];
36 -> {32};
37 -> {36} [color=red];
38 -> {40};
39 -> {35} [color=green];
39 -> {37} [color=red];
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {39};
17 -> {19};
19 -> {20};
20 -> {21};
21 -> {25};
21 -> {22} [color=red];
22 -> {23};
23 -> {24};
24 -> {18};
25 -> {26 27};
26 -> {22} [color=green];
26 -> {25} [color=green style=dashed];
27 -> {28};
28 -> {29};
29 -> {26};
subgraph cluster_8 {
color=red
45 [label="Enter function test_5" style="filled" fillcolor=red];
47 [label="Const: Int(1)"];
48 [label="Postponed enter to lambda"];
30 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
52 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
54 [label="Const: String(test_5)"];
55 [label="Access variable R|<local>/it|"];
56 [label="Const: Int(0)"];
57 [label="Function call: R|<local>/it|.R|kotlin/Int.compareTo|(...)"];
58 [label="Comparison >"];
53 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
32 [label="Enter block"];
33 [label="Postponed enter to lambda"];
subgraph cluster_10 {
color=blue
38 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
40 [label="Enter block"];
41 [label="Const: String(test_3)"];
42 [label="Exit block"];
}
39 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
34 [label="Postponed exit from lambda"];
35 [label="Const: Int(10)"];
36 [label="Function call: R|kotlin/repeat|(...)"];
37 [label="Exit block"];
}
51 [label="Call arguments union" style="filled" fillcolor=yellow];
49 [label="Postponed exit from lambda"];
50 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(...)"];
46 [label="Exit function test_5" style="filled" fillcolor=red];
31 [label="Exit function test_3" style="filled" fillcolor=red];
}
45 -> {47};
47 -> {48};
48 -> {52};
48 -> {49} [color=red];
49 -> {50} [color=green];
50 -> {46};
51 -> {50} [color=red];
30 -> {32};
32 -> {33};
33 -> {38};
33 -> {34} [color=red];
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {31};
38 -> {39 40};
39 -> {34} [color=green];
39 -> {38} [color=green style=dashed];
40 -> {41};
41 -> {42};
42 -> {39};
subgraph cluster_12 {
color=red
43 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
45 [label="Enter block"];
46 [label="Const: Int(1)"];
47 [label="Postponed enter to lambda"];
subgraph cluster_14 {
color=blue
52 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
54 [label="Enter block"];
55 [label="Const: String(test_4)"];
56 [label="Access variable R|<local>/it|"];
57 [label="Const: Int(0)"];
58 [label="Function call: R|<local>/it|.R|kotlin/Int.compareTo|(...)"];
59 [label="Comparison >"];
60 [label="Exit block"];
}
53 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
50 [label="Call arguments union" style="filled" fillcolor=yellow];
48 [label="Postponed exit from lambda"];
49 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(...)"];
51 [label="Exit block"];
}
44 [label="Exit function test_4" style="filled" fillcolor=red];
}
43 -> {45};
45 -> {46};
46 -> {47};
47 -> {52};
47 -> {48} [color=red];
48 -> {49} [color=green];
49 -> {51};
50 -> {49} [color=red];
51 -> {44};
52 -> {54};
53 -> {49} [color=green];
53 -> {51} [color=red];
53 -> {48} [color=green];
53 -> {50} [color=red];
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {53};
58 -> {59};
59 -> {60};
60 -> {53};
subgraph cluster_10 {
subgraph cluster_16 {
color=red
59 [label="Enter function myRun" style="filled" fillcolor=red];
61 [label="Function call: R|<local>/block1|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
62 [label="Function call: R|<local>/block2|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
60 [label="Exit function myRun" style="filled" fillcolor=red];
}
59 -> {61};
61 -> {62};
62 -> {60};
subgraph cluster_11 {
color=red
63 [label="Enter function test_6" style="filled" fillcolor=red];
65 [label="Postponed enter to lambda"];
subgraph cluster_12 {
61 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
70 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
72 [label="Const: String(test_6_1)"];
71 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
63 [label="Enter block"];
64 [label="Const: Int(1)"];
65 [label="Postponed enter to lambda"];
subgraph cluster_18 {
color=blue
70 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
72 [label="Enter block"];
73 [label="Const: String(test_5)"];
74 [label="Access variable R|<local>/it|"];
75 [label="Const: Int(0)"];
76 [label="Function call: R|<local>/it|.R|kotlin/Int.compareTo|(...)"];
77 [label="Comparison >"];
78 [label="Exit block"];
}
71 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
68 [label="Call arguments union" style="filled" fillcolor=yellow];
66 [label="Postponed exit from lambda"];
67 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(...)"];
69 [label="Exit block"];
}
66 [label="Postponed exit from lambda"];
67 [label="Postponed enter to lambda"];
subgraph cluster_13 {
color=blue
73 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
75 [label="Const: String(test_6_2)"];
74 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
68 [label="Postponed exit from lambda"];
69 [label="Function call: R|/myRun|(...)"];
64 [label="Exit function test_6" style="filled" fillcolor=red];
62 [label="Exit function test_5" style="filled" fillcolor=red];
}
63 -> {65};
61 -> {63};
63 -> {64};
64 -> {65};
65 -> {70};
65 -> {66} [color=red];
66 -> {67};
67 -> {73};
67 -> {68} [color=red];
68 -> {69};
69 -> {64};
70 -> {71 72};
66 -> {67} [color=green];
67 -> {69};
68 -> {67} [color=red];
69 -> {62};
70 -> {72};
71 -> {66} [color=green];
71 -> {70} [color=green style=dashed];
72 -> {71};
73 -> {74 75};
74 -> {68} [color=green];
74 -> {73} [color=green style=dashed];
75 -> {74};
71 -> {68} [color=red];
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {71};
subgraph cluster_14 {
subgraph cluster_20 {
color=red
76 [label="Enter function test_7" style="filled" fillcolor=red];
78 [label="Postponed enter to lambda"];
subgraph cluster_15 {
79 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
83 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
85 [label="Const: String(test_7_2)"];
84 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
81 [label="Enter block"];
82 [label="Function call: R|<local>/block1|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
83 [label="Function call: R|<local>/block2|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
84 [label="Exit block"];
}
79 [label="Postponed exit from lambda"];
80 [label="Postponed enter to lambda"];
subgraph cluster_16 {
color=blue
86 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
88 [label="Const: String(test_7_1)"];
87 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
81 [label="Postponed exit from lambda"];
82 [label="Function call: R|/myRun|(...)"];
77 [label="Exit function test_7" style="filled" fillcolor=red];
80 [label="Exit function myRun" style="filled" fillcolor=red];
}
76 -> {78};
78 -> {83};
78 -> {79} [color=red];
79 -> {80};
80 -> {86};
80 -> {81} [color=red];
79 -> {81};
81 -> {82};
82 -> {77};
83 -> {84 85};
84 -> {79} [color=green];
84 -> {83} [color=green style=dashed];
85 -> {84};
86 -> {87 88};
87 -> {81} [color=green];
87 -> {86} [color=green style=dashed];
88 -> {87};
82 -> {83};
83 -> {84};
84 -> {80};
subgraph cluster_17 {
subgraph cluster_22 {
color=red
89 [label="Enter function myDummyRun" style="filled" fillcolor=red];
91 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
90 [label="Exit function myDummyRun" style="filled" fillcolor=red];
}
89 -> {91};
91 -> {90};
subgraph cluster_18 {
color=red
92 [label="Enter function test_8" style="filled" fillcolor=red];
94 [label="Postponed enter to lambda"];
subgraph cluster_19 {
85 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_23 {
color=blue
97 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
99 [label="Const: String(test_8)"];
98 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
87 [label="Enter block"];
88 [label="Postponed enter to lambda"];
subgraph cluster_24 {
color=blue
94 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_25 {
color=blue
96 [label="Enter block"];
97 [label="Const: String(test_6_1)"];
98 [label="Exit block"];
}
95 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
89 [label="Postponed exit from lambda"];
90 [label="Postponed enter to lambda"];
subgraph cluster_26 {
color=blue
99 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_27 {
color=blue
101 [label="Enter block"];
102 [label="Const: String(test_6_2)"];
103 [label="Exit block"];
}
100 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
91 [label="Postponed exit from lambda"];
92 [label="Function call: R|/myRun|(...)"];
93 [label="Exit block"];
}
95 [label="Postponed exit from lambda"];
96 [label="Function call: R|/myDummyRun|(...)"];
93 [label="Exit function test_8" style="filled" fillcolor=red];
86 [label="Exit function test_6" style="filled" fillcolor=red];
}
92 -> {94};
94 -> {95};
94 -> {97} [color=red];
95 -> {96};
96 -> {93};
97 -> {99};
99 -> {98};
85 -> {87};
87 -> {88};
88 -> {94};
88 -> {89} [color=red];
89 -> {90};
90 -> {99};
90 -> {91} [color=red];
91 -> {92};
92 -> {93};
93 -> {86};
94 -> {95 96};
95 -> {89} [color=green];
95 -> {94} [color=green style=dashed];
96 -> {97};
97 -> {98};
98 -> {95};
99 -> {100 101};
100 -> {91} [color=green];
100 -> {99} [color=green style=dashed];
101 -> {102};
102 -> {103};
103 -> {100};
subgraph cluster_28 {
color=red
104 [label="Enter function test_7" style="filled" fillcolor=red];
subgraph cluster_29 {
color=blue
106 [label="Enter block"];
107 [label="Postponed enter to lambda"];
subgraph cluster_30 {
color=blue
113 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_31 {
color=blue
115 [label="Enter block"];
116 [label="Const: String(test_7_2)"];
117 [label="Exit block"];
}
114 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
108 [label="Postponed exit from lambda"];
109 [label="Postponed enter to lambda"];
subgraph cluster_32 {
color=blue
118 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_33 {
color=blue
120 [label="Enter block"];
121 [label="Const: String(test_7_1)"];
122 [label="Exit block"];
}
119 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
110 [label="Postponed exit from lambda"];
111 [label="Function call: R|/myRun|(...)"];
112 [label="Exit block"];
}
105 [label="Exit function test_7" style="filled" fillcolor=red];
}
104 -> {106};
106 -> {107};
107 -> {113};
107 -> {108} [color=red];
108 -> {109};
109 -> {118};
109 -> {110} [color=red];
110 -> {111};
111 -> {112};
112 -> {105};
113 -> {114 115};
114 -> {108} [color=green];
114 -> {113} [color=green style=dashed];
115 -> {116};
116 -> {117};
117 -> {114};
118 -> {119 120};
119 -> {110} [color=green];
119 -> {118} [color=green style=dashed];
120 -> {121};
121 -> {122};
122 -> {119};
subgraph cluster_34 {
color=red
123 [label="Enter function myDummyRun" style="filled" fillcolor=red];
subgraph cluster_35 {
color=blue
125 [label="Enter block"];
126 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
127 [label="Exit block"];
}
124 [label="Exit function myDummyRun" style="filled" fillcolor=red];
}
123 -> {125};
125 -> {126};
126 -> {127};
127 -> {124};
subgraph cluster_36 {
color=red
128 [label="Enter function test_8" style="filled" fillcolor=red];
subgraph cluster_37 {
color=blue
130 [label="Enter block"];
131 [label="Postponed enter to lambda"];
subgraph cluster_38 {
color=blue
135 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_39 {
color=blue
137 [label="Enter block"];
138 [label="Const: String(test_8)"];
139 [label="Exit block"];
}
136 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
132 [label="Postponed exit from lambda"];
133 [label="Function call: R|/myDummyRun|(...)"];
134 [label="Exit block"];
}
129 [label="Exit function test_8" style="filled" fillcolor=red];
}
128 -> {130};
130 -> {131};
131 -> {132 135};
132 -> {133};
133 -> {134};
134 -> {129};
135 -> {137};
137 -> {138};
138 -> {139};
139 -> {136};
}