X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana2%2Fpto.c;h=12547832e5dfd4fc1ebc2f59baddbeaa1d5f2636;hb=d0d85962ef52c14950db90e5981a7bea36023ab3;hp=bae05104a5d044bf07c03453b2de9b64f23a7fdf;hpb=4b3b302ecc2fe66c03ab146cf46a7d8cb2cbaff6;p=libfirm diff --git a/ir/ana2/pto.c b/ir/ana2/pto.c index bae05104a..12547832e 100644 --- a/ir/ana2/pto.c +++ b/ir/ana2/pto.c @@ -12,19 +12,21 @@ Licence: This file is protected by the GPL - GNU GENERAL PUBLIC LICENSE. */ -# ifdef HAVE_CONFIG_H -# include -# endif +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif /* pto: Entry to PTO */ -# include +#ifdef HAVE_STRING_H +# include +#endif # include "pto.h" -# include "irnode.h" +# include "irnode_t.h" # include "irprog.h" # include "xmalloc.h" @@ -48,7 +50,7 @@ extern char *spaces; =================================================== */ /* Helper to pto_init */ -static void pto_init_graph_wrapper (graph_info_t *ginfo, void *__unused) +static void pto_init_graph_wrapper (graph_info_t *ginfo, void *_unused) { ir_graph *graph = ginfo->graph; @@ -61,13 +63,13 @@ static void pto_init_graph_wrapper (graph_info_t *ginfo, void *__unused) /* Initialise the module (not in pto_init.c because it's the entry to pto) */ void pto_init (int lvl) { - HERE ("start"); set_dbg_lvl (lvl); ecg_init (1); /* Initialise the name module */ pto_name_init (); + /* Initialise the init module */ pto_init_init (); @@ -78,39 +80,45 @@ void pto_init (int lvl) ecg_iterate_graphs (pto_init_graph_wrapper, NULL); /* debugging only */ - spaces = (char*) xmalloc (512 * sizeof (char)); + spaces = xmalloc (512 * sizeof (char)); memset (spaces, ' ', 512); spaces += 511; *spaces = '\0'; /* initialise for the CTX-sensitive ecg-traversal */ set_curr_ctx (get_main_ctx ()); - HERE ("end"); } -void pto_run () +void pto_run (void) { - HERE ("start"); - + ir_graph *save; ir_graph *graph = get_irp_main_irg (); + + pto_reset_graph_pto (graph, 0); fake_main_args (graph); - DBGPRINT (0, (stdout, "START PTO\n")); - DBGPRINT (0, (stdout, "START GRAPH (0x%08x) of \"%s.%s\"\n", + DBGPRINT (1, (stdout, "START PTO\n")); + DBGPRINT (1, (stdout, "START GRAPH (0x%08x) of \"%s.%s\"\n", (int) graph, get_type_name (get_entity_owner (get_irg_entity (graph))), get_entity_name (get_irg_entity (graph)))); - /* do we need some kind of environment here? */ - pto_graph (graph, 0); + /* we need some kind of environment here: NULL */ + save = get_current_ir_graph (); + pto_graph (graph, 0, NULL); + set_current_ir_graph (save); + + DBGPRINT (1, (stdout, "END PTO\n")); +} - DBGPRINT (0, (stdout, "END PTO\n")); - HERE ("end"); +/* Dump all interesting stuff to a bunch of files */ +void pto_dump (void) +{ + pto_dump_names ("names.dot"); } -void pto_cleanup () +void pto_cleanup (void) { - HERE ("start"); /* todo: clean up our own mess */ spaces -= 511; /* hope that all changes to spaces are properly nested */ @@ -124,12 +132,38 @@ void pto_cleanup () /* clean up ecg infos */ ecg_cleanup (); - HERE ("end"); } /* $Log$ + Revision 1.17 2005/01/10 17:26:34 liekweg + fixup printfs, don't put environments on the stack + + Revision 1.16 2004/12/22 14:43:14 beck + made allocations C-like + + Revision 1.15 2004/12/21 14:26:53 beck + removed C99 constructs + + Revision 1.14 2004/12/20 17:41:14 liekweg + __unused -> _unused + + Revision 1.13 2004/12/20 17:34:34 liekweg + fix recursion handling + + Revision 1.12 2004/12/02 16:17:51 beck + fixed config.h include + + Revision 1.11 2004/11/30 15:49:27 liekweg + include 'dump' + + Revision 1.10 2004/11/30 14:46:41 liekweg + Correctly reset main graph; remove dbugging stuff + + Revision 1.9 2004/11/26 16:01:56 liekweg + debugging annotations + Revision 1.8 2004/11/24 14:54:21 liekweg Added pto.c as main entry point