|
|
1.1 ! root 1: -title VAXPO1: VAX Peephole Optimizer 1 - Eliminate Redundant TSTLs ! 2: -in80 ! 3: * ! 4: * VAXPO1 removes redundant TSTL instructions of an operand ! 5: * modified by the previous instruction. ! 6: * ! 7: &anchor = 1 ! 8: &stlimit = 10000000 ! 9: * ! 10: * Set up patterns to rip apart statements. ! 11: * ! 12: tab = substr( &alphabet,10,1 ) ! 13: sep = tab ' ' ! 14: letters = 'abcdefghijklmnopqrstuvwxyz23' ! 15: label = break( ':' ) ':' | '' ! 16: eos = span( sep ) | '#' | rpos( 0 ) ! 17: fmtop = label span( sep ) ! 18: + span( letters ) . op span( sep ) ! 19: + ( break( sep '#' ) | rem ) . dst eos ! 20: tstpat = span( sep ) 'tstl' span( sep ) *dst ! 21: + (eos rem) . cmnt ! 22: * ! 23: * Read in opcodes of instructions that set the condition codes ! 24: * ! 25: optbl = table() ! 26: oploop line = input ! 27: line ? '+' :s(oploopx) ! 28: line ? break( sep ) . op span( sep ) rem . n ! 29: optbl[op] = +n :(oploop) ! 30: oploopx ! 31: * ! 32: * Set up i/o associations. ! 33: * ! 34: infile = input ! 35: input( .in,0,infile ) ! 36: terminal = 'Input file: ' infile ! 37: terminal = ! 38: outfile = input ! 39: output( .out,1,outfile ) ! 40: terminal = 'Output file ' outfile ! 41: terminal = ! 42: logfile = input ! 43: output( .output,2,logfile ) ! 44: terminal = 'Log file: ' logfile ! 45: * ! 46: * Check next line for possibly preceding a redunant TSTL. ! 47: * ! 48: optloop line = in :f(eof) ! 49: leq( substr( line,1,1 ),'#' ) :s(write) ! 50: optl1 line ? fmtop :f(write) ! 51: differ( n = optbl[op] ) :f(write) ! 52: dst ? *eq( n,2 ) break( ',' ) len( 1 ) = ! 53: dst ? *eq( n,3 ) break( ',' ) len( 1 ) = ! 54: out = line ! 55: * ! 56: * Dst contains destination operand from previous instruction. ! 57: * So, check now for a TSTL of that operand. ! 58: * ! 59: line = in :f(eof) ! 60: line ? tstpat :f(optl1) ! 61: output = tab out ! 62: opt = opt + 1 ! 63: output = '#--->' tab line ! 64: line = in cmnt ! 65: output = tab line ! 66: output = ! 67: * ! 68: write out = line :(optloop) ! 69: * ! 70: eof output = opt ' redundant TSTL instructions removed' ! 71: end ! 72: addl2 2 ! 73: ashl 3 ! 74: bicl2 2 ! 75: bisl2 2 ! 76: decl 1 ! 77: incl 1 ! 78: movl 2 ! 79: subl2 2 ! 80: xorl2 2 ! 81: + ! 82: spitv35.src ! 83: spitv35.serr ! 84: opttsts
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.