adapted to use new em_code module, and a minor fix

This commit is contained in:
ceriel 1988-01-14 10:52:36 +00:00
parent b90cc5ceb9
commit a726f7d49e
3 changed files with 22 additions and 10 deletions

View file

@ -15,6 +15,9 @@ static char rcsid1[] = "$Header$";
char *filename; /* Name of input file */ char *filename; /* Name of input file */
int errors; /* Number of errors */ int errors; /* Number of errors */
extern arith C_bsssize, C_holsize;
extern int C_bssinit, C_holinit;
main(argc,argv) main(argc,argv)
char **argv; char **argv;
{ {
@ -37,7 +40,7 @@ main(argc,argv)
} }
else if (!O_open( (char *) 0)) fatal("O_open failed"); else if (!O_open( (char *) 0)) fatal("O_open failed");
O_magic(); O_magic();
EM_mkcalls(p); C_out(p);
for(;;) { for(;;) {
EM_getinstr(p=GETNXTPATT()); EM_getinstr(p=GETNXTPATT());
@ -66,14 +69,23 @@ main(argc,argv)
case ps_pro: case ps_pro:
case ps_end: case ps_end:
break; break;
case ps_hol:
C_holsize = EM_holsize;
C_holinit = EM_holinit;
C_out(p);
OO_nxtpatt--;
continue;
case ps_bss:
C_bsssize = EM_bsssize;
C_bssinit = EM_bssinit;
default: default:
EM_mkcalls(p); C_out(p);
OO_nxtpatt--; OO_nxtpatt--;
continue; continue;
} }
break; break;
default: default:
EM_mkcalls(p); C_out(p);
OO_nxtpatt--; OO_nxtpatt--;
continue; continue;
case EM_EOF: case EM_EOF:

View file

@ -159,9 +159,9 @@ OO_flush()
register int i,n; register int i,n;
printstate("Flush"); printstate("Flush");
for(p=OO_buffer;p<OO_patternqueue;p++) for(p=OO_buffer;p<OO_patternqueue;p++)
EM_mkcalls(p); C_out(p);
if(p->em_opcode!=OTHER) if(p->em_opcode!=OTHER)
EM_mkcalls(p); C_out(p);
if(OO_endbackup) { if(OO_endbackup) {
n = OO_endbackup-OO_nxtpatt; n = OO_endbackup-OO_nxtpatt;
BTSCPY(p,q,i,OO_buffer,OO_nxtpatt,n); BTSCPY(p,q,i,OO_buffer,OO_nxtpatt,n);
@ -186,7 +186,7 @@ OO_halfflush()
printstate("Half flush"); printstate("Half flush");
n = MAXBUFFER / 2; n = MAXBUFFER / 2;
for(p=OO_buffer,i=n;i--;) for(p=OO_buffer,i=n;i--;)
EM_mkcalls(p++); C_out(p++);
/* now copy the rest of buffer and pattern back */ /* now copy the rest of buffer and pattern back */
BTSCPY(p,q,i,OO_buffer,OO_buffer+n,n+(OO_nxtpatt-OO_buffer)); BTSCPY(p,q,i,OO_buffer,OO_buffer+n,n+(OO_nxtpatt-OO_buffer));
OO_patternqueue -= n; OO_patternqueue -= n;

View file

@ -34,7 +34,7 @@ outputincalls()
} }
/* fall thru */ /* fall thru */
case CST: case CST:
fprintf(ofile,"%s\t| int:n\t|\n",s); fprintf(ofile,"%s\t| arith:n\t|\n",s);
if(op->id_used) { if(op->id_used) {
fprintf(ofile,"\tEM_mkcst(GETNXTPATT(),op_%s,n);\n",s); fprintf(ofile,"\tEM_mkcst(GETNXTPATT(),op_%s,n);\n",s);
fprintf(ofile,"\tOO_dfa(op_%s);\n",s); fprintf(ofile,"\tOO_dfa(op_%s);\n",s);
@ -78,7 +78,7 @@ outputincalls()
} }
break; break;
case EXT: case EXT:
fprintf(ofile,"%s\t| int:n\t|\n",s); fprintf(ofile,"%s\t| arith:n\t|\n",s);
if(op->id_used) { if(op->id_used) {
fprintf(ofile,"\tEM_mkcst(GETNXTPATT(),op_%s,n);\n",s); fprintf(ofile,"\tEM_mkcst(GETNXTPATT(),op_%s,n);\n",s);
fprintf(ofile,"\tOO_dfa(op_%s);\n",s); fprintf(ofile,"\tOO_dfa(op_%s);\n",s);
@ -87,7 +87,7 @@ outputincalls()
fprintf(ofile,"\tFLUSHDFA();\n"); fprintf(ofile,"\tFLUSHDFA();\n");
fprintf(ofile,"\tC_%s(n);\n",s); fprintf(ofile,"\tC_%s(n);\n",s);
} }
fprintf(ofile,"%s_dnam\t| char *:s int:n\t|\n",s); fprintf(ofile,"%s_dnam\t| char *:s arith:n\t|\n",s);
if(op->id_used) { if(op->id_used) {
fprintf(ofile,"\tEM_mksof(GETNXTPATT(),op_%s,s,n);\n",s); fprintf(ofile,"\tEM_mksof(GETNXTPATT(),op_%s,s,n);\n",s);
fprintf(ofile,"\tOO_dfa(op_%s);\n",s); fprintf(ofile,"\tOO_dfa(op_%s);\n",s);
@ -96,7 +96,7 @@ outputincalls()
fprintf(ofile,"\tFLUSHDFA();\n"); fprintf(ofile,"\tFLUSHDFA();\n");
fprintf(ofile,"\tC_%s_dnam(s,n);\n",s); fprintf(ofile,"\tC_%s_dnam(s,n);\n",s);
} }
fprintf(ofile,"%s_dlb\t| label:l int:n\t|\n",s); fprintf(ofile,"%s_dlb\t| label:l arith:n\t|\n",s);
if(op->id_used) { if(op->id_used) {
fprintf(ofile,"\tEM_mknof(GETNXTPATT(),op_%s,l,n);\n",s); fprintf(ofile,"\tEM_mknof(GETNXTPATT(),op_%s,l,n);\n",s);
fprintf(ofile,"\tOO_dfa(op_%s);\n",s); fprintf(ofile,"\tOO_dfa(op_%s);\n",s);