Merge pull request #2850 from Tilka/alloc_order
Jit64: clean up GetAllocationOrder()
This commit is contained in:
commit
e28fa1588f
|
@ -131,10 +131,10 @@ float RegCache::ScoreRegister(X64Reg xr)
|
|||
X64Reg RegCache::GetFreeXReg()
|
||||
{
|
||||
size_t aCount;
|
||||
const int* aOrder = GetAllocationOrder(aCount);
|
||||
const X64Reg* aOrder = GetAllocationOrder(&aCount);
|
||||
for (size_t i = 0; i < aCount; i++)
|
||||
{
|
||||
X64Reg xr = (X64Reg)aOrder[i];
|
||||
X64Reg xr = aOrder[i];
|
||||
if (!xregs[xr].locked && xregs[xr].free)
|
||||
{
|
||||
return xr;
|
||||
|
@ -226,9 +226,9 @@ void GPRRegCache::SetImmediate32(size_t preg, u32 immValue)
|
|||
regs[preg].location = Imm32(immValue);
|
||||
}
|
||||
|
||||
const int* GPRRegCache::GetAllocationOrder(size_t& count)
|
||||
const X64Reg* GPRRegCache::GetAllocationOrder(size_t* count)
|
||||
{
|
||||
static const int allocationOrder[] =
|
||||
static const X64Reg allocationOrder[] =
|
||||
{
|
||||
// R12, when used as base register, for example in a LEA, can generate bad code! Need to look into this.
|
||||
#ifdef _WIN32
|
||||
|
@ -237,17 +237,17 @@ const int* GPRRegCache::GetAllocationOrder(size_t& count)
|
|||
R12, R13, R14, R15, RSI, RDI, R8, R9, R10, R11, RCX
|
||||
#endif
|
||||
};
|
||||
count = sizeof(allocationOrder) / sizeof(const int);
|
||||
*count = sizeof(allocationOrder) / sizeof(X64Reg);
|
||||
return allocationOrder;
|
||||
}
|
||||
|
||||
const int* FPURegCache::GetAllocationOrder(size_t& count)
|
||||
const X64Reg* FPURegCache::GetAllocationOrder(size_t* count)
|
||||
{
|
||||
static const int allocationOrder[] =
|
||||
static const X64Reg allocationOrder[] =
|
||||
{
|
||||
XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM2, XMM3, XMM4, XMM5
|
||||
};
|
||||
count = sizeof(allocationOrder) / sizeof(int);
|
||||
*count = sizeof(allocationOrder) / sizeof(X64Reg);
|
||||
return allocationOrder;
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ int RegCache::NumFreeRegisters()
|
|||
{
|
||||
int count = 0;
|
||||
size_t aCount;
|
||||
const int* aOrder = GetAllocationOrder(aCount);
|
||||
const X64Reg* aOrder = GetAllocationOrder(&aCount);
|
||||
for (size_t i = 0; i < aCount; i++)
|
||||
if (!xregs[aOrder[i]].locked && xregs[aOrder[i]].free)
|
||||
count++;
|
||||
|
|
|
@ -42,7 +42,7 @@ protected:
|
|||
std::array<PPCCachedReg, 32> regs;
|
||||
std::array<X64CachedReg, NUMXREGS> xregs;
|
||||
|
||||
virtual const int *GetAllocationOrder(size_t& count) = 0;
|
||||
virtual const Gen::X64Reg* GetAllocationOrder(size_t* count) = 0;
|
||||
|
||||
virtual BitSet32 GetRegUtilization() = 0;
|
||||
virtual BitSet32 CountRegsIn(size_t preg, u32 lookahead) = 0;
|
||||
|
@ -176,7 +176,7 @@ public:
|
|||
void StoreRegister(size_t preg, const Gen::OpArg& newLoc) override;
|
||||
void LoadRegister(size_t preg, Gen::X64Reg newLoc) override;
|
||||
Gen::OpArg GetDefaultLocation(size_t reg) const override;
|
||||
const int* GetAllocationOrder(size_t& count) override;
|
||||
const Gen::X64Reg* GetAllocationOrder(size_t* count) override;
|
||||
void SetImmediate32(size_t preg, u32 immValue);
|
||||
BitSet32 GetRegUtilization() override;
|
||||
BitSet32 CountRegsIn(size_t preg, u32 lookahead) override;
|
||||
|
@ -188,7 +188,7 @@ class FPURegCache final : public RegCache
|
|||
public:
|
||||
void StoreRegister(size_t preg, const Gen::OpArg& newLoc) override;
|
||||
void LoadRegister(size_t preg, Gen::X64Reg newLoc) override;
|
||||
const int* GetAllocationOrder(size_t& count) override;
|
||||
const Gen::X64Reg* GetAllocationOrder(size_t* count) override;
|
||||
Gen::OpArg GetDefaultLocation(size_t reg) const override;
|
||||
BitSet32 GetRegUtilization() override;
|
||||
BitSet32 CountRegsIn(size_t preg, u32 lookahead) override;
|
||||
|
|
Loading…
Reference in New Issue