SpillLock is now per MIPS register instead of per ARM register. Fix array size.

This commit is contained in:
Henrik Rydgard committed 2013-01-09 23:14:21 +01:00
1 parent fb7116ccd5
commit 209f1d79a9
2 files changed
+10 -10

No files matched your search

+7 -7
View File
@@ -33,13 +33,13 @@ void ArmRegCache::Init(ARMXEmitter *emitter) {
void ArmRegCache::Start(MIPSAnalyst::AnalysisResults &stats) {
for (int i = 0; i < 16; i++) {
ar[i].mipsReg = -1;
ar[i].spillLock = false;
ar[i].isDirty = false;
}
for (int i = 0; i < NUM_MIPSREG; i++) {
mr[i].loc = ML_MEM;
mr[i].reg = INVALID_REG;
mr[i].imm = -1;
mr[i].spillLock = false;
}
}
@@ -101,7 +101,7 @@ allocate:
int bestToSpill = -1;
for (int i = 0; i < allocCount; i++) {
int reg = allocOrder[i];
if (ar[reg].spillLock)
if (ar[reg].mipsReg != -1 && mr[ar[reg].mipsReg].spillLock)
continue;
bestToSpill = reg;
break;
@@ -213,14 +213,14 @@ int ArmRegCache::GetMipsRegOffset(MIPSReg r) {
}
void ArmRegCache::SpillLock(MIPSReg r1, MIPSReg r2, MIPSReg r3) {
if (mr[r1].loc == ML_ARMREG) ar[mr[r1].reg].spillLock = true;
if (r2 != -1 && mr[r2].loc == ML_ARMREG) ar[mr[r2].reg].spillLock = true;
if (r3 != -1 && mr[r3].loc == ML_ARMREG) ar[mr[r3].reg].spillLock = true;
mr[r1].spillLock = true;
if (r2 != -1) mr[r2].spillLock = true;
if (r3 != -1) mr[r3].spillLock = true;
}
void ArmRegCache::ReleaseSpillLocks() {
for (int i = 0; i < NUM_ARMREG; i++) {
ar[i].spillLock = false;
for (int i = 0; i < NUM_MIPSREG; i++) {
mr[i].spillLock = false;
}
}
+3 -3
View File
@@ -41,7 +41,6 @@ typedef int MIPSReg;
struct RegARM {
int mipsReg; // if -1, no mipsreg attached.
bool isDirty; // Should the register be written back?
bool spillLock; // if true, this register cannot be spilled.
};
enum RegMIPSLoc {
@@ -56,6 +55,7 @@ struct RegMIPS {
// Data (only one of these is used, depending on loc. Could make a union).
u32 imm;
ARMReg reg;
bool spillLock; // if true, this register cannot be spilled.
// If loc == ML_MEM, it's back in its location in the CPU context struct.
};
@@ -108,6 +108,6 @@ private:
NUM_MIPSREG = TOTAL_MAPPABLE_MIPSREGS,
};
RegARM ar[16];
RegMIPS mr[32];
RegARM ar[NUM_ARMREG];
RegMIPS mr[NUM_MIPSREG];
};