IR: Deduplicate code in Reset and FoldFallbackToInterpreter
This commit is contained in:
parent
89473d5996
commit
bb49012445
|
@ -150,6 +150,11 @@ void IRBuilder::Reset()
|
||||||
MarkUsed.clear();
|
MarkUsed.clear();
|
||||||
MarkUsed.reserve(100000);
|
MarkUsed.reserve(100000);
|
||||||
|
|
||||||
|
InvalidateCaches();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IRBuilder::InvalidateCaches()
|
||||||
|
{
|
||||||
GRegCache = {};
|
GRegCache = {};
|
||||||
GRegCacheStore = {};
|
GRegCacheStore = {};
|
||||||
|
|
||||||
|
@ -1209,25 +1214,7 @@ InstLoc IRBuilder::FoldICmpCRUnsigned(InstLoc Op1, InstLoc Op2)
|
||||||
|
|
||||||
InstLoc IRBuilder::FoldFallBackToInterpreter(InstLoc Op1, InstLoc Op2)
|
InstLoc IRBuilder::FoldFallBackToInterpreter(InstLoc Op1, InstLoc Op2)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < 32; i++)
|
InvalidateCaches();
|
||||||
{
|
|
||||||
GRegCache[i] = nullptr;
|
|
||||||
GRegCacheStore[i] = nullptr;
|
|
||||||
FRegCache[i] = nullptr;
|
|
||||||
FRegCacheStore[i] = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
CarryCache = nullptr;
|
|
||||||
CarryCacheStore = nullptr;
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < 8; i++)
|
|
||||||
{
|
|
||||||
CRCache[i] = nullptr;
|
|
||||||
CRCacheStore[i] = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
CTRCache = nullptr;
|
|
||||||
CTRCacheStore = nullptr;
|
|
||||||
return EmitBiOp(FallBackToInterpreter, Op1, Op2);
|
return EmitBiOp(FallBackToInterpreter, Op1, Op2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -388,6 +388,8 @@ public:
|
||||||
void WriteToFile(u64 codeHash);
|
void WriteToFile(u64 codeHash);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void InvalidateCaches();
|
||||||
|
|
||||||
InstLoc EmitZeroOp(unsigned Opcode, unsigned extra);
|
InstLoc EmitZeroOp(unsigned Opcode, unsigned extra);
|
||||||
InstLoc EmitUOp(unsigned OpCode, InstLoc Op1, unsigned extra = 0);
|
InstLoc EmitUOp(unsigned OpCode, InstLoc Op1, unsigned extra = 0);
|
||||||
InstLoc EmitBiOp(unsigned OpCode, InstLoc Op1, InstLoc Op2, unsigned extra = 0);
|
InstLoc EmitBiOp(unsigned OpCode, InstLoc Op1, InstLoc Op2, unsigned extra = 0);
|
||||||
|
|
Loading…
Reference in New Issue