mirror of http://shamusworld.gotdns.org/git/rmac
Removed some dead code, as well as all gpu/dsp regbank check code (not only it was complicated, it also was very incomplete - for example: no bank checks were performed during fixups)
This commit is contained in:
parent
9ad63bfb08
commit
d21544da60
12
direct.c
12
direct.c
|
@ -536,7 +536,7 @@ int d_equrundef(void)
|
|||
{
|
||||
// Reset the attributes of this symbol...
|
||||
regname->sattr = 0;
|
||||
regname->sattre &= ~(EQUATEDREG | BANK_0 | BANK_1);
|
||||
regname->sattre &= ~EQUATEDREG;
|
||||
regname->sattre |= UNDEF_EQUR;
|
||||
}
|
||||
|
||||
|
@ -701,16 +701,16 @@ allright:
|
|||
//
|
||||
int d_regbank0(void)
|
||||
{
|
||||
// Set active register bank zero
|
||||
regbank = BANK_0;
|
||||
// Deprecated, it's not as if this did anything useful, ever
|
||||
warn("regbank0 ignored");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int d_regbank1(void)
|
||||
{
|
||||
// Set active register bank one
|
||||
regbank = BANK_1;
|
||||
// Deprecated, it's not as if this did anything useful, ever
|
||||
warn("regbank1 ignored");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1965,7 +1965,6 @@ int d_gpu(void)
|
|||
rdsp = 0; // Unset DSP assembly
|
||||
robjproc = 0; // Unset OP assembly
|
||||
dsp56001 = 0; // Unset 56001 assembly
|
||||
regbank = BANK_N; // Set no default register bank
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1992,7 +1991,6 @@ int d_dsp(void)
|
|||
rgpu = 0; // Unset GPU assembly
|
||||
robjproc = 0; // Unset OP assembly
|
||||
dsp56001 = 0; // Unset 56001 assembly
|
||||
regbank = BANK_N; // Set no default register bank
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
22
expr.c
22
expr.c
|
@ -290,16 +290,6 @@ int expr2(void)
|
|||
if (sy == NULL)
|
||||
sy = NewSymbol(p, LABEL, j);
|
||||
|
||||
// Check register bank usage
|
||||
if (sy->sattre & EQUATEDREG)
|
||||
{
|
||||
if ((regbank == BANK_0) && (sy->sattre & BANK_1) && !altbankok)
|
||||
warn("equated symbol \'%s\' cannot be used in register bank 0", sy->sname);
|
||||
|
||||
if ((regbank == BANK_1) && (sy->sattre & BANK_0) && !altbankok)
|
||||
warn("equated symbol \'%s\' cannot be used in register bank 1", sy->sname);
|
||||
}
|
||||
|
||||
*evalTokenBuffer.u32++ = SYMBOL;
|
||||
*evalTokenBuffer.u32++ = symbolNum;
|
||||
symbolPtr[symbolNum] = sy;
|
||||
|
@ -463,20 +453,8 @@ int expr(TOKEN * otk, uint64_t * a_value, WORD * a_attr, SYM ** a_esym)
|
|||
if ((symbol->sattre & UNDEF_EQUR) && !riscImmTokenSeen)
|
||||
{
|
||||
error("undefined register equate '%s'", symbol->sname);
|
||||
//if we return right away, it returns some spurious errors...
|
||||
// return ERROR;
|
||||
}
|
||||
|
||||
// Check register bank usage (moved to EvaluateRegisterFromTokenStream()))
|
||||
//if (symbol->sattre & EQUATEDREG)
|
||||
//{
|
||||
// if ((regbank == BANK_0) && (symbol->sattre & BANK_1) && !altbankok)
|
||||
// warn("equated symbol '%s' cannot be used in register bank 0", symbol->sname);
|
||||
//
|
||||
// if ((regbank == BANK_1) && (symbol->sattre & BANK_0) && !altbankok)
|
||||
// warn("equated symbol '%s' cannot be used in register bank 1", symbol->sname);
|
||||
//}
|
||||
|
||||
*evalTokenBuffer.u32++ = SYMBOL;
|
||||
#if 0
|
||||
*evalTokenBuffer++ = (TOKEN)symbol;
|
||||
|
|
28
procln.c
28
procln.c
|
@ -154,7 +154,6 @@ void Assemble(void)
|
|||
char * opname = NULL; // Name of dirctve/mnemonic/macro
|
||||
int listflag; // 0: Don't call listeol()
|
||||
WORD rmask; // Register list, for REG
|
||||
int registerbank; // RISC register bank
|
||||
int riscreg; // RISC register
|
||||
listflag = 0; // Initialise listing flag
|
||||
|
||||
|
@ -441,32 +440,16 @@ When checking to see if it's already been equated, issue a warning.
|
|||
// Check for register to equate to
|
||||
if ((*tok >= KW_R0) && (*tok <= KW_R31))
|
||||
{
|
||||
// sy->sattre = EQUATEDREG | RISCSYM; // Mark as equated register
|
||||
sy->sattre = EQUATEDREG; // Mark as equated register
|
||||
riscreg = *tok;
|
||||
|
||||
// Default is current state of "regbank"
|
||||
registerbank = regbank;
|
||||
|
||||
// Check for ",<bank #>" override notation
|
||||
// Check for ",<bank #>" override notation and skip past it.
|
||||
// It is ignored now. Was that ever useful anyway?
|
||||
if ((tok[1] == ',') && (tok[2] == CONST))
|
||||
{
|
||||
// Advance token pointer to the constant
|
||||
tok += 3;
|
||||
|
||||
// Anything other than a 0 or a 1 will result in "No Bank"
|
||||
if (*(uint64_t*)tok == 0)
|
||||
registerbank = BANK_0;
|
||||
else if (*(uint64_t*)tok == 1)
|
||||
registerbank = BANK_1;
|
||||
|
||||
// Advance half-way through the 64-bit const.
|
||||
// The code below, expecting a regular token,
|
||||
// will advance past the second half.
|
||||
tok++;
|
||||
// Advance token pointer and skip everything
|
||||
tok += 4;
|
||||
}
|
||||
|
||||
sy->sattre |= registerbank; // Store register bank
|
||||
eattr = ABS | DEFINED | GLOBAL;
|
||||
eval = riscreg;
|
||||
tok++;
|
||||
|
@ -499,7 +482,8 @@ When checking to see if it's already been equated, issue a warning.
|
|||
else
|
||||
{
|
||||
sy->sattre = EQUATEDREG; // Mark as equated register
|
||||
riscreg = *tok;
|
||||
eattr = ABS | DEFINED | GLOBAL;
|
||||
eval = *tok;
|
||||
tok++;
|
||||
}
|
||||
}
|
||||
|
|
82
riscasm.c
82
riscasm.c
|
@ -204,19 +204,6 @@ static int EvaluateRegisterFromTokenStream(uint32_t fixup)
|
|||
int reg = *tok & 255;
|
||||
if (reg >= KW_R0 && reg <= KW_R31)
|
||||
{
|
||||
// Check register bank usage in the case of .equr register
|
||||
// (encoded as bits 30 and 31 in *tok).
|
||||
// (I still think that this is superfluous and should be taken out, see my note in token.c)
|
||||
if (*tok & 0x80000000)
|
||||
{
|
||||
// Oops, with all the evaluation in token.c we now lost the equated symbol reference, so we
|
||||
// don't know its name or anything else. Oh well...
|
||||
if ((regbank == BANK_0) && (*tok & 0x40000000) && !altbankok)
|
||||
return error("equated symbol cannot be used in register bank 0");
|
||||
|
||||
if ((regbank == BANK_1) && !(*tok & 0x40000000) && !altbankok)
|
||||
return error("equated symbol cannot be used in register bank 1");
|
||||
}
|
||||
reg -= KW_R0;
|
||||
tok++;
|
||||
return reg;
|
||||
|
@ -246,13 +233,6 @@ static int EvaluateRegisterFromTokenStream(uint32_t fixup)
|
|||
|
||||
// We shouldn't get here, that should not be legal
|
||||
interror(9);
|
||||
|
||||
// If we got a register in range (0-31), return it
|
||||
//if (eattr & RISCREG)
|
||||
// return (int)eval - KW_R0;
|
||||
|
||||
//// Otherwise, it's out of range & we flag an error
|
||||
//return error(reg_err);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -471,39 +451,12 @@ int GenerateRISCCode(int state)
|
|||
if ((tok[1] == '+') || (tok[1] == '-'))
|
||||
{
|
||||
// Trying to make indexed call
|
||||
// Note: no bank check for .equr symbol here, but the original code for .equr
|
||||
// below also didn't check for banks. Even more reasons to throw away
|
||||
// bank checks.
|
||||
if (((*tok & 0xff) == KW_R14) || ((*tok &0xff) == KW_R15))
|
||||
indexed = ((*tok & 0xff) - KW_R0);
|
||||
if ((*tok == KW_R14) || (*tok == KW_R15))
|
||||
indexed = (*tok - KW_R0);
|
||||
else
|
||||
return IllegalIndexedRegister(*tok);
|
||||
}
|
||||
|
||||
//if (*tok == SYMBOL)
|
||||
//{
|
||||
// sy = lookup(string[tok[1]], LABEL, 0);
|
||||
//
|
||||
// if (!sy)
|
||||
// {
|
||||
// error(reg_err);
|
||||
// return ERROR;
|
||||
// }
|
||||
//
|
||||
// if (sy->sattre & EQUATEDREG)
|
||||
// {
|
||||
// if ((tok[2] == '+') || (tok[2] == '-'))
|
||||
// {
|
||||
// if ((sy->svalue - KW_R0) == 14 || (sy->svalue - KW_R0) == 15) {
|
||||
// indexed = (sy->svalue - KW_R0);
|
||||
// tok++;
|
||||
// }
|
||||
// else
|
||||
// return IllegalIndexedRegisterEqur(sy);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if (!indexed)
|
||||
{
|
||||
EVAL_REG_RETURN_IF_ERROR(reg1, FU_REGONE);
|
||||
|
@ -519,7 +472,7 @@ int GenerateRISCCode(int state)
|
|||
parm = (WORD)(reg1 - 14 + 58);
|
||||
tok++;
|
||||
|
||||
if (((*tok & 0xff) >= KW_R0) && ((*tok & 0xff) <= KW_R31))
|
||||
if ((*tok >= KW_R0) && (*tok <= KW_R31))
|
||||
indexed = 1;
|
||||
|
||||
if (*tok == SYMBOL)
|
||||
|
@ -595,31 +548,8 @@ int GenerateRISCCode(int state)
|
|||
tok++;
|
||||
indexed = 0;
|
||||
|
||||
// Again, no bank checks here or in the original code.
|
||||
// This check has more holes than a very hole-y thing.
|
||||
if ((((*tok & 0xff) == KW_R14) || ((*tok & 0xff) == KW_R15)) && (tok[1] != ')'))
|
||||
indexed = (*tok & 0xff) - KW_R0;
|
||||
|
||||
//if (*tok == SYMBOL)
|
||||
//{
|
||||
// sy = lookup(string[tok[1]], LABEL, 0);
|
||||
//
|
||||
// if (!sy)
|
||||
// {
|
||||
// error(reg_err);
|
||||
// return ERROR;
|
||||
// }
|
||||
//
|
||||
// if (sy->sattre & EQUATEDREG)
|
||||
// {
|
||||
// if (((sy->svalue - KW_R0) == 14 || (sy->svalue - KW_R0) == 15)
|
||||
// && (tok[2] != ')'))
|
||||
// {
|
||||
// indexed = (sy->svalue - KW_R0);
|
||||
// tok++;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
if (((*tok == KW_R14) || (*tok == KW_R15)) && (tok[1] != ')'))
|
||||
indexed = *tok - KW_R0;
|
||||
|
||||
if (!indexed)
|
||||
{
|
||||
|
@ -636,7 +566,7 @@ int GenerateRISCCode(int state)
|
|||
parm = (WORD)(reg2 - 14 + 60);
|
||||
tok++;
|
||||
|
||||
if (((*tok & 0xff) >= KW_R0) && ((*tok & 0xff) <= KW_R31))
|
||||
if ((*tok >= KW_R0) && (*tok <= KW_R31))
|
||||
indexed = 1;
|
||||
|
||||
if (*tok == SYMBOL)
|
||||
|
|
2
rmac.c
2
rmac.c
|
@ -43,7 +43,6 @@ int rgpu, rdsp; // Assembling Jaguar GPU or DSP code
|
|||
int robjproc; // Assembling Jaguar Object Processor code
|
||||
int dsp56001; // Assembling DSP 56001 code
|
||||
int list_fd; // File to write listing to
|
||||
int regbank; // RISC register bank
|
||||
int segpadsize; // Segment padding size
|
||||
int endian; // Host processor endianess (0 = LE, 1 = BE)
|
||||
char * objfname; // Object filename pointer
|
||||
|
@ -316,7 +315,6 @@ int Process(int argc, char ** argv)
|
|||
rdsp = 0; // Initialize DSP assembly flag
|
||||
robjproc = 0; // Initialize OP assembly flag
|
||||
lsym_flag = 1; // Include local symbols in object file
|
||||
regbank = BANK_N; // No RISC register bank specified
|
||||
orgactive = 0; // Not in RISC org section
|
||||
orgwarning = 0; // No ORG warning issued
|
||||
segpadsize = 2; // Initialize segment padding size
|
||||
|
|
5
rmac.h
5
rmac.h
|
@ -259,10 +259,6 @@ PTR
|
|||
#define SIZP 0x0080 // .p (FPU pakced decimal real)
|
||||
#define SIZQ 0x0100 // .q (quad word)
|
||||
|
||||
// RISC register bank definitions (used in extended symbol attributes also)
|
||||
#define BANK_N 0x0000 // No register bank specified
|
||||
#define BANK_0 0x0001 // Register bank zero specified
|
||||
#define BANK_1 0x0002 // Register bank one specified
|
||||
#define EQUATEDREG 0x0008 // Equated register symbol
|
||||
#define UNDEF_EQUR 0x0010
|
||||
#define EQUATEDCC 0x0020
|
||||
|
@ -321,7 +317,6 @@ extern int robjproc;
|
|||
extern int dsp56001;
|
||||
extern int err_flag;
|
||||
extern int err_fd;
|
||||
extern int regbank;
|
||||
extern char * firstfname;
|
||||
extern int list_fd;
|
||||
extern int list_pag;
|
||||
|
|
5
sect.c
5
sect.c
|
@ -18,7 +18,8 @@
|
|||
#include "riscasm.h"
|
||||
#include "symbol.h"
|
||||
#include "token.h"
|
||||
|
||||
#define DEF_KW
|
||||
#include "kwtab.h"
|
||||
|
||||
// Function prototypes
|
||||
void MakeSection(int, uint16_t);
|
||||
|
@ -720,6 +721,7 @@ int ResolveFixups(int sno)
|
|||
}
|
||||
else if ((dw & FUMASKRISC) == FU_REGONE)
|
||||
{
|
||||
eval -= KW_R0;
|
||||
if (eval > 31)
|
||||
{
|
||||
error("register one value out of range");
|
||||
|
@ -733,6 +735,7 @@ int ResolveFixups(int sno)
|
|||
}
|
||||
else if ((dw & FUMASKRISC) == FU_REGTWO)
|
||||
{
|
||||
eval -= KW_R0;
|
||||
if (eval > 31)
|
||||
{
|
||||
error("register two value out of range");
|
||||
|
|
22
token.c
22
token.c
|
@ -1208,7 +1208,6 @@ DEBUG { printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n"); }
|
|||
{
|
||||
equrundef = 1;
|
||||
j = -1;
|
||||
//printf("line %d, equrundef found\n", curlineno);
|
||||
}
|
||||
|
||||
// If not tokenized keyword OR token was not found
|
||||
|
@ -1218,7 +1217,8 @@ DEBUG { printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n"); }
|
|||
// because the directive handler (d_equrundef) will run outside this loop, further into procln.c
|
||||
if (!equrundef)
|
||||
{
|
||||
// Last attempt: let's see if this is an equated register
|
||||
// Last attempt: let's see if this is an equated register.
|
||||
// If yes, then just store the register's keyword value instead of the symbol
|
||||
char temp = *ln;
|
||||
*ln = 0;
|
||||
sy = lookup(nullspot, LABEL, 0);
|
||||
|
@ -1227,23 +1227,7 @@ DEBUG { printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n"); }
|
|||
{
|
||||
if (sy->sattre & EQUATEDREG)
|
||||
{
|
||||
uint32_t register_token = sy->svalue;
|
||||
if (rgpu || rdsp)
|
||||
{
|
||||
// If we are in GPU or DSP mode then mark the register bank.
|
||||
// We will use it during EvaluateRegisterFromTokenStream()
|
||||
// when we check if we can use the equated register with the currently
|
||||
// selected bank.
|
||||
// Note (ggn): I find all this superfluous. Do we really want to be so
|
||||
// protective? Plus, the current implementation happily skips
|
||||
// these checks on .equr that are set during fixups - oops!
|
||||
register_token |= 0x80000000; // Mark that this is an .equr
|
||||
if (sy->sattre & BANK_1)
|
||||
{
|
||||
register_token |= 0x40000000; // Mark bank 1
|
||||
}
|
||||
}
|
||||
*tk.u32++ = register_token;
|
||||
*tk.u32++ = sy->svalue;
|
||||
stuffnull = 0;
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue