mirror of
git://c9x.me/qbe.git
synced 2026-05-26 23:44:40 +00:00
reduce temp creation in loadopt()
This commit is contained in:
parent
adab20908f
commit
3cfca4b2f2
18
load.c
18
load.c
@ -166,6 +166,23 @@ load(Slice sl, bits msk, Loc *l)
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
rebase(Slice *sl)
|
||||
{
|
||||
Alias *a;
|
||||
|
||||
if (rtype(sl->ref) != RTmp)
|
||||
return;
|
||||
a = &curf->tmp[sl->ref.val].alias;
|
||||
if (a->offset < 1<<16)
|
||||
if (a->type == ALoc
|
||||
|| a->type == AEsc
|
||||
|| a->type == AUnk) {
|
||||
sl->ref = TMP(a->base);
|
||||
sl->off = a->offset;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
killsl(Ref r, Slice sl)
|
||||
{
|
||||
@ -431,6 +448,7 @@ loadopt(Fn *fn)
|
||||
sz = loadsz(i);
|
||||
sl = (Slice){i->arg[0], 0, sz, i->cls};
|
||||
l = (Loc){LRoot, i-b->ins, b};
|
||||
rebase(&sl);
|
||||
i->arg[1] = def(sl, MASK(sz), b, i, &l);
|
||||
}
|
||||
qsort(ilog, nlog, sizeof ilog[0], icmp);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user