X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=testprograms%2Foo_program_example.c;h=33f761096aaca6fdd207f92fcedc8657893e28dc;hb=2fa17934abe60b32409bf3b797ec3aa675a1b1a0;hp=aba93088f82e6b6b258c190fb206d5d876ddaae2;hpb=fb4e09c319ad22eb4623c289236a1511572756e2;p=libfirm diff --git a/testprograms/oo_program_example.c b/testprograms/oo_program_example.c index aba93088f..33f761096 100644 --- a/testprograms/oo_program_example.c +++ b/testprograms/oo_program_example.c @@ -50,6 +50,8 @@ main(void) ir_node *self, *par1, *a_ptr; ir_node *a_val; + int i; + init_firm (); set_opt_constant_folding(0); @@ -67,6 +69,8 @@ main(void) proc_main_e = new_entity ((type *)owner, id_from_str ("main", 4), (type *)proc_main); main_irg = new_ir_graph (proc_main_e, 4); + /* Remark that this irg is the main routine of the program. */ + set_irp_main_irg(main_irg); /* There is only one block in main, it contains the constants and the calls. */ c2 = new_Const (mode_i, tarval_from_long (mode_i, 2)); @@ -137,10 +141,7 @@ main(void) mature_block (main_irg->end_block); printf("\nDone building the graph.\n"); - vrfy_graph(main_irg); - printf("Dumping the graph and a type graph.\n"); - dump_ir_block_graph (main_irg); - dump_type_graph(main_irg); + irg_vrfy(main_irg); /****************************************************************************/ @@ -168,10 +169,7 @@ main(void) mature_block (set_a_irg->end_block); printf("\nDone building the graph.\n"); - vrfy_graph(set_a_irg); - printf("Dumping the graph and a type graph.\n"); - dump_ir_block_graph (set_a_irg); - dump_type_graph(set_a_irg); + irg_vrfy(set_a_irg); /****************************************************************************/ @@ -203,12 +201,19 @@ main(void) mature_block (c_irg->end_block); /* verify the graph */ - vrfy_graph(main_irg); + irg_vrfy(main_irg); + + for (i = 0; i < get_irp_n_irgs(); i++) + dead_node_elimination(get_irp_irg(i)); printf("\nDone building the graph.\n"); - printf("Dumping the graph and a type graph.\n"); - dump_ir_block_graph (c_irg); - dump_type_graph(c_irg); + + printf("Dumping graphs of all procedures.\n"); + + for (i = 0; i < get_irp_n_irgs(); i++) { + dump_ir_block_graph (get_irp_irg(i)); + dump_type_graph(get_irp_irg(i)); + } /****************************************************************************/