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;
ir_graph *main_irg;
ir_node *array, *array_ptr, *c3, *elt, *val, *x;
-
init_firm ();
/* make basic type information for primitive type int.
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);
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.
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);
}