#include "token.h"
#include "procln.h"
#include "riscasm.h"
+#include "rmac.h"
#define DEF_KW
#include "kwtab.h"
int siz = (int)size;
// Try to optimize to MOVEQ
- if (siz == SIZL && am0 == IMMED && am1 == DREG
+ if (optim_flag && siz == SIZL && am0 == IMMED && am1 == DREG
&& (a0exattr & (TDB|DEFINED)) == DEFINED && a0exval + 0x80 < 0x100)
{
m_moveq((WORD)0x7000, (WORD)0);
+ if (sbra_flag)
+ warn("move.l #size,dx converted to moveq");
}
else
{
// Optimize branch instr. size
if (siz == SIZN)
{
- if (v != 0 && v + 0x80 < 0x100)
+ if (optim_flag && v != 0 && v + 0x80 < 0x100)
{
// Fits in .B
inst |= v & 0xFF;
D_word(inst);
+ if (sbra_flag)
+ warn("Bcc.w/BSR.w converted to .s");
return 0;
}
else
// Defined, absolute values from $FFFF8000..$00007FFF get optimized
// to absolute short
- if ((AnEXATTR & (TDB|DEFINED)) == DEFINED && (AnEXVAL + 0x8000) < 0x10000)
+ if (optim_flag && (AnEXATTR & (TDB|DEFINED)) == DEFINED && (AnEXVAL + 0x8000) < 0x10000)
+ {
AMn = ABSW;
+ if (sbra_flag)
+ warn("absolute value from $FFFF8000..$00007FFF optimised to absolute short");
+ }
// Is .L forced here?
if (*tok == DOTL)
char * cmdlnexec; // Executable name, pointer to ARGV[0]
char * searchpath; // Search path for include files
char defname[] = "noname.o"; // Default output filename
-
+int optim_flag; // Optimise all the things!
//
// Manipulate file extension.
" d: double phrase (16 bytes)\n"
" q: quad phrase (32 bytes)\n"
" -s Warn about possible short branches\n"
+ " and applied optimisations\n"
" -u Force referenced and undefined symbols global\n"
+ " -w Turn off optimisations done automatically\n"
" -v Set verbose mode\n"
" -y[pagelen] Set page line length (default: 61)\n"
"\n", cmdlnexec);
orgactive = 0; // Not in RISC org section
orgwarning = 0; // No ORG warning issued
segpadsize = 2; // Initialise segment padding size
+ optim_flag = 1; // Automatically optimise
// Initialise modules
InitSymbolTable(); // Symbol table
DisplayVersion();
break;
+ case 'w':
+ case 'W':
+ optim_flag=0;
+ break;
case 'x': // Turn on debugging
case 'X':
debug = 1;