Fixed some size_t related warnings.
[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 #include "begin.h"
31
32 /**
33  * libFirm initialization parameters.
34  * @deprecated
35  */
36 struct firm_parameter_t {
37         /**
38          * The size of this structure. init_firm() will only initialize
39          * this amount of data. This allows to add more fields to this structure
40          * without breaking compatibility to older source.
41          */
42         unsigned int size;
43
44         /**
45          * Statistic options. If statistic function where enabled, these
46          * flags configure it, see enum firmstat_options_t.
47          * @deprecated  call firm_init_stat(options) instead
48          */
49         unsigned enable_statistics;
50
51         /**
52          * This function is called, whenever a local variable is
53          * used before definition. The function should insert a default value,
54          * and/or raise a compiler error/warning. Note that returning
55          * an Unknown is allowed here.
56          * @deprecated  call ir_set_uninitialized_local_variable_func() instead
57          */
58         uninitialized_local_variable_func_t *initialize_local_func;
59
60         /**
61          * The interface functions for the type identification module.
62          * If not set, the default implementation with compare_strict() and
63          * firm_hash_name() will be used.
64          */
65         type_identify_if_t *ti_if;
66
67         /**
68          * dummy parameter
69          * (this used to hold an identifier module structure)
70          */
71         void *id_if;
72
73         /**
74          * dummy parameter
75          * (this used to hold a default calling convention, but this concept is no
76          *  more. You should always set the calling convention manually after
77          *  creating the method entity if you need something else)
78          */
79         unsigned cc_mask;
80
81         /**
82          * dummy (here was dbg_info *builtin_dbg before)
83          */
84         void *dummy;
85 };
86
87 typedef struct firm_parameter_t firm_parameter_t;
88
89 /**
90  * Initialize the firm library.
91  *
92  * Initializes the firm library.  Allocates default data structures.
93  * Initializes configurable behavior of the library.
94  *
95  * @param params   should be NULL (you can pass a structure containing
96  *                 initial parameters but this is deprecated)
97  */
98 FIRM_API void ir_init(const firm_parameter_t *params);
99
100 /**
101  * Frees all memory occupied by the firm library.
102  */
103 FIRM_API void ir_finish(void);
104
105 /** returns the libFirm major version number */
106 FIRM_API unsigned ir_get_version_major(void);
107 /** returns libFirm minor version number */
108 FIRM_API unsigned ir_get_version_minor(void);
109 /** returns string describing libFirm revision */
110 FIRM_API const char *ir_get_version_revision(void);
111 /** returns string describing libFirm build */
112 FIRM_API const char *ir_get_version_build(void);
113
114
115
116 /**
117  * a list of firm kinds
118  * Most important datastructures in firm contain a firm_kind field at the
119  * beginning so given void* pointer you can usually still guess the kind
120  * of thing the pointer points to.
121  * This is used in debug helper functions and printers.
122  */
123 typedef enum {
124         k_BAD = 0,                /**< An invalid firm node. */
125         k_entity,                 /**< An entity. */
126         k_type,                   /**< A type. */
127         k_ir_graph,               /**< An IR graph. */
128         k_ir_node,                /**< An IR node. */
129         k_ir_mode,                /**< An IR mode. */
130         k_ir_op,                  /**< An IR opcode. */
131         k_tarval,                 /**< A tarval. */
132         k_ir_loop,                /**< A loop. */
133         k_ir_compound_graph_path, /**< A compound graph path, see entity.h. */
134         k_ir_extblk,              /**< An extended basic block. */
135         k_ir_prog,                /**< A program representation (irp). */
136         k_ir_region,              /**< A region. */
137         k_ir_graph_pass,          /**< An ir_graph pass. */
138         k_ir_prog_pass,           /**< An ir_prog pass. */
139         k_ir_graph_pass_mgr,      /**< An ir_graph pass manager. */
140         k_ir_prog_pass_mgr,       /**< An ir_prog pass manager. */
141         k_ir_max                  /**< maximum value -- illegal for firm nodes. */
142 } firm_kind;
143
144 /**
145  * Returns the kind of a thing.
146  *
147  * @param firm_thing  pointer representing a firm object
148  */
149 FIRM_API firm_kind get_kind(const void *firm_thing);
150
151 #include "end.h"
152
153 #endif