Nothing major
[libfirm] / testprograms / array-stack_example.c
index 1cad063..4280e6f 100644 (file)
@@ -63,7 +63,7 @@ main(void)
 
   init_firm ();
 
-  printf("creating an IR graph: ARRAY-STACK_EXAMPLE...\n");
+  printf("\nCreating an IR graph: ARRAY-STACK_EXAMPLE...\n");
 
   /* make basic type information for primitive type int.
      In Sather primitive types are represented by a class.
@@ -98,7 +98,7 @@ main(void)
 
   /* Now the "real" program: */
   /* Select the array from the stack frame.  */
-  array_ptr = new_simpleSel(get_store(), main_irg->frame, array_ent);
+  array_ptr = new_simpleSel(get_store(), get_irg_frame(main_irg), array_ent);
   /* Load element 3 of the array. For this first generate the pointer
      to this the element by a select node.  (Alternative: increase
      array pointer by (three * elt_size), but this complicates some
@@ -121,22 +121,24 @@ main(void)
 
      x = new_Return (get_store (), 1, in);
   }
-  mature_block (main_irg->current_block);
+  mature_block (get_irg_current_block(main_irg));
 
   /* complete the end_block */
-  add_in_edge (main_irg->end_block, x);
-  mature_block (main_irg->end_block);
+  add_in_edge (get_irg_end_block(main_irg), x);
+  mature_block (get_irg_end_block(main_irg));
+
+  printf("Optimizing ...\n");
+  dead_node_elimination(main_irg);
 
   /* verify the graph */
-  vrfy_graph(main_irg);
+  irg_vrfy(main_irg);
+
 
-  printf("\nDone building the graph.\n");
   printf("Dumping the graph and a type graph.\n");
   dump_ir_block_graph (main_irg);
   dump_type_graph(main_irg);
-
-  printf("\nuse xvcg to view these graphs:\n");
-  printf("/ben/goetz/bin/xvcg GRAPHNAME\n");
+  printf("Use xvcg to view these graphs:\n");
+  printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n");
 
   return (1);
 }