#include "config.h"
#endif /* HAVE_CONFIG_H */
+#include "firm_config.h"
+
#ifdef WITH_ILP
#include "bitset.h"
#include "becopyilp_t.h"
#include "beifg_t.h"
#include "besched_t.h"
-#include "benodesets.h"
#define DEBUG_LVL 1
typedef struct _local_env_t {
double time_limit;
int first_x_var, last_x_var;
+ int n_colors;
+ bitset_t *normal_colors;
pmap *nr_2_irn;
DEBUG_ONLY(firm_dbg_module_t *dbg;)
} local_env_t;
static void build_coloring_cstr(ilp_env_t *ienv) {
- be_ifg_t *ifg = ienv->co->cenv->ifg;
- void *iter = be_ifg_nodes_iter_alloca(ifg);
+ be_ifg_t *ifg = ienv->co->cenv->ifg;
+ void *iter = be_ifg_nodes_iter_alloca(ifg);
bitset_t *colors;
ir_node *irn;
char buf[16];
req = arch_get_register_req(ienv->co->aenv, irn, -1);
+ bitset_clear_all(colors);
+
/* get assignable colors */
if (arch_register_req_is(req, limited)) {
rbitset_copy_to_bitset(req->limited, colors);
} else {
- arch_register_class_put(req->cls, colors);
- // bitset_andnot(colors, ienv->co->cenv->ignore_colors);
+ bitset_copy(colors, lenv->normal_colors);
}
/* add the coloring constraint */
}
static void build_interference_cstr(ilp_env_t *ienv) {
- lpp_t *lpp = ienv->lp;
- be_ifg_t *ifg = ienv->co->cenv->ifg;
- int n_colors = arch_register_class_n_regs(ienv->co->cls);
+ lpp_t *lpp = ienv->lp;
+ local_env_t *lenv = ienv->env;
+ be_ifg_t *ifg = ienv->co->cenv->ifg;
+ int n_colors = lenv->n_colors;
int i, col;
void *iter = be_ifg_cliques_iter_alloca(ifg);
* does not provide this walker, yet.
*/
static void build_affinity_cstr(ilp_env_t *ienv) {
+ local_env_t *lenv = ienv->env;
+ int n_colors = lenv->n_colors;
unit_t *curr;
- int n_colors = arch_register_class_n_regs(ienv->co->cls);
/* for all optimization units */
list_for_each_entry(unit_t, curr, &ienv->co->units, units) {
return ! (e1->n1 == e2->n1 && e1->n2 == e2->n2);
}
-#define HASH_EDGE(e) (nodeset_hash((e)->n1) ^ nodeset_hash((e)->n2))
+#define HASH_EDGE(e) (hash_irn((e)->n1) ^ hash_irn((e)->n2))
static INLINE edge_t *add_edge(set *edges, ir_node *n1, ir_node *n2, int *counter) {
edge_t new_edge;
my.nr_2_irn = pmap_create();
FIRM_DBG_REGISTER(my.dbg, "firm.be.coilp2");
+ my.normal_colors = bitset_alloca(arch_register_class_n_regs(co->cls));
+ bitset_clear_all(my.normal_colors);
+ arch_put_non_ignore_regs(co->aenv, co->cls, my.normal_colors);
+ my.n_colors = bitset_popcnt(my.normal_colors);
+
ienv = new_ilp_env(co, ilp2_build, ilp2_apply, &my);
sol_state = ilp_go(ienv);