eb5b22d46adf2cd9e6e1b37243a16569a9ec8163
[libfirm] / ir / be / bejavacoal.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20
21 #ifndef _BEJAVACOAL_H
22 #define _BEJAVACOAL_H
23
24 struct _be_java_coal_t;
25 typedef struct _be_java_coal_t be_java_coal_t;
26
27 /**
28  * Add an interference edge
29  * @param n first node id.
30  * @param m second node id.
31  */
32 void be_java_coal_add_int_edge(be_java_coal_t *c, int n, int m);
33
34 /**
35  * Add an affinity edge.
36  * @param n first node id.
37  * @param m second node id.
38  * @param costs Costs for the edge.
39  */
40 void be_java_coal_add_aff_edge(be_java_coal_t *c, int n, int m, int costs);
41
42 /**
43  * Set the color of a node.
44  * @param n The node.
45  * @param col The color.
46  */
47 void be_java_coal_set_color(be_java_coal_t *c, int n, int col);
48
49 /**
50  * Set debug information for a node.
51  * @param n The node.
52  * @param dbg Some string copied to Java.
53  */
54 void be_java_coal_set_debug(be_java_coal_t *c, int n, const char *dbg);
55
56 /**
57  * Forbid a color for a node.
58  * Afterwards, the node may not be assigned that color.
59  * @param n The node.
60  * @param col The color.
61  */
62 void be_java_coal_forbid_color(be_java_coal_t *c, int n, int col);
63
64 /**
65  * Start the coalescing.
66  */
67 void be_java_coal_coalesce(be_java_coal_t *c);
68
69 /**
70  * Dump the graph into a dot file.
71  * @param fn Filename to dump to.
72  */
73 void be_java_coal_dump(be_java_coal_t *c, const char *fn);
74
75 /**
76  * Get the color of a node.
77  * @param n The node.
78  * @return The color of the node.
79  */
80 int be_java_coal_get_color(be_java_coal_t *c, int n);
81
82 /**
83  * Init the JAVA coalescer.
84  * @param graph_name The name of the graph to coalesce.
85  * @param n_nodes The number of nodes in the graph. Each node has an ID which ranges from 0 to n_nodes - 1.
86  * @param n_regs  The number of colors available.
87  * @param dbg_level Te debug level for the coalescer. 0 means quiet. >0 more verbose.
88  * @return The coalescing object.
89  */
90 be_java_coal_t *be_java_coal_init(const char *graph_name, int n_nodes, int n_regs, int dbg_level);
91
92 /**
93  * Start the JVM.
94  * This is also done lazily by be_java_coal_init() but as that is called by
95  * the coalescing driver, it might tamper the runtime measurements. So here is
96  * an extra call.
97  */
98 void be_java_coal_start_jvm(void);
99
100 /**
101  * Destroy the coalescing object.
102  */
103 void be_java_coal_destroy(be_java_coal_t *c);
104
105 #endif