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 46e3671
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Core/MIPS/x86/X64IRRegCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,19 @@ void X64IRRegCache::MapWithFlags(IRInst inst, X64Map destFlags, X64Map src1Flags
mapping[2].flags = mapping[2].flags | src2Flags;

auto flushReg = [&](IRNativeReg nreg) {
bool keep = 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 && (mapping[i].flags & MIPSMap::NOINIT) != MIPSMap::NOINIT) {
keep = true;
break;
}
}

FlushNativeReg(nreg);
if (keep) {
FlushNativeReg(nreg);
} else {
DiscardNativeReg(nreg);
}
};

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

0 comments on commit 46e3671

Please sign in to comment.