Fix some groff warnings. adapt mkdispatch to ANSI C.

This commit is contained in:
carl 2019-05-11 01:05:02 +08:00
parent ccfd8a3e18
commit 7a642d6df3
9 changed files with 717 additions and 521 deletions

View file

@ -405,7 +405,7 @@ The code rule section is the largest section in the table.
They specify EM patterns, stack patterns, code to be generated,
etc.
The syntax is:
.IP code rule:
.IP "code rule:"
EM pattern '|' stack pattern '|' code '|'
stack replacement '|' EM replacement '|'
.PP

View file

@ -9,7 +9,6 @@
. if t .ds <, ,\
\}\
\}
.cs 5 22u
.ND
.EQ
delim @@

View file

@ -1333,23 +1333,20 @@ Tables.c
Tables.c contains a large number of initialized array's of all sorts.
Description of each follows:
.br
.in 1i
.ti -0.5i
byte code rules[]
.IP "byte code rules[]"
.br
Pseudo code interpreted by the code generator.
Always starts with some opcode followed by operands depending
on the opcode.
Integers in this table are between 0 and 32767 and have a one byte
encoding if between 0 and 127.
.ti -0.5i
char stregclass[]
.IP "char stregclass[]"
.br
Number of computed static register class per register.
Two registers are in the same class if they have the same properties
and don't share a common subregister.
.ti -0.5i
struct reginfo machregs[]
.IP "struct reginfo machregs[]"
.br
Info per register.
Initialized with representation string, size,
@ -1357,78 +1354,66 @@ members of the register and set of registers affected when this
one is changed.
Also contains room for runtime information,
like contents and reference count.
.ti -0.5i
tkdef_t tokens[]
.IP "tkdef_t tokens[]"
.br
Information per tokentype.
Initialized with size, cost, type of operands and formatstring.
.ti -0.5i
node_t enodes[]
.IP "node_t enodes[]"
.br
List of triples representing expressions for the code generator.
.ti -0.5i
string code strings[]
.IP "string code strings[]"
.br
List of strings.
All strings are put in a list and checked for duplication,
so only one copy per string will reside here.
.ti -0.5i
set_t machsets[]
.IP "set_t machsets[]"
.br
List of token expression sets.
Bit 0 of the set is used for the SCRATCH property of registers,
bit 1 upto NREG are for the corresponding registers
and bit NREG+1 upto the end are for corresponding tokens.
.ti -0.5i
inst_t tokeninstances[]
.IP "inst_t tokeninstances[]"
.br
List of descriptions for building tokens.
Contains type of rule for building one,
plus operands depending on the type.
.ti -0.5i
move_t moves[]
.IP "move_t moves[]"
.br
List of move rules.
Contains token expressions for source and destination
plus cost and index for code rule.
.ti -0.5i
byte pattern[]
.IP "byte pattern[]"
.br
EM patterns.
This is structured internally as chains of patterns,
each chain pointed at by pathash[].
After each pattern the list of possible code rules is given.
.ti -0.5i
int pathash[256]
.IP "int pathash[256]"
.br
Indices into pattern[] for all patterns with a certain low order
byte of the hashing function.
.ti -0.5i
c1_t c1coercs[]
.IP "c1_t c1coercs[]"
.br
List of rules to stack tokens.
Contains token expressions,
register needed,
cost
and code rule.
.ti -0.5i
c2_t c2coercs[]
.IP "c2_t c2coercs[]"
.br
List of splitting coercions.
Token expressions,
split factor,
replacements
and code rule.
.ti -0.5i
c3_t c3coercs[]
.IP "c3_t c3coercs[]"
.br
List of one to one coercions.
Token expressions,
register needed,
replacement
and code rule.
.ti -0.5i
struct reginfo **reglist[]
.IP "struct reginfo **reglist[]"
.br
List of lists of pointers to register information.
For every property the list is here

View file

@ -7,4 +7,3 @@
.ds >, ,
.ds [. " [
.ds .] ]
.cs 5 22

View file

@ -34,8 +34,7 @@ Instruction labels are unsigned positive integers.
The scope of an instruction label is its procedure.
.QQ
The pseudoinstructions CON, ROM and BSS may be preceded by a
line containing a
1\-8 character data label, the first character of which is a
line containing a character based data label, the first character of which is a
letter, period or underscore.
The period may only be followed by
digits, the others may be followed by letters, digits and underscores.
@ -200,7 +199,7 @@ l l l.
<ilb>:\&=:instruction label
::'*' followed by an integer in the range 0..32767.
<pro>:\&=:procedure number ('$' followed by a procedure name)
<val>:\&=:<arg>, <con>, <pro> or <ilb>.
<val>:\&=:<arg>, <con>, <str>, <pro> or <ilb>.
<par>:\&=:<val> or <str>
<...>*:\&=:zero or more of <...>
<...>+:\&=:one or more of <...>

View file

@ -5,7 +5,10 @@
*/
#include "ip_spec.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "em_spec.h"
#include "em_flag.h"
@ -36,60 +39,91 @@ char esca2[] = "escape2" ;
extern char em_flag[];
main(argc,argv) char **argv ; {
if ( argc>1 ) {
if ( freopen(argv[1],"r",stdin)==NULL) {
char *ident(void);
void check(int);
int decflag(char *);
void checkall(void);
void chkc(int, int, int, int);
void ckop(int, int, int, int);
int readchar(void);
void pushback(int);
void writeout(void);
void prx(register int, int, int);
void readin(void);
int getmnem(char *);
void error(char *str, ...);
void mess(char *str, ...);
void fatal(char *str, ...);
int main(int argc, char **argv)
{
if (argc > 1)
{
if (freopen(argv[1], "r", stdin) == NULL)
{
fatal("Cannot open %s", argv[1]);
}
}
if ( argc>2 ) {
if ( freopen(argv[2],"w",stdout)==NULL) {
if (argc > 2)
{
if (freopen(argv[2], "w", stdout) == NULL)
{
fatal("Cannot create %s", argv[2]);
}
}
if ( argc>3 ) {
if (argc > 3)
{
fatal("%s [ file [ file ] ]", argv[0]);
}
atend = 0;
readin();
atend = 1;
checkall();
if ( nerror==0 ) {
if (nerror == 0)
{
writeout();
}
exit(nerror);
}
readin() {
void readin(void)
{
register struct opform *nextform;
char *ident();
char *firstid;
for ( nextform=intable ;
!feof(stdin) && nextform<&intable[NOTAB] ; ) {
for (nextform = intable; !feof(stdin) && nextform < &intable[NOTAB];)
{
firstid = ident();
if ( *firstid=='\n' || feof(stdin) ) continue ;
if (*firstid == '\n' || feof(stdin))
continue;
lastform = nextform;
nextform->i_opcode = getmnem(firstid);
nextform->i_flag = decflag(ident());
switch ( nextform->i_flag&OPTYPE ) {
switch (nextform->i_flag & OPTYPE)
{
case OPMINI:
case OPSHORT:
nextform->i_num = atoi(ident());
break;
}
nextform->i_low = atoi(ident());
if ( *ident()!='\n' ) {
if (*ident() != '\n')
{
int c;
error("End of line expected");
while ( (c=readchar())!='\n' && c!=EOF ) ;
while ((c = readchar()) != '\n' && c != EOF)
;
}
nextform++;
}
if ( !feof(stdin) ) fatal("Internal table too small") ;
if (!feof(stdin))
fatal("Internal table too small");
}
char *ident() {
char *ident(void)
{
/* skip spaces and tabs, anything up to space,tab or eof is
a identifier.
Anything from # to end-of-line is an end-of-line.
@ -100,63 +134,94 @@ char *ident() {
register int c;
register char *cc;
do {
do
{
c = readchar();
} while (c == ' ' || c == '\t');
for ( cc=array ; cc<&array[(sizeof array) - 1] ; cc++ ) {
if ( c=='#' ) {
do {
for (cc = array; cc < &array[(sizeof array) - 1]; cc++)
{
if (c == '#')
{
do
{
c = readchar();
} while (c != '\n' && c != EOF);
}
*cc = c;
if ( c=='\n' && cc==array ) break ;
if (c == '\n' && cc == array)
break;
c = readchar();
if ( c=='\n' ) {
if (c == '\n')
{
pushback(c);
break;
}
if ( c==' ' || c=='\t' || c==EOF ) break ;
if (c == ' ' || c == '\t' || c == EOF)
break;
}
*++cc = 0;
return array;
}
int getmnem(str) char *str ; {
int getmnem(char *str)
{
char (*ptr)[4];
for ( ptr = em_mnem ; *ptr<= &em_mnem[sp_lmnem-sp_fmnem][0] ; ptr++ ) {
if ( strcmp(*ptr,str)==0 ) return (ptr-em_mnem) ;
for (ptr = em_mnem; *ptr <= &em_mnem[sp_lmnem - sp_fmnem][0]; ptr++)
{
if (strcmp(*ptr, str) == 0)
return (ptr - em_mnem);
}
error("Illegal mnemonic");
return 0;
}
error(str,a1,a2,a3,a4,a5,a6) /* VARARGS1 */ char *str ; {
if ( !atend ) fprintf(stderr,"line %d: ",line) ;
fprintf(stderr,str,a1,a2,a3,a4,a5,a6) ;
void error(char *str, ...)
/* VARARGS1 */
{
if (!atend)
fprintf(stderr, "line %d: ", line);
va_list ap;
va_start(ap, str);
vfprintf(stderr, str, ap);
va_end(ap);
fprintf(stderr, "\n");
nerror++;
}
mess(str,a1,a2,a3,a4,a5,a6) /* VARARGS1 */ char *str ; {
if ( !atend ) fprintf(stderr,"line %d: ",line) ;
fprintf(stderr,str,a1,a2,a3,a4,a5,a6) ;
void mess(char *str, ...)
/* VARARGS1 */
{
if (!atend)
fprintf(stderr, "line %d: ", line);
va_list ap;
va_start(ap, str);
vfprintf(stderr, str, ap);
va_end(ap);
fprintf(stderr, "\n");
}
fatal(str,a1,a2,a3,a4,a5,a6) /* VARARGS1 */ char *str ; {
error(str,a1,a2,a3,a4,a5,a6) ;
void fatal(char *str, ...)
/* VARARGS1 */
{
va_list ap;
va_start(ap, str);
error(str, ap);
va_end(ap);
exit(1);
}
#define ILLGL -1
check(val) int val ; {
if ( val!=ILLGL ) error("Illegal flag combination") ;
void check(int val)
{
if (val != ILLGL)
error("Illegal flag combination");
}
int decflag(str) char *str ; {
int decflag(char *str)
{
int type;
int escape;
int range;
@ -164,63 +229,105 @@ int decflag(str) char *str ; {
int notzero;
type = escape = range = wordm = notzero = ILLGL;
while ( *str ) switch ( *str++ ) {
while (*str)
switch (*str++)
{
case 'm':
check(type) ; type=OPMINI ; break ;
check(type);
type = OPMINI;
break;
case 's':
check(type) ; type=OPSHORT ; break ;
check(type);
type = OPSHORT;
break;
case '-':
check(type) ; type=OPNO ; break ;
check(type);
type = OPNO;
break;
case '1':
check(type) ; type=OP8 ; break ;
check(type);
type = OP8;
break;
case '2':
check(type) ; type=OP16 ; break ;
check(type);
type = OP16;
break;
case '4':
check(type) ; type=OP32 ; break ;
check(type);
type = OP32;
break;
case '8':
check(type) ; type=OP64 ; break ;
check(type);
type = OP64;
break;
case 'u':
check(type) ; type=OP16U ; break ;
check(type);
type = OP16U;
break;
case 'e':
check(escape) ; escape=0 ; break ;
check(escape);
escape = 0;
break;
case 'N':
check(range) ; range= 2 ; break ;
check(range);
range = 2;
break;
case 'P':
check(range) ; range= 1 ; break ;
check(range);
range = 1;
break;
case 'w':
check(wordm) ; wordm=0 ; break ;
check(wordm);
wordm = 0;
break;
case 'o':
check(notzero) ; notzero=0 ; break ;
check(notzero);
notzero = 0;
break;
default:
error("Unknown flag");
}
if ( type==ILLGL ) error("Type must be specified") ;
switch ( type ) {
if (type == ILLGL)
error("Type must be specified");
switch (type)
{
case OP64:
case OP32:
if ( escape!=ILLGL ) error("Conflicting escapes") ;
if (escape != ILLGL)
error("Conflicting escapes");
escape = ILLGL;
case OP16:
case OP16U:
case OP8:
case OPSHORT:
case OPNO:
if ( notzero!=ILLGL ) mess("Improbable OPNZ") ;
if ( type==OPNO && range!=ILLGL ) {
if (notzero != ILLGL)
mess("Improbable OPNZ");
if (type == OPNO && range != ILLGL)
{
mess("No operand in range");
}
}
if ( escape!=ILLGL ) type|=OPESC ;
if ( wordm!=ILLGL ) type|=OPWORD ;
switch ( range) {
case ILLGL : type|=OP_BOTH ;
if (escape != ILLGL)
type |= OPESC;
if (wordm != ILLGL)
type |= OPWORD;
switch (range)
{
case ILLGL:
type |= OP_BOTH;
if (type == OPMINI || type == OPSHORT)
error("Minies and shorties must have P or N");
break;
case 1 : type|=OP_POS ; break ;
case 2 : type|=OP_NEG ; break ;
case 1:
type |= OP_POS;
break;
case 2:
type |= OP_NEG;
break;
}
if ( notzero!=ILLGL ) type|=OPNZ ;
if (notzero != ILLGL)
type |= OPNZ;
return type;
}
@ -237,31 +344,41 @@ int elows[256], lows[256], llows[256];
char negc[NMNEM], zc[NMNEM], posc[NMNEM], lnegc[NMNEM], lposc[NMNEM];
checkall() {
register i,flag ;
void checkall(void)
{
register int i, flag;
register struct opform *next;
int opc, low;
for ( i=0 ; i<NMNEM ; i++ ) negc[i]=zc[i]=posc[i]=0 ;
for ( i=0 ; i<256 ; i++ ) lcodes[i]= codes[i]= ecodes[i]= -1 ;
codes[254]=ESCAP1; codes[255]=ESCAP2;
for (i = 0; i < NMNEM; i++)
negc[i] = zc[i] = posc[i] = 0;
for (i = 0; i < 256; i++)
lcodes[i] = codes[i] = ecodes[i] = -1;
codes[254] = ESCAP1;
codes[255] = ESCAP2;
atend=0 ; line=0 ;
for ( next=intable ; next<=lastform ; next++ ) {
atend = 0;
line = 0;
for (next = intable; next <= lastform; next++)
{
line++;
flag = next->i_flag & 0377;
opc = next->i_opcode & 0377;
low = next->i_low & 0377;
chkc(flag, low, opc, low);
switch(flag&OPTYPE) {
case OPNO : zc[opc]++ ; break ;
switch (flag & OPTYPE)
{
case OPNO:
zc[opc]++;
break;
case OPMINI:
case OPSHORT:
for ( i=1 ; i<((next->i_num)&0377) ; i++ ) {
for (i = 1; i < ((next->i_num) & 0377); i++)
{
chkc(flag, low + i, opc, low);
}
if ( !(em_flag[opc]&PAR_G) &&
(flag&OPRANGE)==OP_BOTH) {
if (!(em_flag[opc] & PAR_G) && (flag & OPRANGE) == OP_BOTH)
{
mess("Mini's and shorties should have P or N");
}
break;
@ -288,11 +405,15 @@ checkall() {
}
}
atend = 1;
for ( i=0 ; i<256 ; i++ ) if ( codes[i]== -1 ) {
for (i = 0; i < 256; i++)
if (codes[i] == -1)
{
mess("interpreter opcode %d not used", i);
}
for ( opc=0 ; opc<NMNEM ; opc++ ) {
switch(em_flag[opc]&EM_PAR) {
for (opc = 0; opc < NMNEM; opc++)
{
switch (em_flag[opc] & EM_PAR)
{
case PAR_NO:
ckop(opc, MUST, FORB, FORB);
break;
@ -326,20 +447,27 @@ checkall() {
}
}
chkc(flag,icode,emc,low) {
if ( flag&OPESC ) {
if ( ecodes[icode]!=-1 ) {
mess("Escaped opcode %d used by %s and %s",
icode,ename(emc),ename(ecodes[icode])) ;
void chkc(int flag, int icode, int emc, int low)
{
if (flag & OPESC)
{
if (ecodes[icode] != -1)
{
mess("Escaped opcode %d used by %s and %s", icode, ename(emc),
ename(ecodes[icode]));
}
ecodes[icode] = emc;
eflags[icode] = flag;
elows[icode] = low;
} else switch ( flag&OPTYPE ) {
}
else
switch (flag & OPTYPE)
{
default:
if ( codes[icode]!=-1 ) {
mess("Opcode %d used by %s and %s",
icode,ename(emc),ename(codes[icode])) ;
if (codes[icode] != -1)
{
mess("Opcode %d used by %s and %s", icode, ename(emc),
ename(codes[icode]));
}
codes[icode] = emc;
flags[icode] = flag;
@ -347,9 +475,10 @@ chkc(flag,icode,emc,low) {
break;
case OP32:
case OP64:
if ( lcodes[icode]!=-1 ) {
mess("Long opcode %d used by %s and %s",
icode,ename(emc),ename(lcodes[icode])) ;
if (lcodes[icode] != -1)
{
mess("Long opcode %d used by %s and %s", icode, ename(emc),
ename(lcodes[icode]));
}
lcodes[icode] = emc;
lflags[icode] = flag;
@ -358,32 +487,45 @@ chkc(flag,icode,emc,low) {
}
}
ckop(emc,zf,pf,nf) {
if ( zc[emc]>1 ) mess("More then one OPNO for %s",ename(emc)) ;
if ( posc[emc]>1 ) mess("More then one OP16(pos) for %s",ename(emc)) ;
if ( negc[emc]>1 ) mess("More then one OP16(neg) for %s",ename(emc)) ;
if ( lposc[emc]>1 ) mess("More then one OP32(pos) for %s",ename(emc)) ;
if ( lnegc[emc]>1 ) mess("More then one OP32(neg) for %s",ename(emc)) ;
switch(zf) {
void ckop(int emc, int zf, int pf, int nf)
{
if (zc[emc] > 1)
mess("More then one OPNO for %s", ename(emc));
if (posc[emc] > 1)
mess("More then one OP16(pos) for %s", ename(emc));
if (negc[emc] > 1)
mess("More then one OP16(neg) for %s", ename(emc));
if (lposc[emc] > 1)
mess("More then one OP32(pos) for %s", ename(emc));
if (lnegc[emc] > 1)
mess("More then one OP32(neg) for %s", ename(emc));
switch (zf)
{
case MUST:
if ( zc[emc]==0 ) mess("No OPNO for %s",ename(emc)) ;
if (zc[emc] == 0)
mess("No OPNO for %s", ename(emc));
break;
case FORB:
if ( zc[emc]==1 ) mess("Forbidden OPNO for %s",ename(emc)) ;
if (zc[emc] == 1)
mess("Forbidden OPNO for %s", ename(emc));
break;
}
switch(pf) {
switch (pf)
{
case MUST:
if ( posc[emc]==0 ) mess("No OP16(pos) for %s",ename(emc)) ;
if (posc[emc] == 0)
mess("No OP16(pos) for %s", ename(emc));
break;
case FORB:
if (posc[emc] == 1)
mess("Forbidden OP16(pos) for %s", ename(emc));
break;
}
switch(nf) {
switch (nf)
{
case MUST:
if ( negc[emc]==0 ) mess("No OP16(neg) for %s",ename(emc)) ;
if (negc[emc] == 0)
mess("No OP16(neg) for %s", ename(emc));
break;
case FORB:
if (negc[emc] == 1)
@ -395,72 +537,92 @@ ckop(emc,zf,pf,nf) {
static int pushchar;
static int pushf;
int readchar() {
int readchar(void)
{
int c;
if ( pushf ) {
if (pushf)
{
pushf = 0;
c = pushchar;
} else {
if ( feof(stdin) ) return EOF ;
}
else
{
if (feof(stdin))
return EOF;
c = getc(stdin);
}
if ( c=='\n' ) line++ ;
if (c == '\n')
line++;
return c;
}
pushback(c) {
if ( pushf ) {
void pushback(int c)
{
if (pushf)
{
fatal("Double pushback");
}
pushf++;
pushchar = c;
if ( c=='\n' ) line-- ;
if (c == '\n')
line--;
}
writeout() {
void writeout(void)
{
register int i;
printf("DISPATCH1");
for (i = 0; i < 256;) {
if (!(i % 8)) printf("\n%d", i);
for (i = 0; i < 256;)
{
if (!(i % 8))
printf("\n%d", i);
printf("\t%s", ename(codes[i]));
if (i < 254) {
if (i < 254)
{
prx(flags[i], lows[i], i);
}
i++;
}
printf("\nDISPATCH2");
for (i = 0; i < 256;) {
if (ecodes[i] != -1) {
if (!(i % 8)) printf("\n%d", i);
for (i = 0; i < 256;)
{
if (ecodes[i] != -1)
{
if (!(i % 8))
printf("\n%d", i);
printf("\t%s", ename(ecodes[i]));
prx(eflags[i], elows[i], i);
}
else break;
else
break;
i++;
}
printf("\nDISPATCH3");
i = 0;
while (lcodes[i] != -1) {
if (!(i % 8)) printf("\n%d", i);
while (lcodes[i] != -1)
{
if (!(i % 8))
printf("\n%d", i);
printf("\t%s", ename(lcodes[i]));
prx(lflags[i], llows[i], i);
i++;
}
while (i++ % 8) putchar('\t');
while (i++ % 8)
putchar('\t');
putchar('\n');
}
prx(flg,low,opc)
register int flg;
void prx(register int flg, int low, int opc)
{
int arg = opc - low;
putchar('.');
switch(flg&OPTYPE) {
switch (flg & OPTYPE)
{
case OPNO:
putchar('z');
break;
@ -468,25 +630,38 @@ prx(flg,low,opc)
putchar('u');
break;
case OP16:
if (flg&OP_POS) putchar('p');
else if (flg&OP_NEG) putchar('n');
else putchar('l');
if (flg&OPWORD) putchar('w');
if (flg & OP_POS)
putchar('p');
else if (flg & OP_NEG)
putchar('n');
else
putchar('l');
if (flg & OPWORD)
putchar('w');
break;
case OP32:
if (flg&OP_POS) putchar('P');
else if (flg&OP_NEG) putchar('N');
else putchar('L');
if (flg&OPWORD) putchar('w');
if (flg & OP_POS)
putchar('P');
else if (flg & OP_NEG)
putchar('N');
else
putchar('L');
if (flg & OPWORD)
putchar('w');
break;
case OPSHORT:
if (flg & OPWORD) putchar('w');
else putchar('s');
if (flg & OPWORD)
putchar('w');
else
putchar('s');
/* fall through */
case OPMINI:
if (flg & OPNZ) arg++;
if (flg & OP_NEG) arg = -arg - 1;
if (flg & OPNZ)
arg++;
if (flg & OP_NEG)
arg = -arg - 1;
printf("%d", arg);
if((flg&OPTYPE) == OPMINI && (flg & OPWORD)) putchar('W');
if ((flg & OPTYPE) == OPMINI && (flg & OPWORD))
putchar('W');
}
}

273
doc/install.doc Normal file → Executable file
View file

@ -1,4 +1,3 @@
.\" $Id$
.if n .nr PD 1v
.if n .nr LL 78m
.if n .ll 78m
@ -18,13 +17,6 @@ This document
describes the process of installing the Amsterdam Compiler Kit (ACK).
It depends on the combination of hard- and software how
hard it will be to install the Kit.
This description is intended for a Sun-3 or SPARC workstation.
Installation on VAXen running Berkeley
.UX
or Ultrix,
Sun-2 systems and most System V
.UX
systems should be easy.
As of this distribution, installation on PDP-11's or other
systems with a small address space is no longer supported.
See section 8 for installation on other systems.
@ -35,7 +27,7 @@ In the ACK installation process, three directory trees are used:
.IP "-"
the ACK source tree. This is the tree on the ACK distribution medium.
For the rest of this document, we will refer to this directory
as $SRC_HOME;
as $ACK_SRC_HOME;
.IP "-"
a configuration tree. This tree is built by the installation process and
is used to do compilations in. Its structure reflects that of the source tree,
@ -45,10 +37,10 @@ as $CONFIG;
.IP "-"
an ACK users tree. This tree is also built by the installation process.
For the rest of this document, we will refer to this directory
as $TARGET_HOME;
as $ACK_HOME;
.LP
After installation,
the directories in $TARGET_HOME contain the following information:
the directories in $ACK_HOME contain the following information:
.if n .sp 1
.if n .nr PD 0
.IP "bin" 14
@ -57,30 +49,41 @@ See the section about "Commands".
.IP "lib"
root of a tree containing almost all libraries used by
commands.
Files specific to a certain machine are collected in one subtree
per machine. E.g. "lib/pdp", "lib/z8000".
Files specific to a certain platform are collected in one subtree
per platform. E.g. "lib/cpm", "lib/pdpv7".
The names used here are the same names as used for subtrees
of "$SRC_HOME/mach".
of "$ACK_SRC_HOME/plat". Each of the platform specific directory
contains the following libraries:
.TS
l l.
libb B run-time system
libbc Basic run-time system
libc C run-time system
libpc Pascal run-time system
libm2 Modula-2 run-time system
liboc Occam run-time system
.TE
.IP "lib/descr"
command descriptor files used by the program ack.
command descriptor files used by the program ack to determine utilities to call.
.IP "lib/LLgen"
files used by the LL(1) parser generator.
.IP "lib/flex"
files used by the lexical analyzer generator Flex.
.IP "lib/m2"
definition modules for Modula-2.
.IP "lib.bin"
.IP "lib/ack"
root of a tree containing almost all binaries used by
commands.
All programs specific to a certain machine are collected in one subtree
per machine. E.g. "lib.bin/pdp", "lib.bin/z8000".
All programs specific to a certain platform are collected in one subtree
per machine. E.g. "lib/ack/pdpv7", "lib/ack/cpm".
The names used here are the same names as used for subtrees
of "$SRC_HOME/mach".
.IP "lib.bin/ego"
of "$ACK_SRC_HOME/plat".
.IP "lib/ack/ego"
files used by the global optimizer.
.IP "lib.bin/lint"
.IP "lib/ack/lint"
binaries for the lint passes and lint libraries.
.IP "lib.bin/ceg"
.IP "lib/ack/ceg"
files used by the code-expander-generator.
.IP "etc"
contains the file "ip_spec.t" needed for EM interpreters and EM documentation.
@ -120,7 +123,7 @@ em_abs.h contains trap numbers and address for lin and fil
em_ego.h definition of names for some global optimizer
messages
em_flag.h definition of bits in array em_flag in
$TARGET_HOME/lib.bin/em_data.a. Describes parameters
$ACK_HOME/lib.bin/em_data.a. Describes parameters
effect on flow of instructions
em_mes.h definition of names for mes pseudo numbers
em_mnem.h instruction => compact mapping
@ -202,30 +205,23 @@ These directories have subdirectories named:
.in +3n
.TS
l l.
cg the backend (*.m => *.s)
ncg the new backend (*.m => *.s)
as the assembler (*.s => *.o) or
cg the backend code generator (*.m => *.s)
ncg the new backend code generator (*.m => *.s)
mcg the modified backend code generator (*.m => *.s)
as the CPU specific assembler (*.s => *.o) or
assembler/linker (*.s + libraries => a.out)
cv conversion programs for a.out files
cv conversion programs for a.out files. Mostly replaced by "cvmach"
dl down-load programs
top the target optimizer
int source for an interpreter
int source for an interpreter (requires POSIX compliant host)
ce code expander (fast back-end)
libbc to create Basic run-time system and libraries
libcc to create C run-time system and libraries
libcc.ansi to create ANSI C run-time system and libraries
libpc to create Pascal run-time system and libraries
libf77 to create Fortran run-time system and libraries
libm2 to create Modula-2 run-time system and libraries
liboc to create occam run-time system and libraries
libem EM runtime system, only depending on CPU type
libem to create runtime system used by code generators
libend library defining end, edata, etext
libfp to create floating point library
libfp to create floating point emulation library
libdb to create debugger support library
libsys system-dependent EM library
libce fast cc-compatible C compiler library support
ce code expander (fast back-end)
test various tests
.TE
@ -245,6 +241,21 @@ mach/proto/fp floating point package sources
mach/proto/libg makefiles for compiling libraries
mach/proto/grind machine-independent debugger support
.TE
.IP "plat"
Group of directories which are specific to each operating system.
These dirctories have subdirectories named:
.TS
l l.
cvmach conversion program to convert from a.out to platform specific binaries.
emu system specific platform emulator or simulator used for testing.
libsys system-dependent library used to interface with the operating system.
include/ack system-dependent include files for building libc library, including mandatory "plat.h"
include/sys system-dependent include files used with libsys.
.TE
.IP "emtest"
contains prototype of em test set.
.IP "lang"
@ -262,26 +273,26 @@ the Pascal compiler proper.
the C front-end.
.IP "lang/cem/libcc"
.br
directories with sources of C runtime system, libraries (in EM or C).
directories with sources of C runtime system, libraries (in EM or C). \fIObsolete\fP.
.IP "lang/cem/libcc/gen"
.br
sources for routines in chapter III of
.UX
programmers manual,
excluding stdio.
excluding stdio. \fIObsolete\fP.
.IP "lang/cem/libcc/stdio"
.br
stdio sources.
stdio sources. \fIObsolete\fP.
.IP "lang/cem/libcc/math"
.br
sources for mathematical routines, normally available with the
\fB-lm\fP option to \fIcc\fP.
\fB-lm\fP option to \fIcc\fP. \fIObsolete\fP.
.IP "lang/cem/libcc/mon"
.br
sources for routines in chapter II, mostly written in EM.
sources for routines in chapter II, mostly written in EM. \fIObsolete\fP.
.IP "lang/cem/cemcom"
.br
the compiler proper.
the compiler proper. \fIObsolete\fP.
.IP "lang/cem/cemcom.ansi"
.br
the ANSI C compiler proper.
@ -290,7 +301,10 @@ the ANSI C compiler proper.
the ANSI C preprocessor.
.IP "lang/cem/libcc.ansi"
.br
the ANSI C library sources.
Portable part of the ANSI C library sources. The platform specific source code is in
libsys.
.IP "lang
.IP "lang/cem/ctest"
.br
the C test set.
@ -388,54 +402,79 @@ contains sub-directories for installing the fast ACK compatible compilers.
contains the sources of the fast ACK compatible compiler drivers.
.IP "fcc"
contains the fast cc-compatible C compiler for SUN-3 and VAX.
.IP "modules"
root of a tree containing modules (optional install)
.IP "modules/src/alloc"
Memory management module.
.IP "modules/src/data"
Data structures and collections module.
.IP "modules/src/em_code"
EM assembly generator module (*.[km])
.IP "modules/src/em_data"
EM data managemet module.
.IP "modules/src/em_mes"
EM Message pseudo-instruction generator module.
.IP "modules/src/em_opt"
EM Optimizer
.IP "modules/src/flt_arith"
Floating point support routine module.
.IP "modules/src/object"
ACK Object file format support reader/writer module.
.IP "modules/src/print"
Light version of standard output routines. Optimized for space compared to standard C version.
.IP "modules/src/read_em"
Compact (*.k) EM reader module.
.IP "modules/src/string"
String utility module.
.IP "modules/src/system"
Module related to the ACK system in general as well as wrapper over standard C library calls to
solve portability issues.
.IP "util"
contains directories with sources for various utilities.
.IP "util/ack"
the program used for translation with the Kit.
.IP "util/opt"
the EM peephole optimizer (*.k => *.m).
.IP "util/ego"
the global optimizer.
.IP "util/topgen"
the target optimizer generator.
.IP "util/misc"
decode (*.[km] => *.e) + encode (*.e => *.k).
.IP "util/data"
the C-code for $TARGET_HOME/lib.bin/em_data.a.
These sources are created by the Makefile in `etc`.
.IP "util/ass"
the EM assembler (*.[km] + libraries => e.out).
.IP "util/arch"
the archivers to be used for all EM utilities.
.IP "util/cgg"
a program needed for compiling backends.
.IP "util/ncgg"
a program needed for compiling the newest backends.
.IP "util/cpp"
the C preprocessor.
.IP "util/shf"
various shell files.
.IP "util/LLgen"
the extended LL(1) parser generator.
.IP "util/amisc"
contains some programs handling ACK a.out format, such as anm, asize.
.IP "util/arch"
the archivers to be used for all EM utilities.
.IP "util/ass"
the EM assembler and linker (*.[km] + libraries => e.out).
.IP "util/byacc"
this is Berkeley yacc, in the public domain. \fIObsolete\fP.
.IP "util/ceg"
code expander generator.
.IP "util/cgg"
a program needed for compiling backends.
.IP "util/cmisc"
contains some programs to help in resolving name conflicts, and
a dependency generator for makefiles.
.IP "util/led"
the ACK link-editor, reading ACK relocatable a.out format, and writing
ACK a.out format.
.IP "util/int"
an EM interpreter, written in C. Very useful for checking out software,
but slow.
.IP "util/ceg"
code expander generator.
.IP "util/cpp"
the C preprocessor. \fIObsolete\fP.
.IP "util/ego"
the global optimizer.
.IP "util/grind"
a symbolic debugger.
.IP "util/byacc"
this is Berkeley yacc, in the public domain.
.IP "util/int"
an EM interpreter, written in C. Very useful for checking out software.
.IP "util/led"
the ACK link-editor, reading CPU specific ACK relocatable a.out format, and writing
ACK a.out format.
.IP "util/LLgen"
the extended LL(1) parser generator.
.IP "util/make"
simple make tool.
.IP "util/misc"
decode (*.[km] => *.e) + encode (*.e => *.k).
.IP "util/ncgg"
a program needed for compiling the newest backends.
.IP "util/opt"
the EM peephole optimizer (*.k => *.m).
.IP "util/shf"
various shell files.
.IP "util/topgen"
the target optimizer generator.
.IP "util/flex"
this is a replacement for lex. It carries the following copyright notice:
this is a replacement for lex. \fIObsolete\fP. It carries the following copyright notice:
.IP ""
.nf
Copyright (c) 1990 The Regents of the University of California.
@ -469,8 +508,8 @@ PURPOSE.
.if n .nr PD 1v
.LP
All path names mentioned in the text of this document are relative to
$SRC_HOME, unless they start with '/' or one of $SRC_HOME,
$TARGET_HOME or $CONFIG.
$ACK_SRC_HOME, unless they start with '/' or one of $ACK_SRC_HOME,
$ACK_HOME or $CONFIG.
.NH
Restoring the ACK tree
.PP
@ -480,7 +519,7 @@ distribution tree structure.
Proceed as follows
.IP " \-" 10
Create a directory, for example /usr/share/local/src/ack, on a device
with at least 15 Megabytes left. This directory will be $SRC_HOME.
with at least 15 Megabytes left. This directory will be $ACK_SRC_HOME.
.IP " \-"
Change to that directory (cd ...).
.IP " \-"
@ -497,7 +536,7 @@ Adapting ACK to the local system
Before compiling the sources in the Kit some installation dependent
actions have to be taken.
Most of these are performed by an interactive shell script in the file
.I $SRC_HOME/first/first.
.I $ACK_SRC_HOME/first/first.
Calling this script should be done
from another directory, for instance an empty directory which will later
become $CONFIG.
@ -508,8 +547,8 @@ script are:
.if n .sp 1
.if n .nr PD 0
.IP \-
Asking for the path names of the ACK source directory ($SRC_HOME), the
configuration directory ($CONFIG), and the ACK users directory ($TARGET_HOME).
Asking for the path names of the ACK source directory ($ACK_SRC_HOME), the
configuration directory ($CONFIG), and the ACK users directory ($ACK_HOME).
About 5M are needed for the configuration tree. The disk space needed
for the ACK users tree depends on which front-ends and back-ends are to be
installed.
@ -566,7 +605,7 @@ on a different machine".
.IP \-
Setting the default machine for which code is
produced to the local type of system according to the table above.
This in done in the file "$TARGET_HOME/config/local.h".
This in done in the file "$ACK_HOME/config/local.h".
See also section 9.1.
.IP \-
Asking for things that don't have to be installed.
@ -599,7 +638,7 @@ Most configuration directories will have Makefiles
used to compile and install the programs in that
directory.
All programs needed for compilation and/or cross compilation
with the Kit are installed in $TARGET_HOME by these Makefiles.
with the Kit are installed in $ACK_HOME by these Makefiles.
These Makefiles are produced from corresponding files called
"proto.make" in the source tree. In fact, the "proto.make" files
are almost complete Makefiles, except for some macro definitions that
@ -618,7 +657,7 @@ Calling the "TakeAction" script.
All these Makefiles do not have to be called separately.
We wrote a shell script calling the make's needed to install
the whole Kit.
This script consists of the file $SRC_HOME/TakeAction
This script consists of the file $ACK_SRC_HOME/TakeAction
and a few files called Action in some configuration directories.
The Action files describe in a very simple form which actions
have to be performed in which directories.
@ -645,7 +684,7 @@ what must be installed.
.LP
If the installation succeeded, the Kit is ready to be used.
Read section 6 and the manuals provided
with the Kit (in the $TARGET_HOME/man directory) on how to use it.
with the Kit (in the $ACK_HOME/man directory) on how to use it.
.NH 2
Problems
.NH 3
@ -654,7 +693,7 @@ on Unisoft m68000 systems.
The Unisoft C compiler has a bug which impedes the correct
translation of the peephole optimizer.
For a more detailed description of this phenomenon see
the file "$SRC_HOME/mach/m68k2/Unisoft_bug".
the file "$ACK_SRC_HOME/mach/m68k2/Unisoft_bug".
(This observation was made in 1985 or so, so it is probably
no longer true).
.NH 3
@ -727,7 +766,7 @@ If that directory contains an Action file issue the command
.NH
Commands
.PP
The following commands are available in the $TARGET_HOME/bin directory after compilation
The following commands are available in the $ACK_HOME/bin directory after compilation
of the Kit:
.IP "\fIack\fP, \fIacc\fP, \fIabc\fP, \fIapc\fP, \fIocm\fP, \fIm2\fP, \fIf2c\fP and their links" 14
.br
@ -780,7 +819,7 @@ this is a cc-compatible fast C compiler, available on SUN-3 and VAX
systems. It compiles very fast, but produces slow code.
.LP
We currently make the Kit available to our users by telling
them that they should include the $TARGET_HOME/bin directory in
them that they should include the $ACK_HOME/bin directory in
their PATH shell variable.
The programs will still work when moved to a different
directory or linked to.
@ -793,7 +832,7 @@ Any call name not being \fIcc\fP, \fIacc\fP, \fIabc\fP, \fIpc\fP, \fIf2c\fP,
\fIocm\fP, \fIm2\fP, or \fIapc\fP will be
interpreted as the name of a 'machine description' and the
program will try to find a description file with that name.
The installation process will only touch the utilities in the $TARGET_HOME/bin
The installation process will only touch the utilities in the $ACK_HOME/bin
directory, not copies of these utilities.
.NH
Machines
@ -802,7 +841,7 @@ Below is a table with entries for all commands in
the bin directory used to (cross)compile for a particular machine.
The name in the first column gives the name in the bin directory.
The column headed dir indicates which subdirectories of
$TARGET_HOME/lib and/or $TARGET_HOME/lib.bin are needed for compilation.
$ACK_HOME/lib and/or $ACK_HOME/lib.bin are needed for compilation.
The column head i/p contains the integer and pointer size used in units of
bytes.
The subdirectories with the same name in mach contain the sources.
@ -1002,11 +1041,11 @@ the second takes 2/4 and 4/4 files,
and the last one takes 2/2, 2/4 and 4/4.
The PDP 11 interpreter executes floating point instructions.
.LP
The program \fB$TARGET_HOME/bin/em\fP calls the appropriate
The program \fB$ACK_HOME/bin/em\fP calls the appropriate
interpreter.
The interpreters are looked for in the em22, em24 and em44
subdirectories of $TARGET_HOME/lib.bin.
The third interpreter is available as the program \fB$TARGET_HOME/bin/int\fP
subdirectories of $ACK_HOME/lib.bin.
The third interpreter is available as the program \fB$ACK_HOME/bin/int\fP
in the bin directory.
.NH
Compilation on a different machine.
@ -1036,7 +1075,7 @@ which is a major undertaking.
.NH 2
Universal assembler/loader, link editor
.PP
For most machines, the description files in $TARGET_HOME/lib/*/descr use our
For most machines, the description files in $ACK_HOME/lib/*/descr use our
universal assembler and our link editor.
The load file produced is not directly
usable in any system known to us,
@ -1046,23 +1085,23 @@ executable files.
The \fIdl\fP programs present for some machines unravel
our a.out files and transmit commands to load memory
to a microprocessor over a serial line.
The file $TARGET_HOME/man/man5/ack.out.5 contains a description of the format of
The file $ACK_HOME/man/man5/ack.out.5 contains a description of the format of
the universal assembler load file.
It might be useful to those who wish or need to write their
own conversion programs.
Also, a module is included to read and write our a.out format.
See $TARGET_HOME/man/man3/object.3.
See $ACK_HOME/man/man3/object.3.
.NH
Options
.NH 2
Default machine
.PP
There is one important option in $TARGET_HOME/config/local.h.
There is one important option in $ACK_HOME/config/local.h.
The utility \fIack\fP uses a default machine name when called
as \fIacc\fP, \fIcc\fP, \fIabc\fP, \fIapc\fP, \fIpc\fP, \fIocm\fP,
\fIm2\fP, \fIf2c\fP, or \fIack\fP.
The machine name used by default is determined by the
definition of ACKM in $TARGET_HOME/config/local.h.
definition of ACKM in $ACK_HOME/config/local.h.
The Kit is distributed with "sun3" as the default machine,
but the shell script "first" in the directory "first" alters this
to suit the target system.
@ -1071,14 +1110,14 @@ and by default produce code that can't run on the local system.
.NH 2
Pathnames
.PP
Absolute path names are concentrated in "$TARGET_HOME/config/em_path.h".
Absolute path names are concentrated in "$ACK_HOME/config/em_path.h".
Only the utilities \fIack\fP, \fIflex\fP, and \fILLgen\fP use
absolute path names to access files in the Kit.
The tree is distributed with /usr/em as the working
directory.
The definition of EM_DIR in em_path.h should be altered to
specify the root
directory for the Compiler Kit binaries on the local system ($TARGET_HOME).
directory for the Compiler Kit binaries on the local system ($ACK_HOME).
This is done automatically by the shell script "first" in the
directory "first".
Em_path.h also specifies which directory should be used for
@ -1090,7 +1129,7 @@ The shape of the tree should not be altered lightly because
most Makefiles and the
utility \fIack\fP know the shape of the ACK tree.
The knowledge of the utility \fIack\fP about the shape of the tree is
concentrated in the files in the directory $TARGET_HOME/lib/*/descr and $TARGET_HOME/lib/descr/*.
concentrated in the files in the directory $ACK_HOME/lib/*/descr and $ACK_HOME/lib/descr/*.
.NH
Makefiles
.PP
@ -1120,11 +1159,11 @@ Opr should be an off-line printer daemon.
On some systems it exists under another name e.g. lpr.
The easiest way to call such a spooler is using a shell script
with the name opr that calls lpr.
This script should be placed in /usr/bin or $TARGET_HOME/bin or
This script should be placed in /usr/bin or $ACK_HOME/bin or
one of the directories in the PATH environment variable.
.IP clean
remove all files not needed for day-to-day use,
that is binaries not in $TARGET_HOME/bin or $TARGET_HOME/lib.bin, object files etc.
that is binaries not in $ACK_HOME/bin or $ACK_HOME/lib.bin, object files etc.
.LP
Example:
.DS
@ -1132,13 +1171,13 @@ make install
.DE
given as command in a configuration directory will cause
compilation of all programs in the directory and copying of the results
to the $TARGET_HOME/bin and $TARGET_HOME/lib.bin directories.
to the $ACK_HOME/bin and $ACK_HOME/lib.bin directories.
.NH
Testing
.PP
Test sets are available in Pascal, C, Basic and EM assembly:
.IP EM 8
the directory $SRC_HOME/emtest contains a few EM test programs.
the directory $ACK_SRC_HOME/emtest contains a few EM test programs.
The EM assembly files in these tests must be transformed into
load files.
These tests use the LIN and NOP instructions to mark the passing of each
@ -1151,7 +1190,7 @@ The test finishes normally with 0 as the last number printed
In all other cases a bug showed its
existence.
.IP Pascal
the directory $SRC_HOME/lang/pc/test contains a few Pascal test programs.
the directory $ACK_SRC_HOME/lang/pc/test contains a few Pascal test programs.
All these programs print the number of errors found and a
identification of these errors.
.sp 1
@ -1170,7 +1209,7 @@ Easton, Pennsylvania 18042
USA
.DE
.IP C
the sub-directories in $SRC_HOME/lang/cem/ctest contain C test programs.
the sub-directories in $ACK_SRC_HOME/lang/cem/ctest contain C test programs.
The idea behind these tests is:
if there is a program called xx.c, compile it into xx.cem.
Run it with standard output to xx.cem.r, compare this file to
@ -1184,7 +1223,7 @@ The contents of the result files depend on the word size,
the xx.cem.g files on the distribution are intended for a
32-bit machine.
.IP Basic
the directory $SRC_HOME/lang/basic/test contains some forty Basic programs.
the directory $ACK_SRC_HOME/lang/basic/test contains some forty Basic programs.
Not all of these programs are correct, some have syntactic errors,
some simply don't work.
The Makefile in that directory attempts to compile and run
@ -1198,8 +1237,8 @@ An example of the output of a make is present in the file Out.std.
Documentation
.PP
After installation, the manual pages for Amsterdam Compiler Kit can be found
in the $TARGET_HOME/man directory. Also, the following documents are provided
in the $TARGET_HOME/doc directory:
in the $ACK_HOME/man directory. Also, the following documents are provided
in the $ACK_HOME/doc directory:
.TS
l l.
toolkit.doc general overview (CACM article)

View file

@ -514,7 +514,7 @@ contains routines to build the data structure from the input
.BI C_ xxx
routines and place the structure on the pattern queue. These routines are also
used to build the data structures when a replacement is constructed.
.IP aux.c 10
.IP utils.c 10
routines to implement the external functions used in the pattern table.
.LP