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
|
#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 2 3 4
entries: 1
// creating simple block with block #1
// Solipsizing branches into 2
relevant to solipsize: 1
// eliminated branch from 1
// Solipsizing branches into 4
relevant to solipsize: 1
// eliminated branch from 1
// Process() running
blocks : 2 3 4
entries: 2 4
// Investigated independent groups:
group: 2 3
// Independent groups: 1
// Handleable independent groups: 1
// creating multiple block with 1 inner groups
// multiple group with entry 2:
2 3
// Solipsizing branches into 4
relevant to solipsize: 2 3
// eliminated branch from 2
// eliminated branch from 3
// Process() called
// Process() running
blocks : 2 3
entries: 2
// creating simple block with block #2
// Solipsizing branches into 3
relevant to solipsize: 2
// 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
L1:
if (ep -> LBB1) {
LBB1
if (!(LBB1 -> LBB2)) {
break L1;
}
LBB2
}
LBB3
|