From: David Given Date: Fri, 16 Dec 2016 20:08:28 +0000 (+0100) Subject: Convert to use the set API. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=35a33e5c9f724a769a5387781556286d1856792f;p=ack.git Convert to use the set API. --- diff --git a/mach/proto/mcg/pass_typeinference.c b/mach/proto/mcg/pass_typeinference.c index f3b123e25..5bc12ac44 100644 --- a/mach/proto/mcg/pass_typeinference.c +++ b/mach/proto/mcg/pass_typeinference.c @@ -1,11 +1,11 @@ #include "mcg.h" static bool changed; -static ARRAYOF(struct ir) irs; +static struct set irs; static void addall(struct ir* ir) { - if (array_appendu(&irs, ir)) + if (set_add(&irs, ir)) return; if (ir->left) @@ -18,7 +18,7 @@ static void collect_irs(void) { int i; - irs.count = 0; + set_reset(&irs); for (i=0; iopcode == IR_PHI) { @@ -192,11 +192,11 @@ static void propagate_types(void) static void assign_fallback_types(void) { - int i; + struct set_iterator sit = {}; - for (i=0; iopcode]; if (!ir->type && (ird->returntype == '?')) @@ -258,13 +258,13 @@ static void insert_copy(struct ir* ir, struct ir** child, char returntype, char static void insert_ir_copies(void) { - int i; + struct set_iterator sit = {}; /* Insert copies for normal IR nodes. */ - for (i=0; iopcode]; insert_copy(ir, &ir->left, ird->returntype, ird->lefttype); @@ -274,14 +274,15 @@ static void insert_ir_copies(void) static void insert_phi_copies(void) { - int i, j; + struct set_iterator sit = {}; + int j; /* If the child of a phi isn't the same type as the phi itself, we need to * insert the copy at the end of the block that exported the value. */ - for (i=0; iu.phivalue.count; j++) {