494f2b06370d567b302b6c6a3d8219ce67896bda
[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    The graph may not be in state phase_building.  The outs datasturcture
23    is freed, the outs state set to no_outs. (@@@ Change this? -> inconsistent.)
24    Removes old attributes of nodes.
25    Attention: the numbers assigned to nodes if the library is compiled for
26    development/debugging are not conserved by copying. */
27 void dead_node_elimination(ir_graph *irg);
28
29 /* Inlines a method at the given call site.
30    Assumes that call is a Call node in current_ir_graph and that
31    the type in the Call nodes type attribute is the same as the
32    type of the called graph.
33    Further it assumes that all Phi nodes in a block of current_ir_graph
34    are assembled in a "link" list in the link field of the corresponding
35    block nodes.  Further assumes that all Proj nodes are in a "link" list
36    in the nodes producing the tuple.  (This is only a optical feature
37    for the graph.)  Conserves this feature for the old
38    nodes of the graph.  This precondition can be established by a call to
39    collect_phisprojs(), see irgmod.h.
40    Called_graph must be unequal to current_ir_graph.   Will not inline
41    if they are equal.
42    Sets visited masterflag in curren_ir_graph to max of flag in current
43    and called graphs.
44    Removes the call node and splits the basic block the call node
45    belongs to.  Inserts a copy of the called graph between these nodes.
46    It is recommended to call local_optimize_graph after inlining as this
47    function leaves a set of obscure Tuple nodes, e.g. a Proj-Tuple-Jmp
48    combination as control flow operation. */
49 void inline_method(ir_node *call, ir_graph *called_graph);
50
51 # endif /* _IRGOPT_H_ */