updated header
[libfirm] / ir / opt / funccall.h
1 /*
2  * Copyright (C) 1995-2007 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   Optimization of function calls.
23  * @author  Michael Beck
24  * @version $Id$
25  */
26 #ifndef FIRM_OPT_FUNCCALL_H
27 #define FIRM_OPT_FUNCCALL_H
28
29 /**
30  * Optimize function calls by handling const functions.
31  *
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).
35  *
36  * The result of calls to such functions depends only on its
37  * arguments, hence those calls are no more pinned.
38  *
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).
44  *
45  * This optimizations read the irg_const_function property of
46  * entities and and sets the irg_const_function property of
47  * graphs.
48  *
49  * If callee information is valid, we also optimize polymorphic Calls.
50  *
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.
55  *
56  * If the fontend created external entities with the irg_const_function
57  * property set, the force_run parameter should be set, else
58  * should be unset.
59  *
60  * @note This optimization destroys the link fields of nodes.
61  */
62 void optimize_funccalls(int force_run);
63
64 #endif /* FIRM_OPT_FUNCCALL_H */