beifg: Factorise code to count interference components.
[libfirm] / ir / be / beloopana.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief       Compute register pressure in loops.
9  * @author      Christian Wuerdig
10  * @date        20.02.2007
11  */
12 #ifndef FIRM_BE_BELOOPANA_H
13 #define FIRM_BE_BELOOPANA_H
14
15 #include "irloop.h"
16
17 #include "bearch.h"
18
19 typedef struct be_loopana_t be_loopana_t;
20
21 /**
22  * Compute the register pressure for a class of all loops in the irg.
23  * @param irg   The graph
24  * @param cls   The register class to compute the pressure for
25  * @return The loop analysis object.
26  */
27 be_loopana_t *be_new_loop_pressure_cls(ir_graph *irg,
28                                        const arch_register_class_t *cls);
29
30 /**
31  * Compute the register pressure of all loops in the irg.
32  * @param irg   The graph
33  * @param cls   register class to compute loop pressure for,
34  *              if NULL computes for all classes
35  * @return The loop analysis object.
36  */
37 be_loopana_t *be_new_loop_pressure(ir_graph *irg,
38                                    const arch_register_class_t *cls);
39
40 /**
41  * Returns the computed register pressure for the given class and loop.
42  * @return The pressure or INT_MAX if not found
43  */
44 unsigned be_get_loop_pressure(be_loopana_t *loop_ana,
45                               const arch_register_class_t *cls, ir_loop *loop);
46
47 /**
48  * Frees loop analysis object.
49  */
50 void be_free_loop_pressure(be_loopana_t *loop_ana);
51
52 #endif