|
|
1.1 ! root 1: -IN80 ! 2: -TITLE OPTIMIZE OUT REDUNDANT TSTL OPS FROM MACRO SOURCE ! 3: -STITL PREAMBLE ! 4: * ! 5: * This Spitbol program is a quick&dirty pass over the ! 6: * translated Minimal source (MACRO-32) to remove the ! 7: * obviously unneeded TSTL comparison instructions. ! 8: * A TSTL is unnecessary when it follows a MOVL, ADDL2, SUBL2, ! 9: * BISL2 or BICL2 in the program. (There are others, but they ! 10: * occur infrequently or not at all). If the operand of the ! 11: * TSTL is a register that is the same as the second operand ! 12: * register of one of these op-codes that immediately precedes the ! 13: * TSTL & the TSTL is not labelled, then it clearly can be dumped. ! 14: * ! 15: * Steve Duff April 1980 ! 16: * ! 17: -STITL INITIALIZATION ! 18: * ! 19: * Keywords... ! 20: * ! 21: &STLIMIT = 10000000; &TRIM = 1; &ANCHOR = 1 ! 22: * ! 23: * Patterns... ! 24: * ! 25: REG = 'R' (ANY('23456789') | ('1' ANY('01'))) ! 26: SB = SPAN(' ') ! 27: LABEL = LEN(5) '::' ! 28: OPTPATT = (LABEL | '') SB ! 29: + ('MOVL' | 'ADDL2' | 'SUBL2' | 'BICL2' | 'BISL2') ! 30: + SB BREAK(',') LEN(1) REG . OPTREG (SB | RPOS(0)) ! 31: TSTLPATT = SB 'TSTL' SB *OPTREG (SB | RPOS(0)) ! 32: * ! 33: * I/O ! 34: * ! 35: TERMINAL = 'Enter Name Of .MAR File, Sans Extension.' ! 36: FILENAME = TERMINAL ! 37: INPUT(.INFILE,1,FILENAME '.MAR') :F(NOFILE_ERROR) ! 38: OUTPUT(.OUTFILE,2,FILENAME '.MAR') ! 39: -STITL PROGRAM ! 40: LOOP ! 41: CARD1 = INFILE :F(EXIT) ! 42: CARD1 ANY(';') :S(FLUSH1) ! 43: CARD1 OPTPATT :F(FLUSH1) ! 44: CARD2 = INFILE ! 45: CARD2 TSTLPATT :F(FLUSH2) ! 46: COUNT = COUNT + 1 ! 47: FLUSH1 ! 48: OUTFILE = CARD1 :(LOOP) ! 49: FLUSH2 ! 50: OUTFILE = CARD1 ! 51: OUTFILE = CARD2 :(LOOP) ! 52: EXIT ! 53: TERMINAL = COUNT ' TSTL OPCODES REMOVED.' ! 54: END
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.