2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
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.
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.
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
22 * @brief Interface for external Java coalescer.
23 * @author Sebastian Hack
26 #ifndef FIRM_BE_BEJAVACOAL_H
27 #define FIRM_BE_BEJAVACOAL_H
29 struct _be_java_coal_t;
30 typedef struct _be_java_coal_t be_java_coal_t;
33 * Add an interference edge
34 * @param n first node id.
35 * @param m second node id.
37 void be_java_coal_add_int_edge(be_java_coal_t *c, int n, int m);
40 * Add an affinity edge.
41 * @param n first node id.
42 * @param m second node id.
43 * @param costs Costs for the edge.
45 void be_java_coal_add_aff_edge(be_java_coal_t *c, int n, int m, int costs);
48 * Set the color of a node.
50 * @param col The color.
52 void be_java_coal_set_color(be_java_coal_t *c, int n, int col);
55 * Set debug information for a node.
57 * @param dbg Some string copied to Java.
59 void be_java_coal_set_debug(be_java_coal_t *c, int n, const char *dbg);
62 * Forbid a color for a node.
63 * Afterwards, the node may not be assigned that color.
65 * @param col The color.
67 void be_java_coal_forbid_color(be_java_coal_t *c, int n, int col);
70 * Start the coalescing.
72 void be_java_coal_coalesce(be_java_coal_t *c);
75 * Dump the graph into a dot file.
76 * @param fn Filename to dump to.
78 void be_java_coal_dump(be_java_coal_t *c, const char *fn);
81 * Get the color of a node.
83 * @return The color of the node.
85 int be_java_coal_get_color(be_java_coal_t *c, int n);
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.
95 be_java_coal_t *be_java_coal_init(const char *graph_name, int n_nodes, int n_regs, int dbg_level);
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
103 void be_java_coal_start_jvm(void);
106 * Destroy the coalescing object.
108 void be_java_coal_destroy(be_java_coal_t *c);
110 #endif /* FIRM_BE_BEJAVACOAL_H */