#define pns_args pn_Start_T_args
#define pns_value_arg_base pn_Start_P_value_arg_base
+#define pnc_number pn_Cmp
+#define False pn_Cmp_False
+#define Eq pn_Cmp_Eq
+#define Lt pn_Cmp_Lt
+#define Le pn_Cmp_Le
+#define Gt pn_Cmp_Gt
+#define Ge pn_Cmp_Ge
+#define Lg pn_Cmp_Lg
+#define Leg pn_Cmp_Leg
+#define Uo pn_Cmp_Uo
+#define Ue pn_Cmp_Ue
+#define Ul pn_Cmp_Ul
+#define Ule pn_Cmp_Ule
+#define Ug pn_Cmp_Ug
+#define Uge pn_Cmp_Uge
+#define Ne pn_Cmp_Ne
+#define True pn_Cmp_True
+
/* irmode.h */
#define get_ident_of_mode get_mode_ident
#define get_size_of_mode get_mode_size
/* irdump */
#define dump_cg_graph dump_ir_graph
#define dump_cg_block_graph dump_ir_block_graph
-extern char *dump_file_filter; /* use the setter instead. */
/* type.h */
#define get_type_nameid(_t_) get_type_ident(_t_)
#define id_to_str(X) get_id_str(X)
#define id_from_str(X, Y) new_id_from_chars(X, Y)
+
+
#endif
/* the expression that evaluates the condition */
/* cmpGt = a > 2 */
c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
- cmpGt = new_Proj(new_Cmp(get_value(0, mode_Is), c2), mode_b, Gt);
+ cmpGt = new_Proj(new_Cmp(get_value(0, mode_Is), c2), mode_b, pn_Cmp_Gt);
cmpGt = new_Conv(cmpGt, mode_Is);
/* cmpLt = a < 10 */
c10 = new_Const (mode_Is, new_tarval_from_long (10, mode_Is));
- cmpLt = new_Proj(new_Cmp(get_value(0, mode_Is), c10), mode_b, Lt);
+ cmpLt = new_Proj(new_Cmp(get_value(0, mode_Is), c10), mode_b, pn_Cmp_Lt);
cmpLt = new_Conv(cmpLt, mode_Is);
/* cmpGt && cmpLt */
and = new_And(cmpGt, cmpLt, mode_Is);
/* compare result and 0 because we have no cast from integer to bool */
and = new_Cmp(and, new_Const (mode_Is, new_tarval_from_long (0, mode_Is)));
- and = new_Proj(and, mode_b, Ne);
+ and = new_Proj(and, mode_b, pn_Cmp_Ne);
/* the conditional branch */
x = new_Cond (and);
c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
set_value(0, c2);
- cond = new_Cond(new_Proj(new_Cmp(c1, c2), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(c1, c2), mode_b, pn_Cmp_Eq));
f = new_Proj(cond, mode_X, 0);
t = new_Proj(cond, mode_X, 1);
mature_immBlock(get_irg_current_block(irg));
add_immBlock_pred (r, x);
x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, new_tarval_from_long (0, mode_Is)),
new_Const (mode_Is, new_tarval_from_long (0, mode_Is))),
- mode_b, Eq));
+ mode_b, pn_Cmp_Eq));
f = new_Proj (x, mode_X, 0);
t = new_Proj (x, mode_X, 1);
cmp = new_Cmp(get_value(a_pos, mode_Is), get_value(b_pos, mode_Is)); /*
cmp = new_Cmp(new_Const (mode_Is, new_tarval_from_long (2, mode_Is)),
new_Const (mode_Is, new_tarval_from_long (2, mode_Is)));*/
- x = new_Cond (new_Proj(cmp, mode_b, Eq));
+ x = new_Cond (new_Proj(cmp, mode_b, pn_Cmp_Eq));
f = new_Proj (x, mode_X, 0);
t = new_Proj (x, mode_X, 1);
/* the expression that evaluates the condition */
c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
- cmpGt = new_Proj(new_Cmp(get_value(0, mode_Is), c2), mode_b, Gt);
+ cmpGt = new_Proj(new_Cmp(get_value(0, mode_Is), c2), mode_b, pn_Cmp_Gt);
/* the conditional branch */
x = new_Cond (cmpGt);
/* Generate a conditional branch */
cmp = new_Cmp(get_value(a_pos, mode_Is), get_value(b_pos, mode_Is));
- x = new_Cond (new_Proj(cmp, mode_b, Eq));
+ x = new_Cond (new_Proj(cmp, mode_b, pn_Cmp_Eq));
f = new_Proj (x, mode_X, 0);
t = new_Proj (x, mode_X, 1);
add_immBlock_pred (r, x);
x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Iu, new_tarval_from_long (0, mode_Is)),
new_Const (mode_Iu, new_tarval_from_long (0, mode_Is))),
- mode_b, Eq));
+ mode_b, pn_Cmp_Eq));
f = new_Proj (x, mode_X, 0);
t = new_Proj (x, mode_X, 1);
c1 = new_Const (mode_Is, new_tarval_from_long (1, mode_Is));
c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
- cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, pn_Cmp_Eq));
f = new_Proj(cond, mode_X, 0);
t = new_Proj(cond, mode_X, 1);
mature_immBlock(get_irg_current_block(irg));
new_immBlock();
add_immBlock_pred(get_irg_current_block(irg), f);
- cond = new_Cond(new_Proj(new_Cmp(expr, c2), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c2), mode_b, pn_Cmp_Eq));
f = new_Proj(cond, mode_X, 0);
t = new_Proj(cond, mode_X, 1);
mature_immBlock(get_irg_current_block(irg));
c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
c3 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
- cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, pn_Cmp_Eq));
f = new_Proj(cond, mode_X, 0);
t = new_Proj(cond, mode_X, 1);
mature_immBlock(get_irg_current_block(irg));
loopBlock1 = new_immBlock();
add_immBlock_pred(loopBlock1, t);
- cond = new_Cond(new_Proj(new_Cmp(expr, c2), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c2), mode_b, pn_Cmp_Eq));
f_l1 = new_Proj(cond, mode_X, 0);
t_l1 = new_Proj(cond, mode_X, 1);
loopBlock2 = new_immBlock();
add_immBlock_pred(loopBlock2, f);
- cond = new_Cond(new_Proj(new_Cmp(expr, c3), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c3), mode_b, pn_Cmp_Eq));
f_l2 = new_Proj(cond, mode_X, 0);
t_l2 = new_Proj(cond, mode_X, 1);
c4 = new_Const (mode_Is, new_tarval_from_long (4, mode_Is));
c5 = new_Const (mode_Is, new_tarval_from_long (5, mode_Is));
- cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, pn_Cmp_Eq));
f2 = new_Proj(cond, mode_X, 0);
t = new_Proj(cond, mode_X, 1);
mature_immBlock(get_irg_current_block(irg));
new_immBlock();
add_immBlock_pred(get_irg_current_block(irg), t);
- cond = new_Cond(new_Proj(new_Cmp(expr, c5), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c5), mode_b, pn_Cmp_Eq));
f = new_Proj(cond, mode_X, 0);
t = new_Proj(cond, mode_X, 1);
mature_immBlock(get_irg_current_block(irg));
loopBlock1 = new_immBlock();
add_immBlock_pred(loopBlock1, t);
- cond = new_Cond(new_Proj(new_Cmp(expr, c2), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c2), mode_b, pn_Cmp_Eq));
f_l1 = new_Proj(cond, mode_X, 0);
t_l1 = new_Proj(cond, mode_X, 1);
loopBlock2 = new_immBlock();
add_immBlock_pred(loopBlock2, f);
- cond = new_Cond(new_Proj(new_Cmp(expr, c3), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c3), mode_b, pn_Cmp_Eq));
f_l2 = new_Proj(cond, mode_X, 0);
t_l2 = new_Proj(cond, mode_X, 1);
loopBlock3 = new_immBlock();
add_immBlock_pred(loopBlock3, f2);
- cond = new_Cond(new_Proj(new_Cmp(expr, c4), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(expr, c4), mode_b, pn_Cmp_Eq));
f_l3 = new_Proj(cond, mode_X, 0);
t_l3 = new_Proj(cond, mode_X, 1);
ir_node *x, *t, *cmp;
int start_value, end_value;
- pnc_number cmp_dir;
+ pn_Cmp cmp_dir;
if (loop_dir == loop_forward) {
start_value = 0;
end_value = 11;
- cmp_dir = Ge;
+ cmp_dir = pn_Cmp_Ge;
}
else {
start_value = 10;
end_value = 0;
- cmp_dir = Lt;
+ cmp_dir = pn_Cmp_Lt;
}
/* The entity for the procedure */
r1 = new_immBlock();
add_immBlock_pred(get_irg_current_block(irg), x);
cmp = new_Cmp(new_Const_int(10), get_value(i_pos, mode_Is));
- x = new_Cond(new_Proj(cmp, mode_b, Gt));
+ x = new_Cond(new_Proj(cmp, mode_b, pn_Cmp_Gt));
f = new_Proj(x, mode_X, 0);
t = new_Proj(x, mode_X, 1);
ir_node *b1 = new_Const_int(45);
add_immBlock_pred(get_irg_current_block(irg), f);
cmp = new_Cmp(new_Const_int(0), b1);
- x = new_Cond (new_Proj(cmp, mode_b, Lt));
+ x = new_Cond (new_Proj(cmp, mode_b, pn_Cmp_Lt));
f1 = new_Proj (x, mode_X, 0);
t1 = new_Proj (x, mode_X, 1);
printf("Done building the graph. Dumping and optimizing it.\n");
dump_consts_local(1);
turn_off_edge_labels();
+
+
+#if 1 /* Use this version for testing. Loop unrolling creates random node numbers,
+ therefore we can not compare test graphs. */
+ for (i = 0; i < n_irgs; ++i) {
+ current_ir_graph = get_irp_irg(i);
+ irg_vrfy(current_ir_graph);
+ finalize_cons (current_ir_graph);
+
+ construct_backedges(current_ir_graph);
+
+ set_opt_strength_red_verbose(2);
+ set_firm_verbosity(2);
+ set_optimize(0);
+ set_opt_loop_unrolling(1);
+ optimize_loop_unrolling(current_ir_graph);
+
+ irg_vrfy(current_ir_graph);
+ }
+#else
for (i = 0; i < n_irgs; ++i) {
current_ir_graph = get_irp_irg(i);
irg_vrfy(current_ir_graph);
/* output the vcg file */
dump_ir_block_graph (current_ir_graph, 0);
+
construct_backedges(current_ir_graph);
dump_ir_graph (current_ir_graph, 0);
dump_all_types(0);
dump_ir_block_graph (current_ir_graph, "-loop-unrolling");
// dump_ir_graph (current_ir_graph, "-pure-loop-unrolling");
}
+#endif
//printf("use xvcg to view this graph:\n");
//printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n");
new_Cmp (
new_Const (mode_Iu, new_tarval_from_long (0, mode_Is)),
x),
- mode_b, Gt));
+ mode_b, pn_Cmp_Gt));
/* build the cfg of the loop */
add_immBlock_pred (r, new_Proj (x, mode_X, 0));
add_immBlock_pred (r, x);
x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, new_tarval_from_long (0, mode_Is)),
new_Const (mode_Is, new_tarval_from_long (0, mode_Is))),
- mode_b, Eq));
+ mode_b, pn_Cmp_Eq));
/* x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, new_tarval_from_long (0, mode_Is)),
get_value(1, mode_Is)),
- mode_b, Eq));*/
+ mode_b, pn_Cmp_Eq));*/
f = new_Proj (x, mode_X, 0);
t = new_Proj (x, mode_X, 1);
ir_node *x, *t, *cmp;
int start_value, end_value;
- pnc_number cmp_dir;
+ pn_Cmp cmp_dir;
if (loop_dir == loop_forward) {
start_value = 0;
end_value = 10;
- cmp_dir = Gt;
+ cmp_dir = pn_Cmp_Gt;
}
else {
start_value = 10;
end_value = 0;
- cmp_dir = Lt;
+ cmp_dir = pn_Cmp_Lt;
}
/* The entity for the procedure */
r1 = new_immBlock();
add_immBlock_pred(get_irg_current_block(irg), x);
cmp = new_Cmp(new_Const_int(10), get_value(i_pos, mode_Is));
- x = new_Cond(new_Proj(cmp, mode_b, Gt));
+ x = new_Cond(new_Proj(cmp, mode_b, pn_Cmp_Gt));
f = new_Proj(x, mode_X, 0);
t = new_Proj(x, mode_X, 1);
ir_node *b1 = new_Const_int(45);
add_immBlock_pred(get_irg_current_block(irg), f);
cmp = new_Cmp(new_Const_int(0), b1);
- x = new_Cond (new_Proj(cmp, mode_b, Lt));
+ x = new_Cond (new_Proj(cmp, mode_b, pn_Cmp_Lt));
f1 = new_Proj (x, mode_X, 0);
t1 = new_Proj (x, mode_X, 1);
c2 = new_Proj (get_irg_args(irg), mode_Is, 0);
set_value(1, c2);
- cond = new_Cond(new_Proj(new_Cmp(c1, c2), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(c1, c2), mode_b, pn_Cmp_Eq));
set_value(0, new_Const (mode_Is, new_tarval_from_long (6, mode_Is)));
f = new_Proj(cond, mode_X, 0);
t = new_Proj(cond, mode_X, 1);
add_immBlock_pred(scndCondBlock, f);
mature_immBlock(scndCondBlock);
c1 = new_Const (mode_Is, new_tarval_from_long (3, mode_Is));
- cond = new_Cond(new_Proj(new_Cmp(c1, get_value(1, mode_Is)), mode_b, Eq));
+ cond = new_Cond(new_Proj(new_Cmp(c1, get_value(1, mode_Is)), mode_b, pn_Cmp_Eq));
f = new_Proj(cond, mode_X, 0);
t = new_Proj(cond, mode_X, 1);
mature_immBlock(get_irg_current_block(irg));
add_immBlock_pred (r, x);
x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, new_tarval_from_long (0, mode_Is)),
get_value(1, mode_Is)),
- mode_b, Eq));
+ mode_b, pn_Cmp_Eq));
f = new_Proj (x, mode_X, 0);
t = new_Proj (x, mode_X, 1);