Skip to content

Commit

Permalink
x86jit: Fix flush for special-purpose reg.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Sep 17, 2023
1 parent 7fb67bb commit 07150b5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Core/MIPS/x86/X64IRRegCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,25 @@ void X64IRRegCache::MapWithFlags(IRInst inst, X64Map destFlags, X64Map src1Flags
mapping[2].flags = mapping[2].flags | src2Flags;

auto flushReg = [&](IRNativeReg nreg) {
bool mustKeep = false;
bool canDiscard = false;
for (int i = 0; i < 3; ++i) {
if (mapping[i].reg == nr[nreg].mipsReg && (mapping[i].flags & MIPSMap::NOINIT) == MIPSMap::NOINIT) {
DiscardNativeReg(nreg);
return;
if (mapping[i].reg != nr[nreg].mipsReg)
continue;

if ((mapping[i].flags & MIPSMap::NOINIT) != MIPSMap::NOINIT) {
mustKeep = true;
break;
} else {
canDiscard = true;
}
}

FlushNativeReg(nreg);
if (mustKeep || !canDiscard) {
FlushNativeReg(nreg);
} else {
DiscardNativeReg(nreg);
}
};

// If there are any special rules, we might need to spill.
Expand Down

0 comments on commit 07150b5

Please sign in to comment.