From: Götz Lindenmaier Date: Wed, 23 Feb 2005 16:57:47 +0000 (+0000) Subject: pn numbers X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=375ed64a6ca155d467bba1c44e5b635f82102c37;p=libfirm pn numbers [r5215] --- diff --git a/ir/common/old_fctnames.h b/ir/common/old_fctnames.h index cf2562cce..dca4acf08 100644 --- a/ir/common/old_fctnames.h +++ b/ir/common/old_fctnames.h @@ -51,6 +51,24 @@ #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 @@ -72,7 +90,6 @@ /* 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_) @@ -104,4 +121,6 @@ extern char *dump_file_filter; /* use the setter instead. */ #define id_to_str(X) get_id_str(X) #define id_from_str(X, Y) new_id_from_chars(X, Y) + + #endif diff --git a/testprograms/cond_example.c b/testprograms/cond_example.c index b03027bcf..1152f14cb 100644 --- a/testprograms/cond_example.c +++ b/testprograms/cond_example.c @@ -79,19 +79,19 @@ int main(int argc, char **argv) /* 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); diff --git a/testprograms/dead_block_example.c b/testprograms/dead_block_example.c index 071dbd17b..90ada1c5e 100644 --- a/testprograms/dead_block_example.c +++ b/testprograms/dead_block_example.c @@ -93,7 +93,7 @@ int main(int argc, char **argv) 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)); diff --git a/testprograms/endless_loop.c b/testprograms/endless_loop.c index fa1709251..af4dfadb4 100644 --- a/testprograms/endless_loop.c +++ b/testprograms/endless_loop.c @@ -90,7 +90,7 @@ main(void) 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); diff --git a/testprograms/global_cse.c b/testprograms/global_cse.c index 1c1c11e9d..a43d443c5 100644 --- a/testprograms/global_cse.c +++ b/testprograms/global_cse.c @@ -100,7 +100,7 @@ main(void) 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); diff --git a/testprograms/if_else_example.c b/testprograms/if_else_example.c index 4d98778d2..8d5b066d9 100644 --- a/testprograms/if_else_example.c +++ b/testprograms/if_else_example.c @@ -84,7 +84,7 @@ int main(int argc, char **argv) /* 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); diff --git a/testprograms/if_example.c b/testprograms/if_example.c index b53b65371..c3e216f76 100644 --- a/testprograms/if_example.c +++ b/testprograms/if_example.c @@ -89,7 +89,7 @@ main(void) /* 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); diff --git a/testprograms/if_while_example.c b/testprograms/if_while_example.c index f7b3df802..6e29332d9 100644 --- a/testprograms/if_while_example.c +++ b/testprograms/if_while_example.c @@ -97,7 +97,7 @@ main(void) 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); diff --git a/testprograms/irr_cf_example.c b/testprograms/irr_cf_example.c index f72080d3d..43bb39802 100644 --- a/testprograms/irr_cf_example.c +++ b/testprograms/irr_cf_example.c @@ -87,7 +87,7 @@ int main(int argc, char **argv) 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)); @@ -99,7 +99,7 @@ int main(int argc, char **argv) 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)); diff --git a/testprograms/irr_loop_example.c b/testprograms/irr_loop_example.c index d3d9a4350..f64072038 100644 --- a/testprograms/irr_loop_example.c +++ b/testprograms/irr_loop_example.c @@ -100,20 +100,20 @@ int main(int argc, char **argv) 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); @@ -151,33 +151,33 @@ int main(int argc, char **argv) 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); diff --git a/testprograms/loop_unroll_example.c b/testprograms/loop_unroll_example.c index a66dea6ef..c80393c8b 100644 --- a/testprograms/loop_unroll_example.c +++ b/testprograms/loop_unroll_example.c @@ -77,17 +77,17 @@ static void function_begin(type *owner, type *mtp, char *fct_name, loop_dir_t lo 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 */ @@ -247,7 +247,7 @@ main(void) 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); @@ -286,7 +286,7 @@ main(void) 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); @@ -436,6 +436,26 @@ main(void) 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); @@ -443,6 +463,7 @@ main(void) /* 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); @@ -463,6 +484,7 @@ main(void) 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"); diff --git a/testprograms/memory_example.c b/testprograms/memory_example.c index 21e54bcfe..d0947cc71 100644 --- a/testprograms/memory_example.c +++ b/testprograms/memory_example.c @@ -132,7 +132,7 @@ main(void) 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)); diff --git a/testprograms/oo_inline_example.c b/testprograms/oo_inline_example.c index 35def4575..74b783d56 100644 --- a/testprograms/oo_inline_example.c +++ b/testprograms/oo_inline_example.c @@ -227,11 +227,11 @@ main(void) 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); diff --git a/testprograms/strength_red_example.c b/testprograms/strength_red_example.c index 59726dd5c..5ddaf4e63 100644 --- a/testprograms/strength_red_example.c +++ b/testprograms/strength_red_example.c @@ -88,17 +88,17 @@ static void function_begin(type *owner, type *mtp, char *fct_name, loop_dir_t lo 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 */ @@ -258,7 +258,7 @@ main(void) 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); @@ -297,7 +297,7 @@ main(void) 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); diff --git a/testprograms/three_cfpred_example.c b/testprograms/three_cfpred_example.c index 9bdafb0ee..de4b56099 100644 --- a/testprograms/three_cfpred_example.c +++ b/testprograms/three_cfpred_example.c @@ -96,7 +96,7 @@ int main(int argc, char **argv) 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); @@ -118,7 +118,7 @@ int main(int argc, char **argv) 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)); diff --git a/testprograms/while_example.c b/testprograms/while_example.c index b9040cb98..1991fa7d0 100644 --- a/testprograms/while_example.c +++ b/testprograms/while_example.c @@ -85,7 +85,7 @@ main(void) 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);