- fixed comment: bs cannot be NULL anymore (and was never NULL previously)
[libfirm] / ir / be / bejavacoal.h
1 /*
2  * Copyright (C) 1995-2008 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  * @file
22  * @brief       Interface for external Java coalescer.
23  * @author      Sebastian Hack
24  * @version     $Id$
25  */
26 #ifndef FIRM_BE_BEJAVACOAL_H
27 #define FIRM_BE_BEJAVACOAL_H
28
29 struct _be_java_coal_t;
30 typedef struct _be_java_coal_t be_java_coal_t;
31
32 /**
33  * Add an interference edge
34  * @param n first node id.
35  * @param m second node id.
36  */
37 void be_java_coal_add_int_edge(be_java_coal_t *c, int n, int m);
38
39 /**
40  * Add an affinity edge.
41  * @param n first node id.
42  * @param m second node id.
43  * @param costs Costs for the edge.
44  */
45 void be_java_coal_add_aff_edge(be_java_coal_t *c, int n, int m, int costs);
46
47 /**
48  * Set the color of a node.
49  * @param n The node.
50  * @param col The color.
51  */
52 void be_java_coal_set_color(be_java_coal_t *c, int n, int col);
53
54 /**
55  * Set debug information for a node.
56  * @param n The node.
57  * @param dbg Some string copied to Java.
58  */
59 void be_java_coal_set_debug(be_java_coal_t *c, int n, const char *dbg);
60
61 /**
62  * Forbid a color for a node.
63  * Afterwards, the node may not be assigned that color.
64  * @param n The node.
65  * @param col The color.
66  */
67 void be_java_coal_forbid_color(be_java_coal_t *c, int n, int col);
68
69 /**
70  * Start the coalescing.
71  */
72 void be_java_coal_coalesce(be_java_coal_t *c);
73
74 /**
75  * Dump the graph into a dot file.
76  * @param fn Filename to dump to.
77  */
78 void be_java_coal_dump(be_java_coal_t *c, const char *fn);
79
80 /**
81  * Get the color of a node.
82  * @param n The node.
83  * @return The color of the node.
84  */
85 int be_java_coal_get_color(be_java_coal_t *c, int n);
86
87 /**
88  * Init the JAVA coalescer.
89  * @param graph_name The name of the graph to coalesce.
90  * @param n_nodes The number of nodes in the graph. Each node has an ID which ranges from 0 to n_nodes - 1.
91  * @param n_regs  The number of colors available.
92  * @param dbg_level Te debug level for the coalescer. 0 means quiet. >0 more verbose.
93  * @return The coalescing object.
94  */
95 be_java_coal_t *be_java_coal_init(const char *graph_name, int n_nodes, int n_regs, int dbg_level);
96
97 /**
98  * Start the JVM.
99  * This is also done lazily by be_java_coal_init() but as that is called by
100  * the coalescing driver, it might tamper the runtime measurements. So here is
101  * an extra call.
102  */
103 void be_java_coal_start_jvm(void);
104
105 /**
106  * Destroy the coalescing object.
107  */
108 void be_java_coal_destroy(be_java_coal_t *c);
109
110 #endif /* FIRM_BE_BEJAVACOAL_H */