mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-27 08:05:41 +00:00
CPU/Recompiler: Optimize away nops completely
35% performance improvement for PGXP CPU mode in Racing Lagoon.
This commit is contained in:
parent
f4242f390b
commit
baad1a4b23
|
@ -65,6 +65,13 @@ bool CodeGenerator::CompileBlock(CodeBlock* block, CodeBlock::HostCodePointer* o
|
||||||
|
|
||||||
bool CodeGenerator::CompileInstruction(const CodeBlockInstruction& cbi)
|
bool CodeGenerator::CompileInstruction(const CodeBlockInstruction& cbi)
|
||||||
{
|
{
|
||||||
|
if (IsNopInstruction(cbi.instruction))
|
||||||
|
{
|
||||||
|
InstructionPrologue(cbi, 1);
|
||||||
|
InstructionEpilogue(cbi);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool result;
|
bool result;
|
||||||
switch (cbi.instruction.op)
|
switch (cbi.instruction.op)
|
||||||
{
|
{
|
||||||
|
|
|
@ -214,6 +214,7 @@ private:
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
bool CompileInstruction(const CodeBlockInstruction& cbi);
|
bool CompileInstruction(const CodeBlockInstruction& cbi);
|
||||||
bool Compile_Fallback(const CodeBlockInstruction& cbi);
|
bool Compile_Fallback(const CodeBlockInstruction& cbi);
|
||||||
|
bool Compile_Nop(const CodeBlockInstruction& cbi);
|
||||||
bool Compile_Bitwise(const CodeBlockInstruction& cbi);
|
bool Compile_Bitwise(const CodeBlockInstruction& cbi);
|
||||||
bool Compile_Shift(const CodeBlockInstruction& cbi);
|
bool Compile_Shift(const CodeBlockInstruction& cbi);
|
||||||
bool Compile_Load(const CodeBlockInstruction& cbi);
|
bool Compile_Load(const CodeBlockInstruction& cbi);
|
||||||
|
|
|
@ -13,6 +13,12 @@ const char* GetRegName(Reg reg)
|
||||||
return s_reg_names[static_cast<u8>(reg)];
|
return s_reg_names[static_cast<u8>(reg)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsNopInstruction(const Instruction& instruction)
|
||||||
|
{
|
||||||
|
// TODO: Handle other types of nop.
|
||||||
|
return (instruction.bits == 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool IsBranchInstruction(const Instruction& instruction)
|
bool IsBranchInstruction(const Instruction& instruction)
|
||||||
{
|
{
|
||||||
switch (instruction.op)
|
switch (instruction.op)
|
||||||
|
|
|
@ -220,6 +220,7 @@ union Instruction
|
||||||
};
|
};
|
||||||
|
|
||||||
// Instruction helpers.
|
// Instruction helpers.
|
||||||
|
bool IsNopInstruction(const Instruction& instruction);
|
||||||
bool IsBranchInstruction(const Instruction& instruction);
|
bool IsBranchInstruction(const Instruction& instruction);
|
||||||
bool IsUnconditionalBranchInstruction(const Instruction& instruction);
|
bool IsUnconditionalBranchInstruction(const Instruction& instruction);
|
||||||
bool IsDirectBranchInstruction(const Instruction& instruction);
|
bool IsDirectBranchInstruction(const Instruction& instruction);
|
||||||
|
|
Loading…
Reference in a new issue