tms57002: Trick to reduce the compiler memory usage [O. Galibert]

This commit is contained in:
Olivier Galibert 2018-08-23 19:20:17 +02:00
parent f10c6be54f
commit 6e0bf6736a
6 changed files with 53 additions and 11 deletions

View File

@ -2345,11 +2345,13 @@ if (CPUS["TMS57002"]~=null) then
files {
MAME_DIR .. "src/devices/cpu/tms57002/tms57002.cpp",
MAME_DIR .. "src/devices/cpu/tms57002/tms57002.h",
MAME_DIR .. "src/devices/cpu/tms57002/tmsops.cpp",
MAME_DIR .. "src/devices/cpu/tms57002/tms57kdec.cpp",
}
dependency {
{ MAME_DIR .. "src/devices/cpu/tms57002/tms57kdec.cpp", GEN_DIR .. "emu/cpu/tms57002/tms57002.hxx" },
{ MAME_DIR .. "src/devices/cpu/tms57002/tms57002.cpp", GEN_DIR .. "emu/cpu/tms57002/tms57002.hxx" },
{ MAME_DIR .. "src/devices/cpu/tms57002/tmsops.cpp", GEN_DIR .. "emu/cpu/tms57002/tms57002.hxx" },
}
custombuildtask {
{ MAME_DIR .. "src/devices/cpu/tms57002/tmsinstr.lst" , GEN_DIR .. "emu/cpu/tms57002/tms57002.hxx", { MAME_DIR .. "src/devices/cpu/tms57002/tmsmake.py" }, {"@echo Generating TMS57002 source file...", PYTHON .. " $(1) $(<) $(@)" } }

View File

@ -16,7 +16,6 @@
DEFINE_DEVICE_TYPE(TMS57002, tms57002_device, "tms57002", "Texas Instruments TMS57002 \"DASP\"")
// Can't use a DEVICE_ADDRESS_MAP, not yet anyway
void tms57002_device::internal_pgm(address_map &map)
{
map(0x00, 0xff).ram();
@ -800,8 +799,6 @@ void tms57002_device::execute_run()
macc_write = macc;
for(;;) {
uint32_t c, d;
int64_t r;
const icd *i = cache.inst + ipc;
ipc = i->next;
@ -821,9 +818,9 @@ void tms57002_device::execute_run()
++ca, ++id;
goto inst;
#define CINTRP
#define CINTRPSWITCH
#include "cpu/tms57002/tms57002.hxx"
#undef CINTRP
#undef CINTRPSWITCH
default:
fatalerror("Unhandled opcode in tms57002_execute\n");

View File

@ -203,6 +203,10 @@ private:
short get_hashnode(unsigned char adr, uint32_t st1, short pnode);
int decode_get_pc();
uint32_t get_cmem(uint8_t addr);
#define CINTRPDECL
#include "../../emu/cpu/tms57002/tms57002.hxx"
#undef CINTRPDECL
};
enum {

View File

@ -232,7 +232,7 @@ lmld 1 32 1 n
lpc 2a 31 1 n
lpc %c
if(sti & S_HOST)
break;
return;
c = %c;
host[0] = c >> 24;
host[1] = c >> 16;
@ -338,7 +338,7 @@ raov 2a 38 1 n
rde 1 39 1 n
rde %c
if(sti & (S_READ|S_WRITE))
break;
return;
xoa = %c;
xm_init();
sti |= S_READ;
@ -525,7 +525,7 @@ sub 1 0d 1 y
wre 1 38 1 n
wre %d,%c
if(sti & (S_READ|S_WRITE))
break;
return;
xwr = %d24;
xoa = %c;
xm_init();

View File

@ -268,13 +268,17 @@ class Instruction:
for v in VARIANT_CANONICAL_ORDER:
if v in flags_fixed:
vals.append("%s=%d" % (v, flags_fixed[v]))
out = ["case %d: // %s %s" % (no, self._name, " ".join(vals))]
out = ["void tms57002_device::ex_%d(const icd *i) // %s %s" % (no, self._name, " ".join(vals))]
out.append("{")
out.append("\tuint32_t c; (void)c;")
out.append("\tuint32_t d; (void)d;")
out.append("\tint64_t r; (void)r;")
for line in self.PreprocessRunString():
exp = self.ExpandCintrp(line, flags_fixed)
# ensure we're not outputing a = a;
if not CheckSelfAssign(exp):
out.append(exp)
out.append(" break;")
out.append("}")
out.append("")
EmitWithPrefix(f, out, prefix)
return no + 1
@ -404,6 +408,21 @@ def EmitCintrp(f, ins_list):
for i in ins_list:
no = i.EmitCintrp(f, "", no)
print("#endif", file=f)
return no
def EmitCintrpDecl(f, ins_list, no):
ins_list.sort(key=lambda x : (x._cat, x._id))
print("#ifdef CINTRPDECL", file=f)
for i in range(4, no):
print("void ex_%d(const icd *i);" % i, file=f)
print("#endif", file=f)
def EmitCintrpSwitch(f, ins_list, no):
ins_list.sort(key=lambda x : (x._cat, x._id))
print("#ifdef CINTRPSWITCH", file=f)
for i in range(4, no):
print("case %d: ex_%d(i); break;" % (i, i), file=f)
print("#endif", file=f)
def CheckSelfAssign(line):
@ -424,4 +443,6 @@ except Exception:
EmitDasm(f, ins_list)
EmitCdec(f, ins_list)
EmitCintrp(f, ins_list)
no = EmitCintrp(f, ins_list)
EmitCintrpDecl(f, ins_list, no)
EmitCintrpSwitch(f, ins_list, no)

View File

@ -0,0 +1,18 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
/***************************************************************************
tms57002.c
TMS57002 "DASP" emulator.
***************************************************************************/
#include "emu.h"
#include "tms57002.h"
// Kept separate from tms57002.cpp to avoid the optimizer eating all the memory
#define CINTRP
#include "cpu/tms57002/tms57002.hxx"
#undef CINTRP