1 /* Copyright (C) 1998 - 2001 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Author: Christian Schaefer, Goetz Lindenmaier
6 ** Optimizations for a whole ir graph, i.e., a procedure.
16 /* Applies local optimizations (see iropt.h) to all nodes in the graph. */
17 void local_optimize_graph (ir_graph *irg);
19 /* Performs dead node elimination by copying the ir graph to a new obstack.
20 Further removes Bad predecesors from Blocks and the corresponding
22 Optimization is only performed if options `optimize' and
23 `opt_dead_node_elimination' are set.
24 The graph may not be in state phase_building. The outs datasturcture
25 is freed, the outs state set to no_outs. (@@@ Change this? -> inconsistent.)
26 Removes old attributes of nodes. Sets link field to NULL.
27 Attention: the numbers assigned to nodes if the library is compiled for
28 development/debugging are not conserved by copying. */
29 void dead_node_elimination(ir_graph *irg);
31 /* Removes Bad Bad predecesors from Blocks and the corresponding
32 inputs to Phi nodes as in dead_node_elimination but without
34 @@@ not implemented! */
35 void remove_bad_predecessors(ir_graph *irg);
37 /* Inlines a method at the given call site.
38 Assumes that call is a Call node in current_ir_graph and that
39 the type in the Call nodes type attribute is the same as the
40 type of the called graph.
41 Further it assumes that all Phi nodes in a block of current_ir_graph
42 are assembled in a "link" list in the link field of the corresponding
43 block nodes. Further assumes that all Proj nodes are in a "link" list
44 in the nodes producing the tuple. (This is only an optical feature
45 for the graph.) Conserves this feature for the old
46 nodes of the graph. This precondition can be established by a call to
47 collect_phisprojs(), see irgmod.h.
48 Called_graph must be unequal to current_ir_graph. Will not inline
50 Sets visited masterflag in current_ir_graph to the max of the flag in
51 current and called graph.
52 Removes the call node and splits the basic block the call node
53 belongs to. Inserts a copy of the called graph between these nodes.
54 It is recommended to call local_optimize_graph after inlining as this
55 function leaves a set of obscure Tuple nodes, e.g. a Proj-Tuple-Jmp
56 combination as control flow operation. */
57 void inline_method(ir_node *call, ir_graph *called_graph);
60 /* Inlines all small methods at call sites where the called address comes
61 from a Const node that references the entity representing the called
63 The size argument is a rough measure for the code size of the method:
64 Methods where the obstack containing the firm graph is smaller than
65 size are inlined. Further only a limited number of calls are inlined.
66 If the method contains more than 1024 inlineable calls none will be
68 Inlining is only performed if flags `optimize' and `inlineing' are set.
69 The graph may not be in state phase_building.
70 It is recommended to call local_optimize_graph after inlining as this
71 function leaves a set of obscure Tuple nodes, e.g. a Proj-Tuple-Jmp
72 combination as control flow operation. */
73 void inline_small_irgs(ir_graph *irg, int size);
75 /* Code Placement. Pinns all floating nodes to a block where they
76 will be executed only if needed. Depends on the flag opt_global_cse.
77 Graph may not be in phase_building. Does not schedule control dead
78 code. Uses dominator information which it computes if the irg is not
79 in state dom_consistent. Destroys the out information as it moves nodes
80 to other blocks. Optimizes Tuples in Control edges. (@@@ This
82 @@@ A more powerful code placement would move operations past Phi nodes
83 out of loops. Further the control flow should be normalized before
84 computing the dominator information so that there exists an optimal block
85 for all operations. */
86 void place_code(ir_graph *irg);
90 # endif /* _IRGOPT_H_ */