changed ir_vrfy and vrfy_graph to irn_vrfy and irg_vrfy!
[libfirm] / testprograms / empty.c
index 5d2e7fc..8198b64 100644 (file)
@@ -27,7 +27,7 @@ int main(int argc, char **argv)
 {
   ir_graph *irg;          /* this variable contains the irgraph */
   type_class *owner;      /* the class in which this method is defined */
-  type_method *proc_main; /* typeinformation for the method main */
+  type_method *proc_main; /* type information for the method main */
   entity *ent;            /* represents this method as entity of owner */
   ir_node *x;
 
@@ -39,15 +39,15 @@ int main(int argc, char **argv)
   /* FIRM was designed for oo languages where all methods belong to a class.
    * For imperative languages like C we view a file as a large class containing
    * all functions as methods in this file.
-   * Therefore we define a class "empty" according to the file name
-   * with a method main as an entity.
+   * (Therefore we define a class "empty" according to the file name
+   *  with a method main as an entity.)
+   * This class now is automatically generated.
    */
-#define CLASSNAME "EMPTY"
 #define METHODNAME "main"
 #define NRARGS 0
 #define NRES 0
 
-  owner = new_type_class (id_from_str (CLASSNAME, strlen(CLASSNAME)));
+  owner = get_glob_type();
   proc_main = new_type_method(id_from_str(METHODNAME, strlen(METHODNAME)),
                               NRARGS, NRES);
   ent = new_entity ((type *)owner,
@@ -82,13 +82,14 @@ int main(int argc, char **argv)
   /* Now we can mature the end block as all it's predecessors are known. */
   mature_block (irg->end_block);
 
+  /* verify the graph */
+  irg_vrfy(irg);
+
   printf("\nDone building the graph.  Dumping it.\n");
   dump_ir_block_graph (irg);
 
   printf("use xvcg to view this graph:\n");
-  printf("/ben/trapp/bin/i486/xvcg GRAPHNAME\n");
+  printf("/ben/goetz/bin/xvcg GRAPHNAME\n");
 
   return (0);
-
-
 }