added copyright information
[libfirm] / testprograms / memory_example.c
index b6a6e79..d91071d 100644 (file)
@@ -66,7 +66,7 @@ main(void)
 
   printf("\nCreating an IR graph: MEMORY_EXAMPLE...\n");
 
-  init_firm ();
+  init_firm (NULL);
 
   set_opt_dead_node_elimination (1);
 
@@ -83,18 +83,22 @@ main(void)
   /* Generates start and end blocks and nodes and a first, initial block */
   irg = new_ir_graph (ent, 4);
 
-  /* generate two constant pointers to string constants */
-  /* this simulates two global variables, a and b point to these variables */
-  a = new_Const (mode_P, tarval_P_from_str ("VAR_A"));
-  b = new_Const (mode_P, tarval_P_from_str ("VAR_B"));
-
-  /* set VAR_A and VAR_B to constant values */
+  /* create two global variables, a and b point to these variables */
+  a = new_simpleSel(
+              get_store(),
+              get_irg_globals(irg),
+              new_entity(get_glob_type(),id_from_str("VAR_A",6),prim_t_int));
+  b = new_simpleSel(
+              get_store(),
+              get_irg_globals(irg),
+              new_entity(get_glob_type(),id_from_str("VAR_B",6),prim_t_int));
+   /* set VAR_A and VAR_B to constant values */
   set_store (new_Proj (new_Store (get_store (), a,
-                                 new_Const (mode_Iu, tarval_from_long (mode_Is, 0))),
+                                 new_Const (mode_Iu, new_tarval_from_long (0, mode_Is))),
                        mode_M, 0));
 
   set_store (new_Proj (new_Store (get_store (), b,
-                                 new_Const (mode_Iu, tarval_from_long (mode_Is, 1))),
+                                 new_Const (mode_Iu, new_tarval_from_long (1, mode_Is))),
                        mode_M, 0));
 
   /* finish this first block */
@@ -122,7 +126,7 @@ main(void)
   x = new_Cond (
         new_Proj (
           new_Cmp (
-            new_Const (mode_Iu, tarval_from_long (mode_Is, 0)),
+            new_Const (mode_Iu, new_tarval_from_long (0, mode_Is)),
             x),
           mode_b, Gt));