remove the unused 'ident' type, remove tpo_max add tpo_last
[libfirm] / include / libfirm / firm_common.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief    common firm declarations
23  * @author   Martin Trapp, Christian Schaefer, Goetz Lindenmaier
24  * @version  $Id$
25  */
26 #ifndef FIRM_COMMON_FIRM_COMMON_H
27 #define FIRM_COMMON_FIRM_COMMON_H
28
29 #include "firm_types.h"
30
31 /**
32  * libFirm initialization parameters.
33  */
34 struct _firm_parameter_t {
35   /**
36    * The size of this structure. init_firm() will only initialize
37    * this amount of data. This allows to add more fields to this structure
38    * without breaking compatibility to older source.
39    */
40   unsigned int size;
41
42   /**
43    * Statistic options. If statistic function where enabled, these
44    * flags configure it, see enum firmstat_options_t.
45    */
46   unsigned enable_statistics;
47
48   /**
49    * This function is called, whenever a local variable is
50    * used before definition. The function should insert a default value,
51    * and/or raise a compiler error/warning. Note that returning
52    * an Unknown is allowed here.
53    */
54   uninitialized_local_variable_func_t *initialize_local_func;
55
56   /**
57    * The interface functions for the type identification module.
58    * If not set, the default implementation with compare_strict() and
59    * firm_hash_name() will be used.
60    */
61   type_identify_if_t *ti_if;
62
63   /**
64    * The interface for the ident module.
65    * If not set, the default libFirm ident module (using hash sets).
66    */
67   ident_if_t *id_if;
68
69   /**
70    * The default calling convention.
71    */
72   unsigned cc_mask;
73
74   /**
75    * The debug info that should be used for "builtin" objects.
76    */
77   dbg_info *builtin_dbg;
78 };
79
80 typedef struct _firm_parameter_t firm_parameter_t;
81
82 /**
83  * Initialize the firm library.
84  *
85  * Initializes the firm library.  Allocates default data structures.
86  * Initializes configurable behavior of the library.
87  *
88  * @param params   A structure containing the parameters of the libFirm.
89  *
90  * The parameter struct may be NULL. In that case, the original FIRM behavior
91  * is conserved.
92  */
93 void ir_init(const firm_parameter_t *params);
94
95 /**
96  * Frees all memory occupied by the firm library.
97  */
98 void ir_finish(void);
99
100 /** returns the libFirm major version number */
101 unsigned ir_get_version_major(void);
102 /** returns libFirm minor version number */
103 unsigned ir_get_version_minor(void);
104 /** returns string describing libFirm revision */
105 const char *ir_get_version_revision(void);
106 /** returns string describing libFirm build */
107 const char *ir_get_version_build(void);
108
109
110
111 /** a list of firm kinds
112  @@@ not all datatypes are tagged yet. */
113 typedef enum {
114         k_BAD = 0,                /**< An invalid firm node. */
115         k_entity,                 /**< An entity. */
116         k_type,                   /**< A type. */
117         k_ir_graph,               /**< An IR graph. */
118         k_ir_node,                /**< An IR node. */
119         k_ir_mode,                /**< An IR mode. */
120         k_ir_op,                  /**< An IR opcode. */
121         k_tarval,                 /**< A tarval. */
122         k_ir_loop,                /**< A loop. */
123         k_ir_compound_graph_path, /**< A compound graph path, see entity.h. */
124         k_ir_extblk,              /**< An extended basic block. */
125         k_ir_prog,                /**< A program representation (irp). */
126         k_ir_region,              /**< A region. */
127         k_ir_graph_pass,          /**< An ir_graph pass. */
128         k_ir_prog_pass,           /**< An ir_prog pass. */
129         k_ir_graph_pass_mgr,      /**< An ir_graph pass manager. */
130         k_ir_prog_pass_mgr,       /**< An ir_prog pass manager. */
131         k_ir_max                  /**< maximum value -- illegal for firm nodes. */
132 } firm_kind;
133
134 /**
135  * Returns the kind of a thing.
136  *
137  * @param firm_thing  pointer representing a firm object
138  */
139 firm_kind get_kind(const void *firm_thing);
140
141 /** Returns the kind of a thing as a string. */
142 const char *print_firm_kind(void *firm_thing);
143
144 /** Print an identification of a firm thing. */
145 void firm_identify_thing(void *X);
146
147 #endif