From: David Given Date: Fri, 16 Dec 2016 20:04:31 +0000 (+0100) Subject: Convert to use the set API. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0507904efbf35cfb6fe18b7d1f3fb36ba0b3a621;p=ack.git Convert to use the set API. --- diff --git a/mach/proto/mcg/pass_removedeadphis.c b/mach/proto/mcg/pass_removedeadphis.c index b8b61fbbd..8d46b80d2 100644 --- a/mach/proto/mcg/pass_removedeadphis.c +++ b/mach/proto/mcg/pass_removedeadphis.c @@ -1,6 +1,6 @@ #include "mcg.h" -static ARRAYOF(struct ir) phis; +static struct set phis; static bool changed; static void collect_phis(struct basicblock* bb) @@ -11,16 +11,16 @@ static void collect_phis(struct basicblock* bb) { struct ir* ir = bb->irs.item[i]; if (ir->opcode == IR_PHI) - array_append(&phis, ir); + set_add(&phis, ir); } } static bool ir_walker_cb(struct ir* ir, void* user) { if (ir->left) - array_remove(&phis, ir->left); + set_remove(&phis, ir->left); if (ir->right) - array_remove(&phis, ir->right); + set_remove(&phis, ir->right); return false; } @@ -36,7 +36,7 @@ static void remove_referenced_phis(struct basicblock* bb) { case IR_PHI: for (j=0; ju.phivalue.count; j++) - array_remove(&phis, ir->u.phivalue.item[j].right); + set_remove(&phis, ir->u.phivalue.item[j].right); break; default: @@ -53,7 +53,7 @@ static void purge_unused_phis(struct basicblock* bb) for (i=0; iirs.count; i++) { struct ir* ir = bb->irs.item[i]; - if ((ir->opcode == IR_PHI) && (array_contains(&phis, ir))) + if ((ir->opcode == IR_PHI) && (set_contains(&phis, ir))) { array_remove(&bb->irs, ir); i--; @@ -70,7 +70,7 @@ void pass_remove_dead_phis(void) { changed = false; - phis.count = 0; + set_reset(&phis); for (i=0; i