scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

peep.c (289B)


      1 #include <scc/scc.h>
      2 
      3 #include "../cc2.h"
      4 #include "arch.h"
      5 
      6 static void
      7 deljmp(void)
      8 {
      9 	if (!pc)
     10 		return;
     11 
     12 	if (pc->op == ASJP || pc->op == ASJR) {
     13 		if (pc->from1.u.sym == pc->next->label)
     14 			delcode();
     15 	}
     16 }
     17 
     18 void
     19 peephole(void)
     20 {
     21 	for (pc = prog; pc; pc = pc->next) {
     22 		deljmp();
     23 	}
     24 }