From f34bb0f36e058fc744546a33ed41c08c4954feca Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 31 Dec 2017 09:53:33 -0800 Subject: Enable LTO on certain targets that don't need the full LDFLAGS by splitting out the optimization flags into a separate var --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b44fb88..4350168 100644 --- a/Makefile +++ b/Makefile @@ -65,18 +65,18 @@ endif #PORTABLE endif #Windows ifdef DEBUG -CFLAGS:=-ggdb $(CFLAGS) -LDFLAGS:=-ggdb $(LDFLAGS) +OPT:=-ggdb -Og else ifdef NOLTO -CFLAGS:=-O2 $(CFLAGS) -LDFLAGS:=-O2 $(LDFLAGS) +OPT:=-O2 else -CFLAGS:=-O2 -flto $(CFLAGS) -LDFLAGS:=-O2 -flto $(LDFLAGS) +OPT:=-O2 -flto endif #NOLTO endif #DEBUG +CFLAGS:=$(OPT) $(CFLAGS) +LDFLAGS:=$(OPT) $(LDFLAGS) + ifdef Z80_LOG_ADDRESS CFLAGS+= -DZ80_LOG_ADDRESS endif @@ -166,7 +166,7 @@ blastjag$(EXE) : jaguar.o jag_video.o render_sdl.o serialize.o $(M68KOBJS) $(TRA $(CC) -o $@ $^ $(LDFLAGS) dis$(EXE) : dis.o 68kinst.o tern.o vos_program_module.o - $(CC) -o $@ $^ + $(CC) -o $@ $^ $(OPT) jagdis : jagdis.o jagcpu.o tern.o $(CC) -o $@ $^ @@ -178,13 +178,13 @@ libemu68k.a : $(M68KOBJS) $(TRANSOBJS) ar rcs libemu68k.a $(M68KOBJS) $(TRANSOBJS) trans : trans.o serialize.o $(M68KOBJS) $(TRANSOBJS) util.o - $(CC) -o trans trans.o $(M68KOBJS) $(TRANSOBJS) util.o + $(CC) -o trans trans.o $(M68KOBJS) $(TRANSOBJS) util.o $(OPT) transz80 : transz80.o $(Z80OBJS) $(TRANSOBJS) $(CC) -o transz80 transz80.o $(Z80OBJS) $(TRANSOBJS) ztestrun : ztestrun.o serialize.o $(Z80OBJS) $(TRANSOBJS) - $(CC) -o ztestrun ztestrun.o $(Z80OBJS) $(TRANSOBJS) + $(CC) -o ztestrun ztestrun.o $(Z80OBJS) $(TRANSOBJS) $(OPT) ztestgen : ztestgen.o z80inst.o $(CC) -ggdb -o ztestgen ztestgen.o z80inst.o @@ -198,7 +198,7 @@ vgmplay$(EXE) : vgmplay.o render_sdl.o ppm.o serialize.o $(CONFIGOBJS) $(AUDIOOB $(FIXUP) ./$@ blastcpm : blastcpm.o util.o serialize.o $(Z80OBJS) $(TRANSOBJS) - $(CC) -o $@ $^ + $(CC) -o $@ $^ $(OPT) test : test.o vdp.o $(CC) -o test test.o vdp.o -- cgit v1.2.3 From d7331c70ead9e7b511f35a1825a4715b3bfad448 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 31 Dec 2017 14:08:47 -0800 Subject: Fix accidental add to RSP with SZ_D and SZ_PTR. Using SZ_D breakse when the stack is located outside of the 32-bit addressable range --- backend_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend_x86.c b/backend_x86.c index 614df1b..9458499 100644 --- a/backend_x86.c +++ b/backend_x86.c @@ -244,7 +244,7 @@ code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t n if (is_write && (memmap[chunk].flags & MMAP_CODE)) { pop_r(code, opts->scratch2); } else { - add_ir(code, sizeof(void*), RSP, SZ_D); + add_ir(code, sizeof(void*), RSP, SZ_PTR); code->stack_off -= sizeof(void *); } } else { -- cgit v1.2.3 From aa3d342f4bff853c7148f751a2703ae017926d70 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 3 Jan 2018 07:09:39 -0800 Subject: Fix silly bug in STOP implementation that caused excessive CPU usage --- m68k_core_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m68k_core_x86.c b/m68k_core_x86.c index 1f9a511..6fa1dce 100644 --- a/m68k_core_x86.c +++ b/m68k_core_x86.c @@ -2365,7 +2365,7 @@ void translate_m68k_stop(m68k_options *opts, m68kinst *inst) } code_ptr loop_top = code->cur; call(code, opts->do_sync); - cmp_rr(code, opts->gen.limit, opts->gen.cycles, SZ_D); + cmp_rr(code, opts->gen.cycles, opts->gen.limit, SZ_D); code_ptr normal_cycle_up = code->cur + 1; jcc(code, CC_A, code->cur + 2); cycles(&opts->gen, BUS); -- cgit v1.2.3