Bug 492490 - nanojit: move Assembler::findVictim() from RegAlloc.cpp to Assembler.cpp

This commit is contained in:
Nicholas Nethercote 2009-05-18 02:20:59 -04:00
Родитель 55f1ebda7d
Коммит c6c72b27f7
2 изменённых файлов: 22 добавлений и 22 удалений

Просмотреть файл

@ -1795,6 +1795,28 @@ namespace nanojit
debug_only(saved.used = 0); // marker that we are no longer in exit path debug_only(saved.used = 0); // marker that we are no longer in exit path
} }
// scan table for instruction with the lowest priority, meaning it is used
// furthest in the future.
LIns* Assembler::findVictim(RegAlloc &regs, RegisterMask allow)
{
NanoAssert(allow != 0);
LIns *i, *a=0;
int allow_pri = 0x7fffffff;
for (Register r=FirstReg; r <= LastReg; r = nextreg(r))
{
if ((allow & rmask(r)) && (i = regs.getActive(r)) != 0)
{
int pri = canRemat(i) ? 0 : regs.getPriority(r);
if (!a || pri < allow_pri) {
a = i;
allow_pri = pri;
}
}
}
NanoAssert(a != 0);
return a;
}
#ifdef NJ_VERBOSE #ifdef NJ_VERBOSE
char Assembler::outline[8192]; char Assembler::outline[8192];
char Assembler::outlineEOL[512]; char Assembler::outlineEOL[512];

Просмотреть файл

@ -96,28 +96,6 @@ namespace nanojit
free |= rmask(r); free |= rmask(r);
} }
// scan table for instruction with the lowest priority, meaning it is used
// furthest in the future.
LIns* Assembler::findVictim(RegAlloc &regs, RegisterMask allow)
{
NanoAssert(allow != 0);
LIns *i, *a=0;
int allow_pri = 0x7fffffff;
for (Register r=FirstReg; r <= LastReg; r = nextreg(r))
{
if ((allow & rmask(r)) && (i = regs.getActive(r)) != 0)
{
int pri = canRemat(i) ? 0 : regs.getPriority(r);
if (!a || pri < allow_pri) {
a = i;
allow_pri = pri;
}
}
}
NanoAssert(a != 0);
return a;
}
#ifdef NJ_VERBOSE #ifdef NJ_VERBOSE
/* static */ void RegAlloc::formatRegisters(RegAlloc& regs, char* s, Fragment *frag) /* static */ void RegAlloc::formatRegisters(RegAlloc& regs, char* s, Fragment *frag)
{ {