removed debug output
[libfirm] / testprograms / global_var_example.c
index 503f1ea..707f498 100644 (file)
@@ -1,11 +1,14 @@
-/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
-** All rights reserved.
-**
-** Authors: Goetz Lindenmaier
-**
-** testprogram.
-**
-*/
+/*
+ * Project:     libFIRM
+ * File name:   testprograms/global_var_example.c
+ * Purpose:     Illustrates representation of global variable.
+ * Author:      Christian Schaefer, Goetz Lindenmaier
+ * Modified by:
+ * Created:
+ * CVS-ID:      $Id$
+ * Copyright:   (c) 1999-2003 Universität Karlsruhe
+ * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ */
 
 # include <stdio.h>
 # include <string.h>
  */
 
 /**
-***  This program shows how to build ir for global variables.
-***  It constructs the ir for the following pseudo-program:
-***
-***  int i;
-***
-***  main() {
-***    i = 2;
-***    return;
-***  }
+*  This program shows how to build ir for global variables.
+*  It constructs the ir for the following pseudo-program:
+*
+*  int i;
+*
+*  main() {
+*    i = 2;
+*    return;
+*  }
 **/
 
 int main(int argc, char **argv)
@@ -43,7 +46,7 @@ int main(int argc, char **argv)
   printf("\nCreating an IR graph: GLOBAL_VAR ...\n");
 
   /* init library */
-  init_firm ();
+  init_firm (NULL);
 
   /* make basic type information for primitive type int.
      In Sather primitive types are represented by a class.
@@ -57,7 +60,7 @@ int main(int argc, char **argv)
    * a large class containing all functions as methods in this file.
    * This class is automatically generated and can be obtained by get_glob_type().
    */
-#define METHODNAME "main"
+#define METHODNAME "GLOBAL_VAR_main"
 #define NRARGS 0
 #define NRES 0
 
@@ -90,13 +93,11 @@ int main(int argc, char **argv)
   i_ptr = new_simpleSel(get_store(), get_irg_globals(irg), i_ent);
 
   store = new_Store (get_store(), i_ptr,
-                    new_Const(mode_Is, tarval_from_long (mode_Is, 2)));
+                    new_Const(mode_Is, new_tarval_from_long (2, mode_Is)));
   set_store(new_Proj(store, mode_M, 0));
 
-  {
-    ir_node *in[0]; /* this is the array containing the return parameters */
-    x = new_Return (get_store(), 0, in);
-  }
+  x = new_Return (get_store(), 0, NULL);
+
   /* Now generate all instructions for this block and all its predecessor blocks
    * so we can mature it. */
   mature_block (get_irg_current_block(irg));