mirror of
git://c9x.me/qbe.git
synced 2026-04-05 18:09:47 +00:00
Blk::pred is a vector
Scratching an itch - avoid unnecesary re-allocation in fillpred() which is called often in the optimisation chain.
This commit is contained in:
parent
c16f7eafca
commit
024dffac8b
11
cfg.c
11
cfg.c
@ -45,10 +45,11 @@ edgedel(Blk *bs, Blk **pbd)
|
|||||||
static void
|
static void
|
||||||
addpred(Blk *bp, Blk *bc)
|
addpred(Blk *bp, Blk *bc)
|
||||||
{
|
{
|
||||||
if (!bc->pred) {
|
if (bc->pred)
|
||||||
bc->pred = alloc(bc->npred * sizeof bc->pred[0]);
|
vgrow(&bc->pred, bc->npred);
|
||||||
bc->visit = 0;
|
else
|
||||||
}
|
bc->pred = vnew(bc->npred, sizeof bc->pred[0], PFn);
|
||||||
|
assert(bc->visit < bc->npred);
|
||||||
bc->pred[bc->visit++] = bp;
|
bc->pred[bc->visit++] = bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ fillpreds(Fn *f)
|
|||||||
|
|
||||||
for (b=f->start; b; b=b->link) {
|
for (b=f->start; b; b=b->link) {
|
||||||
b->npred = 0;
|
b->npred = 0;
|
||||||
b->pred = 0;
|
b->visit = 0;
|
||||||
}
|
}
|
||||||
for (b=f->start; b; b=b->link) {
|
for (b=f->start; b; b=b->link) {
|
||||||
if (b->s1)
|
if (b->s1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user