scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 78ccf13a90596a1c132707c46679d62e2a18207b
parent fb96623fc6a1919d7c1551b2a3e13f73265034b4
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 21 Mar 2015 03:14:29 -0400

Add peephole for jump to next instruction

The code generated will have in some cases jumps to the
next instruction, so it is something the peephole
optimizer must remove.

Diffstat:
Mcc2/peep.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/cc2/peep.c b/cc2/peep.c @@ -30,6 +30,10 @@ peephole(void) /* TODO: More optimizations (ex: -1) */ } break; + case JP: + if (to.u.sym->u.pc == pc->next) + delcode(); + break; } } }