mirror of
git://c9x.me/qbe.git
synced 2024-11-22 17:37:34 +01:00
fix case of Pool constants
This commit is contained in:
parent
79f3673d20
commit
70f297bab7
10 changed files with 27 additions and 27 deletions
4
all.h
4
all.h
|
@ -419,8 +419,8 @@ extern char debug['Z'+1];
|
|||
|
||||
/* util.c */
|
||||
typedef enum {
|
||||
Pheap, /* free() necessary */
|
||||
Pfn, /* discarded after processing the function */
|
||||
PHeap, /* free() necessary */
|
||||
PFn, /* discarded after processing the function */
|
||||
} Pool;
|
||||
|
||||
extern Typ *typ;
|
||||
|
|
|
@ -608,8 +608,8 @@ selvaarg(Fn *fn, Blk *b, Ins *i)
|
|||
*b0->phi = (Phi){
|
||||
.cls = Kl, .to = loc,
|
||||
.narg = 2,
|
||||
.blk = vnew(2, sizeof b0->phi->blk[0], Pfn),
|
||||
.arg = vnew(2, sizeof b0->phi->arg[0], Pfn),
|
||||
.blk = vnew(2, sizeof b0->phi->blk[0], PFn),
|
||||
.arg = vnew(2, sizeof b0->phi->arg[0], PFn),
|
||||
};
|
||||
b0->phi->blk[0] = bstk;
|
||||
b0->phi->blk[1] = breg;
|
||||
|
|
|
@ -659,8 +659,8 @@ arm64_selvaarg(Fn *fn, Blk *b, Ins *i)
|
|||
*b0->phi = (Phi){
|
||||
.cls = Kl, .to = loc,
|
||||
.narg = 2,
|
||||
.blk = vnew(2, sizeof b0->phi->blk[0], Pfn),
|
||||
.arg = vnew(2, sizeof b0->phi->arg[0], Pfn),
|
||||
.blk = vnew(2, sizeof b0->phi->blk[0], PFn),
|
||||
.arg = vnew(2, sizeof b0->phi->arg[0], PFn),
|
||||
};
|
||||
b0->phi->blk[0] = bstk;
|
||||
b0->phi->blk[1] = breg;
|
||||
|
|
2
cfg.c
2
cfg.c
|
@ -209,7 +209,7 @@ addfron(Blk *a, Blk *b)
|
|||
if (a->fron[n] == b)
|
||||
return;
|
||||
if (!a->nfron)
|
||||
a->fron = vnew(++a->nfron, sizeof a->fron[0], Pfn);
|
||||
a->fron = vnew(++a->nfron, sizeof a->fron[0], PFn);
|
||||
else
|
||||
vgrow(&a->fron, ++a->nfron);
|
||||
a->fron[a->nfron-1] = b;
|
||||
|
|
2
copy.c
2
copy.c
|
@ -141,7 +141,7 @@ copy(Fn *fn)
|
|||
bsinit(ts, fn->ntmp);
|
||||
bsinit(as, fn->ntmp);
|
||||
cpy = emalloc(fn->ntmp * sizeof cpy[0]);
|
||||
stk = vnew(10, sizeof stk[0], Pheap);
|
||||
stk = vnew(10, sizeof stk[0], PHeap);
|
||||
|
||||
/* 1. build the copy-of map */
|
||||
for (n=0; n<fn->nblk; n++) {
|
||||
|
|
2
fold.c
2
fold.c
|
@ -193,7 +193,7 @@ fold(Fn *fn)
|
|||
|
||||
val = emalloc(fn->ntmp * sizeof val[0]);
|
||||
edge = emalloc(fn->nblk * sizeof edge[0]);
|
||||
usewrk = vnew(0, sizeof usewrk[0], Pheap);
|
||||
usewrk = vnew(0, sizeof usewrk[0], PHeap);
|
||||
|
||||
for (t=0; t<fn->ntmp; t++)
|
||||
val[t] = Top;
|
||||
|
|
8
load.c
8
load.c
|
@ -332,8 +332,8 @@ def(Slice sl, bits msk, Blk *b, Ins *i, Loc *il)
|
|||
p->to = r;
|
||||
p->cls = sl.cls;
|
||||
p->narg = b->npred;
|
||||
p->arg = vnew(p->narg, sizeof p->arg[0], Pfn);
|
||||
p->blk = vnew(p->narg, sizeof p->blk[0], Pfn);
|
||||
p->arg = vnew(p->narg, sizeof p->arg[0], PFn);
|
||||
p->blk = vnew(p->narg, sizeof p->blk[0], PFn);
|
||||
for (np=0; np<b->npred; ++np) {
|
||||
bp = b->pred[np];
|
||||
if (!bp->s2
|
||||
|
@ -389,7 +389,7 @@ loadopt(Fn *fn)
|
|||
Loc l;
|
||||
|
||||
curf = fn;
|
||||
ilog = vnew(0, sizeof ilog[0], Pheap);
|
||||
ilog = vnew(0, sizeof ilog[0], PHeap);
|
||||
nlog = 0;
|
||||
inum = 0;
|
||||
for (b=fn->start; b; b=b->link)
|
||||
|
@ -404,7 +404,7 @@ loadopt(Fn *fn)
|
|||
qsort(ilog, nlog, sizeof ilog[0], icmp);
|
||||
vgrow(&ilog, nlog+1);
|
||||
ilog[nlog].bid = fn->nblk; /* add a sentinel */
|
||||
ib = vnew(0, sizeof(Ins), Pheap);
|
||||
ib = vnew(0, sizeof(Ins), PHeap);
|
||||
for (ist=ilog, n=0; n<fn->nblk; ++n) {
|
||||
b = fn->rpo[n];
|
||||
for (; ist->bid == n && ist->isphi; ++ist) {
|
||||
|
|
16
parse.c
16
parse.c
|
@ -277,7 +277,7 @@ lex()
|
|||
if (c == '"') {
|
||||
t = Tstr;
|
||||
Quoted:
|
||||
tokval.str = vnew(2, 1, Pfn);
|
||||
tokval.str = vnew(2, 1, PFn);
|
||||
tokval.str[0] = c;
|
||||
esc = 0;
|
||||
for (i=1;; i++) {
|
||||
|
@ -711,9 +711,9 @@ Ins:
|
|||
phi = alloc(sizeof *phi);
|
||||
phi->to = r;
|
||||
phi->cls = k;
|
||||
phi->arg = vnew(i, sizeof arg[0], Pfn);
|
||||
phi->arg = vnew(i, sizeof arg[0], PFn);
|
||||
memcpy(phi->arg, arg, i * sizeof arg[0]);
|
||||
phi->blk = vnew(i, sizeof blk[0], Pfn);
|
||||
phi->blk = vnew(i, sizeof blk[0], PFn);
|
||||
memcpy(phi->blk, blk, i * sizeof blk[0]);
|
||||
phi->narg = i;
|
||||
*plink = phi;
|
||||
|
@ -833,8 +833,8 @@ parsefn(Lnk *lnk)
|
|||
curf = alloc(sizeof *curf);
|
||||
curf->ntmp = 0;
|
||||
curf->ncon = 1; /* first constant must be 0 */
|
||||
curf->tmp = vnew(curf->ntmp, sizeof curf->tmp[0], Pfn);
|
||||
curf->con = vnew(curf->ncon, sizeof curf->con[0], Pfn);
|
||||
curf->tmp = vnew(curf->ntmp, sizeof curf->tmp[0], PFn);
|
||||
curf->con = vnew(curf->ncon, sizeof curf->con[0], PFn);
|
||||
for (i=0; i<Tmp0; ++i)
|
||||
if (T.fpr0 <= i && i < T.fpr0 + T.nfpr)
|
||||
newtmp(0, Kd, curf);
|
||||
|
@ -862,7 +862,7 @@ parsefn(Lnk *lnk)
|
|||
err("empty function");
|
||||
if (curb->jmp.type == Jxxx)
|
||||
err("last block misses jump");
|
||||
curf->mem = vnew(0, sizeof curf->mem[0], Pfn);
|
||||
curf->mem = vnew(0, sizeof curf->mem[0], PFn);
|
||||
curf->nmem = 0;
|
||||
curf->nblk = nblk;
|
||||
curf->rpo = 0;
|
||||
|
@ -983,7 +983,7 @@ parsetyp()
|
|||
return;
|
||||
}
|
||||
n = 0;
|
||||
ty->fields = vnew(1, sizeof ty->fields[0], Pheap);
|
||||
ty->fields = vnew(1, sizeof ty->fields[0], PHeap);
|
||||
if (t == Tlbrace) {
|
||||
ty->isunion = 1;
|
||||
do {
|
||||
|
@ -1131,7 +1131,7 @@ parse(FILE *f, char *path, void data(Dat *), void func(Fn *))
|
|||
lnum = 1;
|
||||
thead = Txxx;
|
||||
ntyp = 0;
|
||||
typ = vnew(0, sizeof typ[0], Pheap);
|
||||
typ = vnew(0, sizeof typ[0], PHeap);
|
||||
for (;;) {
|
||||
lnk = (Lnk){0};
|
||||
switch (parselnk(&lnk)) {
|
||||
|
|
6
ssa.c
6
ssa.c
|
@ -54,7 +54,7 @@ filluse(Fn *fn)
|
|||
tmp[t].phi = 0;
|
||||
tmp[t].width = WFull;
|
||||
if (tmp[t].use == 0)
|
||||
tmp[t].use = vnew(0, sizeof(Use), Pfn);
|
||||
tmp[t].use = vnew(0, sizeof(Use), PFn);
|
||||
}
|
||||
for (b=fn->start; b; b=b->link) {
|
||||
for (p=b->phi; p; p=p->link) {
|
||||
|
@ -183,8 +183,8 @@ phiins(Fn *fn)
|
|||
p->cls = k;
|
||||
p->to = TMP(t);
|
||||
p->link = a->phi;
|
||||
p->arg = vnew(0, sizeof p->arg[0], Pfn);
|
||||
p->blk = vnew(0, sizeof p->blk[0], Pfn);
|
||||
p->arg = vnew(0, sizeof p->arg[0], PFn);
|
||||
p->blk = vnew(0, sizeof p->blk[0], PFn);
|
||||
a->phi = p;
|
||||
if (!bshas(defs, a->id))
|
||||
if (!bshas(u, a->id)) {
|
||||
|
|
6
util.c
6
util.c
|
@ -116,7 +116,7 @@ vnew(ulong len, size_t esz, Pool pool)
|
|||
|
||||
for (cap=VMin; cap<len; cap*=2)
|
||||
;
|
||||
f = pool == Pheap ? emalloc : alloc;
|
||||
f = pool == PHeap ? emalloc : alloc;
|
||||
v = f(cap * esz + sizeof(Vec));
|
||||
v->mag = VMag;
|
||||
v->cap = cap;
|
||||
|
@ -132,7 +132,7 @@ vfree(void *p)
|
|||
|
||||
v = (Vec *)p - 1;
|
||||
assert(v->mag == VMag);
|
||||
if (v->pool == Pheap) {
|
||||
if (v->pool == PHeap) {
|
||||
v->mag = 0;
|
||||
free(v);
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ intern(char *s)
|
|||
if (n == 1<<(32-IBits))
|
||||
die("interning table overflow");
|
||||
if (n == 0)
|
||||
b->str = vnew(1, sizeof b->str[0], Pheap);
|
||||
b->str = vnew(1, sizeof b->str[0], PHeap);
|
||||
else if ((n & (n-1)) == 0)
|
||||
vgrow(&b->str, n+n);
|
||||
|
||||
|
|
Loading…
Reference in a new issue