more warning fixes
[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
21  *  are basically all nodes in a single ir_loop entry, i.e., basic
22  *  blocks and inner loop nodes.  The analysis computes a new set of
23  *  edges that link all nodes of a loop to an acyclic graph.
24  *
25  *  The interval analysis counts the number of exception control flow
26  *  operations leaving a block.  This depends on stuff computed in
27  *  execution_freqencies.
28  */
29
30 #ifndef _INTERVAL_ANALYSIS_H_
31 #define _INTERVAL_ANALYSIS_H_
32
33
34 #include "irloop.h"
35 #include "irnode.h"
36
37 /** The ins of regions:  regions are loops or blocks.
38  *
39  *  @todo: we should make a type for the regions, or reuse loop_element.
40  */
41 int   get_region_n_ins(void *region);
42 void *get_region_in   (void *region, int pos);
43 void  add_region_in   (void *region, void *in);
44
45
46 /** The number of out edges of a region.
47  *
48  *  This number is useful for evaluation of execution frequencies.
49  */
50 int get_region_n_outs(void *region);
51
52 /** The number of exception out edges of a region.
53  *
54  *  This number is useful for evaluation of execution frequencies.
55  */
56 int get_region_n_exc_outs(void *region);
57
58 /** The control flow operation corresponding to the loop-region in at
59  *  position pos.
60  */
61 void *get_loop_cfop(void *region, int pos);
62
63
64 /** The algorithm to construct the interval graph.
65  *
66  *  Constructs the cf loop tree and leaves a valid version of it.
67  *
68  *  @todo: @@@ add flag that states correctness of interval analysis information
69  *  to irg.
70  **/
71 void construct_intervals(ir_graph *irg);
72
73
74 /** frees interval information of all graphs. */
75 void free_intervals(void);
76
77
78 /** dump a graph with the intervals. File name suffix "-interval". */
79 void dump_interval_graph(ir_graph *irg, const char *suffix);
80
81
82 #define DDMR(X) if(is_ir_node(X)) DDMN(X); else DDML(X)
83
84
85 #endif /* _INTERVAL_ANALYSIS_H_ */