From ebd528885a35ec21d7d3f786609261ece1d688be Mon Sep 17 00:00:00 2001 From: borutr Date: Sat, 16 Feb 2008 15:05:19 +0000 Subject: [PATCH] * src/z80/peeph-gbz80.def: applied patch #1880235: Z80 return peephole, thanks to Philipp Krause git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5012 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 11 ++++++++++- src/z80/peeph-z80.def | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9de75a2..3d1b6a46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,15 @@ 2008-02-16 Borut Razem - * + * as/z80/asmain.c, as/z80/asm.h, as/z80/asdata.c, + as/link/z80/lkmain.c, as/z80/as_gbz80.dsp, as/z80/as_z80.dsp, + as/z80/Makefile.in. as/z80/Makefile.bcc: + applied patch #1893393: patch for as-z80 and link-z80 to generate + cdb, thanks to Armin Diehl + * as/*/asnoice.c, as/hc08/as_hc08.dsp, as/hc08/Makefile.in, + as/mcs51/asx8051.dsp, as/mcs51/Makefile.in: + asnoice.c moved to as/asxxsrc/asnoice.c + * src/z80/peeph-gbz80.def: applied patch + #1880235: Z80 return peephole, thanks to Philipp Krause 2008-02-14 Maarten Brock diff --git a/src/z80/peeph-z80.def b/src/z80/peeph-z80.def index f717847a..01901e87 100644 --- a/src/z80/peeph-z80.def +++ b/src/z80/peeph-z80.def @@ -151,22 +151,31 @@ replace restart { jp %1,%5 } by { ret %1 - ; peephole z12 replaced jump by return. + ; peephole z11a replaced jump by return. } if labelIsReturnOnly(), labelRefCountChange(%5 -1) // Should be one of the last ones. Opens the code to further peephole optimization. replace restart { %1: } by { - ; peephole z13 removed unused label %1. + ; peephole z12 removed unused label %1. } if labelRefCount(%1 0) +// Applying z11 or z11a followed by z12 will often leave a dead ret at the end of the function. Remove it. +replace { + jp %5 + ret +} by { + jp %5 + ; peephole z13 removed unused ret. +} + // These should be the last rules, so that the peepholes above need to look at jp only. replace { jp %5 } by { jr %5 - ; peephole z14 changed absolute to relative conditional jump. + ; peephole z14 changed absolute to relative unconditional jump. } if labelInRange() replace { -- 2.47.2