PR163: descriptor_params_from_paramtypes is protected by a mutex now (per descriptor...
[cacao.git] / src / vm / jit / optimizing / graph.h
1 /* src/vm/jit/optimizing/graph.h - control flow graph header
2
3    Copyright (C) 2005, 2006, 2008
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_H
27 #define _LSRA_GRAPH_H
28
29 #include "config.h"
30
31 #include "vm/jit/optimizing/lsra.h"
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;
57   struct graph_element *next;
58 };
59
60 struct graphdata {
61 /* #ifdef GRAPH_DEBUG_CHECK */
62         int basicblockcount;
63 /* #endif */
64         int *num_succ;
65         struct graph_element **successor;
66         int *num_pred;
67         struct graph_element **predecessor;
68 };
69
70 typedef struct graphdata graphdata;
71 typedef struct graph_element graph_element;
72 typedef graph_element *graphiterator;
73
74 /* function prototypes */
75
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
79
80 void transform_BB(jitdata *, graphdata *gd);
81 graphdata *graph_init(int basicblockcount);
82                                             /* Generate the CFG */
83 void graph_make_cfg(jitdata *,graphdata *); 
84 void graph_DFS(lsradata *ls, graphdata *gd);
85 int graph_get_first_successor(graphdata *gd, int b_index, graphiterator *i);
86 int graph_get_first_predecessor(graphdata *gd, int b_index, graphiterator *i);
87 int graph_get_next(graphiterator *i);
88 int graph_get_num_predecessor(graphdata *gd, int b_index);
89 int graph_get_num_successor(graphdata *gd, int b_index);
90 bool graph_has_multiple_successors( graphdata *gd, int b_index);
91 bool graph_has_multiple_predecessors( graphdata *gd, int b_index);
92
93 #ifdef __cplusplus
94 }
95 #endif
96
97 #endif /* _LSRA_GRAPH_H */
98
99
100 /*
101  * These are local overrides for various environment variables in Emacs.
102  * Please do not remove this and leave it at the end of the file, where
103  * Emacs will automagically detect them.
104  * ---------------------------------------------------------------------
105  * Local variables:
106  * mode: c
107  * indent-tabs-mode: t
108  * c-basic-offset: 4
109  * tab-width: 4
110  * End:
111  */