FILE compilers_laba fopen dump txt FOR_EACH_BB bb gimple_stmt_iterator

 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
FILE* compilers_laba = fopen("dump.txt", "w");
FOR_EACH_BB (bb) {
gimple_stmt_iterator si;
for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si)) {
gimple phi = gsi_stmt (si);
fprintf(compilers_laba, "gimple phi code: %d\n", gimple_code(phi));
}
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) {
gimple stmt = gsi_stmt (si);
fprintf(compilers_laba, "gimple stmt code: %d", gimple_code(stmt));
switch (gimple_code(stmt)) {
case GIMPLE_ASSIGN:
fprintf(compilers_laba, " GIMPLE_ASSIGN\n");
print_gimple_stmt (compilers_laba, stmt, 0, TDF_SLIM);
break;
case GIMPLE_CALL:
fprintf(compilers_laba, " GIMPLE_CALL\n");
print_gimple_stmt (compilers_laba, stmt, 0, TDF_SLIM);
break;
default:
fprintf(compilers_laba, "\n");
}
bool flag = gimple_has_mem_ops(stmt);
fprintf(compilers_laba, "statement has memory operands - %d\n", flag);
if (flag) fprintf(compilers_laba, "number of operands for statement - %d\n", gimple_num_ops(stmt));
}
}
fclose(compilers_laba);