CACAO
graph.hpp
Go to the documentation of this file.
1 /* src/vm/jit/optimizing/graph.hpp - control flow graph header
2 
3  Copyright (C) 2005-2013
4  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 
6  This file is part of CACAO.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2, or (at
11  your option) any later version.
12 
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA.
22 
23 */
24 
25 
26 #ifndef LSRA_GRAPH_HPP_
27 #define LSRA_GRAPH_HPP_ 1
28 
29 #include "config.h"
30 
32 
33 #if !defined(NDEBUG)
34 # include <assert.h>
35 /* # define GRAPH_DEBUG_CHECK */
36 # define GRAPH_DEBUG_VERBOSE
37 #endif
38 
39 #ifdef GRAPH_DEBUG_CHECK
40 # define _GRAPH_CHECK_BOUNDS(i,l,h) assert( ((i) >= (l)) && ((i) < (h)));
41 # define _GRAPH_ASSERT(a) assert((a));
42 #else
43 # define _GRAPH_CHECK_BOUNDS(i,l,h)
44 # define _GRAPH_ASSERT(a)
45 #endif
46 
47 #if 0
48 struct _sbr {
49  int header; /* BB Index of subroutine start (SBR_HEADER) */
50  struct graph_element *ret; /* List of possible return BB indizes */
51  struct _sbr *next;
52 };
53 #endif
54 
55 struct graph_element {
56  int value;
58 };
59 
60 struct graphdata {
61 /* #ifdef GRAPH_DEBUG_CHECK */
63 /* #endif */
64  int *num_succ;
66  int *num_pred;
68 };
69 
70 struct graphdata;
73 
74 /* function prototypes */
75 
76 void transform_BB(jitdata *, graphdata *gd);
77 graphdata *graph_init(int basicblockcount);
78  /* Generate the CFG */
80 void graph_DFS(lsradata *ls, graphdata *gd);
81 int graph_get_first_successor(graphdata *gd, int b_index, graphiterator *i);
84 int graph_get_num_predecessor(graphdata *gd, int b_index);
85 int graph_get_num_successor(graphdata *gd, int b_index);
86 bool graph_has_multiple_successors( graphdata *gd, int b_index);
87 bool graph_has_multiple_predecessors( graphdata *gd, int b_index);
88 
89 void graph_add_edge( graphdata *gd, int from, int to );
90 
91 #endif // LSRA_GRAPH_HPP_
92 
93 
94 /*
95  * These are local overrides for various environment variables in Emacs.
96  * Please do not remove this and leave it at the end of the file, where
97  * Emacs will automagically detect them.
98  * ---------------------------------------------------------------------
99  * Local variables:
100  * mode: c++
101  * indent-tabs-mode: t
102  * c-basic-offset: 4
103  * tab-width: 4
104  * End:
105  */
int graph_get_next(graphiterator *i)
Definition: graph.cpp:104
struct graph_element ** predecessor
Definition: graph.hpp:67
bool graph_has_multiple_predecessors(graphdata *gd, int b_index)
Definition: graph.cpp:121
Definition: jit.hpp:126
int header
Definition: lsra.hpp:143
argument_type from
struct graph_element * next
Definition: graph.hpp:57
int basicblockcount
Definition: graph.hpp:62
void graph_add_edge(graphdata *gd, int from, int to)
Definition: graph.cpp:131
int graph_get_first_predecessor(graphdata *gd, int b_index, graphiterator *i)
Definition: graph.cpp:99
struct _list * ret
Definition: lsra.hpp:144
struct graph_element ** successor
Definition: graph.hpp:65
void graph_DFS(lsradata *ls, graphdata *gd)
Definition: graph.cpp:416
int graph_get_num_successor(graphdata *gd, int b_index)
Definition: graph.cpp:89
int * num_pred
Definition: graph.hpp:66
void transform_BB(jitdata *jd, graphdata *gd)
Definition: graph.cpp:658
MIIterator i
struct _sbr * next
Definition: lsra.hpp:145
void graph_make_cfg(jitdata *jd, graphdata *gd)
Definition: graph.cpp:206
int * num_succ
Definition: graph.hpp:64
graph_element * graphiterator
Definition: graph.hpp:71
int graph_get_num_predecessor(graphdata *gd, int b_index)
Definition: graph.cpp:84
Definition: lsra.hpp:142
bool graph_has_multiple_successors(graphdata *gd, int b_index)
Definition: graph.cpp:126
graphdata * graph_init(int basicblockcount)
Definition: graph.cpp:60
int graph_get_first_successor(graphdata *gd, int b_index, graphiterator *i)
Definition: graph.cpp:94