1985-07-26 11:45:49 +00:00
|
|
|
|
|
|
|
#ifndef NORCSID
|
|
|
|
static char rcsid[] = "$Header$" ;
|
|
|
|
#endif
|
|
|
|
|
1985-07-26 11:29:08 +00:00
|
|
|
con_part(sz, w)
|
|
|
|
register int sz;
|
|
|
|
word w;
|
|
|
|
{
|
|
|
|
while (part_size % sz) part_size++;
|
|
|
|
|
|
|
|
if (part_size == TEM_WSIZE)
|
|
|
|
part_flush();
|
|
|
|
if (sz == 1 || sz == 2) {
|
|
|
|
w &= (sz == 1 ? 0xFF : 0xFFFF);
|
|
|
|
w <<= 8 * part_size;
|
|
|
|
part_word |= w;
|
|
|
|
} else {
|
|
|
|
assert(sz == 4);
|
|
|
|
part_word = w;
|
|
|
|
}
|
|
|
|
part_size += sz;
|
|
|
|
}
|
|
|
|
|
|
|
|
con_mult(sz)
|
|
|
|
word sz;
|
|
|
|
{
|
|
|
|
if (sz != 4)
|
|
|
|
fatal("bad icon/ucon size");
|
1987-01-16 17:17:12 +00:00
|
|
|
fprintf(codefile,".data4\t%s\n",str);
|
1985-07-26 11:29:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef REGVARS
|
|
|
|
full lbytes;
|
|
|
|
struct regadm {
|
|
|
|
char *ra_str;
|
|
|
|
long ra_off;
|
|
|
|
} regadm[4];
|
|
|
|
int n_regvars;
|
|
|
|
|
|
|
|
regscore(off,size,typ,score,totyp) long off; {
|
|
|
|
|
|
|
|
/*This function is copied from pdp/ncg
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* 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() {
|
|
|
|
|
|
|
|
n_regvars=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
f_regsave(){
|
|
|
|
register i;
|
1987-01-16 13:59:02 +00:00
|
|
|
register int c = '[';
|
1985-07-26 11:29:08 +00:00
|
|
|
|
1987-01-16 13:59:02 +00:00
|
|
|
fprintf(codefile, "enter ");
|
|
|
|
for (i=0; i<n_regvars; i++) {
|
|
|
|
fprintf(codefile,"%c%s", c, regadm[i].ra_str);
|
|
|
|
c = ',';
|
1985-07-26 11:29:08 +00:00
|
|
|
}
|
1987-01-16 17:17:12 +00:00
|
|
|
fprintf(codefile, "], %ld\n", lbytes);
|
1985-07-26 11:29:08 +00:00
|
|
|
for (i=0;i<n_regvars;i++)
|
|
|
|
if (regadm[i].ra_off>=0)
|
|
|
|
fprintf(codefile, "movd %ld(fp), %s",
|
|
|
|
regadm[i].ra_off, regadm[i].ra_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
regsave(regstr,off,size) char *regstr; long off; {
|
|
|
|
|
|
|
|
fprintf(codefile,"\t! Local %ld into %s\n",off,regstr);
|
|
|
|
regadm[n_regvars].ra_str = regstr;
|
|
|
|
regadm[n_regvars].ra_off = off;
|
|
|
|
n_regvars++;
|
|
|
|
}
|
|
|
|
|
|
|
|
regreturn() {
|
|
|
|
register int i;
|
1987-01-16 13:59:02 +00:00
|
|
|
register int c = '[';
|
1985-07-26 11:29:08 +00:00
|
|
|
|
1987-01-16 13:59:02 +00:00
|
|
|
fprintf(codefile, "exit ");
|
|
|
|
for (i=1; i<n_regvars; i++) {
|
|
|
|
fprintf(codefile,"%c%s", c, regadm[i].ra_str);
|
|
|
|
c = ',';
|
1985-07-26 11:29:08 +00:00
|
|
|
}
|
|
|
|
fprintf(codefile, "]\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
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,".define %s\n",argstr) ;
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
default :
|
|
|
|
while ( getarg(any_ptyp) != sp_cend ) ;
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
prolog(nlocals) full nlocals; {
|
|
|
|
|
|
|
|
#ifndef REGVARS
|
1987-01-16 17:17:12 +00:00
|
|
|
fprintf(codefile, "enter[], %ld\n",nlocals);
|
1985-07-26 11:29:08 +00:00
|
|
|
#else
|
|
|
|
lbytes = nlocals;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
char *segname[] = {
|
1987-01-16 17:17:12 +00:00
|
|
|
".sect .text",
|
|
|
|
".sect .data",
|
|
|
|
".sect .rom",
|
|
|
|
".sect .bss"
|
1985-07-26 11:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
con_float() {
|
|
|
|
|
|
|
|
fatal("no reals");
|
|
|
|
}
|