From: ggn Date: Tue, 23 Jan 2018 08:57:01 +0000 (+0200) Subject: Added optimisation switches -o8 and -o9 X-Git-Tag: v2.1.0~93 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=commitdiff_plain;h=b57de9c1d9a47f152b590f1cdbd05a2910667ce4 Added optimisation switches -o8 and -o9 Added optimisation switches -o8 (adda.w/l #x,Dy to addq.w/l #x,Dy) and -o9 (adda.w/l #x,Dy to lea x(Dy),Dy), both off by default. --- diff --git a/mach.c b/mach.c index 2673aa9..ef4c8c6 100644 --- a/mach.c +++ b/mach.c @@ -452,6 +452,22 @@ int m_abcd(WORD inst, WORD siz) // int m_adda(WORD inst, WORD siz) { + if (a0exattr & DEFINED) + { + if (CHECK_OPTS(OPT_ADDA_ADDQ)) + if (a0exval > 1 && a0exval <= 8) + // Immediate is between 1 and 8 so let's convert to addq + return m_addq(B16(01010000, 00000000), siz); + if (CHECK_OPTS(OPT_ADDA_LEA)) + if (a0exval > 8) + { + // Immediate is larger than 8 so let's convert to lea + am0 = ADISP; // Change addressing mode + a0reg = a1reg; // In ADISP a0reg is used instead of a1reg! + return m_lea(B16(01000001, 11011000), SIZW); + } + } + inst |= am0 | a0reg | lwsiz_8[siz] | reg_9[a1reg]; D_word(inst); ea0gen(siz); // Generate EA @@ -1298,7 +1314,7 @@ int m_cas(WORD inst, WORD siz) if (*tok != EOL) return error("extra (unexpected) text found"); - // Reject invalud ea modes + // Reject invalid ea modes amsk = amsktab[am0]; if ((amsk & (M_AIND | M_APOSTINC | M_APREDEC | M_ADISP | M_AINDEXED | M_ABSW | M_ABSL | M_ABASE | M_MEMPOST | M_MEMPRE)) == 0) diff --git a/rmac.c b/rmac.c index a4b6b42..615d84d 100644 --- a/rmac.c +++ b/rmac.c @@ -161,6 +161,8 @@ void DisplayHelp(void) " o5: Absolute long base displacement to word (off)\n" " o6: Null branches to NOP (off)\n" " o7: clr.l Dx to moveq #0,Dx (off)\n" + " o8: adda.w/l #x,Dy to addq.w/l #x,Dy (off)\n" + " o9: adda.w/l #x,Dy to lea x(Dy),Dy (off)\n" " ~o[value] Turn a specific optimisation off\n" " +oall Turn all optimisations on\n" " ~oall Turn all optimisations off\n" diff --git a/rmac.h b/rmac.h index 4831749..7b1d972 100644 --- a/rmac.h +++ b/rmac.h @@ -275,6 +275,8 @@ enum OPT_BASE_DISP = 5, OPT_NULL_BRA = 6, OPT_CLR_DX = 7, + OPT_ADDA_ADDQ = 8, + OPT_ADDA_LEA = 9, OPT_COUNT // Dummy, used to count number of optimisation switches };