adapting to phototypesetter
This commit is contained in:
parent
1cd71875ac
commit
10569743c8
11 changed files with 213 additions and 454 deletions
284
doc/6500.doc
284
doc/6500.doc
|
@ -1,6 +1,6 @@
|
||||||
. \" $Header$"
|
. \" $Header$"
|
||||||
.po +10
|
.RP
|
||||||
.ND
|
.ND Dec 1984
|
||||||
.TL
|
.TL
|
||||||
.B
|
.B
|
||||||
A backend table for the 6500 microprocessor
|
A backend table for the 6500 microprocessor
|
||||||
|
@ -12,212 +12,6 @@ The backend table is part of the Amsterdam Compiler Kit (ACK).
|
||||||
It translates the intermediate language family EM to a machine
|
It translates the intermediate language family EM to a machine
|
||||||
code for the MCS6500 microprocessor family.
|
code for the MCS6500 microprocessor family.
|
||||||
.AE
|
.AE
|
||||||
.PP
|
|
||||||
.bp
|
|
||||||
.NH
|
|
||||||
Introduction.
|
|
||||||
.PP
|
|
||||||
As more and more organizations aquire many micro and minicomputers,
|
|
||||||
the need for portable compilers is becoming more and more acute.
|
|
||||||
The present situation, in which each harware vendor provides its
|
|
||||||
own compilers -- each with its own deficiencies and extensions, and
|
|
||||||
none of them compatible -- leaves much to be desired.
|
|
||||||
The ideal situation would be an integrated system containing
|
|
||||||
a family of (cross) compilers, each compiler accepting a standard
|
|
||||||
source language and, producing code for a wide variety of target
|
|
||||||
machines. Furthermore, the compilers should be compatible, so programs
|
|
||||||
written in one language can call procedures written in another
|
|
||||||
language. Finally, the system should be designed so as to make
|
|
||||||
adding new languages and, new machines easy. Such an integerated
|
|
||||||
system is being built at the Vrije Universiteit.
|
|
||||||
.PP
|
|
||||||
The compiler building system, which is called the "Amsterdam Compiler
|
|
||||||
Kit" (ACK), can be thought of as a "tool kit." It consists of
|
|
||||||
a number of parts that can be combined to form compilers (and
|
|
||||||
interpreters) with various properties. The tool kit is based
|
|
||||||
on an idea (UNCOL) that was first suggested in 1960 [5],
|
|
||||||
but which never really caught on then. The problem which UNCOL
|
|
||||||
attemps to solve is how to make a compiler for each of
|
|
||||||
.B
|
|
||||||
N
|
|
||||||
.R
|
|
||||||
languages on
|
|
||||||
.B
|
|
||||||
M
|
|
||||||
.R
|
|
||||||
different machines without having to write
|
|
||||||
.B
|
|
||||||
N
|
|
||||||
.R
|
|
||||||
x
|
|
||||||
.B
|
|
||||||
M
|
|
||||||
.R
|
|
||||||
programs.
|
|
||||||
.PP
|
|
||||||
As shown in Fig. 1, the UNCOL approach is to write
|
|
||||||
.B
|
|
||||||
N
|
|
||||||
.R
|
|
||||||
"front ends," each of which translates
|
|
||||||
one source language to a common
|
|
||||||
intermediate language, UNCOL (UNiversal Computer Oriented
|
|
||||||
Language), and
|
|
||||||
.B
|
|
||||||
M
|
|
||||||
.R
|
|
||||||
"back ends," each of which translates programs
|
|
||||||
in UNCOL to a specific machine language. Under these conditions,
|
|
||||||
only
|
|
||||||
.B
|
|
||||||
N
|
|
||||||
.R
|
|
||||||
+
|
|
||||||
.B
|
|
||||||
M
|
|
||||||
.R
|
|
||||||
programs must be written to provide all
|
|
||||||
.B
|
|
||||||
N
|
|
||||||
.R
|
|
||||||
languages on all
|
|
||||||
.B
|
|
||||||
M
|
|
||||||
.R
|
|
||||||
machines, instead of
|
|
||||||
.B
|
|
||||||
N
|
|
||||||
.R
|
|
||||||
x
|
|
||||||
.B
|
|
||||||
M
|
|
||||||
.R
|
|
||||||
programs.
|
|
||||||
.PP
|
|
||||||
Various reseachers have attempted to design a suitable UNCOL [1,6],
|
|
||||||
but none of these have become popular. It is the believe of the
|
|
||||||
designers of the Amsterdam Compiler Kit that previous attemps
|
|
||||||
have failed because they have been too ambitious, that is, they have
|
|
||||||
tried to cover all languages and all machines using a single UNCOL.
|
|
||||||
The approach of the designers is more modest:
|
|
||||||
they cater only to algebraic languages and machines whose memory
|
|
||||||
consist of 8-bit bytes, each with its own address.
|
|
||||||
Typical languages that could be handled include Ada, ALGOL 60,
|
|
||||||
ALGOL 68, BASIC, C, FORTRAN, Modula, Pascal, PL/I, PL/M, PLAIN and
|
|
||||||
RATFOR, where COBOL, LISP and SNOBOL would be less efficient.
|
|
||||||
Examples of machines that could be included are the Intel 8080 and
|
|
||||||
8086, Motorola 6800, 6809 and 68000, Zilog Z80 and Z8000, DEC PDP-11
|
|
||||||
and Vax, MOS Technology MCS6500 family and IBM but not the Burroughs
|
|
||||||
6700, CDC Cyber or Univac 1108 (because they are not byte_oriented).
|
|
||||||
With these restrictions the designers believe that the old UNCOL
|
|
||||||
idea can be used as the basis of a practical compiler-building
|
|
||||||
system.
|
|
||||||
.sp 10
|
|
||||||
.bp
|
|
||||||
.NH
|
|
||||||
An overview of the Amsterdam Compiler kit
|
|
||||||
.PP
|
|
||||||
The tool kit consists of eight components:
|
|
||||||
.IP 1.
|
|
||||||
The preprocessor.
|
|
||||||
.IP 2.
|
|
||||||
The front ends.
|
|
||||||
.IP 3.
|
|
||||||
The peephole optimizer.
|
|
||||||
.IP 4.
|
|
||||||
The global optimizer.
|
|
||||||
.IP 5.
|
|
||||||
The back end.
|
|
||||||
.IP 6.
|
|
||||||
The target machine optimizer.
|
|
||||||
.IP 7.
|
|
||||||
The universal assembler/linker.
|
|
||||||
.IP 8.
|
|
||||||
The utility package.
|
|
||||||
.PP
|
|
||||||
A fully optimizing compiler, depicted in Fig. 2, has seven cascaded
|
|
||||||
phases. Conceptually, each component reads an input file and writes
|
|
||||||
a transformed output file to be used as input to the next component.
|
|
||||||
In practice, some components may use temporary files to allow
|
|
||||||
multiple passes over the input or internal intermediate files.
|
|
||||||
.sp 20
|
|
||||||
.PP
|
|
||||||
In the following paragraphs a brief decription of each component
|
|
||||||
is given.
|
|
||||||
A more detailed description of the back end will be given in the
|
|
||||||
rest of this document. For a more detailed descripiton on the rest
|
|
||||||
of the components see [7]. A program to be compiled is first fed
|
|
||||||
into the (language independed) preprocessor, which provides a
|
|
||||||
simple macro facility and similar textual facilities.
|
|
||||||
The preprocessor's ouput is a legal program in one of the programming
|
|
||||||
languages supported, whereas the input is a program possibly
|
|
||||||
augmented with macro's, etc.
|
|
||||||
.PP
|
|
||||||
This output goes into the appropriate front end, whose job it is to
|
|
||||||
produce intermediate cade.
|
|
||||||
This intermediate code (the UNCOL of ACK) is the machine language
|
|
||||||
for a simple stack machine EM (Encoding Machine).
|
|
||||||
A typical front end might build a parse tree from the input
|
|
||||||
and then use the parse tree to generate EM cade,
|
|
||||||
which is similar to reverse Polish.
|
|
||||||
In order to perform this work, the front end has to maintain tables of declare
|
|
||||||
tables of declared variables, labels, etc., determine where
|
|
||||||
to place the data structures in memory and so on.
|
|
||||||
.PP
|
|
||||||
The EM code generated by the front end is fed into the peephole
|
|
||||||
optimizer, which scans it with a window of a view instructions,
|
|
||||||
replacing certain inefficient code sequences by better ones.
|
|
||||||
Such a search is important because EM contains instructions to
|
|
||||||
handle numerous important special cases efficiently
|
|
||||||
(e.g. incrementing a variable by 1).
|
|
||||||
It is our strategy to relieve the front ends of the burden
|
|
||||||
of hunting for special cases because there are many front ends
|
|
||||||
and just one peephole optimizer.
|
|
||||||
By handeling the special cases in the peephole optimizer,
|
|
||||||
the front ends become simpler, easier to write and easier to maintain.
|
|
||||||
.PP
|
|
||||||
Following the peephole optimizer is a global optimizer [2],
|
|
||||||
which unlike the peephole optimizer, examines the program as a whole.
|
|
||||||
It builts a data flow graph to make possible a variety of global
|
|
||||||
optimizations, among them, moving invariant code out of loops,
|
|
||||||
avoiding redundant computations, live/dead analysis and
|
|
||||||
eliminating tail recursion.
|
|
||||||
Note that the output of the global optimizer is still EM code.
|
|
||||||
.PP
|
|
||||||
Next comes the back end, which differs from the front ends in a
|
|
||||||
fundamental way.
|
|
||||||
Each front end is a separate program, whereas the back end is a
|
|
||||||
single program that is driven by a machine dependent driving table.
|
|
||||||
The driving table for a specific machine tells how EM code is
|
|
||||||
mapped onto the machine's assembly language.
|
|
||||||
Although a simple driving table just might macro expand each
|
|
||||||
EM instruction into a sequence of target machine instructions,
|
|
||||||
a much more sophisticated translation strategy is normaly used,
|
|
||||||
as described later.
|
|
||||||
For speech, the back end does not actually read in the driving
|
|
||||||
table at run time.
|
|
||||||
Instead, the tables are compiled along with the back end in advance,
|
|
||||||
resulting in one binairy program per machine.
|
|
||||||
.PP
|
|
||||||
The output of the back end is a program in the assembly language
|
|
||||||
of some particular machine.
|
|
||||||
The next component in the pipeline reads this program and performs
|
|
||||||
peephole optimization on it.
|
|
||||||
The optimizations performed here involve idiosyncrasies of the
|
|
||||||
target machine that cannot be performed by the machine-independent
|
|
||||||
EM-to-EM peephole optimizer.
|
|
||||||
Typically these optimizations take advantage of the special
|
|
||||||
instructions or special addressing modes.
|
|
||||||
.PP
|
|
||||||
The optimized target machine assembly code then goes into the final
|
|
||||||
component in the pipeline, the universal assembler/linker.
|
|
||||||
This program assembles the input to object format, extracting
|
|
||||||
routines from libraries and including them as needed.
|
|
||||||
.PP
|
|
||||||
The final component of the tool kit is the utility package,
|
|
||||||
which contains various test programs, interpreters for EM code,
|
|
||||||
EM libraries, conversion programs and other aids for the
|
|
||||||
implementer and user.
|
|
||||||
.bp
|
.bp
|
||||||
.DS C
|
.DS C
|
||||||
.B
|
.B
|
||||||
|
@ -264,7 +58,7 @@ manufactured by Acorn Computer Ltd..
|
||||||
The MOS Technology MCS6500
|
The MOS Technology MCS6500
|
||||||
.PP
|
.PP
|
||||||
The MCS6500 is as a family of CPU devices developed by MOS
|
The MCS6500 is as a family of CPU devices developed by MOS
|
||||||
Technology.
|
Technology [1].
|
||||||
The members of the MCS6500 family are the same chips in a
|
The members of the MCS6500 family are the same chips in a
|
||||||
different housing.
|
different housing.
|
||||||
The MCS6502, the big brother in the family, can handle 64k
|
The MCS6502, the big brother in the family, can handle 64k
|
||||||
|
@ -861,7 +655,7 @@ The above description of the machine table is
|
||||||
a description of the table for the MCS6500.
|
a description of the table for the MCS6500.
|
||||||
It uses only a part of the possibilities which the code generator
|
It uses only a part of the possibilities which the code generator
|
||||||
generator offers.
|
generator offers.
|
||||||
For a more precise and detailed description see [4].
|
For a more precise and detailed description see [2].
|
||||||
.DS C
|
.DS C
|
||||||
.B
|
.B
|
||||||
THE BACK END TABLE.
|
THE BACK END TABLE.
|
||||||
|
@ -1141,7 +935,7 @@ This subroutine expects the multiplicand in zero page
|
||||||
at locations ARTH, ARTH+1, while the multiplier is in zero
|
at locations ARTH, ARTH+1, while the multiplier is in zero
|
||||||
page locations ARTH+2, ARTH+3.
|
page locations ARTH+2, ARTH+3.
|
||||||
For a description of the algorithms used for multiplication and
|
For a description of the algorithms used for multiplication and
|
||||||
division, see [9].
|
division, see [3].
|
||||||
A table content is:
|
A table content is:
|
||||||
.sp 1
|
.sp 1
|
||||||
.br
|
.br
|
||||||
|
@ -2071,34 +1865,6 @@ if it is to be used on a MCS6500.
|
||||||
REFERENCES.
|
REFERENCES.
|
||||||
.R
|
.R
|
||||||
.IP 1.
|
.IP 1.
|
||||||
Haddon. B.K., and Waite, W.M.
|
|
||||||
Experience with the Universal Intermediate Language Janus.
|
|
||||||
.B
|
|
||||||
Software Practice & Experience 8
|
|
||||||
.R
|
|
||||||
,
|
|
||||||
5 (Sept.-Oct. 1978), 601-616.
|
|
||||||
.RS
|
|
||||||
.PP
|
|
||||||
An intermediate language for use with Algol 68, Pascal, etc.
|
|
||||||
is described.
|
|
||||||
The paper discusses some problems encountered and how they were
|
|
||||||
dealt with.
|
|
||||||
.RE
|
|
||||||
.IP 2.
|
|
||||||
Lowry, E.S., and Medlock, C.W. Object Code Optimization.
|
|
||||||
.B
|
|
||||||
Commun. ACM 12
|
|
||||||
.R
|
|
||||||
,
|
|
||||||
(Jan. 1969), 13-22.
|
|
||||||
.RS
|
|
||||||
.PP
|
|
||||||
A classical paper on global object code optimization.
|
|
||||||
It covers data flow analysis, common subexpressions, code motion,
|
|
||||||
register allocation and other techniques.
|
|
||||||
.RE
|
|
||||||
.IP 3.
|
|
||||||
Osborn, A., Jacobson, S., and Kane, J. The Mos Technology MCS6500.
|
Osborn, A., Jacobson, S., and Kane, J. The Mos Technology MCS6500.
|
||||||
.B
|
.B
|
||||||
An Introduction to Microcomputers ,
|
An Introduction to Microcomputers ,
|
||||||
|
@ -2109,7 +1875,7 @@ Volume II, Some Real Products (june 1977) chap. 9.
|
||||||
A hardware description of some real existing CPU's, such as
|
A hardware description of some real existing CPU's, such as
|
||||||
the Intel Z80, MCS6500, etc. is given in this book.
|
the Intel Z80, MCS6500, etc. is given in this book.
|
||||||
.RE
|
.RE
|
||||||
.IP 4.
|
.IP 2.
|
||||||
van Staveren, H.
|
van Staveren, H.
|
||||||
The table driven code generator from the Amsterdam Compiler Kit.
|
The table driven code generator from the Amsterdam Compiler Kit.
|
||||||
Vrije Universiteit, Amsterdam, (July 11, 1983).
|
Vrije Universiteit, Amsterdam, (July 11, 1983).
|
||||||
|
@ -2117,43 +1883,7 @@ Vrije Universiteit, Amsterdam, (July 11, 1983).
|
||||||
.PP
|
.PP
|
||||||
The defining document for writing a back end table.
|
The defining document for writing a back end table.
|
||||||
.RE
|
.RE
|
||||||
.IP 5.
|
.IP 3.
|
||||||
Steel, T.B., Jr. UNCOL: The Myth and the Fact. in
|
|
||||||
.B
|
|
||||||
Ann. Rev. Auto. Prog.
|
|
||||||
.R
|
|
||||||
Goodman, R. (ed.), vol 2., (1960), 325-344.
|
|
||||||
.RS
|
|
||||||
.PP
|
|
||||||
An introduction to the UNCOL idea by its originator.
|
|
||||||
.RE
|
|
||||||
.IP 6.
|
|
||||||
Steel. T.B., Jr. A first Version of UNCOL.
|
|
||||||
.B
|
|
||||||
Proc. Western Joint Comp. Conf.
|
|
||||||
.R
|
|
||||||
,
|
|
||||||
(1961), 371-377.
|
|
||||||
.IP 7.
|
|
||||||
Tanenbaum, A.S., Stevenson, J.W., Keizer, E.G., and van Staveren,
|
|
||||||
H.
|
|
||||||
A Practical Tool Kit for Making Portable Compilers.
|
|
||||||
Informatica Rapport 74, Vrije Universiteit, Amsterdam, 1983.
|
|
||||||
.RS
|
|
||||||
.PP
|
|
||||||
An overview on the Amsterdam Compiler Kit.
|
|
||||||
.RE
|
|
||||||
.IP 8.
|
|
||||||
Tanenbaum, A.S., Stevenson, J.W., Keizer, E.G., and van Staveren,
|
|
||||||
H.
|
|
||||||
Description of an Experimental Machine Architecture for use with
|
|
||||||
Block Structured Languages.
|
|
||||||
Informatica Rapport 81, Vrije Universiteit, Amsterdam, 1983.
|
|
||||||
.RS
|
|
||||||
.PP
|
|
||||||
The defining document for EM.
|
|
||||||
.RE
|
|
||||||
.IP 9.
|
|
||||||
Tanenbaum, A.S. Structured Computer Organization.
|
Tanenbaum, A.S. Structured Computer Organization.
|
||||||
Prentice Hall. (1976).
|
Prentice Hall. (1976).
|
||||||
.RS
|
.RS
|
||||||
|
|
30
doc/Makefile
30
doc/Makefile
|
@ -2,14 +2,19 @@
|
||||||
|
|
||||||
SUF=pr
|
SUF=pr
|
||||||
PRINT=cat
|
PRINT=cat
|
||||||
RESFILES=cref.$(SUF) pcref.$(SUF) val.$(SUF) v7bugs.$(SUF) install.$(SUF)\
|
|
||||||
ack.$(SUF) cg.$(SUF) regadd.$(SUF) peep.$(SUF) toolkit.$(SUF) LLgen.$(SUF)\
|
|
||||||
basic.$(SUF) 6500.$(SUF) ncg.$(SUF) i80.$(SUF)
|
|
||||||
NROFF=nroff
|
NROFF=nroff
|
||||||
|
TBL=tbl
|
||||||
|
EQN=eqn
|
||||||
MS=-ms
|
MS=-ms
|
||||||
|
|
||||||
|
RESFILES= \
|
||||||
|
toolkit.$(SUF) install.$(SUF) ack.$(SUF) v7bugs.$(SUF) \
|
||||||
|
peep.$(SUF) cg.$(SUF) ncg.$(SUF) regadd.$(SUF) LLgen.$(SUF) \
|
||||||
|
basic.$(SUF) cref.$(SUF) pcref.$(SUF) val.$(SUF) \
|
||||||
|
6500.$(SUF) i80.$(SUF) z80.$(SUF)
|
||||||
|
|
||||||
cref.$(SUF): cref.doc
|
cref.$(SUF): cref.doc
|
||||||
tbl $? | $(NROFF) >$@
|
$(TBL) $? | $(NROFF) >$@
|
||||||
v7bugs.$(SUF): v7bugs.doc
|
v7bugs.$(SUF): v7bugs.doc
|
||||||
$(NROFF) $(MS) $? >$@
|
$(NROFF) $(MS) $? >$@
|
||||||
ack.$(SUF): ack.doc
|
ack.$(SUF): ack.doc
|
||||||
|
@ -17,11 +22,11 @@ ack.$(SUF): ack.doc
|
||||||
cg.$(SUF): cg.doc
|
cg.$(SUF): cg.doc
|
||||||
$(NROFF) $(MS) $? >$@
|
$(NROFF) $(MS) $? >$@
|
||||||
ncg.$(SUF): ncg.doc
|
ncg.$(SUF): ncg.doc
|
||||||
tbl $? | $(NROFF) $(MS) >$@
|
$(TBL) $? | $(NROFF) $(MS) >$@
|
||||||
regadd.$(SUF): regadd.doc
|
regadd.$(SUF): regadd.doc
|
||||||
$(NROFF) $(MS) $? >$@
|
$(NROFF) $(MS) $? >$@
|
||||||
install.$(SUF): install.doc
|
install.$(SUF): install.doc
|
||||||
$(NROFF) $(MS) $? >$@
|
$(TBL) $? | $(NROFF) $(MS) >$@
|
||||||
pcref.$(SUF): pcref.doc
|
pcref.$(SUF): pcref.doc
|
||||||
$(NROFF) $? >$@
|
$(NROFF) $? >$@
|
||||||
basic.$(SUF): basic.doc
|
basic.$(SUF): basic.doc
|
||||||
|
@ -33,23 +38,26 @@ val.$(SUF): val.doc
|
||||||
toolkit.$(SUF): toolkit.doc
|
toolkit.$(SUF): toolkit.doc
|
||||||
$(NROFF) $(MS) $? >$@
|
$(NROFF) $(MS) $? >$@
|
||||||
LLgen.$(SUF): LLgen.doc
|
LLgen.$(SUF): LLgen.doc
|
||||||
eqn $? | tbl | $(NROFF) $(MS) >$@
|
$(EQN) $? | $(TBL) | $(NROFF) $(MS) >$@
|
||||||
6500.$(SUF): 6500.doc
|
6500.$(SUF): 6500.doc
|
||||||
$(NROFF) $(MS) $? >$@
|
$(TBL) $? | $(NROFF) $(MS) >$@
|
||||||
i80.$(SUF): i80.doc
|
i80.$(SUF): i80.doc
|
||||||
$(NROFF) $(MS) $? >$@
|
$(NROFF) $(MS) $? >$@
|
||||||
|
z80.$(SUF): z80.doc
|
||||||
|
$(NROFF) $(MS) $? >$@
|
||||||
|
|
||||||
install cmp:
|
install cmp:
|
||||||
|
|
||||||
distr: install.doc
|
distr: install.doc
|
||||||
tbl install.doc | nroff -Tlp $(MS) >install.pr
|
tbl install.doc | nroff -Tlp $(MS) >install.pr
|
||||||
|
|
||||||
pr:
|
pr:
|
||||||
@make "SUF="$SUF "NROFF="$NROFF "PRINT="$PRINT $(RESFILES) \
|
@make "SUF="$(SUF) "NROFF="$(NROFF) \
|
||||||
>make.pr.out 2>&1
|
$(RESFILES) >make.pr.out 2>&1
|
||||||
@$(PRINT) $(RESFILES)
|
@$(PRINT) $(RESFILES)
|
||||||
|
|
||||||
opr:
|
opr:
|
||||||
make pr | opr
|
make pr | opr
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f *.old $(RESFILES) *.t
|
-rm -f *.old $(RESFILES) *.t *.out
|
||||||
|
|
212
doc/ack.doc
212
doc/ack.doc
|
@ -1,7 +1,6 @@
|
||||||
.\" $Header$
|
.\" $Header$
|
||||||
.nr LL 7.5i
|
|
||||||
.tr ~
|
|
||||||
.nr PD 1v
|
.nr PD 1v
|
||||||
|
.tr ~
|
||||||
.TL
|
.TL
|
||||||
Ack Description File
|
Ack Description File
|
||||||
.br
|
.br
|
||||||
|
@ -9,7 +8,7 @@ Reference Manual
|
||||||
.AU
|
.AU
|
||||||
Ed Keizer
|
Ed Keizer
|
||||||
.AI
|
.AI
|
||||||
Wiskundig Seminarium
|
Vakgroep Informatica
|
||||||
Vrije Universiteit
|
Vrije Universiteit
|
||||||
Amsterdam
|
Amsterdam
|
||||||
.NH
|
.NH
|
||||||
|
@ -24,16 +23,16 @@ source file.
|
||||||
Each transformation table entry tells which input suffixes are
|
Each transformation table entry tells which input suffixes are
|
||||||
allowed and what suffix/name the output file has.
|
allowed and what suffix/name the output file has.
|
||||||
When the output file does not already satisfy the request of the
|
When the output file does not already satisfy the request of the
|
||||||
user, with the flag \fB-c.suffix\fP, the table is scanned
|
user, with the flag \fB\-c.suffix\fP, the table is scanned
|
||||||
starting with the next transformation in the table for another
|
starting with the next transformation in the table for another
|
||||||
transformation that has as input suffix the output suffix of
|
transformation that has as input suffix the output suffix of
|
||||||
the previous transformation.
|
the previous transformation.
|
||||||
A few special transformations are recognized, among them is the
|
A few special transformations are recognized, among them is the
|
||||||
combiner.
|
combiner.
|
||||||
A program combining several files into one.
|
A program combining several files into one.
|
||||||
When no stop suffix was specified (flag \fB-c.suffix\fP) \fIack\fP
|
When no stop suffix was specified (flag \fB\-c.suffix\fP) \fIack\fP
|
||||||
stops after executing the combiner with as arguments the -
|
stops after executing the combiner with as arguments the \-
|
||||||
possibly transformed - input files and libraries.
|
possibly transformed \- input files and libraries.
|
||||||
\fIAck\fP will only perform the transformations in the order in
|
\fIAck\fP will only perform the transformations in the order in
|
||||||
which they are presented in the table.
|
which they are presented in the table.
|
||||||
.LP
|
.LP
|
||||||
|
@ -60,7 +59,7 @@ convoluted.
|
||||||
First, when the last filename in the program call name is not
|
First, when the last filename in the program call name is not
|
||||||
one of \fIack\fP, \fIcc\fP, \fIacc\fP, \fIpc\fP or \fIapc\fP,
|
one of \fIack\fP, \fIcc\fP, \fIacc\fP, \fIpc\fP or \fIapc\fP,
|
||||||
this filename is used as the backend description name.
|
this filename is used as the backend description name.
|
||||||
Second, when the \fB-m\fP is present the \fB-m\fP is chopped of this
|
Second, when the \fB\-m\fP is present the \fB\-m\fP is chopped of this
|
||||||
flag and the rest is used as the backend description name.
|
flag and the rest is used as the backend description name.
|
||||||
Third, when both failed the shell environment variable ACKM is
|
Third, when both failed the shell environment variable ACKM is
|
||||||
used.
|
used.
|
||||||
|
@ -119,8 +118,8 @@ Syntax: (\fIsuffix sequence\fP:\fIsuffix sequence\fP=\fItext\fP)
|
||||||
.br
|
.br
|
||||||
Example: (.c.p.e:.e=tail_em)
|
Example: (.c.p.e:.e=tail_em)
|
||||||
.br
|
.br
|
||||||
If the two suffix sequences have a common member -~\&.e in this
|
If the two suffix sequences have a common member \-~\&.e in this
|
||||||
case~- the text is produced.
|
case~\- the text is produced.
|
||||||
When no common member is present the empty string is produced.
|
When no common member is present the empty string is produced.
|
||||||
Thus the example given is a constant expression.
|
Thus the example given is a constant expression.
|
||||||
Normally, one of the suffix sequences is produced by variable
|
Normally, one of the suffix sequences is produced by variable
|
||||||
|
@ -134,17 +133,17 @@ the text following the \fIneed\fP is appended to both the HEAD and
|
||||||
TAIL variable.
|
TAIL variable.
|
||||||
The value of the variable RTS is determined by the first
|
The value of the variable RTS is determined by the first
|
||||||
transformation used with a \fIrts\fP property.
|
transformation used with a \fIrts\fP property.
|
||||||
.LP
|
.IP
|
||||||
Two runtime flags have effect on the value of one or more of
|
Two runtime flags have effect on the value of one or more of
|
||||||
these variables.
|
these variables.
|
||||||
The flag \fB-.suffix\fP has the same effect on these three variables
|
The flag \fB\-.suffix\fP has the same effect on these three variables
|
||||||
as if a file with that \fBsuffix\fP was included in the argument list
|
as if a file with that \fBsuffix\fP was included in the argument list
|
||||||
and had to be translated.
|
and had to be translated.
|
||||||
The flag \fB-r.suffix\fP only has that effect on the TAIL
|
The flag \fB\-r.suffix\fP only has that effect on the TAIL
|
||||||
variable.
|
variable.
|
||||||
The program call names \fIacc\fP and \fIcc\fP have the effect
|
The program call names \fIacc\fP and \fIcc\fP have the effect
|
||||||
of an automatic \fB-.c\fB flag.
|
of an automatic \fB\-.c\fP flag.
|
||||||
\fIApc\fP and \fIpc\fP have the effect of an automatic \fB-.p\fP flag.
|
\fIApc\fP and \fIpc\fP have the effect of an automatic \fB\-.p\fP flag.
|
||||||
.IP "Line splitting"
|
.IP "Line splitting"
|
||||||
.br
|
.br
|
||||||
The string is transformed into a sequence of strings by replacing
|
The string is transformed into a sequence of strings by replacing
|
||||||
|
@ -168,7 +167,7 @@ of the line.
|
||||||
Three special two-characters sequences exist: \e#, \e\e and
|
Three special two-characters sequences exist: \e#, \e\e and
|
||||||
\e<newline>.
|
\e<newline>.
|
||||||
Their effect is described under 'backslashing' above.
|
Their effect is described under 'backslashing' above.
|
||||||
Each - nonempty - line starts with a keyword, possibly
|
Each \- nonempty \- line starts with a keyword, possibly
|
||||||
preceded by blank space.
|
preceded by blank space.
|
||||||
The keyword can be followed by a further specification.
|
The keyword can be followed by a further specification.
|
||||||
The two are separated by blank space.
|
The two are separated by blank space.
|
||||||
|
@ -193,7 +192,7 @@ The lines in between associate properties to a transformation
|
||||||
and may be presented in any order.
|
and may be presented in any order.
|
||||||
The identifier after the \fIname\fP keyword determines the name
|
The identifier after the \fIname\fP keyword determines the name
|
||||||
of the transformation.
|
of the transformation.
|
||||||
This name is used for debugging and by the \fB-R\fP flag.
|
This name is used for debugging and by the \fB\-R\fP flag.
|
||||||
The keywords are used to specify which input suffices are
|
The keywords are used to specify which input suffices are
|
||||||
recognized by that transformation,
|
recognized by that transformation,
|
||||||
the program to run, the arguments to be handed to that program
|
the program to run, the arguments to be handed to that program
|
||||||
|
@ -212,7 +211,7 @@ keyword. All other transformations do.
|
||||||
.IP \fIto\fP
|
.IP \fIto\fP
|
||||||
.br
|
.br
|
||||||
followed by the suffix of the output file name or in the case of a
|
followed by the suffix of the output file name or in the case of a
|
||||||
linker -~indicated by C option after the \fIprop\fP keyword~-
|
linker \-~indicated by C option after the \fIprop\fP keyword~\-
|
||||||
the output file name.
|
the output file name.
|
||||||
.IP \fIprogram\fP
|
.IP \fIprogram\fP
|
||||||
.br
|
.br
|
||||||
|
@ -235,9 +234,9 @@ assignment separated by blank space.
|
||||||
As soon as both description files are read, \fIack\fP looks
|
As soon as both description files are read, \fIack\fP looks
|
||||||
at all transformations in these files to find a match for the
|
at all transformations in these files to find a match for the
|
||||||
flags given to \fIack\fP.
|
flags given to \fIack\fP.
|
||||||
The flags \fB-m\fP, \fB-o\fP,
|
The flags \fB\-m\fP, \fB\-o\fP,
|
||||||
\fI-O\fP, \fB-r\fP, \fB-v\fP, \fB-g\fP, -\fB-c\fP, \fB-t\fP,
|
\fB\-O\fP, \fB\-r\fP, \fB\-v\fP, \fB\-g\fP, \-\fB\-c\fP, \fB\-t\fP,
|
||||||
\fB-k\fP, \fB-R\fP and -\f-.\fP are specific to \fIack\fP and
|
\fB\-k\fP, \fB\-R\fP and \-\fB\-.\fP are specific to \fIack\fP and
|
||||||
not handed down to any transformation.
|
not handed down to any transformation.
|
||||||
The matching is performed in the order in which the entries
|
The matching is performed in the order in which the entries
|
||||||
appear in the definition.
|
appear in the definition.
|
||||||
|
@ -249,11 +248,11 @@ replaced by the characters matched by
|
||||||
the * in the expression.
|
the * in the expression.
|
||||||
The right hand part is also subject to variable replacement.
|
The right hand part is also subject to variable replacement.
|
||||||
The variable will probably be used in the program arguments.
|
The variable will probably be used in the program arguments.
|
||||||
The \fB-l\fP flags are special,
|
The \fB\-l\fP flags are special,
|
||||||
the order in which they are presented to \fIack\fP must be
|
the order in which they are presented to \fIack\fP must be
|
||||||
preserved.
|
preserved.
|
||||||
The identifier LNAME is used in conjunction with the scanning of
|
The identifier LNAME is used in conjunction with the scanning of
|
||||||
\fB-l\fP flags.
|
\fB\-l\fP flags.
|
||||||
The value assigned to LNAME is used to replace the flag.
|
The value assigned to LNAME is used to replace the flag.
|
||||||
The example further on shows the use all this.
|
The example further on shows the use all this.
|
||||||
.IP \fIargs\fP
|
.IP \fIargs\fP
|
||||||
|
@ -261,13 +260,13 @@ The example further on shows the use all this.
|
||||||
The keyword is followed by the program call arguments.
|
The keyword is followed by the program call arguments.
|
||||||
It is subject to backslashing, variable replacement, expression
|
It is subject to backslashing, variable replacement, expression
|
||||||
replacement, line splitting and IO replacement.
|
replacement, line splitting and IO replacement.
|
||||||
The variables assigned to by \fImapflags\P will probably be
|
The variables assigned to by \fImapflags\fP will probably be
|
||||||
used here.
|
used here.
|
||||||
The flags not recognized by \fIack\fP or any of the transformations
|
The flags not recognized by \fIack\fP or any of the transformations
|
||||||
are passed to the linker and inserted before all other arguments.
|
are passed to the linker and inserted before all other arguments.
|
||||||
.IP \fIprop\fB
|
.IP \fIprop\fP
|
||||||
.br
|
.br
|
||||||
This -~optional~- keyword is followed by a sequence of options,
|
This \-~optional~\- keyword is followed by a sequence of options,
|
||||||
each option is indicated by one character
|
each option is indicated by one character
|
||||||
signifying a special property of the transformation.
|
signifying a special property of the transformation.
|
||||||
The possible options are:
|
The possible options are:
|
||||||
|
@ -282,18 +281,18 @@ The possible options are:
|
||||||
.DE
|
.DE
|
||||||
.IP \fIrts\fP
|
.IP \fIrts\fP
|
||||||
.br
|
.br
|
||||||
This -~optional~- keyword indicates that the rest of the line must be
|
This \-~optional~\- keyword indicates that the rest of the line must be
|
||||||
used to set the variable RTS, if it was not already set.
|
used to set the variable RTS, if it was not already set.
|
||||||
Thus the variable RTS is set by the first transformation
|
Thus the variable RTS is set by the first transformation
|
||||||
executed which such a property or as a result from \fIack\fP's program
|
executed which such a property or as a result from \fIack\fP's program
|
||||||
call name (acc, cc, apc or pc) or by the \fB-.suffix\fP flag.
|
call name (acc, cc, apc or pc) or by the \fB\-.suffix\fP flag.
|
||||||
.IP \fIneed\fP
|
.IP \fIneed\fP
|
||||||
.br
|
.br
|
||||||
This -~optional~- keyword indicates that the rest of the line must be
|
This \-~optional~\- keyword indicates that the rest of the line must be
|
||||||
concatenated to the NEEDS variable.
|
concatenated to the NEEDS variable.
|
||||||
This is done once for every transformation used or indicated
|
This is done once for every transformation used or indicated
|
||||||
by one of the program call names mentioned above or indicated
|
by one of the program call names mentioned above or indicated
|
||||||
by the \fB-.suffix\fP flag.
|
by the \fB\-.suffix\fP flag.
|
||||||
.br
|
.br
|
||||||
.nr PD 1v
|
.nr PD 1v
|
||||||
.NH
|
.NH
|
||||||
|
@ -302,7 +301,7 @@ Conventions used in description files
|
||||||
\fIAck\fP reads two description files.
|
\fIAck\fP reads two description files.
|
||||||
A few of the variables defined in the machine specific file
|
A few of the variables defined in the machine specific file
|
||||||
are used by the descriptions of the front-ends.
|
are used by the descriptions of the front-ends.
|
||||||
Other variables, set by \fack\fB, are of use to all
|
Other variables, set by \fIack\fP, are of use to all
|
||||||
transformations.
|
transformations.
|
||||||
.PP
|
.PP
|
||||||
\fIAck\fP sets the variable EM to the home directory of the
|
\fIAck\fP sets the variable EM to the home directory of the
|
||||||
|
@ -312,7 +311,7 @@ being massaged, this is usefull for debugging.
|
||||||
.br
|
.br
|
||||||
The variable M indicates the
|
The variable M indicates the
|
||||||
directory in mach/{M}/lib/tail_..... and NAME is the string to
|
directory in mach/{M}/lib/tail_..... and NAME is the string to
|
||||||
be defined by the preprocessor with -D{NAME}.
|
be defined by the preprocessor with \-D{NAME}.
|
||||||
The definitions of {w}, {s}, {l}, {d}, {f} and {p} indicate
|
The definitions of {w}, {s}, {l}, {d}, {f} and {p} indicate
|
||||||
EM_WSIZE, EM_SSIZE, EM_LSIZE, EM_DSIZE, EM_FSIZE and EM_PSIZE
|
EM_WSIZE, EM_SSIZE, EM_LSIZE, EM_DSIZE, EM_FSIZE and EM_PSIZE
|
||||||
respectively.
|
respectively.
|
||||||
|
@ -330,91 +329,94 @@ The variables HEAD, TAIL and RTS are set by \fIack\fP and used
|
||||||
to compose the arguments for the linker.
|
to compose the arguments for the linker.
|
||||||
.NH
|
.NH
|
||||||
Example
|
Example
|
||||||
.sp 1
|
.PP
|
||||||
description for front-end
|
Description for front-end
|
||||||
.DS X
|
.DS X
|
||||||
name cpp # the C-preprocessor
|
.ta 4n 40n
|
||||||
# no from, it's governed by the P property
|
name cpp # the C-preprocessor
|
||||||
to .i # result files have suffix i
|
# no from, it's governed by the P property
|
||||||
program {EM}/lib/cpp # pathname of loadfile
|
to .i # result files have suffix i
|
||||||
mapflag -I* CPP_F={CPP_F?} -I* # grab -I.. -U.. and
|
program {EM}/lib/cpp # pathname of loadfile
|
||||||
mapflag -U* CPP_F={CPP_F?} -U* # -D.. to use as arguments
|
mapflag \-I* CPP_F={CPP_F?} \-I* # grab \-I.. \-U.. and
|
||||||
mapflag -D* CPP_F={CPP_F?} -D* # in the variable CPP_F
|
mapflag \-U* CPP_F={CPP_F?} \-U* # \-D.. to use as arguments
|
||||||
args {CPP_F?} {INCLUDES?} -D{NAME} -DEM_WSIZE={w} -DEM_PSIZE={p} \
|
mapflag \-D* CPP_F={CPP_F?} \-D* # in the variable CPP_F
|
||||||
-DEM_SSIZE={s} -DEM_LSIZE={l} -DEM_FSIZE={f} -DEM_DSIZE={d} <
|
args {CPP_F?} {INCLUDES?} \-D{NAME} \-DEM_WSIZE={w} \-DEM_PSIZE={p} \e
|
||||||
# The arguments are: first the -[IUD]...
|
\-DEM_SSIZE={s} \-DEM_LSIZE={l} \-DEM_FSIZE={f} \-DEM_DSIZE={d} <
|
||||||
# then the include dir's for this machine
|
# The arguments are: first the \-[IUD]...
|
||||||
# then the NAME and size valeus finally
|
# then the include dir's for this machine
|
||||||
# followed by the input file name
|
# then the NAME and size valeus finally
|
||||||
prop >P # Output on stdout, is preprocessor
|
# followed by the input file name
|
||||||
|
prop >P # Output on stdout, is preprocessor
|
||||||
end
|
end
|
||||||
name cem # the C-compiler proper
|
name cem # the C-compiler proper
|
||||||
from .c # used for files with suffix .c
|
from .c # used for files with suffix .c
|
||||||
to .k # produces compact code files
|
to .k # produces compact code files
|
||||||
program {EM}/lib/em_cem # pathname of loadfile
|
program {EM}/lib/em_cem # pathname of loadfile
|
||||||
mapflag -p CEM_F={CEM_F?} -Xp # pass -p as -Xp to cem
|
mapflag \-p CEM_F={CEM_F?} \-Xp # pass \-p as \-Xp to cem
|
||||||
mapflag -L CEM_F={CEM_F?} -l # pass -L as -l to cem
|
mapflag \-L CEM_F={CEM_F?} \-l # pass \-L as \-l to cem
|
||||||
args -Vw{w}i{w}p{p}f{f}s{s}l{l}d{d} {CEM_F?}
|
args \-Vw{w}i{w}p{p}f{f}s{s}l{l}d{d} {CEM_F?}
|
||||||
# the arguments are the object sizes in
|
# the arguments are the object sizes in
|
||||||
# the -V... flag and possibly -l and -Xp
|
# the \-V... flag and possibly \-l and \-Xp
|
||||||
prop <>p # input on stdin, output on stdout, use cpp
|
prop <>p # input on stdin, output on stdout, use cpp
|
||||||
rts .c # use the C run-time system
|
rts .c # use the C run-time system
|
||||||
need .c # use the C libraries
|
need .c # use the C libraries
|
||||||
end
|
end
|
||||||
name decode # make human readable files from compact code
|
name decode # make human readable files from compact code
|
||||||
from .k.m # accept files with suffix .k or .m
|
from .k.m # accept files with suffix .k or .m
|
||||||
to .e # produce .e files
|
to .e # produce .e files
|
||||||
program {EM}/lib/em_decode # pathname of loadfile
|
program {EM}/lib/em_decode # pathname of loadfile
|
||||||
args < # the input file name is the only argument
|
args < # the input file name is the only argument
|
||||||
prop > # the output comes on stdout
|
prop > # the output comes on stdout
|
||||||
end
|
end
|
||||||
.DE
|
.DE
|
||||||
|
|
||||||
.DS X
|
.DS X
|
||||||
|
.ta 4n 40n
|
||||||
Example of a backend, in this case the EM assembler/loader.
|
Example of a backend, in this case the EM assembler/loader.
|
||||||
|
|
||||||
var w=2 # wordsize 2
|
var w=2 # wordsize 2
|
||||||
var p=2 # pointersize 2
|
var p=2 # pointersize 2
|
||||||
var s=2 # short size 2
|
var s=2 # short size 2
|
||||||
var l=4 # long size 4
|
var l=4 # long size 4
|
||||||
var f=4 # float size 4
|
var f=4 # float size 4
|
||||||
var d=8 # double size 8
|
var d=8 # double size 8
|
||||||
var M=int # Unused in this example
|
var M=int # Unused in this example
|
||||||
var NAME=int22 # for cpp (NAME=int results in #define int 1)
|
var NAME=int22 # for cpp (NAME=int results in #define int 1)
|
||||||
var LIB=mach/int/lib/tail_ # part of file name for libraries
|
var LIB=mach/int/lib/tail_ # part of file name for libraries
|
||||||
var RT=mach/int/lib/head_ # part of file name for run-time startoff
|
var RT=mach/int/lib/head_ # part of file name for run-time startoff
|
||||||
var SIZE_FLAG=-sm # default internal table size flag
|
var SIZE_FLAG=\-sm # default internal table size flag
|
||||||
var INCLUDES=-I{EM}/include # use {EM}/include for #include files
|
var INCLUDES=\-I{EM}/include # use {EM}/include for #include files
|
||||||
name asld # Assembler/loader
|
name asld # Assembler/loader
|
||||||
from .k.m.a # accepts compact code and archives
|
from .k.m.a # accepts compact code and archives
|
||||||
to e.out # output file name
|
to e.out # output file name
|
||||||
program {EM}/lib/em_ass # load file pathname
|
program {EM}/lib/em_ass # load file pathname
|
||||||
mapflag -l* LNAME={EM}/{LIB}* # e.g. -ly becomes
|
mapflag \-l* LNAME={EM}/{LIB}* # e.g. \-ly becomes
|
||||||
# {EM}/mach/int/lib/tail_y
|
# {EM}/mach/int/lib/tail_y
|
||||||
mapflag -+* ASS_F={ASS_F?} -+* # recognize -+ and --
|
mapflag \-+* ASS_F={ASS_F?} \-+* # recognize \-+ and \-\-
|
||||||
mapflag --* ASS_F={ASS_F?} --*
|
mapflag \-\-* ASS_F={ASS_F?} \-\-*
|
||||||
mapflag -s* SIZE_FLAG=-s* # overwrite old value of SIZE_FLAG
|
mapflag \-s* SIZE_FLAG=\-s* # overwrite old value of SIZE_FLAG
|
||||||
args {SIZE_FLAG} \
|
args {SIZE_FLAG} \e
|
||||||
({RTS}:.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \
|
({RTS}:.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) \-o > < \e
|
||||||
(.p:{TAIL}={EM}/{LIB}pc) \
|
(.p:{TAIL}={EM}/{LIB}pc) \e
|
||||||
(.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \
|
(.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \e
|
||||||
(.c.p:{TAIL}={EM}/{LIB}mon)
|
(.c.p:{TAIL}={EM}/{LIB}mon)
|
||||||
# -s[sml] must be first argument
|
# \-s[sml] must be first argument
|
||||||
# the next line contains the choice for head_cc or head_pc
|
# the next line contains the choice for head_cc or head_pc
|
||||||
# and the specification of in- and output.
|
# and the specification of in- and output.
|
||||||
# the last three args lines choose libraries
|
# the last three args lines choose libraries
|
||||||
prop C # This is the final stage
|
prop C # This is the final stage
|
||||||
end
|
end
|
||||||
.DE
|
.DE
|
||||||
|
|
||||||
The command "ack -mint -v -v -I../h -L -ly prog.c"
|
The command \fIack \-mint \-v \-v \-I../h \-L \-ly prog.c\fP
|
||||||
would result in the following
|
would result in the following
|
||||||
calls (with exec(II)):
|
calls (with exec(II)):
|
||||||
.DS X
|
.DS X
|
||||||
1) /lib/cpp -I../h -I/usr/em/include -Dint22 -DEM_WSIZE=2 -DEM_PSIZE=2
|
.ta 4n
|
||||||
-DEM_SSIZE=2 -DEM_LSIZE=4 -DEM_FSIZE=4 -DEM_DSIZE=8 prog.c
|
1) /lib/cpp \-I../h \-I/usr/em/include \-Dint22 \-DEM_WSIZE=2 \-DEM_PSIZE=2 \e
|
||||||
2) /usr/em/lib/em_cem -Vw2i2p2f4s2l4d8 -l
|
\-DEM_SSIZE=2 \-DEM_LSIZE=4 \-DEM_FSIZE=4 \-DEM_DSIZE=8 prog.c
|
||||||
3) /usr/em/lib/em_ass -sm /usr/em/mach/int/lib/head_cc -o e.out prog.k
|
2) /usr/em/lib/em_cem \-Vw2i2p2f4s2l4d8 \-l
|
||||||
/usr/em/mach/int/lib/tail_y /usr/em/mach/int/lib/tail_cc.1s
|
3) /usr/em/lib/em_ass \-sm /usr/em/mach/int/lib/head_cc \-o e.out prog.k
|
||||||
/usr/em/mach/int/lib/tail_cc.2g /usr/em/mach/int/lib/tail_mon
|
/usr/em/mach/int/lib/tail_y /usr/em/mach/int/lib/tail_cc.1s
|
||||||
|
/usr/em/mach/int/lib/tail_cc.2g /usr/em/mach/int/lib/tail_mon
|
||||||
.DE
|
.DE
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
.\" $Header$
|
.\" $Header$
|
||||||
.RP
|
.RP
|
||||||
|
.ND Nov 1984
|
||||||
.TL
|
.TL
|
||||||
The table driven code generator from
|
The table driven code generator from
|
||||||
.br
|
.br
|
||||||
|
@ -17,6 +18,11 @@ The Amsterdam Compiler Kit is such a collection of tools.
|
||||||
This document provides a description of the internal workings
|
This document provides a description of the internal workings
|
||||||
of the table driven code generator in the Amsterdam Compiler Kit,
|
of the table driven code generator in the Amsterdam Compiler Kit,
|
||||||
and a description of syntax and semantics of the driving table.
|
and a description of syntax and semantics of the driving table.
|
||||||
|
.PP
|
||||||
|
>>> NOTE <<<
|
||||||
|
.br
|
||||||
|
This document pertains to the \fBold\fP code generator. Refer to the
|
||||||
|
"Second Revised Edition" for the new code generator.
|
||||||
.AE
|
.AE
|
||||||
.NH 1
|
.NH 1
|
||||||
Introduction
|
Introduction
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
.\" $Header$
|
.\" $Header$
|
||||||
.ll 72
|
|
||||||
.nr ID 4
|
.nr ID 4
|
||||||
.de hd
|
.de hd
|
||||||
'sp 2
|
'sp 2
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
. \" $Header$
|
||||||
.RP
|
.RP
|
||||||
|
.ND April 1985
|
||||||
.TL
|
.TL
|
||||||
Back end table for the Intel 8080 micro-processor
|
Back end table for the Intel 8080 micro-processor
|
||||||
.AU
|
.AU
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
.\" $Header$
|
.\" $Header$
|
||||||
.nr LL 7.5i
|
|
||||||
.nr PD 1v
|
.nr PD 1v
|
||||||
.TL
|
.TL
|
||||||
Amsterdam Compiler Kit installation guide
|
Amsterdam Compiler Kit Installation Guide
|
||||||
.AU
|
.AU
|
||||||
Ed Keizer
|
Ed Keizer
|
||||||
.AI
|
.AI
|
||||||
Wiskundig Seminarium
|
Vakgroep Informatica
|
||||||
Vrije Universiteit
|
Vrije Universiteit
|
||||||
Amsterdam
|
Amsterdam
|
||||||
.NH
|
.NH
|
||||||
|
@ -33,16 +32,16 @@ The process of installing Amsterdam Compiler Kit is quite simple.
|
||||||
It is important that the original Amsterdam Compiler Kit
|
It is important that the original Amsterdam Compiler Kit
|
||||||
distribution tree structure is restored.
|
distribution tree structure is restored.
|
||||||
Proceed as follows
|
Proceed as follows
|
||||||
.IP " -" 10
|
.IP " \-" 10
|
||||||
Create a directory, for example /usr/em, on a device
|
Create a directory, for example /usr/em, on a device
|
||||||
with at least 15 Megabytes left.
|
with at least 15 Megabytes left.
|
||||||
.IP " -"
|
.IP " \-"
|
||||||
Change to that directory (cd ...); it will be the working directory.
|
Change to that directory (cd ...); it will be the working directory.
|
||||||
.IP " -"
|
.IP " \-"
|
||||||
Extract all files from the distribution medium, for instance
|
Extract all files from the distribution medium, for instance
|
||||||
magtape:
|
magtape:
|
||||||
\fBtar x\fP.
|
\fBtar x\fP.
|
||||||
.IP " -"
|
.IP " \-"
|
||||||
Keep a copy of the original distribution to be able to repeat the process
|
Keep a copy of the original distribution to be able to repeat the process
|
||||||
of installation in case of disasters.
|
of installation in case of disasters.
|
||||||
This copy is also useful as a reference point for diff-listings.
|
This copy is also useful as a reference point for diff-listings.
|
||||||
|
@ -143,29 +142,31 @@ These directories have subdirectories named:
|
||||||
.in +3n
|
.in +3n
|
||||||
.TS
|
.TS
|
||||||
l l.
|
l l.
|
||||||
as the assembler ( *.s + libraries => a.out )
|
|
||||||
cg the backend ( *.m => *.s )
|
cg the backend ( *.m => *.s )
|
||||||
ncg the new backend ( *.m => *.s )
|
ncg the new backend ( *.m => *.s )
|
||||||
|
as the assembler ( *.s + libraries => a.out )
|
||||||
|
cv Conversion programs for a.out files.
|
||||||
|
dl Down-load programs
|
||||||
|
|
||||||
|
libem Sources for EM runtime system, intended to depend only on CPU type
|
||||||
libbc Used to create Basic run-time system and libraries
|
libbc Used to create Basic run-time system and libraries
|
||||||
libcc Used to create C run-time system and libraries
|
libcc Used to create C run-time system and libraries
|
||||||
libpc Used to create Pascal run-time system and libraries
|
libpc Used to create Pascal run-time system and libraries
|
||||||
libem Sources for EM runtime system, intended to depend only on CPU type
|
|
||||||
libsys Sources for system-dependent EM library
|
libsys Sources for system-dependent EM library
|
||||||
test Various tests
|
test Various tests
|
||||||
dl Down-load programs
|
|
||||||
cv Conversion programs for a.out files.
|
|
||||||
int Source for an interpreter
|
int Source for an interpreter
|
||||||
.TE
|
.TE
|
||||||
.in -3n
|
.in -3n
|
||||||
The directory proto contains files used by most machines
|
The directory proto contains files used by most machines,
|
||||||
like machine-independent sources and Makefiles.
|
like machine-independent sources and Makefiles.
|
||||||
.in +3n
|
.in +3n
|
||||||
.TS
|
.TS
|
||||||
l l.
|
l l.
|
||||||
mach/proto/libg Makefile for compiling libraries.
|
|
||||||
mach/proto/as Assembler sources.
|
|
||||||
mach/proto/cg Current backend sources.
|
mach/proto/cg Current backend sources.
|
||||||
mach/proto/ncg New backend sources.
|
mach/proto/ncg New backend sources.
|
||||||
|
mach/proto/as Assembler sources.
|
||||||
|
mach/proto/libg Makefile for compiling libraries.
|
||||||
.TE
|
.TE
|
||||||
.IP "emtest"
|
.IP "emtest"
|
||||||
.br
|
.br
|
||||||
|
@ -277,14 +278,14 @@ first in a directory of the same name.
|
||||||
.LP
|
.LP
|
||||||
These actions are:
|
These actions are:
|
||||||
.sp 1
|
.sp 1
|
||||||
.IP -
|
.IP \-
|
||||||
Automatically checking whether you included the ACK bin directory in your
|
Automatically checking whether you included the ACK bin directory in your
|
||||||
shell PATH.
|
shell PATH.
|
||||||
See also the section on "commands".
|
See also the section on "commands".
|
||||||
.IP -
|
.IP \-
|
||||||
Automatically setting the pathname of the parent directory in ../h/em_path.h.
|
Automatically setting the pathname of the parent directory in ../h/em_path.h.
|
||||||
See also the section on "pathnames".
|
See also the section on "pathnames".
|
||||||
.IP -
|
.IP \-
|
||||||
Asking you for the type of system you have
|
Asking you for the type of system you have
|
||||||
and creating the shell script "ack_sys" in the Kit's bin directory.
|
and creating the shell script "ack_sys" in the Kit's bin directory.
|
||||||
Several utilities make use of "ack_sys" to determine the type of
|
Several utilities make use of "ack_sys" to determine the type of
|
||||||
|
@ -313,12 +314,12 @@ For ANY you can use any name you fancy,
|
||||||
but the Kit will not be able to compile programs for your system.
|
but the Kit will not be able to compile programs for your system.
|
||||||
If you want to do that you have to read the section about "compilation
|
If you want to do that you have to read the section about "compilation
|
||||||
on a different machine".
|
on a different machine".
|
||||||
.IP -
|
.IP \-
|
||||||
Automatically setting the default machine for which code is
|
Automatically setting the default machine for which code is
|
||||||
produced to your own type of system according to the table above.
|
produced to your own type of system according to the table above.
|
||||||
This in done in the file "h/local.h".
|
This in done in the file "h/local.h".
|
||||||
See also the section 8.2.
|
See also the section 8.2.
|
||||||
.IP -
|
.IP \-
|
||||||
Automatically editing a few description files that tell
|
Automatically editing a few description files that tell
|
||||||
ACK to use your system's assembler.
|
ACK to use your system's assembler.
|
||||||
On both the PDP and the VAX the Kit uses the native assembler and linker.
|
On both the PDP and the VAX the Kit uses the native assembler and linker.
|
||||||
|
@ -326,14 +327,14 @@ The description files in lib/pdp/descr, lib/vax2/descr and
|
||||||
lib/vax4/descr have to be altered to prevent
|
lib/vax4/descr have to be altered to prevent
|
||||||
attempts to assemble programs with unsuitable assemblers.
|
attempts to assemble programs with unsuitable assemblers.
|
||||||
The original descr files are copied to descr.orig.
|
The original descr files are copied to descr.orig.
|
||||||
.IP -
|
.IP \-
|
||||||
Automatically installing the special include directory for vax2.
|
Automatically installing the special include directory for vax2.
|
||||||
This will only be done on VAX systems.
|
This will only be done on VAX systems.
|
||||||
The shell scripts needed by ACK for the vax2 backend differ slightly
|
The shell scripts needed by ACK for the vax2 backend differ slightly
|
||||||
from the one issued by Berkeley.
|
from the one issued by Berkeley.
|
||||||
.br
|
.br
|
||||||
Note: this has only been tested under BSD4.1a.
|
Note: this has only been tested under BSD4.1a.
|
||||||
.IP -
|
.IP \-
|
||||||
Automatically editing the system.h file in mach/vax[24]/libem.
|
Automatically editing the system.h file in mach/vax[24]/libem.
|
||||||
Again, only on VAXen.
|
Again, only on VAXen.
|
||||||
These files reflect whether you have BSD4.1a, BSD4.1c or BSD4.2.
|
These files reflect whether you have BSD4.1a, BSD4.1c or BSD4.2.
|
||||||
|
@ -341,7 +342,7 @@ These files reflect whether you have BSD4.1a, BSD4.1c or BSD4.2.
|
||||||
.sp 1
|
.sp 1
|
||||||
Some actions still have to be done by hand.
|
Some actions still have to be done by hand.
|
||||||
.sp 1
|
.sp 1
|
||||||
.IP -
|
.IP \-
|
||||||
The VAX backends cannot be booted on systems
|
The VAX backends cannot be booted on systems
|
||||||
with a 16-bit address space systems.
|
with a 16-bit address space systems.
|
||||||
The program lib/cgg needs more memory than available to transform
|
The program lib/cgg needs more memory than available to transform
|
||||||
|
@ -354,18 +355,18 @@ You will hardly be able to use these, because the
|
||||||
code generated by these programs cannot be
|
code generated by these programs cannot be
|
||||||
assembled and loaded without a native VAX assembler,
|
assembled and loaded without a native VAX assembler,
|
||||||
but its nice to be able to look at the code produced.
|
but its nice to be able to look at the code produced.
|
||||||
.IP -
|
.IP \-
|
||||||
The installation of the PUBMAC macro package is not done
|
The installation of the PUBMAC macro package is not done
|
||||||
automatically because you needs super-user privileges to do
|
automatically because you needs super-user privileges to do
|
||||||
that on most systems.
|
that on most systems.
|
||||||
This macro package is used with several of the documents
|
This macro package is used with several of the documents
|
||||||
provided in the Kit.
|
provided in the Kit.
|
||||||
.IP -
|
.IP \-
|
||||||
UNIX V7 as originally distributed contains a few bugs that
|
UNIX V7 as originally distributed contains a few bugs that
|
||||||
prevent correct execution of some of the larger programs.
|
prevent correct execution of some of the larger programs.
|
||||||
See the section named "Fixes for the UNIX V7 system"
|
See the section named "Fixes for the UNIX V7 system"
|
||||||
about what to do.
|
about what to do.
|
||||||
.IP -
|
.IP \-
|
||||||
The manual files for the Kit can be copied to their
|
The manual files for the Kit can be copied to their
|
||||||
appropriate place in the system by giving the command "make install"
|
appropriate place in the system by giving the command "make install"
|
||||||
in the man directory.
|
in the man directory.
|
||||||
|
@ -788,7 +789,7 @@ Sometimes the system differs so much from V7 that certain manifest constants
|
||||||
do not exist any more.
|
do not exist any more.
|
||||||
At other times these include files were written for a compiler without
|
At other times these include files were written for a compiler without
|
||||||
a restriction on name length.
|
a restriction on name length.
|
||||||
In that case - I've seen it happen - people tend to use differing
|
In that case \- I've seen it happen \- people tend to use differing
|
||||||
identifiers that are identical in the first eight characters.
|
identifiers that are identical in the first eight characters.
|
||||||
All these problems you have to solve yourself,
|
All these problems you have to solve yourself,
|
||||||
the libraries are only included as an extra and too much system
|
the libraries are only included as an extra and too much system
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
.ds OF \\fBtest~off:~\\fR
|
.ds OF \\fBtest~off:~\\fR
|
||||||
.ds ON \\fBtest~on:~~\\fR
|
.ds ON \\fBtest~on:~~\\fR
|
||||||
.ds AL \\fBtest~all:~\\fR
|
.ds AL \\fBtest~all:~\\fR
|
||||||
.ll 72
|
.ll 72n
|
||||||
.wh 0 hd
|
.wh 0 hd
|
||||||
.wh 60 fo
|
.wh 60 fo
|
||||||
.de hd
|
.de hd
|
||||||
|
@ -37,7 +37,7 @@ by
|
||||||
.de VU
|
.de VU
|
||||||
.sp 3
|
.sp 3
|
||||||
.ce 4
|
.ce 4
|
||||||
Wiskundig Seminarium
|
Vakgroep Informatica
|
||||||
Vrije Universiteit
|
Vrije Universiteit
|
||||||
De Boelelaan 1081
|
De Boelelaan 1081
|
||||||
Amsterdam
|
Amsterdam
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
.\" $Header$
|
.\" $Header$
|
||||||
.RP
|
.RP
|
||||||
.ND
|
.ND July 1984
|
||||||
.nr LL 78m
|
|
||||||
.tr ~
|
.tr ~
|
||||||
.ds as *
|
.ds as *
|
||||||
.TL
|
.TL
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" $Header$
|
.\" $Header$
|
||||||
.ll 72
|
.ll 72n
|
||||||
.wh 0 hd
|
.wh 0 hd
|
||||||
.wh 60 fo
|
.wh 60 fo
|
||||||
.de hd
|
.de hd
|
||||||
|
|
70
doc/z80.doc
70
doc/z80.doc
|
@ -1,16 +1,21 @@
|
||||||
|
. \" $Header$
|
||||||
|
.ND April 1985
|
||||||
|
.TL
|
||||||
THE Z80 BACK END TABLE
|
THE Z80 BACK END TABLE
|
||||||
|
.AU
|
||||||
|
Frans van Haarlem
|
||||||
|
.NH 1
|
||||||
INTRODUCTION
|
INTRODUCTION
|
||||||
|
.PP
|
||||||
This table was written to make it run, not to make it clever!
|
This table was written to make it run, not to make it clever!
|
||||||
The effect is, that the table written for the intel 8080,
|
The effect is, that the table written for the intel 8080,
|
||||||
which was made very clever runs faster and requiers less space!!
|
which was made very clever runs faster and requiers less space!!
|
||||||
So, for anyone to run programs on a z80 machine:
|
So, for anyone to run programs on a z80 machine:
|
||||||
You could try to make the table as clever as the one for the i80,
|
You could try to make the table as clever as the one for the i80,
|
||||||
or you could run the i80 table, for that can run on every z80 too.
|
or you could run the i80 table, for that can run on every z80 too.
|
||||||
|
.NH
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
.PP
|
||||||
It will not be possible to run the entire Amsterdam Compiler Kit on a
|
It will not be possible to run the entire Amsterdam Compiler Kit on a
|
||||||
Z80-based computer system.
|
Z80-based computer system.
|
||||||
One has to write a program on another
|
One has to write a program on another
|
||||||
|
@ -24,31 +29,37 @@ for example by downloading or
|
||||||
by storing it in ROM (Read Only Memory).
|
by storing it in ROM (Read Only Memory).
|
||||||
Depending on the characteristics of the particular z80 based system, some
|
Depending on the characteristics of the particular z80 based system, some
|
||||||
adaptions have to be made:
|
adaptions have to be made:
|
||||||
1) In 'head_em': the base address, which is the address where the first
|
.IP 1)
|
||||||
z80 instruction will be stored, and the initial value of the
|
In \fIhead_em\fP: the base address, which is the address where the first
|
||||||
stackpointer are set to 0x1000 and 0x7ffe respectivally.
|
z80 instruction will be stored, and the initial value of the
|
||||||
The latter because it could run on a 32K machine as well.
|
stackpointer are set to 0x1000 and 0x7ffe respectivally.
|
||||||
Other systems require other values.
|
The latter because it could run on a 32K machine as well.
|
||||||
2) In 'head_em': before calling "_m_a_i_n", the environment
|
Other systems require other values.
|
||||||
pointer, argument vector and argument count will have to be pushed
|
.IP 2)
|
||||||
onto the stack.
|
In \fIhead_em\fP: before calling "_m_a_i_n", the environment
|
||||||
Since this back-end is tested on a system without any knowledge
|
pointer, argument vector and argument count will have to be pushed
|
||||||
of these things, dummies are pushed now.
|
onto the stack.
|
||||||
3) In 'tail_em': proper routines "putchar" and "getchar" should
|
Since this back-end is tested on a system without any knowledge
|
||||||
be provided.
|
of these things, dummies are pushed now.
|
||||||
They should write resp. read a character on/from the monitor.
|
.IP 3)
|
||||||
Maybe some conversions will have to be made.
|
In \fItail_em\fP: proper routines "putchar" and "getchar" should
|
||||||
The ones for the Nascom and Hermac z80 micro's are to be found
|
be provided.
|
||||||
in the EM-library.
|
They should write resp. read a character on/from the monitor.
|
||||||
4) In 'head_em': an application program returns control to the monitor by
|
Maybe some conversions will have to be made.
|
||||||
jumping to address 0x20.
|
The ones for the Nascom and Hermac z80 micro's are to be found
|
||||||
If this is not the right way on your system, change it.
|
in the EM-library.
|
||||||
For an CPM-machine for example this should be 0x5, to provide a warm boot.
|
.IP 4)
|
||||||
5) In 'tail_em': the current version of the z80 back-end has very limited I/O
|
In \fIhead_em\fP: an application program returns control to the monitor by
|
||||||
capabilities, because it was tested on a system that
|
jumping to address 0x20.
|
||||||
had no knowlegde of files.
|
If this is not the right way on your system, change it.
|
||||||
So the implementation of the EM-instruction 'mon' is very simple;
|
For an CPM-machine for example this should be 0x5, to provide a warm boot.
|
||||||
it can only do the following things:
|
.IP 5)
|
||||||
|
In \fItail_em\fP: the current version of the z80 back-end has very limited I/O
|
||||||
|
capabilities, because it was tested on a system that
|
||||||
|
had no knowlegde of files.
|
||||||
|
So the implementation of the EM-instruction \fImon\fP is very simple;
|
||||||
|
it can only do the following things:
|
||||||
|
.DS
|
||||||
Monitor call 1:
|
Monitor call 1:
|
||||||
Exit
|
Exit
|
||||||
Monitor call 3:
|
Monitor call 3:
|
||||||
|
@ -64,5 +75,6 @@ adaptions have to be made:
|
||||||
close file, returns error code = 0.
|
close file, returns error code = 0.
|
||||||
Monitor call 54:
|
Monitor call 54:
|
||||||
io-control, returns error code = 0.
|
io-control, returns error code = 0.
|
||||||
|
.DE
|
||||||
If the system should do file-handling the routine ".mon"
|
If the system should do file-handling the routine ".mon"
|
||||||
should be extended thoroughly.
|
should be extended thoroughly.
|
||||||
|
|
Loading…
Add table
Reference in a new issue