/*
- * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
#include "ident_t.h"
#include "firm.h"
#include "irflag_t.h"
-/* init functions are not public */
#include "tv_t.h"
#include "tpop_t.h"
#include "irprog_t.h"
#include "irgraph_t.h"
#include "type_t.h"
#include "entity_t.h"
-#include "opt_inline_t.h"
-#include "scalar_replace.h"
#include "firmstat.h"
#include "irarch.h"
-#include "reassoc_t.h"
-#include "funccall_t.h"
#include "irhooks.h"
#include "iredges_t.h"
#include "irmemory_t.h"
-#include "tropt.h"
+#include "opt_init.h"
#include "debugger.h"
#include "be_t.h"
+#include "irtools.h"
/* returns the firm root */
-lc_opt_entry_t *firm_opt_get_root(void) {
+lc_opt_entry_t *firm_opt_get_root(void)
+{
static lc_opt_entry_t *grp = NULL;
if (!grp)
grp = lc_opt_get_grp(lc_opt_root_grp(), "firm");
/* initialize firm flags */
firm_init_flags();
/* initialize all ident stuff */
- init_ident(def_params.id_if, 1024);
+ init_ident();
/* enhanced statistics, need idents and hooks */
- firm_init_stat(def_params.enable_statistics);
+ if (def_params.enable_statistics != 0)
+ firm_init_stat(def_params.enable_statistics);
/* Edges need hooks. */
init_edges();
/* create the type kinds. */
/* initialize all op codes an irnode can consist of */
init_op();
/* called once for each run of this library */
- firm_init_cons(def_params.initialize_local_func);
+ if (def_params.initialize_local_func != NULL)
+ ir_set_uninitialized_local_variable_func(
+ def_params.initialize_local_func);
/* initialize reassociation */
firm_init_reassociation();
/* initialize function call optimization */
later. */
init_irprog_2();
/* Initialize the type module and construct some idents needed. */
- firm_init_type(def_params.builtin_dbg, def_params.cc_mask);
+ ir_init_type();
/* initialize the entity module */
- firm_init_entity();
- /* allocate a hash table. */
- init_type_identify(def_params.ti_if);
+ ir_init_entity();
/* class cast optimization */
firm_init_class_casts_opt();
/* memory disambiguation */
firm_init_memory_disambiguator();
+ firm_init_loop_opt();
/* Init architecture dependent optimizations. */
- arch_dep_init(arch_dep_default_factory);
- arch_dep_set_opts(0);
+ arch_dep_set_opts(arch_dep_none);
+
+ init_irnode();
#ifdef DEBUG_libfirm
/* integrated debugger extension */
void ir_finish(void)
{
- int i;
+ size_t i;
- for (i = get_irp_n_irgs() - 1; i >= 0; --i)
- free_ir_graph(get_irp_irg(i));
- for (i = get_irp_n_pseudo_irgs() - 1; i >= 0; --i)
- free_ir_graph(get_irp_pseudo_irg(i));
+ /* must iterate backwards here */
+ for (i = get_irp_n_irgs(); i > 0;)
+ free_ir_graph(get_irp_irg(--i));
free_type_entities(get_glob_type());
- for (i = get_irp_n_types() - 1; i >= 0; --i)
- free_type_entities(get_irp_type(i));
+ /* must iterate backwards here */
+ for (i = get_irp_n_types(); i > 0;)
+ free_type_entities(get_irp_type(--i));
- for (i = get_irp_n_types() - 1; i >= 0; --i)
- free_type(get_irp_type(i));
+ for (i = get_irp_n_types(); i > 0;)
+ free_type(get_irp_type(--i));
free_ir_prog();
+ ir_finish_entity();
+ ir_finish_type();
+
finish_tarval();
finish_mode();
finish_tpop();