|
|
1.1 ! root 1: To convert two pass to 1 pass operation: ! 2: (I suggest that you use a subdirectory, since ! 3: it is hard to repair some of this damage once done) ! 4: ! 5: I assume that you have new copies of the machine-independent ! 6: files. The file cl is no longer used, and there is no ! 7: use of lex at all. The file scan.c contains the new ! 8: lexical analyzer. Moreover, the file comm2.c is no longer ! 9: used when the passes are loaded together. ! 10: These changes may affect local procedures for searching, printing, ! 11: diffing, etc. the compiler. ! 12: ! 13: I suggest that you take the makefile in /usr/n as well, to help you ! 14: along. ! 15: ! 16: The conversion process, as well as I understand it is as follows. ! 17: ! 18: 1. Make a subdirectory, and put in it the old machine dependent files ! 19: macdefs, mac2defs, local.c, order.c, code.c, local2.c, and table.c. ! 20: Put in all the new machine independent stuff, including the new makefile ! 21: ! 22: 2. Insert the line # define ONEPASS into macdefs ! 23: Change LABFMT by deleting the \n. ! 24: ! 25: 3. In all the machine dependent source files local.c, ! 26: code.c, order.c, local2.c, and table.c, remove the includes of ! 27: manifest and macdefs; these are now included by mfile1 and mfile2. ! 28: ! 29: 4. The main routine for pass 2 (probably on local2.c) ! 30: should be deleted; it probably only does a call to mainp2. ! 31: If it does anything else of interest, ! 32: let me know. ! 33: ! 34: 5. On the file local.c, in the routine `ecode', ! 35: replace the lines ! 36: printf( ".%d\t%s\n", lineno, ftitle ); ! 37: prtree( p ); ! 38: by ! 39: p2tree( p ); ! 40: p2compile( p ); ! 41: ! 42: 6. In code.c, in the function bccode, replace the line ! 43: printf( "[\t%d\t%d\t%d\t\n", ftnno, XXXX, YYYY ); ! 44: by ! 45: p2bbeg( XXXX, YYYY ); ! 46: Also, in efcode, replace the line which prints out the "]..." ! 47: with ! 48: p2bend(); ! 49: ! 50: 7. In code.c and local.c, look at all remaining printfs. Lines ! 51: which go onto the intermediate file all had ")" at the head. ! 52: All of these must be clobbered. Thus, a line which read ! 53: printf( ") xxx yyy\n) zzz www\n" ); ! 54: must be changed to read ! 55: printf( " xxx yyy\n zzz www\n" ); ! 56: This is tedious, although a few cleverly chosen ed commands ! 57: will probably do the trick. ! 58: ! 59: 8. Say make, and stand back. The result is a ! 60: single program called comp. ! 61: You may experience loading errors as a result of having used the ! 62: same external names in the first and second pass. Look at the ! 63: beginning of mfile2 to get a hint about one way to deal with ! 64: this problem (add stuff to mac2defs to change the names). ! 65: The other way to deal with it is just fix it... ! 66: ! 67: 9. As a side-effect of other changes, the meaning of the arguments ! 68: to match has changed slightly; ASG OPANY, as it always ! 69: did, matches any assignment op except ++, --, and = itself. ! 70: OPANY, on the other hand, matches only ops which are not assignment ! 71: ops. In table.c, there must be explicit rewriting rule entries for ! 72: ++, --, and =. In most cases with which I am familiar, this should ! 73: be true already, and no change is needed. ! 74: ! 75: 10. Usage is /lib/cpp x.c | comp ! 76: which produces assembler output on the std. output. ! 77: research!/usr/bin/ncc gives the interdata compiler, with many ! 78: bells and whistles, as a Bourne shell script. ! 79: regression tests, and checks that this compiler ! 80: produces the same output as the earlier one, are ! 81: both wise. ! 82: ! 83: Good Luck!
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.