X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=testprograms%2Fdead_block_example.c;h=ad6c8ccc2d146b893fd8b407a2c4d34f251ddd89;hb=b921583b21e930ddee1869bb623dca483d3529ed;hp=2ff7b31194b66c02bcb2bc2875560ce598e3f668;hpb=efbeaff549fcc6015da255ed4d453a95937ff0fd;p=libfirm diff --git a/testprograms/dead_block_example.c b/testprograms/dead_block_example.c index 2ff7b3119..ad6c8ccc2 100644 --- a/testprograms/dead_block_example.c +++ b/testprograms/dead_block_example.c @@ -46,15 +46,13 @@ 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 *c1, *c2, *cond, *f, *t, *endBlock, *Block1, *jmp, *Block2, *deadBlock, *x; - /* init library */ init_firm (); - set_opt_constant_folding (1); /* 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 @@ -123,13 +121,23 @@ int main(int argc, char **argv) add_in_edge (irg->end_block, x); mature_block (irg->end_block); + /* verify the graph */ + irg_vrfy(irg); + printf("\nDone building the graph.\n"); + local_optimize_graph (irg); + printf("\nDone local optimization.\n"); + set_opt_constant_folding (1); + set_optimize(0); + set_opt_cse(1); + dead_node_elimination (irg); printf("Dumping the graph and a control flow graph.\n"); + dump_ir_block_graph (irg); dump_cfg (irg); printf("use xvcg to view these graphs:\n"); - printf("/ben/trapp/bin/i486/xvcg GRAPHNAME\n"); + printf("/ben/goetz/bin/xvcg GRAPHNAME\n"); return (0); }