|
|
1.1 ! root 1: /* @(#) peep.c: 1.2 3/3/84 */ ! 2: /* peep.c ! 3: ** ! 4: ** 3B20S peephole improvement driver ! 5: ** ! 6: ** ! 7: ** This module contains the driver for the 3B peephole improver. ! 8: */ ! 9: ! 10: ! 11: ! 12: ! 13: #include "optim.h" ! 14: ! 15: extern void w1opt(); ! 16: extern void w2opt(); ! 17: extern void w3opt(); ! 18: extern int window(); ! 19: ! 20: extern int dflag; /* non-0 to display live/dead data */ ! 21: extern int hflag; /* non-0 to disable peephole entirely */ ! 22: void peep() ! 23: { ! 24: void prld(); /* routine to print live/dead data */ ! 25: ! 26: ! 27: if (hflag == 0) ! 28: { ! 29: #ifdef LIVEDEAD ! 30: if (dflag != 0) /* if enabled */ ! 31: prld(); /* print the world's live/dead data */ ! 32: #endif ! 33: ! 34: window(2, w2opt); /* do 2-instruction first to merge ! 35: ** triadics ! 36: */ ! 37: window(3, w3opt); /* ... to discard extra compares */ ! 38: window(1, w1opt); /* do 1-instruction next to kill dead ! 39: ** code, split triadics again (!) ! 40: */ ! 41: ! 42: window(2, w2opt); /* now repeat to clean up stragglers */ ! 43: window(1, w1opt); ! 44: } ! 45: return; ! 46: } ! 47: /* Print live/dead data for all instruction nodes */ ! 48: ! 49: #ifdef LIVEDEAD ! 50: ! 51: ! 52: void ! 53: prld() ! 54: { ! 55: register NODE * p; ! 56: int prinst(); ! 57: ! 58: for (ALLN(p)) /* for all instruction nodes... */ ! 59: { ! 60: PUTCHAR(CC); /* write comment char */ ! 61: ! 62: PRINTF("(live: 0x%X)", p->nlive); /* print live/dead data */ ! 63: (void) prinst(p); /* print instruction */ ! 64: } ! 65: return; ! 66: } ! 67: ! 68: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.