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