X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=testprograms%2Farray-heap_example.c;h=9750b788b282ac974f76643a58d7f8a09585c76a;hb=79df37c097fe8cfb7d8e56d30b658f7ce8f6655d;hp=084378a82967ec110e88858c31f1a7da996381f1;hpb=efbeaff549fcc6015da255ed4d453a95937ff0fd;p=libfirm diff --git a/testprograms/array-heap_example.c b/testprograms/array-heap_example.c index 084378a82..9750b788b 100644 --- a/testprograms/array-heap_example.c +++ b/testprograms/array-heap_example.c @@ -43,7 +43,7 @@ int main(void) { - /* describes the fake class "ARRAY-HEAP_EXAMPLE" with it's method main */ + /* describes the method main */ type_class *owner; type_method *proc_main; entity *proc_main_e; @@ -65,7 +65,6 @@ main(void) ir_graph *main_irg; ir_node *array, *array_ptr, *c3, *elt, *val, *x; - init_firm (); /* make basic type information for primitive type int. @@ -78,7 +77,7 @@ main(void) printf("creating an IR graph: ARRAY-HEAP_EXAMPLE...\n"); /* first build procedure main */ - owner = new_type_class (id_from_str ("ARRAY-HEAP_EXAMPLE", 13)); + owner = get_glob_type(); proc_main = new_type_method(id_from_str("main", 4), 0, 1); set_method_res_type(proc_main, 0, (type *)prim_t_int); proc_main_e = new_entity ((type*)owner, id_from_str ("main", 4), (type *)proc_main); @@ -92,9 +91,10 @@ main(void) set_array_bounds(array_type, 1, L_BOUND, U_BOUND); set_array_element_type(array_type, (union type*)prim_t_int); /* As the array is accessed by Sel nodes, we need information about - the entity the node select. Entities of an array are it's elements + the entity the node selects. Entities of an array are it's elements which are, in this case, integers. */ - array_ent = new_entity((type*)array_type, id_from_str("array_field", 11), (type*)prim_t_int); + array_ent = new_entity((type*)array_type, id_from_str("array_field", 11), + (type*)prim_t_int); /* Allocate the array. All program known variables that are not modeled by dataflow edges need an explicit allocate node. @@ -141,13 +141,16 @@ main(void) add_in_edge (main_irg->end_block, x); mature_block (main_irg->end_block); + /* verify the graph */ + 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/trapp/bin/i486/xvcg GRAPHNAME\n"); + printf("/ben/goetz/bin/xvcg GRAPHNAME\n"); return (1); }