pn numbers
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 23 Feb 2005 16:57:47 +0000 (16:57 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 23 Feb 2005 16:57:47 +0000 (16:57 +0000)
[r5215]

16 files changed:
ir/common/old_fctnames.h
testprograms/cond_example.c
testprograms/dead_block_example.c
testprograms/endless_loop.c
testprograms/global_cse.c
testprograms/if_else_example.c
testprograms/if_example.c
testprograms/if_while_example.c
testprograms/irr_cf_example.c
testprograms/irr_loop_example.c
testprograms/loop_unroll_example.c
testprograms/memory_example.c
testprograms/oo_inline_example.c
testprograms/strength_red_example.c
testprograms/three_cfpred_example.c
testprograms/while_example.c

index cf2562c..dca4acf 100644 (file)
 #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
index b03027b..1152f14 100644 (file)
@@ -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);
index 071dbd1..90ada1c 100644 (file)
@@ -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));
index fa17092..af4dfad 100644 (file)
@@ -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);
 
index 1c1c11e..a43d443 100644 (file)
@@ -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);
 
index 4d98778..8d5b066 100644 (file)
@@ -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);
index b53b653..c3e216f 100644 (file)
@@ -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);
 
index f7b3df8..6e29332 100644 (file)
@@ -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);
 
index f72080d..43bb398 100644 (file)
@@ -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));
index d3d9a43..f640720 100644 (file)
@@ -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);
 
index a66dea6..c80393c 100644 (file)
@@ -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");
 
index 21e54bc..d0947cc 100644 (file)
@@ -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));
index 35def45..74b783d 100644 (file)
@@ -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);
 
index 59726dd..5ddaf4e 100644 (file)
@@ -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);
 
index 9bdafb0..de4b560 100644 (file)
@@ -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));
index b9040cb..1991fa7 100644 (file)
@@ -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);