From: Götz Lindenmaier Date: Tue, 19 Nov 2002 12:44:24 +0000 (+0000) Subject: Bugfixes X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=ee570c8331d85f5e1fa8148cb6e5d1908c03ed43;p=libfirm Bugfixes [r521] --- diff --git a/testprograms/dead_block_example.c b/testprograms/dead_block_example.c index 663a4f3c3..cee4b0ce0 100644 --- a/testprograms/dead_block_example.c +++ b/testprograms/dead_block_example.c @@ -57,8 +57,6 @@ int main(int argc, char **argv) /* init library */ init_firm (); - set_opt_cse(0); /* there is a bug: first and start block are cse!! @@@ */ - /*** Make basic type information for primitive type int. ***/ prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); diff --git a/testprograms/if_else_example.c b/testprograms/if_else_example.c index 89ef83d7c..3be3a83d5 100644 --- a/testprograms/if_else_example.c +++ b/testprograms/if_else_example.c @@ -34,6 +34,7 @@ int main(int argc, char **argv) { + type *prim_t_int; ir_graph *irg; /* this variable contains the irgraph */ type *owner; /* the class in which this method is defined */ type *method; /* the type of this method */ @@ -45,6 +46,9 @@ int main(int argc, char **argv) /* init library */ init_firm (); + /*** Make basic type information for primitive type int. ***/ + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + /* 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. @@ -55,6 +59,9 @@ int main(int argc, char **argv) owner = get_glob_type(); method = new_type_method (id_from_str("main", 4), 0, 2); + set_method_res_type(method, 0, prim_t_int); + set_method_res_type(method, 1, prim_t_int); + ent = new_entity (owner, id_from_str (ENTITYNAME, strlen(ENTITYNAME)), method); @@ -122,6 +129,8 @@ int main(int argc, char **argv) /* Now we can mature the end block as all it's predecessors are known. */ mature_block (get_irg_end_block(irg)); + finalize_cons (irg); + printf("\nOptimizing ...\n"); local_optimize_graph(irg); dead_node_elimination(irg);