make code a bit more readble
[libfirm] / ir / be / beirg.c
1 /*
2  * Author:      Matthias Braun
3  * Date:                13.12.2006
4  * Copyright:   (c) Universitaet Karlsruhe
5  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
6  */
7 #ifdef HAVE_CONFIG_H
8 #include "config.h"
9 #endif
10
11 #include "execfreq.h"
12 #include "beirg_t.h"
13
14 void be_assure_liveness(be_irg_t *birg)
15 {
16         if(birg->lv != NULL)
17                 return;
18
19         birg->lv = be_liveness(birg->irg);
20 }
21
22 void be_invalidate_liveness(be_irg_t *birg)
23 {
24         if(birg->lv == NULL)
25                 return;
26
27         be_liveness_free(birg->lv);
28         birg->lv = NULL;
29 }
30
31 void be_assure_dom_front(be_irg_t *birg)
32 {
33         if(birg->dom_front != NULL)
34                 return;
35
36         birg->dom_front = be_compute_dominance_frontiers(birg->irg);
37 }
38
39 void be_invalidate_dom_front(be_irg_t *birg)
40 {
41         if(birg->dom_front == NULL)
42                 return;
43
44         be_free_dominance_frontiers(birg->dom_front);
45         birg->dom_front = NULL;
46 }
47
48 void be_free_birg(be_irg_t *birg)
49 {
50         free_execfreq(birg->exec_freq);
51         birg->exec_freq = NULL;
52
53         if(birg->dom_front != NULL) {
54                 be_free_dominance_frontiers(birg->dom_front);
55                 birg->dom_front = NULL;
56         }
57         if(birg->lv != NULL) {
58                 be_liveness_free(birg->lv);
59                 birg->lv = NULL;
60         }
61 }