shithub: scc

Download patch

ref: 78ccf13a90596a1c132707c46679d62e2a18207b
parent: fb96623fc6a1919d7c1551b2a3e13f73265034b4
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Mar 20 23:14:29 EDT 2015

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.

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