2 * Copyright (C) 1995-2007 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 Optimization of function calls.
23 * @author Michael Beck
26 #ifndef FIRM_OPT_FUNCCALL_H
27 #define FIRM_OPT_FUNCCALL_H
30 * Optimize function calls by handling const functions.
32 * This optimization first detects all "const functions", i.e.,
33 * IR graphs that neither read nor write memory (and hence did
34 * not create exceptions, as these use memory in Firm).
36 * The result of calls to such functions depends only on its
37 * arguments, hence those calls are no more pinned.
39 * This is a rather strong criteria, so do not expect that a
40 * lot of functions will be found. Moreover, all of them might
41 * already be inlined if inlining is activated.
42 * Anyway, it might be good for handling builtin's or pseudo-graphs,
43 * even if the later read/write memory (but we know how).
45 * This optimizations read the irg_const_function property of
46 * entities and and sets the irg_const_function property of
49 * If callee information is valid, we also optimize polymorphic Calls.
51 * @param force_run if non-zero, an optimization run is started even
52 * if no const function graph was detected.
53 * Else calls are only optimized if at least one
54 * const function graph was detected.
56 * If the fontend created external entities with the irg_const_function
57 * property set, the force_run parameter should be set, else
60 * @note This optimization destroys the link fields of nodes.
62 void optimize_funccalls(int force_run);
64 #endif /* FIRM_OPT_FUNCCALL_H */