added missing header for firmjni
[libfirm] / ir / common / firm.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/common/firm.h
4  * Purpose:     Central firm header.
5  * Author:      Martin Trapp, Christian Schaefer
6  * Modified by: Goetz Lindenmaier
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1998-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14  * @file firm.h
15  *
16  *  Central FIRM header.
17  *
18  *  FIRM is a full graph based intermediate representation in SSA Form
19  *  with a novel concept to model side effects.  It allows fast, aggressive
20  *  optimizations.
21  *
22  *  This header is the central header of the library implementation of this
23  *  IR.
24  *
25  *  The internal representation of a program in firm is separated into five
26  *  different modules:
27  *   - Firm Graphs representing the code of a program. (Subdirectory ir.)
28  *     Firm Graphs are assembled out of several data structures:
29  *     irprog: represents a program.  Allows access to all types and all
30  *       FIRM graphs for procedures and other global things.
31  *     irgraph: represents a procedure.  Allows access to the code of the
32  *       procedure, the actual FIRM graph.
33  *     irnode: A node of a FIRM graph.  Nodes are typed with an opcode and a mode
34  *   and represent instructions in a program.
35  *     irop: The opcode of FIRM nodes.
36  *     irmode: The mode of FIRM nodes.  Most modes correspond to machine known
37  *       data types (int, float, pointer).
38  *   - Entities representing program known objects. (Subdirectory tr.)
39  *     All variables and procedures are entities.
40  *   - Types describing the type system for the program. (Subdirectory tr.)
41  *   - Target Values representing program known constants. (Subdirectory tv.)
42  *   - Identifiers representing any Strings used in the program. (Subdirectory ident.)
43  *
44  *   Further this library supplies functionality to build and optimize FIRM graphs
45  *   and further functionality needed in a compiler.  Finally there is more
46  *   generic functionality to support implementations using firm.  (Code generation,
47  *   further optimizations).
48  */
49 #ifndef _FIRM_H_
50 #define _FIRM_H_
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 /* The representations */
57 #include "firm_common.h"   /* common type tags. */
58 #include "irprog.h"        /* control flow and data of a program */
59 #include "irgraph.h"       /* graphs */
60 #include "type.h"          /* type representation */
61 #include "entity.h"        /* entity representation */
62 #include "tv.h"            /* target values */
63 #include "ident.h"         /* source code identificators */
64
65 /* Functionality */
66 #include "ircons.h"        /* construct ir */
67 #include "ircgcons.h"      /* construct interprocedural graph */
68
69 /* Optimizations */
70 #include "irflag.h"         /* optimization flags */
71 #include "irgopt.h"         /* optimize ir */
72 #include "reassoc.h"        /* optimize ir by reassociation */
73 #include "ldstopt.h"        /* optimize Load/Store */
74 #include "cfopt.h"          /* optimize control flow */
75 #include "tailrec.h"        /* optimize tail-recursion calls */
76 #include "ircgopt.h"        /* Optimizations based on interprocedural graph */
77 #include "opt_osr.h"        /* Operator Strength Reduction */
78 #include "strength_red.h"   /* Old (and buggy) Strength reduction */
79 #include "loop_unrolling.h" /* Do loop unrolling */
80 #include "ifconv.h"         /* if conversion */
81 #include "funccall.h"       /* real function call optimization */
82 #include "return.h"         /* Return node normalizations */
83 #include "scalar_replace.h" /* Scalar replacement */
84 #include "proc_cloning.h"   /* procedure cloning */
85 #include "opt_confirms.h"   /* Confirm based optimizations */
86 #include "gvn_pre.h"        /* global value numbering and partial redundancy elimination */
87 #include "opt_frame.h"      /* frame type optimization */
88 #include "tropt.h"          /* optimize the type representation */
89
90 /* Lowering */
91 #include "lower_calls.h"      /* lowering of different calls */
92 #include "lower_intrinsics.h" /* lowering of intrinsic calls */
93 #include "lower_dw.h"         /* double word types lowering */
94
95 /* Analyses */
96 #include "irouts.h"         /* Graph reversal / out edges. */
97 #include "trouts.h"         /* Graph reversal / out edges for types. */
98 #include "irdom.h"          /* Dominator analysis */
99 #include "cgana.h"          /* Analysis to construct interprocedural graph */
100                             /* including some optimizations */
101 #include "irloop.h"         /* loop and backedge analysis */
102 #include "callgraph.h"      /* Callgraph construction */
103 #include "irconsconfirm.h"  /* Confirm nodes */
104 #include "analyze_irg_args.h" /* Simple pointer parameter analysis */
105 #include "irtypeinfo.h"       /* type information for nodes */
106 #include "interval_analysis.h"
107 #include "field_temperature.h"
108 #include "execution_frequency.h"
109
110 /* Support */
111 #include "irgmod.h"         /* Support to modify ir */
112 #include "irgwalk.h"        /* Support to walk ir */
113 #include "typewalk.h"       /* Support to walk type information */
114 #include "typegmod.h"       /* Support to modify type graph */
115 #include "type_identify.h"  /* Support for type identification */
116 #include "mangle.h"         /* Support for mangling ident names. */
117 #include "tr_inheritance.h" /* Support to handle inheritance. */
118
119 #include "irarch.h"        /* architecture dependent optimizations */
120 #include "archop.h"        /* architecture dependent opcodes */
121 //#include "modeconv.h"      /* architecture dependent mode conversion */
122
123 #include "firmstat.h"      /* statistics */
124
125 #include "irreflect.h"     /* reflection */
126
127 #include "seqnumbers.h"    /* debug support */
128
129
130 /* @@@ temporarily for jni builder until preprocessor works.
131    Then it should be sufficient to include <file.h> instead
132    of firm.h as not all enums are needed in the implementation
133    files. */
134 #include "irdump.h"
135 #include "irprintf.h"
136 #include "irvrfy.h"
137 #include "trvrfy.h"
138
139 #include "irarch.h"
140
141 #include "iredges.h"
142
143 /* Macros that define the old function names we decided to rename.
144    Use for compatibility with old implementations. */
145 /*#include "old_fctnames.h"*/
146
147 /**
148  * libFirm initialization parameters.
149  */
150 struct _firm_parameter_t {
151   /**
152    * The size of this structure. init_firm() will only initialize
153    * this amount of data. This allows to add more fields to this structure
154    * without breaking compatibility to older source.
155    */
156   unsigned int size;
157
158   /**
159    * Statistic options. If statistic function where enabled, these
160    * flags configure it, see enum firmstat_options_t.
161    */
162   unsigned enable_statistics;
163
164   /**
165    * This function is called, whenever a local variable is
166    * used before definition. The function should insert a default value,
167    * and/or raise a compiler error/warning. Note that returning
168    * an Unknown is allowed here.
169    */
170   uninitialized_local_variable_func_t *initialize_local_func;
171
172   /**
173    * The interface functions for the type identification module.
174    * If not set, the default implementation with compare_strict() and
175    * firm_hash_name() will be used.
176    */
177   type_identify_if_t *ti_if;
178
179   /**
180    * The interface for the ident module.
181    * If not set, the default libFirm ident module (using hash sets).
182    */
183   ident_if_t *id_if;
184
185   /**
186    * The architecture dependent opcode settings.
187    * If not set, no architecture dependent operations will be used.
188    */
189   const arch_ops_info *arch_op_settings;
190
191   /**
192    * The default calling convention.
193    */
194   unsigned cc_mask;
195
196   /**
197    * The debug info that should be used for "builtin" objects.
198    */
199   dbg_info *builtin_dbg;
200
201   /**
202    * Prefix for the command line options.
203    * example: if the option is -ffirm-opt-bla, then the prefix is "-f"
204    * @note Only active, if libfirm is compiled with libcore.
205    */
206   const char *arg_prefix;
207
208   /**
209    * Number of arguments in the "command line".
210    * @note Only active, if libfirm is compiled with libcore.
211    */
212   int argc;
213
214   /**
215    * Array of arguments.
216    * @note Only active, if libfirm is compiled with libcore.
217    */
218   const char **argv;
219
220   /**
221    * Name of ini file which is initially read.
222    * @note Only active, if libfirm is compiled with libcore.
223    */
224   const char *ini_file;
225 };
226
227 typedef struct _firm_parameter_t firm_parameter_t;
228
229 #define libFirm_VERSION_MAJOR 1
230 #define libFirm_VERSION_MINOR 4
231
232 /**
233  * The Firm version number.
234  */
235 typedef struct _firm_version_t {
236   unsigned major;
237   unsigned minor;
238 } firm_version_t;
239
240 /**
241  * Initialize the firm library.
242  *
243  * Initializes the firm library.  Allocates default data structures.
244  * Initializes configurable behavior of the library.
245  *
246  * @param params   A structure containing the parameters of the libFirm.
247  *
248  * The parameter struct may be NULL. In that case, the original FIRM behavior
249  * is conserved.
250  */
251 void init_firm(const firm_parameter_t *params);
252
253 /**
254  * Frees all memory occupied by the firm library.
255  */
256 void free_firm(void);
257
258 /**
259  * Returns the libFirm version number.
260  * If statically linked, always libFirm_VERSION_MAJOR, libFirm_VERSION_MINOR
261  */
262 void firm_get_version(firm_version_t *version);
263
264 #ifdef __cplusplus
265 }
266 #endif
267
268 #endif /* _FIRM_H_ */