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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
#include "Relooper.h"
int main() {
char buffer[100000];
rl_set_output_buffer(buffer);
void *block_map[10000];
void *rl = rl_new_relooper();
void *b1 = rl_new_block("// code 1");
block_map[1] = b1;
rl_relooper_add_block(rl, block_map[1]);
void *b2 = rl_new_block("// code 2");
block_map[2] = b2;
rl_relooper_add_block(rl, block_map[2]);
void *b3 = rl_new_block("// code 3");
block_map[3] = b3;
rl_relooper_add_block(rl, block_map[3]);
void *b4 = rl_new_block("// code 4");
block_map[4] = b4;
rl_relooper_add_block(rl, block_map[4]);
rl_block_add_branch_to(block_map[1], block_map[2], "ep -> LBB1", NULL);
rl_block_add_branch_to(block_map[1], block_map[4], NULL, NULL);
rl_block_add_branch_to(block_map[2], block_map[3], "LBB1 -> LBB2", NULL);
rl_block_add_branch_to(block_map[2], block_map[4], NULL, NULL);
rl_block_add_branch_to(block_map[3], block_map[4], NULL, NULL);
rl_relooper_calculate(rl, block_map[1]);
rl_relooper_render(rl);
rl_delete_relooper(rl);
puts(buffer);
return 0;
}
// Adding block 1 (ep)
// with branch out to 2
// with branch out to 4
// Adding block 2 (LBB1)
// with branch out to 3
// with branch out to 4
// Adding block 3 (LBB2)
// with branch out to 4
// Adding block 4 (LBB3)
// Process() called
// Process() running
blocks : 1:
OUT 2
OUT 4
2:
OUT 3
OUT 4
IN 1
3:
OUT 4
IN 2
4:
IN 1
IN 2
IN 3
entries: 1:
OUT 2
OUT 4
// creating simple block with block #1
// Solipsizing branches into 2
relevant to solipsize: 1:
OUT 2
OUT 4
// eliminated branch from 1
// Solipsizing branches into 4
relevant to solipsize: 1:
OUT 4
// eliminated branch from 1
// Process() running
blocks : 2:
OUT 3
OUT 4
3:
OUT 4
IN 2
4:
IN 2
IN 3
entries: 2:
OUT 3
OUT 4
4:
IN 2
IN 3
// Investigated independent groups:
group: 2:
OUT 3
OUT 4
3:
OUT 4
IN 2
// Independent groups: 1
// Handleable independent groups: 1
// creating multiple block with 1 inner groups
// multiple group with entry 2:
2:
OUT 3
OUT 4
3:
OUT 4
IN 2
// Solipsizing branches into 4
relevant to solipsize: 2:
OUT 3
OUT 4
3:
OUT 4
IN 2
// eliminated branch from 2
// eliminated branch from 3
// Process() called
// Process() running
blocks : 2:
OUT 3
3:
IN 2
entries: 2:
OUT 3
// creating simple block with block #2
// Solipsizing branches into 3
relevant to solipsize: 2:
OUT 3
// eliminated branch from 2
// Process() running
blocks : 3:
entries: 3:
// creating simple block with block #3
// Process() returning
remaining blocks after multiple: 4:
// Process() running
blocks : 4:
entries: 4:
// creating simple block with block #4
// Process() returning
// === Optimizing shapes ===
// Fusing Multiple to Simple
ep
do {
if (ep -> LBB1) {
LBB1
if (!(LBB1 -> LBB2)) {
break;
}
LBB2
}
} while(0);
LBB3
|