summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bespillslots.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2014-03-29 10:13:39 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2014-04-10 10:33:55 +0200
commit1966adc74b7dc4a47f556d36628019beeb3f6d0d (patch)
treeb742c3a080dc2fd527d77849651ca2d8a547fb1a /ir/be/bespillslots.c
parent5512229a51005fec43bac48ff09c64251b392754 (diff)
all: Add and use QSORT() and QSORT_ARR().
Diffstat (limited to 'ir/be/bespillslots.c')
-rw-r--r--ir/be/bespillslots.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ir/be/bespillslots.c b/ir/be/bespillslots.c
index 4d18281..bccc539 100644
--- a/ir/be/bespillslots.c
+++ b/ir/be/bespillslots.c
@@ -11,6 +11,7 @@
*/
#include <stdlib.h>
+#include "../../adt/util.h"
#include "set.h"
#include "array.h"
#include "irgwalk.h"
@@ -394,12 +395,10 @@ static void do_greedy_coalescing(be_fec_env_t *env)
}
/* sort affinity edges */
- size_t affinity_edge_count = ARR_LEN(env->affinity_edges);
- qsort(env->affinity_edges, affinity_edge_count,
- sizeof(env->affinity_edges[0]), cmp_affinity);
+ QSORT_ARR(env->affinity_edges, cmp_affinity);
/* try to merge affine nodes */
- for (size_t i = 0; i < affinity_edge_count; ++i) {
+ for (size_t i = 0, n = ARR_LEN(env->affinity_edges); i < n; ++i) {
const affinity_edge_t *edge = env->affinity_edges[i];
int s1 = uf_find(spillslot_unionfind, edge->slot1);
int s2 = uf_find(spillslot_unionfind, edge->slot2);