4 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
6 * This file is part of libFirm.
8 * This file may be distributed and/or modified under the terms of the
9 * GNU General Public License version 2 as published by the Free Software
10 * Foundation and appearing in the file LICENSE.GPL included in the
11 * packaging of this file.
13 * Licensees holding valid libFirm Professional Edition licenses may use
14 * this file in accordance with the libFirm Commercial License.
15 * Agreement provided with the Software.
17 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * @date Tue Nov 23 18:37:09 CET 2004
43 # include "irnode_t.h"
47 # include "pto_debug.h"
48 # include "pto_init.h"
49 # include "pto_name.h"
55 /* Local Data Types: */
57 /* Local Variables: */
60 /* Local Prototypes: */
62 /* ===================================================
64 =================================================== */
66 /* Helper to pto_init */
67 static void pto_init_graph_wrapper (graph_info_t *ginfo, void *_unused)
69 ir_graph *graph = ginfo->graph;
71 pto_init_graph (graph);
74 /* ===================================================
75 Exported Implementation:
76 =================================================== */
77 /* Initialise the module (not in pto_init.c because it's the entry to pto) */
78 void pto_init (int lvl)
84 /* Initialise the name module */
87 /* Initialise the init module */
90 /* allocate ctx-sens names for allocs and set ... etc etc */
91 pto_init_type_names ();
93 /* initialise all graphs with the static names */
94 ecg_iterate_graphs (pto_init_graph_wrapper, NULL);
97 spaces = xmalloc (512 * sizeof (char));
98 memset (spaces, ' ', 512);
102 /* initialise for the CTX-sensitive ecg-traversal */
103 set_curr_ctx (get_main_ctx ());
109 ir_graph *graph = get_irp_main_irg ();
111 pto_reset_graph_pto (graph, 0);
112 fake_main_args (graph);
114 DBGPRINT (1, (stdout, "START PTO\n"));
115 DBGPRINT (1, (stdout, "START GRAPH (0x%08x) of \"%s.%s\"\n",
117 get_type_name (get_entity_owner (get_irg_entity (graph))),
118 get_entity_name (get_irg_entity (graph))));
120 /* we need some kind of environment here: NULL */
121 save = get_current_ir_graph ();
122 pto_graph (graph, 0, NULL);
123 set_current_ir_graph (save);
125 DBGPRINT (1, (stdout, "END PTO\n"));
128 /* Dump all interesting stuff to a bunch of files */
131 pto_dump_names ("names.dot");
134 void pto_cleanup (void)
136 /* todo: clean up our own mess */
137 spaces -= 511; /* hope that all changes to spaces are
139 memset (spaces, 0x00, 512);
142 /* Cleanup the name module */
144 /* Cleanup the Init module */
147 /* clean up ecg infos */
154 Revision 1.17 2005/01/10 17:26:34 liekweg
155 fixup printfs, don't put environments on the stack
157 Revision 1.16 2004/12/22 14:43:14 beck
158 made allocations C-like
160 Revision 1.15 2004/12/21 14:26:53 beck
161 removed C99 constructs
163 Revision 1.14 2004/12/20 17:41:14 liekweg
166 Revision 1.13 2004/12/20 17:34:34 liekweg
167 fix recursion handling
169 Revision 1.12 2004/12/02 16:17:51 beck
170 fixed config.h include
172 Revision 1.11 2004/11/30 15:49:27 liekweg
175 Revision 1.10 2004/11/30 14:46:41 liekweg
176 Correctly reset main graph; remove dbugging stuff
178 Revision 1.9 2004/11/26 16:01:56 liekweg
179 debugging annotations
181 Revision 1.8 2004/11/24 14:54:21 liekweg
182 Added pto.c as main entry point