db4637c6217cb994998ce97db4daed34759ab69f
[libfirm] / ir / ana / interval_analysis.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ana/interval_analysis.h
4  * Purpose:     Decompost control flow graph into acylic, hierarchic intervals.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:     5.11.2004
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2004 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14 * @file interval_analysis.h
15 *
16 *  Decompost control flow graph into acylic, hierarchic intervals.
17 *
18 *  @author Goetz Lindenmaier
19 *
20 *  The analysis is based on the control flow looptree.  An intervall are basically
21 *  all nodes in a single ir_loop entry, i.e., basic blocks and inner loop nodes.
22 *  The analysis computes a new set of edges that link all nodes of a loop to an
23 *  acyclic graph.
24 *
25 *
26 *
27 */
28
29 #ifndef _INTERVAL_ANALYSIS_H_
30 #define _INTERVAL_ANALYSIS_H_
31
32
33 #include "irloop.h"
34 #include "irnode.h"
35
36 /** The ins of regions:  regions are loops or blocks.
37  *
38  *  @todo: we should make a type for the regions, or reuse loop_element.
39  */
40 int   get_region_n_ins(void *region);
41 void *get_region_in   (void *region, int pos);
42 void  add_region_in   (void *region, void *in);
43
44
45 /** The number of out edges of a region.
46  *
47  *  This number is useful for evaluation of execution frequencies.
48  */
49 int   get_region_n_outs(void *region);
50 int get_region_n_exc_outs(void *region);
51
52 /** The control flow operation corresponding to the loop-region in at
53  *  position pos.
54  */
55 void *get_loop_cfop(void *region, int pos);
56
57
58
59
60 /** The algorithm to construct the interval graph.
61  *
62  *  @todo: @@@ add flag that states correctness of interval analysis information
63  *  to irg.
64  **/
65
66 void construct_intervals(ir_graph *irg);
67
68 /** frees interval information of all graphs. */
69 void free_intervals(void);
70
71
72 /** dump a graph with the intervals. File name suffix "-interval". */
73 void dump_interval_graph(ir_graph *irg, const char *suffix);
74
75
76 #define DDMR(X) if(is_ir_node(X)) DDMN(X); else DDML(X)
77
78
79 #endif /* _INTERVAL_ANALYSIS_H_ */