X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fcommon%2Ffirm.c;h=10c3c3b28f6d365ea64ed3d817ed88a0bf592c41;hb=fe81eb2f6a3fe480432a4695dd7d38efb30dd70a;hp=be5ae511b81d3dc92addd0f9ae2788df751cabef;hpb=6d36abf323fc5c7fba7ed2f1f6939a84b3e4a932;p=libfirm diff --git a/ir/common/firm.c b/ir/common/firm.c index be5ae511b..10c3c3b28 100644 --- a/ir/common/firm.c +++ b/ir/common/firm.c @@ -1,42 +1,80 @@ -/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe -** All rights reserved. -** -** Authors: Martin Trapp, Christian Schaefer -** -*/ +/* + * Project: libFIRM + * File name: ir/common/firm.c + * Purpose: Central firm functionality. + * Author: Martin Trapp, Christian Schaefer + * Modified by: Goetz Lindenmaier + * Created: + * CVS-ID: $Id$ + * Copyright: (c) 1998-2003 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif # include -# include "ident.h" +# include "ident_t.h" # include "firm.h" # include "mangle.h" -# include "xp_help.h" +# include "tv_t.h" +/* init functions are not public */ +# include "tpop_t.h" # include "irnode_t.h" +# include "irmode_t.h" +# include "irgraph_t.h" +# include "type_t.h" +# include "firmstat.h" void -init_firm (void) +init_firm (default_initialize_local_variable_func_t *func) { - /* register the character 'I' as variable for ident outputs. */ - xprintf_register ('I', ident_print); - /* register the character 'v' as variable for tarval outputs. */ - xprintf_register ('v', tarval_print); - /* register the character 'R' as variable for ir node outputs. */ - xprintf_register ('R', ir_node_print); /* initialize all ident stuff */ - id_init (); - /* create an obstack and put alle tarvals in a pdeq */ - tarval_init_1 (); + id_init (1024); + /* enhanced statistics, need idents */ + stat_init(); + /* create the type kinds. */ + init_tpop (); + /* create an obstack and put all tarvals in a pdeq */ + init_tarval_1 (); /* initialize all modes an ir node can consist of */ init_mode (); /* initialize tarvals, and floating point arithmetic */ - tarval_init_2 (); + init_tarval_2 (); + /* init graph construction */ + init_irgraph(); /* kind of obstack initialization */ init_mangle (); /* initalize all op codes an irnode can consist of */ init_op (); - /* called once for each run of this library, empty at this moment!!! */ - init_cons (); + /* called once for each run of this library */ + init_cons (func); /* Builds a construct allowing to access all information to be constructed later. */ - init_irprog (); + /* Constructs some idents needed. */ + init_type(); +} + + +void free_firm (void) { + int i; + + for (i = 0; i < get_irp_n_irgs(); i++) + free_ir_graph(get_irp_irg(i)); + + for (i = 0; i < get_irp_n_types(); i++) { + free_type_entities(get_irp_type(i)); + free_type(get_irp_type(i)); + } + + free_type_entities(get_glob_type()); + free_ir_prog(); + + finish_tarval(); + finish_op(); + finish_mode(); + finish_tpop(); + id_finish(); }