used enum values for Tuple creation
[libfirm] / ir / common / firm.c
index fc6db5d..067592e 100644 (file)
@@ -1,12 +1,14 @@
-
-/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
-* All rights reserved.
-*
-* Authors: Martin Trapp, Christian Schaefer, Goetz Lindenmaier
-*
-*/
-
-/* $Id$ */
+/*
+ * 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 <config.h>
 # include "irmode_t.h"
 # include "irgraph_t.h"
 # include "type_t.h"
+# include "firmstat.h"
 
 void
 init_firm (default_initialize_local_variable_func_t *func)
 {
+  /* enhanced statistics */
+  stat_init();
   /* initialize all ident stuff */
-  id_init ();
+  id_init (1024);
   /* create the type kinds. */
   init_tpop ();
   /* create an obstack and put all tarvals in a pdeq */
@@ -51,3 +56,25 @@ init_firm (default_initialize_local_variable_func_t *func)
   /* 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();
+}