Implement better magic to handle changing control dependencies when welding blocks
[libfirm] / ir / opt / funccall.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/opt/ldstopt.h
4  * Purpose:     optimization of real function calls
5  * Author:      Michael Beck
6  * Created:
7  * CVS-ID:      $Id$
8  * Copyright:   (c) 1998-2005 Universität Karlsruhe
9  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
10  */
11
12 /**
13  * @file funccall.h
14  *
15  * Optimization of real function calls.
16  *
17  * @author Michael Beck
18  */
19 #ifndef _FUNCCALL_H_
20 #define _FUNCCALL_H_
21
22 /**
23  * Optimize function calls by handling const functions.
24  *
25  * This optimization first detects all "const functions", i.e.,
26  * IR graphs that neither read nor write memory (and hence did
27  * not create exceptions, as these use memory in Firm).
28  *
29  * The result of calls to such functions depends only on its
30  * arguments, hence those calls are no more pinned.
31  *
32  * This is a rather strong criteria, so do not expect that a
33  * lot of functions will be found. Moreover, all of them might
34  * already be inlined if inlining is activated.
35  * Anyway, it might be good for handling builtin's or pseudo-graphs,
36  * even if the later read/write memory (but we know how).
37  *
38  * This optimizations read the irg_const_function property of
39  * entities and and sets the irg_const_function property of
40  * graphs.
41  *
42  * If callee information is valid, we also optimize polymorphic Calls.
43  *
44  * @param force_run  if set, an optimization run is startet even
45  *                   if no const function graph was detected.
46  *                   Else calls are only optimized if at least one
47  *                   const function graph was detected.
48  *
49  * If the fontend created external entities with irg_const_function
50  * property set, the force_run parameter should be set, else
51  * should be unset.
52  */
53 void optimize_funccalls(int force_run);
54
55 #endif /* _FUNCCALL_H_ */