Implemented support for endless loops:
[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.  (This is only a optical feature
34    for the graph.)  Conserves this feature for the old
35    nodes of the graph.  This precondition can be established by a call to
36    collect_phisprojs(), see irgmod.h.
37    Called_graph must be unequal to current_ir_graph.   Will not inline
38    if they are equal.
39    Sets visited masterflag in curren_ir_graph to max of flag in current
40    and called graphs.
41    Removes the call node and splits the basic block the call node
42    belongs to.  Inserts a copy of the called graph between these nodes.
43    It is recommended to call local_optimize_graph after inlining as this
44    function leaves a set of obscure Tuple nodes, e.g. a Proj-Tuple-Jmp
45    combination as control flow operation. */
46 void inline_method(ir_node *call, ir_graph *called_graph);
47
48 # endif /* _IRGOPT_H_ */