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