#include "bespillslots.h"
#include "bechordal_t.h"
#include "bejavacoal.h"
+#include "benodesets.h"
#define DBG_COALESCING 1
/** Compare 2 affinity edges (used in quicksort) */
static int cmp_affinity(const void *d1, const void *d2) {
- const affinity_edge_t *e1 = d1;
- const affinity_edge_t *e2 = d2;
+ const affinity_edge_t * const *e1 = d1;
+ const affinity_edge_t * const *e2 = d2;
- return e1->affinity < e2->affinity ? -1 : 1;
+ // sort in descending order
+ return (*e1)->affinity < (*e2)->affinity ? 1 : -1;
}
static int cmp_spill(const void* d1, const void* d2, size_t size) {
static spill_t *get_spill(ss_env_t *env, ir_node *node) {
spill_t spill, *res;
- int hash = HASH_PTR(node);
+ int hash = nodeset_hash(node);
spill.spill = node;
res = set_find(env->spills, &spill, sizeof(spill), hash);
const arch_env_t *arch_env = env->arch_env;
const arch_register_class_t *cls;
spill_t spill, *res;
- int hash = HASH_PTR(node);
+ int hash = nodeset_hash(node);
assert(arch_irn_class_is(arch_env, node, spill));
static spill_t *collect_memphi(ss_env_t *env, ir_node *node) {
int i, arity;
spill_t spill, *res;
- int hash = HASH_PTR(node);
+ int hash = nodeset_hash(node);
assert(is_Phi(node));
if(res->cls == NULL) {
res->cls = arg_spill->cls;
} else {
- assert(res->cls == arg_spill->cls);
+ assert(arg_spill->cls == NULL || res->cls == arg_spill->cls);
}
// add an affinity edge
int hash;
entry.block = block;
- hash = HASH_PTR(block);
+ hash = nodeset_hash(block);
res = set_find(env->memperms, &entry, sizeof(entry), hash);