2 * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Central firm functionality.
23 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
28 #ifdef HAVE_FIRM_REVISION_H
29 # include "firm_revision.h"
46 #include "irgraph_t.h"
52 #include "iredges_t.h"
53 #include "irmemory_t.h"
59 /* returns the firm root */
60 lc_opt_entry_t *firm_opt_get_root(void)
62 static lc_opt_entry_t *grp = NULL;
64 grp = lc_opt_get_grp(lc_opt_root_grp(), "firm");
68 void ir_init(const firm_parameter_t *param)
70 firm_parameter_t def_params;
73 /* for historical reasons be_init must be run first */
76 memset(&def_params, 0, sizeof(def_params));
79 /* check for reasonable size */
80 assert(param->size <= sizeof(def_params) && (param->size & 3) == 0 &&
81 "parameter struct not initialized ???");
82 size = sizeof(def_params);
83 if (param->size < size)
86 memcpy(&def_params, param, size);
89 /* initialize firm flags */
91 /* initialize all ident stuff */
93 /* enhanced statistics, need idents and hooks */
94 if (def_params.enable_statistics != 0)
95 firm_init_stat(def_params.enable_statistics);
96 /* Edges need hooks. */
98 /* create the type kinds. */
100 /* create an obstack and put all tarvals in a pdeq */
101 init_tarval_1(0l, /* support_quad_precision */0);
102 /* Builds a basic program representation, so modes can be added. */
104 /* initialize all modes an ir node can consist of */
106 /* initialize tarvals, and floating point arithmetic */
108 /* init graph construction */
110 /* kind of obstack initialization */
112 /* initialize all op codes an irnode can consist of */
114 /* called once for each run of this library */
115 if (def_params.initialize_local_func != NULL)
116 ir_set_uninitialized_local_variable_func(
117 def_params.initialize_local_func);
118 /* initialize reassociation */
119 firm_init_reassociation();
120 /* initialize function call optimization */
121 firm_init_funccalls();
122 /* initialize function inlining */
124 /* initialize scalar replacement */
125 firm_init_scalar_replace();
126 /* Builds a construct allowing to access all information to be constructed
129 /* Initialize the type module and construct some idents needed. */
131 /* initialize the entity module */
133 /* class cast optimization */
134 firm_init_class_casts_opt();
135 /* memory disambiguation */
136 firm_init_memory_disambiguator();
137 firm_init_loop_opt();
139 /* Init architecture dependent optimizations. */
140 arch_dep_set_opts(arch_dep_none);
145 /* integrated debugger extension */
146 firm_init_debugger();
154 /* must iterate backwards here */
155 for (i = get_irp_n_irgs(); i > 0;)
156 free_ir_graph(get_irp_irg(--i));
158 free_type_entities(get_glob_type());
159 /* must iterate backwards here */
160 for (i = get_irp_n_types(); i > 0;)
161 free_type_entities(get_irp_type(--i));
163 for (i = get_irp_n_types(); i > 0;)
164 free_type(get_irp_type(--i));
179 unsigned ir_get_version_major(void)
181 return libfirm_VERSION_MAJOR;
184 unsigned ir_get_version_minor(void)
186 return libfirm_VERSION_MINOR;
189 const char *ir_get_version_revision(void)
191 #ifdef libfirm_VERSION_REVISION
192 return libfirm_VERSION_REVISION;
198 const char *ir_get_version_build(void)