2 * Copyright (C) 1995-2008 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 common firm declarations
23 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
26 #ifndef FIRM_COMMON_FIRM_COMMON_H
27 #define FIRM_COMMON_FIRM_COMMON_H
29 #include "firm_types.h"
33 * libFirm initialization parameters.
35 struct _firm_parameter_t {
37 * The size of this structure. init_firm() will only initialize
38 * this amount of data. This allows to add more fields to this structure
39 * without breaking compatibility to older source.
44 * Statistic options. If statistic function where enabled, these
45 * flags configure it, see enum firmstat_options_t.
47 unsigned enable_statistics;
50 * This function is called, whenever a local variable is
51 * used before definition. The function should insert a default value,
52 * and/or raise a compiler error/warning. Note that returning
53 * an Unknown is allowed here.
55 uninitialized_local_variable_func_t *initialize_local_func;
58 * The interface functions for the type identification module.
59 * If not set, the default implementation with compare_strict() and
60 * firm_hash_name() will be used.
62 type_identify_if_t *ti_if;
65 * The interface for the ident module.
66 * If not set, the default libFirm ident module (using hash sets).
71 * The default calling convention.
76 * dummy (here was dbg_info *builtin_dbg before)
81 typedef struct _firm_parameter_t firm_parameter_t;
84 * Initialize the firm library.
86 * Initializes the firm library. Allocates default data structures.
87 * Initializes configurable behavior of the library.
89 * @param params A structure containing the parameters of the libFirm.
91 * The parameter struct may be NULL. In that case, the original FIRM behavior
94 FIRM_DLL void ir_init(const firm_parameter_t *params);
97 * Frees all memory occupied by the firm library.
99 FIRM_DLL void ir_finish(void);
101 /** returns the libFirm major version number */
102 FIRM_DLL unsigned ir_get_version_major(void);
103 /** returns libFirm minor version number */
104 FIRM_DLL unsigned ir_get_version_minor(void);
105 /** returns string describing libFirm revision */
106 FIRM_DLL const char *ir_get_version_revision(void);
107 /** returns string describing libFirm build */
108 FIRM_DLL const char *ir_get_version_build(void);
112 /** a list of firm kinds
113 @@@ not all datatypes are tagged yet. */
115 k_BAD = 0, /**< An invalid firm node. */
116 k_entity, /**< An entity. */
117 k_type, /**< A type. */
118 k_ir_graph, /**< An IR graph. */
119 k_ir_node, /**< An IR node. */
120 k_ir_mode, /**< An IR mode. */
121 k_ir_op, /**< An IR opcode. */
122 k_tarval, /**< A tarval. */
123 k_ir_loop, /**< A loop. */
124 k_ir_compound_graph_path, /**< A compound graph path, see entity.h. */
125 k_ir_extblk, /**< An extended basic block. */
126 k_ir_prog, /**< A program representation (irp). */
127 k_ir_region, /**< A region. */
128 k_ir_graph_pass, /**< An ir_graph pass. */
129 k_ir_prog_pass, /**< An ir_prog pass. */
130 k_ir_graph_pass_mgr, /**< An ir_graph pass manager. */
131 k_ir_prog_pass_mgr, /**< An ir_prog pass manager. */
132 k_ir_max /**< maximum value -- illegal for firm nodes. */
136 * Returns the kind of a thing.
138 * @param firm_thing pointer representing a firm object
140 FIRM_DLL firm_kind get_kind(const void *firm_thing);
142 /** Returns the kind of a thing as a string. */
143 FIRM_DLL const char *print_firm_kind(void *firm_thing);
145 /** Print an identification of a firm thing. */
146 FIRM_DLL void firm_identify_thing(void *X);