mirror of
git://c9x.me/qbe.git
synced 2024-11-26 11:17:43 +01:00
use uint for block ids
This commit is contained in:
parent
835b2b4910
commit
7e1c1f9f77
8 changed files with 33 additions and 33 deletions
2
alias.c
2
alias.c
|
@ -101,7 +101,7 @@ esc(Ref r, Fn *fn)
|
|||
void
|
||||
fillalias(Fn *fn)
|
||||
{
|
||||
int n;
|
||||
uint n;
|
||||
Blk *b;
|
||||
Phi *p;
|
||||
Ins *i;
|
||||
|
|
8
all.h
8
all.h
|
@ -333,13 +333,13 @@ struct Blk {
|
|||
Blk *s2;
|
||||
Blk *link;
|
||||
|
||||
int id;
|
||||
int visit;
|
||||
uint id;
|
||||
uint visit;
|
||||
|
||||
Blk *idom;
|
||||
Blk *dom, *dlink;
|
||||
Blk **fron;
|
||||
int nfron;
|
||||
uint nfron;
|
||||
|
||||
Blk **pred;
|
||||
uint npred;
|
||||
|
@ -432,7 +432,7 @@ struct Fn {
|
|||
int ntmp;
|
||||
int ncon;
|
||||
int nmem;
|
||||
int nblk;
|
||||
uint nblk;
|
||||
int retty; /* index in typ[], -1 if no aggregate return */
|
||||
Ref retr;
|
||||
Blk **rpo;
|
||||
|
|
21
cfg.c
21
cfg.c
|
@ -76,11 +76,11 @@ fillpreds(Fn *f)
|
|||
}
|
||||
|
||||
static int
|
||||
rporec(Blk *b, int x)
|
||||
rporec(Blk *b, uint x)
|
||||
{
|
||||
Blk *s1, *s2;
|
||||
|
||||
if (!b || b->id >= 0)
|
||||
if (!b || b->id != -1u)
|
||||
return x;
|
||||
b->id = 1;
|
||||
s1 = b->s1;
|
||||
|
@ -100,16 +100,16 @@ rporec(Blk *b, int x)
|
|||
void
|
||||
fillrpo(Fn *f)
|
||||
{
|
||||
int n;
|
||||
uint n;
|
||||
Blk *b, **p;
|
||||
|
||||
for (b=f->start; b; b=b->link)
|
||||
b->id = -1;
|
||||
b->id = -1u;
|
||||
n = 1 + rporec(f->start, f->nblk-1);
|
||||
f->nblk -= n;
|
||||
f->rpo = alloc(f->nblk * sizeof f->rpo[0]);
|
||||
for (p=&f->start; (b=*p);) {
|
||||
if (b->id == -1) {
|
||||
if (b->id == -1u) {
|
||||
blkdel(b);
|
||||
*p = b->link;
|
||||
} else {
|
||||
|
@ -150,8 +150,8 @@ void
|
|||
filldom(Fn *fn)
|
||||
{
|
||||
Blk *b, *d;
|
||||
int ch, n;
|
||||
uint p;
|
||||
int ch;
|
||||
uint n, p;
|
||||
|
||||
for (b=fn->start; b; b=b->link) {
|
||||
b->idom = 0;
|
||||
|
@ -201,7 +201,7 @@ dom(Blk *b1, Blk *b2)
|
|||
static void
|
||||
addfron(Blk *a, Blk *b)
|
||||
{
|
||||
int n;
|
||||
uint n;
|
||||
|
||||
for (n=0; n<a->nfron; n++)
|
||||
if (a->fron[n] == b)
|
||||
|
@ -245,12 +245,11 @@ loopmark(Blk *hd, Blk *b, void f(Blk *, Blk *))
|
|||
void
|
||||
loopiter(Fn *fn, void f(Blk *, Blk *))
|
||||
{
|
||||
int n;
|
||||
uint p;
|
||||
uint n, p;
|
||||
Blk *b;
|
||||
|
||||
for (b=fn->start; b; b=b->link)
|
||||
b->visit = -1;
|
||||
b->visit = -1u;
|
||||
for (n=0; n<fn->nblk; ++n) {
|
||||
b = fn->rpo[n];
|
||||
for (p=0; p<b->npred; ++p)
|
||||
|
|
18
fold.c
18
fold.c
|
@ -188,15 +188,15 @@ fold(Fn *fn)
|
|||
Blk *b, **pb;
|
||||
Phi *p, **pp;
|
||||
Ins *i;
|
||||
int n, d;
|
||||
uint a;
|
||||
int t, d;
|
||||
uint n, a;
|
||||
|
||||
val = emalloc(fn->ntmp * sizeof val[0]);
|
||||
edge = emalloc(fn->nblk * sizeof edge[0]);
|
||||
usewrk = vnew(0, sizeof usewrk[0], Pheap);
|
||||
|
||||
for (n=0; n<fn->ntmp; n++)
|
||||
val[n] = Top;
|
||||
for (t=0; t<fn->ntmp; t++)
|
||||
val[t] = Top;
|
||||
for (n=0; n<fn->nblk; n++) {
|
||||
b = fn->rpo[n];
|
||||
b->visit = 0;
|
||||
|
@ -256,14 +256,14 @@ fold(Fn *fn)
|
|||
|
||||
if (debug['F']) {
|
||||
fprintf(stderr, "\n> SCCP findings:");
|
||||
for (n=Tmp0; n<fn->ntmp; n++) {
|
||||
if (val[n] == Bot)
|
||||
for (t=Tmp0; t<fn->ntmp; t++) {
|
||||
if (val[t] == Bot)
|
||||
continue;
|
||||
fprintf(stderr, "\n%10s: ", fn->tmp[n].name);
|
||||
if (val[n] == Top)
|
||||
fprintf(stderr, "\n%10s: ", fn->tmp[t].name);
|
||||
if (val[t] == Top)
|
||||
fprintf(stderr, "Top");
|
||||
else
|
||||
printref(CON(val[n]), fn, stderr);
|
||||
printref(CON(val[t]), fn, stderr);
|
||||
}
|
||||
fprintf(stderr, "\n dead code: ");
|
||||
}
|
||||
|
|
6
load.c
6
load.c
|
@ -26,7 +26,7 @@ struct Slice {
|
|||
struct Insert {
|
||||
uint isphi:1;
|
||||
uint num:31;
|
||||
int bid;
|
||||
uint bid;
|
||||
uint off;
|
||||
union {
|
||||
Ins ins;
|
||||
|
@ -329,8 +329,8 @@ loadopt(Fn *fn)
|
|||
{
|
||||
Ins *i, *ib;
|
||||
Blk *b;
|
||||
int n, sz;
|
||||
uint ni, ext, nt;
|
||||
int sz;
|
||||
uint n, ni, ext, nt;
|
||||
Insert *ist;
|
||||
Slice sl;
|
||||
Loc l;
|
||||
|
|
2
main.c
2
main.c
|
@ -39,7 +39,7 @@ data(Dat *d)
|
|||
static void
|
||||
func(Fn *fn)
|
||||
{
|
||||
int n;
|
||||
uint n;
|
||||
|
||||
if (dbg)
|
||||
fprintf(stderr, "**** Function %s ****", fn->name);
|
||||
|
|
6
rega.c
6
rega.c
|
@ -423,12 +423,12 @@ doblk(Blk *b, RMap *cur)
|
|||
void
|
||||
rega(Fn *fn)
|
||||
{
|
||||
int j, t, n, r, r1, x, rl[Tmp0];
|
||||
int j, t, r, r1, x, rl[Tmp0];
|
||||
Blk *b, *b1, *s, ***ps, *blist;
|
||||
RMap *end, *beg, cur, old;
|
||||
Ins *i;
|
||||
Phi *p;
|
||||
uint u;
|
||||
uint u, n;
|
||||
Ref src, dst;
|
||||
|
||||
/* 1. setup */
|
||||
|
@ -455,7 +455,7 @@ rega(Fn *fn)
|
|||
}
|
||||
|
||||
/* 2. assign registers following post-order */
|
||||
for (n=fn->nblk-1; n>=0; n--) {
|
||||
for (n=fn->nblk-1; n!=-1u; n--) {
|
||||
b = fn->rpo[n];
|
||||
cur.n = 0;
|
||||
bszero(cur.b);
|
||||
|
|
3
ssa.c
3
ssa.c
|
@ -101,7 +101,8 @@ phiins(Fn *fn)
|
|||
Ins *i;
|
||||
Phi *p;
|
||||
Ref r;
|
||||
int t, n, nt;
|
||||
int t, nt;
|
||||
uint n;
|
||||
short k;
|
||||
|
||||
bsinit(u, fn->nblk);
|
||||
|
|
Loading…
Reference in a new issue