667254d6bfe31c28dc42acd3d4e60f33f50b0bc8
[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  * Project:     libFIRM
22  * File name:   ir/opt/ldstopt.h
23  * Purpose:     optimization of real function calls
24  * Author:      Michael Beck
25  * Created:
26  * CVS-ID:      $Id$
27  * Copyright:   (c) 1998-2005 Universität Karlsruhe
28  */
29
30 /**
31  * @file funccall.h
32  *
33  * Optimization of real function calls.
34  *
35  * @author Michael Beck
36  */
37 #ifndef _FUNCCALL_H_
38 #define _FUNCCALL_H_
39
40 /**
41  * Optimize function calls by handling const functions.
42  *
43  * This optimization first detects all "const functions", i.e.,
44  * IR graphs that neither read nor write memory (and hence did
45  * not create exceptions, as these use memory in Firm).
46  *
47  * The result of calls to such functions depends only on its
48  * arguments, hence those calls are no more pinned.
49  *
50  * This is a rather strong criteria, so do not expect that a
51  * lot of functions will be found. Moreover, all of them might
52  * already be inlined if inlining is activated.
53  * Anyway, it might be good for handling builtin's or pseudo-graphs,
54  * even if the later read/write memory (but we know how).
55  *
56  * This optimizations read the irg_const_function property of
57  * entities and and sets the irg_const_function property of
58  * graphs.
59  *
60  * If callee information is valid, we also optimize polymorphic Calls.
61  *
62  * @param force_run  if set, an optimization run is startet even
63  *                   if no const function graph was detected.
64  *                   Else calls are only optimized if at least one
65  *                   const function graph was detected.
66  *
67  * If the fontend created external entities with irg_const_function
68  * property set, the force_run parameter should be set, else
69  * should be unset.
70  *
71  * @note This optimization destroys the link fields of nodes.
72  */
73 void optimize_funccalls(int force_run);
74
75 #endif /* _FUNCCALL_H_ */