fixup commit for tag 'distr3'

This commit is contained in:
cvs2hg
1989-10-04 10:56:17 +00:00
parent 81b1d21c35
commit 42e84d8dd2
230 changed files with 71 additions and 31971 deletions

View File

@@ -1,135 +0,0 @@
#ifndef NORCSID
static char rcsid[] = "$Header$";
#endif
#include <stdio.h>
/*
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* This product is part of the Amsterdam Compiler Kit.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
* Author: Hans van Staveren
*/
char buf[512];
char *index();
main() {
register n,sa;
register char *p;
sa=0;
for (;;) {
getline(buf);
if (n=stackadjust()) {
sa += n;
continue;
}
if (nullinstruction())
continue;
if (sa) {
if (buf[0]=='t' && buf[1]=='s' && buf[2]=='t' && buf[3]==' ') {
sa -= 2;
buf[0]='m';
buf[1]='o';
buf[2]='v';
strcat(buf,",(sp)+");
} else if (buf[0]=='m' && buf[1]=='o' && buf[2]=='v' &&
buf[3]==' ' && (p=index(&buf[5],','))!=0 &&
p[1]=='-' && p[2]=='(' && p[3]=='s') {
sa -= 2;
p[1]=' ';
}
}
switch(sa) {
case 0:break;
case 2:puts("tst (sp)+");sa=0;break;
case 4:puts("cmp (sp)+,(sp)+");sa=0;break;
case 6:puts("add $06,sp");sa=0;break;
}
puts(buf);
}
}
getline(buf) register char *buf; {
register c;
while ((c=getchar())==' ' || c=='\t')
;
if (c==EOF)
exit(0);
do *buf++=c;
while ((c=getchar())!='\n');
*buf=0;
}
stackadjust() {
if (buf[0]=='t' &&
buf[1]=='s' &&
buf[2]=='t' &&
buf[3]==' ' &&
buf[4]=='(' &&
buf[5]=='s' &&
buf[6]=='p' &&
buf[7]==')' &&
buf[8]=='+') return(2);
if (buf[0]=='c' &&
buf[1]=='m' &&
buf[2]=='p' &&
buf[3]==' ' &&
buf[4]=='(' &&
buf[5]=='s' &&
buf[6]=='p' &&
buf[7]==')' &&
buf[8]=='+' &&
buf[9]==',' &&
buf[10]=='(' &&
buf[11]=='s' &&
buf[12]=='p' &&
buf[13]==')' &&
buf[14]=='+') return(4);
if (buf[0]=='a' &&
buf[1]=='d' &&
buf[2]=='d' &&
buf[3]==' ' &&
buf[4]=='$' &&
buf[5]=='0' &&
buf[6]=='6' &&
buf[7]==',' &&
buf[8]=='s' &&
buf[9]=='p' &&
buf[10]==0) return(6);
return(0);
}
nullinstruction() {
register char *p;
if (buf[4]=='$' && buf[5]=='0' && buf[6]=='0' && buf[7]==',') {
p=index(buf,'-');
if (p!=0 && p[1]=='(')
return(0);
p=index(buf,'+');
if (p!=0 && p[-1]==')')
return(0);
if (buf[0]=='b' && buf[1]=='i' && (buf[2]=='s' || buf[2]=='c'))
return(1);
if (buf[0]=='a' && buf[1]=='d' && buf[2]=='d')
return(1);
if (buf[0]=='s' && buf[1]=='u' && buf[2]=='b')
return(1);
}
return(0);
}

View File

@@ -1,29 +0,0 @@
/ $Header$
.globl blm~
.globl save~,retu~
/ Size in r0
blm~:
jsr pc,save~
mov (sp)+,r2
mov (sp)+,r3
mov r0,r1
asr r0
beq 2f
/ Now avoid wrong copy.
/ The pieces may overlap !
cmp r3,r2
beq 2f
blt 3f
1:
mov (r3)+,(r2)+
sob r0,1b
2:
jmp retu~
3:
add r1,r3
add r1,r2
4:
mov -(r3),-(r2)
sob r0,4b
br 2b

View File

@@ -1,21 +0,0 @@
MAKEFILE=../../proto/libg/Makefile
MACHDEF="MACH=pdp -Rbe-p2" "SUF=s" "ASAR=ar"
PCDEF="PREF=pc" "SUB=" "SRC=lang/pc/libpc"
LIBDIR=../lib
install:
make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) cp
cmp:
make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) all
cmp head_pc $(LIBDIR)/head_pc
cmp tail_pc $(LIBDIR)/tail_pc
clean:
-rm -f *.old *.[ce$(SUF)] tail* head*
opr:
make pr | opr
pr:
@pr Makefile

View File

@@ -1,205 +0,0 @@
#ifndef NORCSID
static char rcsid[] = "$Header$";
#endif
/*
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* This product is part of the Amsterdam Compiler Kit.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
* Author: Hans van Staveren
*/
/*
* machine dependent back end routines for the PDP-11
*/
con_part(sz,w) register sz; word w; {
while (part_size % sz)
part_size++;
if (part_size == 2)
part_flush();
if (sz == 1) {
w &= 0xFF;
if (part_size)
w <<= 8;
part_word |= w;
} else {
assert(sz == 2);
part_word = w;
}
part_size += sz;
}
con_mult(sz) word sz; {
long l;
if (sz != 4)
fatal("bad icon/ucon size");
l = atol(str);
fprintf(codefile,"\t%o;%o\n",(int)(l>>16),(int)l);
}
con_float() {
double f;
register short *p,i;
/*
* This code is correct only when the code generator is
* run on a PDP-11 or VAX-11 since it assumes native
* floating point format is PDP-11 format.
*/
if (argval != 4 && argval != 8)
fatal("bad fcon size");
f = atof(str);
p = (short *) &f;
i = *p++;
if (argval == 8) {
fprintf(codefile,"\t%o;%o;",i,*p++);
i = *p++;
}
fprintf(codefile,"\t%o;%o\n",i,*p++);
}
#ifdef REGVARS
char Rstring[10];
full lbytes;
struct regadm {
char *ra_str;
long ra_off;
} regadm[2];
int n_regvars;
regscore(off,size,typ,score,totyp) long off; {
/*
* This function is full of magic constants.
* They are a result of experimentation.
*/
if (size != 2)
return(-1);
score -= 1; /* allow for save/restore */
if (off>=0)
score -= 2;
if (typ==reg_pointer)
score *= 17;
else if (typ==reg_loop)
score = 10*score+50; /* Guestimate */
else
score *= 10;
return(score); /* 10 * estimated # of words of profit */
}
i_regsave() {
Rstring[0] = 0;
n_regvars=0;
}
f_regsave() {
register i;
if (n_regvars==0 || lbytes==0) {
fprintf(codefile,"mov r5,-(sp)\nmov sp,r5\n");
if (lbytes == 2)
fprintf(codefile,"tst -(sp)\n");
else if (lbytes!=0)
fprintf(codefile,"sub $0%o,sp\n",lbytes);
for (i=0;i<n_regvars;i++)
fprintf(codefile,"mov %s,-(sp)\n",regadm[i].ra_str);
} else {
if (lbytes>6) {
fprintf(codefile,"mov $0%o,r0\n",lbytes);
fprintf(codefile,"jsr r5,PR%s\n",Rstring);
} else {
fprintf(codefile,"jsr r5,PR%d%s\n",lbytes,Rstring);
}
}
for (i=0;i<n_regvars;i++)
if (regadm[i].ra_off>=0)
fprintf(codefile,"mov 0%lo(r5),%s\n",regadm[i].ra_off,
regadm[i].ra_str);
}
regsave(regstr,off,size) char *regstr; long off; {
fprintf(codefile,"/ Local %ld into %s\n",off,regstr);
strcat(Rstring,regstr);
regadm[n_regvars].ra_str = regstr;
regadm[n_regvars].ra_off = off;
n_regvars++;
}
regreturn() {
fprintf(codefile,"jmp RT%s\n",Rstring);
}
#endif
prolog(nlocals) full nlocals; {
#ifndef REGVARS
fprintf(codefile,"mov r5,-(sp)\nmov sp,r5\n");
if (nlocals == 0)
return;
if (nlocals == 2)
fprintf(codefile,"tst -(sp)\n");
else
fprintf(codefile,"sub $0%o,sp\n",nlocals);
#else
lbytes = nlocals;
#endif
}
dlbdlb(as,ls) string as,ls; {
if (strlen(as)+strlen(ls)+2<sizeof(labstr)) {
strcat(ls,":");
strcat(ls,as);
} else
fatal("too many consecutive labels");
}
mes(type) word type; {
int argt ;
switch ( (int)type ) {
case ms_ext :
for (;;) {
switch ( argt=getarg(
ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
case sp_cend :
return ;
default:
strarg(argt) ;
fprintf(codefile,".globl %s\n",argstr) ;
break ;
}
}
default :
while ( getarg(any_ptyp) != sp_cend ) ;
break ;
}
}
char *segname[] = {
".text", /* SEGTXT */
".data", /* SEGCON */
".data", /* SEGROM */
".bss" /* SEGBSS */
};

View File

@@ -1,24 +0,0 @@
/* $Header$ */
#define ex_ap(y) fprintf(codefile,".globl %s\n",y)
#define in_ap(y) /* nothing */
#define newplb(x) fprintf(codefile,"%s:\n",x)
#define newilb(x) fprintf(codefile,"%s:\n",x)
#define newdlb(x) fprintf(codefile,"%s:\n",x)
#define newlbss(l,x) fprintf(codefile,"%s:.=.+0%o\n",l,x);
#define cst_fmt "$0%o"
#define off_fmt "0%o"
#define ilb_fmt "I%x_%x"
#define dlb_fmt "_%d"
#define hol_fmt "hol%d"
#define hol_off "0%o+hol%d"
#define con_cst(x) fprintf(codefile,"0%o\n",x)
#define con_ilb(x) fprintf(codefile,"%s\n",x)
#define con_dlb(x) fprintf(codefile,"%s\n",x)
#define id_first '_'
#define BSS_INIT 0

File diff suppressed because it is too large Load Diff