From: David Given Date: Fri, 16 Dec 2016 20:12:35 +0000 (+0100) Subject: Convert to the set API. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=cf15e220795be513aba35da463714dd225c4b4e5;p=ack.git Convert to the set API. --- diff --git a/mach/proto/mcg/pass_vregusage.c b/mach/proto/mcg/pass_vregusage.c index 339ea78ca..8681844d9 100644 --- a/mach/proto/mcg/pass_vregusage.c +++ b/mach/proto/mcg/pass_vregusage.c @@ -1,6 +1,6 @@ #include "mcg.h" -static ARRAYOF(struct vreg) vregs; +static struct set vregs; static void assign_uses_cb(struct hop* hop, void* user) { @@ -14,7 +14,7 @@ static void assign_uses_cb(struct hop* hop, void* user) struct vreg* vreg = hop->outs.item[i]; assert(vreg->defined == NULL); vreg->defined = hop; - array_appendu(&vregs, vreg); + set_add(&vregs, vreg); } } @@ -36,7 +36,7 @@ void pass_determine_vreg_usage(void) { int i, j; - vregs.count = 0; + set_reset(&vregs); hop_walk(assign_uses_cb, NULL); for (i=0; iphis.item[j].right; struct vreg* src = phi->ir->result; array_appendu(&src->usedphis, bb); - array_appendu(&vregs, src); - array_appendu(&vregs, dest); + set_add(&vregs, src); + set_add(&vregs, dest); } } - for (i=0; iis_spillable = is_spillable_vreg(vreg); + struct set_iterator sit = {}; + while (set_next(&vregs, &sit)) + { + struct vreg* vreg = sit.item; + vreg->is_spillable = is_spillable_vreg(vreg); + } } }