Add MOV optimization and MOV_sum

Replaces incarnations of the A=B+C pattern throughout the
code so we can apply optimizations consistently.
This commit is contained in:
Matt Mastracci
2016-06-26 20:05:45 -06:00
parent adcef046f6
commit 1e08ad0d97
5 changed files with 92 additions and 88 deletions

View File

@ -310,6 +310,7 @@ struct OpArg
}
bool IsSimpleReg() const { return scale == SCALE_NONE; }
bool IsSimpleReg(X64Reg reg) const { return IsSimpleReg() && GetSimpleReg() == reg; }
bool IsZero() const { return IsImm() && offset == 0; }
int GetImmBits() const
{
switch (scale)
@ -639,6 +640,7 @@ public:
void TEST(int bits, const OpArg& a1, const OpArg& a2);
void CMP_or_TEST(int bits, const OpArg& a1, const OpArg& a2);
void MOV_sum(int bits, X64Reg dest, const OpArg& a1, const OpArg& a2);
// Are these useful at all? Consider removing.
void XCHG(int bits, const OpArg& a1, const OpArg& a2);