mirror of http://shamusworld.gotdns.org/git/rmac
Added new optimisation option "+op" which enforces PC relative mode (#123)
This commit is contained in:
parent
2e916a913f
commit
fbbe9b115f
4
eagen0.c
4
eagen0.c
|
@ -326,6 +326,10 @@ int eaNgen(WORD siz)
|
|||
case ABSL:
|
||||
if (w) // Defined
|
||||
{
|
||||
if (optim_pc)
|
||||
if (aNexattr&(DEFINED | REFERENCED | EQUATED) == DEFINED | REFERENCED)
|
||||
return error("relocation not allowed");
|
||||
|
||||
if (tdb)
|
||||
MarkRelocatable(cursect, sloc, tdb, MLONG, NULL);
|
||||
|
||||
|
|
2
expr.c
2
expr.c
|
@ -180,7 +180,7 @@ int expr1(void)
|
|||
|
||||
if ((fd = open(string[*tok], _OPEN_INC)) < 0)
|
||||
{
|
||||
for(i=0; nthpath("RMACPATH", i, buf1)!= 0; i++)
|
||||
for(i=0; nthpath("RMACPATH", i, buf1)!=0; i++)
|
||||
{
|
||||
fd = strlen(buf1);
|
||||
|
||||
|
|
10
parmode.h
10
parmode.h
|
@ -81,7 +81,7 @@
|
|||
}
|
||||
else if ((*tok >= KW_D0) && (*tok <= KW_D7))
|
||||
{
|
||||
//Since index register isn't used here, store register number in this field
|
||||
// Since index register isn't used here, store register number in this field
|
||||
AnIXREG = *tok++ & 7; // (Dn)
|
||||
|
||||
if (*tok == ')')
|
||||
|
@ -1169,6 +1169,14 @@ CHK_FOR_DISPn:
|
|||
// expr[.L]
|
||||
AMn = ABSL;
|
||||
|
||||
// When PC relative is enforced, check for any symbols that aren't
|
||||
// EQU'd, in this case it's an illegal mode
|
||||
if (optim_pc)
|
||||
if (AnEXATTR & REFERENCED)
|
||||
if (AnEXATTR & DEFINED)
|
||||
if (!(AnEXATTR & EQUATED))
|
||||
return error("relocation not allowed");
|
||||
|
||||
// .L is forced here
|
||||
if (*tok == DOTL)
|
||||
{
|
||||
|
|
8
rmac.c
8
rmac.c
|
@ -53,6 +53,7 @@ char * cmdlnexec; // Executable name, pointer to ARGV[0]
|
|||
char * searchpath; // Search path for include files
|
||||
char defname[] = "noname.o"; // Default output filename
|
||||
int optim_flags[OPT_COUNT]; // Specific optimisations on/off matrix
|
||||
int optim_pc = 0; // Enforce PC relative
|
||||
int activecpu = CPU_68000; // Active 68k CPU (68000 by default)
|
||||
int activefpu = FPU_NONE; // Active FPU (none by default)
|
||||
int org68k_active = 0; // .org switch for 68k (only with RAW output format)
|
||||
|
@ -173,6 +174,7 @@ void DisplayHelp(void)
|
|||
" 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"
|
||||
" op: Enforce PC relative (off)\n"
|
||||
" ~o[value] Turn a specific optimisation off\n"
|
||||
" +oall Turn all optimisations on\n"
|
||||
" ~oall Turn all optimisations off\n"
|
||||
|
@ -232,6 +234,12 @@ int ParseOptimization(char * optstring)
|
|||
}
|
||||
else if (optstring[1] == 'o' || optstring[1] == 'O') // Turn on specific optimisation
|
||||
{
|
||||
if (optstring[2] == 'p' || optstring[2] == 'P')
|
||||
{
|
||||
optim_pc = 1;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int opt_no = atoi(&optstring[2]);
|
||||
|
||||
if ((opt_no >= 0) && (opt_no < OPT_COUNT))
|
||||
|
|
1
rmac.h
1
rmac.h
|
@ -316,6 +316,7 @@ extern int legacy_flag;
|
|||
extern int prg_flag; // 1 = write ".PRG" relocatable executable
|
||||
extern LONG PRGFLAGS;
|
||||
extern int optim_flags[OPT_COUNT];
|
||||
extern int optim_pc;
|
||||
extern int activecpu;
|
||||
extern int activefpu;
|
||||
extern uint32_t org68k_address;
|
||||
|
|
18
sect.c
18
sect.c
|
@ -415,6 +415,15 @@ int ResolveFixups(int sno)
|
|||
// evexpr presumably issues the errors/warnings here
|
||||
if (evexpr(fup->expr, &eval, &eattr, &esym) != OK)
|
||||
continue;
|
||||
|
||||
if (optim_pc)
|
||||
if (eattr & REFERENCED)
|
||||
if (eattr & DEFINED)
|
||||
if (!(eattr & EQUATED))
|
||||
{
|
||||
error("relocation not allowed");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Simple symbol
|
||||
else
|
||||
|
@ -422,6 +431,15 @@ int ResolveFixups(int sno)
|
|||
SYM * sy = fup->symbol;
|
||||
eattr = sy->sattr;
|
||||
|
||||
if (optim_pc)
|
||||
if (eattr & REFERENCED)
|
||||
if (eattr & DEFINED)
|
||||
if (!(eattr & EQUATED))
|
||||
{
|
||||
error("relocation not allowed");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eattr & DEFINED)
|
||||
eval = sy->svalue;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue