8cc76195234dc29650d954cc9454d7723dd5d11e
[libfirm] / ir / ir / irgopt.h
1 /* Copyright (C) 1998 - 2001 by Universitaet Karlsruhe
2 ** All rights reserved.
3 **
4 ** Author: Christian Schaefer, Goetz Lindenmaier
5 **
6 ** Optimizations for a whole ir graph, i.e., a procedure.
7 */
8
9 # ifndef _IRGOPT_H_
10 # define _IRGOPT_H_
11
12 # include "irgraph.h"
13
14 /* Applies local optimizations (see iropt.h) to all nodes in the graph. */
15 void local_optimize_graph (ir_graph *irg);
16
17 /* Performs dead node elimination by copying the ir graph to a new obstack.
18    Further removes Bad predecesors from Blocks and the corresponding
19    inputs to Phi nodes.
20    Attention: the numbers assigned to nodes if the library is compiled for
21    development/debugging are not conserved by copying. */
22 void dead_node_elimination(ir_graph *irg);
23
24 /* Inlines a method at the given call site.
25    Assumes that call is a Call node in current_ir_graph and that
26    the type in the Call nodes type attribute is the same as the
27    type of the called graph.
28    Further it assumes that all Phi nodes in a block of current_ir_graph
29    are assembled in a "link" list in the link field of the corresponding
30    block nodes.  Further assumes that all Proj nodes are in a "link" list
31    in the nodes producing the tuple.  Conserves this feature for the old
32    nodes of the graph.  This precondition can be established by a call to
33    collect_phis(), see irgmod.h.
34    Called_graph must be unequal to current_ir_graph.   Will not inline
35    if they are equal.
36    Sets visited masterflag in curren_ir_graph to max of flag in current
37    and called graphs.
38    Removes the call node and splits the basic block the call node
39    belongs to.  Inserts a copy of the called graph between these nodes.
40    It is recommended to call local_optimize_graph after inlining as this
41    function leaves a set of obscure Tuple nodes, e.g. a Proj-Tuple-Jmp
42    combination as control flow operation. */
43 void inline_method(ir_node *call, ir_graph *called_graph);
44
45 # endif /* _IRGOPT_H_ */