Another batch...

This commit is contained in:
Godzil
2013-03-12 03:18:07 +01:00
committed by Manoël Trapier
parent 653bd13b40
commit 674eb61908
13 changed files with 256 additions and 143 deletions

View File

@@ -32,7 +32,7 @@ extern line_p reg_mes(); /* (offset tmp; short size; int typ,score)
* given arguments. * given arguments.
*/ */
extern bool dom(); /* (bblock_p b1,b2) extern bool dom(); /* (bblock_p b1,b2)
/* See if b1 dominates b2. Note that a * See if b1 dominates b2. Note that a
* block always * dominates itself. * block always * dominates itself.
*/ */
extern bblock_p common_dom(); /* (bblock_p a,b) extern bblock_p common_dom(); /* (bblock_p a,b)

View File

@@ -17,14 +17,62 @@
#include "debug.h" #include "debug.h"
#include "global.h" #include "global.h"
int linecount; /* # lines in this file */ int linecount; /* # lines in this file */
bool verbose_flag = FALSE; /* generate verbose output ? */ bool verbose_flag = FALSE; /* generate verbose output ? */
/* VARARGS1 */ #ifdef __STDC__
error(s,a) char *s,*a; {
/* VARARGS1 */
void error(char *s, ...)
{
va_list ap;
fprintf(stderr,"error on line %u",linecount);
if (filename != (char *) 0) {
fprintf(stderr," file %s",filename);
}
fprintf(stderr,": ");
va_start(ap, s);
vfprintf(stderr,s, ap);
va_end(ap);
fprintf(stderr,"\n");
abort();
exit(-1);
}
#ifdef TRACE
/* VARARGS1 */
void OUTTRACE(char *s, ...)
{
va_list ap;
fprintf(stderr,"> ");
va_start(ap, s);
vfprintf(stderr,s, ap);
va_end(ap);
fprintf(stderr,"\n");
}
#endif
#ifdef VERBOSE
/* VARARGS1 */
void OUTVERBOSE(char *s, ...)
{
if (verbose_flag) {
va_list ap;
fprintf(stderr,"optimization: ");
va_start(ap, s);
vfprintf(stderr,s, ap);
va_end(ap);
fprintf(stderr,"\n");
}
}
#endif
#else /* __STDC__ */
/* VARARGS1 */
void error(char *s, char *a)
{
fprintf(stderr,"error on line %u",linecount); fprintf(stderr,"error on line %u",linecount);
if (filename != (char *) 0) { if (filename != (char *) 0) {
fprintf(stderr," file %s",filename); fprintf(stderr," file %s",filename);
@@ -38,9 +86,7 @@ error(s,a) char *s,*a; {
#ifdef TRACE #ifdef TRACE
/* VARARGS1 */ /* VARARGS1 */
OUTTRACE(s,n) void OUTTRACE(char *s, int n)
char *s;
int n;
{ {
fprintf(stderr,"> "); fprintf(stderr,"> ");
fprintf(stderr,s,n); fprintf(stderr,s,n);
@@ -50,9 +96,7 @@ OUTTRACE(s,n)
#ifdef VERBOSE #ifdef VERBOSE
/* VARARGS1 */ /* VARARGS1 */
OUTVERBOSE(s,n1,n2) void OUTVERBOSE(char *s, int n1, int n2)
char *s;
int n1,n2;
{ {
if (verbose_flag) { if (verbose_flag) {
fprintf(stderr,"optimization: "); fprintf(stderr,"optimization: ");
@@ -62,17 +106,18 @@ OUTVERBOSE(s,n1,n2)
} }
#endif #endif
#endif /* __STDC__ */
#ifdef DEBUG #ifdef DEBUG
badassertion(file,line) char *file; unsigned line; { void badassertion(char *file, unsigned int line)
{
fprintf(stderr,"assertion failed file %s, line %u\n",file,line); fprintf(stderr,"assertion failed file %s, line %u\n",file,line);
error("assertion"); error("assertion");
} }
/* Valid Address */ /* Valid Address */
VA(a) short *a; { void VA(short *a)
{
if (a == (short *) 0) error("VA: 0 argument"); if (a == (short *) 0) error("VA: 0 argument");
if ( ((unsigned) a & 01) == 01) { if ( ((unsigned) a & 01) == 01) {
/* MACHINE DEPENDENT TEST */ /* MACHINE DEPENDENT TEST */
@@ -83,14 +128,16 @@ VA(a) short *a; {
/* Valid Instruction code */ /* Valid Instruction code */
VI(i) short i; { void VI(short i)
{
if (i > ps_last) error("VI: illegal instr: %d", i); if (i > ps_last) error("VI: illegal instr: %d", i);
} }
/* Valid Line */ /* Valid Line */
VL(l) line_p l; { void VL(line_p l)
{
byte instr, optype; byte instr, optype;
VA((short *) l); VA((short *) l);
@@ -106,7 +153,8 @@ VL(l) line_p l; {
/* Valid Data block */ /* Valid Data block */
VD(d) dblock_p d; { void VD(dblock_p d)
{
byte pseudo; byte pseudo;
VA((short *) d); VA((short *) d);
@@ -119,7 +167,8 @@ VD(d) dblock_p d; {
/* Valid Object */ /* Valid Object */
VO(o) obj_p o; { void VO(obj_p o)
{
offset off; offset off;
VA((short *) o); VA((short *) o);
@@ -133,7 +182,8 @@ VO(o) obj_p o; {
/* Valid Proc */ /* Valid Proc */
VP(p) proc_p p; { void VP(proc_p p)
{
proc_id pid; proc_id pid;
int nrlabs; int nrlabs;

View File

@@ -11,20 +11,42 @@
extern int linecount; /* # lines in this file */ extern int linecount; /* # lines in this file */
extern bool verbose_flag; /* generate verbose output ? */ extern bool verbose_flag; /* generate verbose output ? */
#ifdef __STDC__
/* VARARGS 1 */
void error(char *fmt, ...);
# ifdef TRACE
void OUTTRACE(char *s, ...);
# else /* TRACE */
# define OUTTRACE(s,n)
# endif /* TRACE */
# ifdef VERBOSE
void OUTVERBOSE(char *s, ...);
# else /* VERBOSE */
# define OUTVERBOSE(s,n1,n2)
# endif /* VERBOSE */
#else /* __STDC__ */
/* VARARGS 1 */ /* VARARGS 1 */
extern error(); extern error();
# ifdef TRACE
#ifdef TRACE
extern OUTTRACE(); extern OUTTRACE();
#else # else /* TRACE */
#define OUTTRACE(s,n) # define OUTTRACE(s,n)
#endif # endif /* TRACE */
#ifdef VERBOSE
# ifdef VERBOSE
extern OUTVERBOSE(); extern OUTVERBOSE();
#else # else /* VERBOSE */
#define OUTVERBOSE(s,n1,n2) # define OUTVERBOSE(s,n1,n2)
#endif # endif /* VERBOSE */
#endif /* __STDC__ */
#ifdef DEBUG #ifdef DEBUG
/* Some (all?) Unix debuggers don't particularly like /* Some (all?) Unix debuggers don't particularly like

View File

@@ -29,9 +29,7 @@ STATIC bool core_flag = FALSE; /* report core usage? */
#endif #endif
STATIC mach_init(machfile,phase_machinit) STATIC void mach_init(char *machfile, int (*phase_machinit)(FILE *))
char *machfile;
int (*phase_machinit)();
{ {
/* Read target machine dependent information */ /* Read target machine dependent information */
@@ -47,13 +45,9 @@ STATIC mach_init(machfile,phase_machinit)
go(argc,argv,initialize,optimize,phase_machinit,proc_flag) void go(int argc, char *argv[], int (*initialize)(void),
int argc; int (*optimize)(proc_p), int (*phase_machinit)(FILE *),
char *argv[]; int (*proc_flag)(char *))
int (*initialize)();
int (*optimize)();
int (*phase_machinit)();
int (*proc_flag)();
{ {
FILE *f, *gf, *f2, *gf2; /* The EM input and output and FILE *f, *gf, *f2, *gf2; /* The EM input and output and
* the basic block graphs input and output * the basic block graphs input and output
@@ -140,9 +134,12 @@ go(argc,argv,initialize,optimize,phase_machinit,proc_flag)
} }
no_action() { } int no_action(proc_p dummy)
{
return 0;
}
core_usage() void core_usage()
{ {
#ifdef DEBUG #ifdef DEBUG
if (core_flag) { if (core_flag) {
@@ -151,9 +148,7 @@ core_usage()
#endif #endif
} }
report(s,n) void report(char *s, int n)
char *s;
int n;
{ {
/* Report number of optimizations found, if report_flag is set */ /* Report number of optimizations found, if report_flag is set */

View File

@@ -9,6 +9,18 @@
* *
*/ */
#ifdef __STDC__
void go(int argc, char *argv[], int (*initialize)(void),
int (*optimize)(proc_p), int (*phase_machinit)(FILE *),
int (*proc_flag)(char *));
int no_action(proc_p dummy);
void core_usage();
void report(char *s, int n);
#else
extern go(); /* ( int argc; char *argv[]; extern go(); /* ( int argc; char *argv[];
* int (*initialize)(); int (*optimize)(); * int (*initialize)(); int (*optimize)();
@@ -37,3 +49,5 @@ extern report(); /* ( char *s; int n)
* Report number of optimizations found, if * Report number of optimizations found, if
* report_flag is set * report_flag is set
*/ */
#endif

View File

@@ -6,7 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
/* MAKECLASSDEF /* MAKECLASSDEF
* *
* This program is used by several phases of the optimizer * This program is used by several phases of the optimizer
@@ -25,8 +25,9 @@
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
convert(mnemfile,classfile) void error(char *);
FILE *mnemfile, *classfile;
void convert(FILE *mnemfile, FILE *classfile)
{ {
char mnem1[10], mnem2[10],def[10]; char mnem1[10], mnem2[10],def[10];
int src,res,newcl,opc; int src,res,newcl,opc;
@@ -61,19 +62,13 @@ convert(mnemfile,classfile)
printf("};\n"); printf("};\n");
} }
void error(char *s)
error(s)
char *s;
{ {
fprintf(stderr,"%s\n",s); fprintf(stderr,"%s\n",s);
exit(-1); exit(-1);
} }
int main(int argc, char *argv[])
main(argc,argv)
int argc;
char *argv[];
{ {
FILE *f1,*f2; FILE *f1,*f2;

View File

@@ -87,6 +87,7 @@ int asizetab[] = {
void oldline(line_p lnp); void oldline(line_p lnp);
void oldargb(argb_p abp); void oldargb(argb_p abp);
void oldreg(reg_p rp); void oldreg(reg_p rp);
void oldargs(arg_p ap);
/* /*
* alloc routines: * alloc routines:
@@ -131,7 +132,7 @@ arg_p newarg(int kind)
return(ap); return(ap);
} }
void ldargs(arg_p ap) void oldargs(arg_p ap)
{ {
arg_p next; arg_p next;

View File

@@ -21,14 +21,19 @@ static char rcsid[] = "$Id$";
* Author: Hans van Staveren * Author: Hans van Staveren
*/ */
flow() { void findreach();
void reach(line_p lnp);
void cleaninstrs();
void flow()
{
findreach(); /* determine reachable labels */ findreach(); /* determine reachable labels */
cleaninstrs(); /* throw away unreachable code */ cleaninstrs(); /* throw away unreachable code */
} }
findreach() { void findreach()
register num_p *npp,np; {
num_p *npp,np;
reach(instrs); reach(instrs);
for(npp=curpro.numhash;npp< &curpro.numhash[NNUMHASH]; npp++) for(npp=curpro.numhash;npp< &curpro.numhash[NNUMHASH]; npp++)
@@ -51,8 +56,9 @@ findreach() {
} }
} }
reach(lnp) register line_p lnp; { void reach(line_p lnp)
register num_p np; {
num_p np;
for (;lnp != (line_p) 0; lnp = lnp->l_next) { for (;lnp != (line_p) 0; lnp = lnp->l_next) {
if(lnp->l_optyp == OPNUMLAB) { if(lnp->l_optyp == OPNUMLAB) {
@@ -88,9 +94,10 @@ reach(lnp) register line_p lnp; {
} }
} }
cleaninstrs() { void cleaninstrs()
register line_p *lpp,lp,*lastbra; {
bool reachable,superfluous; line_p *lpp, lp, *lastbra;
bool reachable, superfluous;
int instr; int instr;
lpp = &instrs; lastbra = (line_p *) 0; reachable = TRUE; lpp = &instrs; lastbra = (line_p *) 0; reachable = TRUE;

View File

@@ -46,6 +46,16 @@ int CBO_instrs[] = {
/* don't add op_mli and op_mlu! */ /* don't add op_mli and op_mlu! */
}; };
void enter(char *name, int value);
void yyerror(char *s);
void printnodes();
void initio();
void outpat(int exprno, int instrno);
void outbyte(int b);
void outshort(int s);
void out(int w);
int patCBO; int patCBO;
int rplCBO; int rplCBO;
%} %}
@@ -242,8 +252,9 @@ struct hashmnem {
byte h_value; byte h_value;
} hashmnem[HASHSIZE]; } hashmnem[HASHSIZE];
inithash() { void inithash()
register i; {
int i;
enter("lab",op_lab); enter("lab",op_lab);
enter("LLP",op_LLP); enter("LLP",op_LLP);
@@ -255,8 +266,9 @@ inithash() {
enter(em_mnem[i],i+sp_fmnem); enter(em_mnem[i],i+sp_fmnem);
} }
unsigned hashname(name) register char *name; { unsigned int hashname(char *name)
register unsigned h; {
unsigned int h;
h = (*name++)&BMASK; h = (*name++)&BMASK;
h = (h<<4)^((*name++)&BMASK); h = (h<<4)^((*name++)&BMASK);
@@ -264,8 +276,9 @@ unsigned hashname(name) register char *name; {
return(h); return(h);
} }
enter(name,value) char *name; { void enter(char *name, int value)
register unsigned h; {
unsigned int h;
h=hashname(name)%HASHSIZE; h=hashname(name)%HASHSIZE;
while (hashmnem[h].h_name[0] != 0) while (hashmnem[h].h_name[0] != 0)
@@ -274,8 +287,9 @@ enter(name,value) char *name; {
hashmnem[h].h_value = value; hashmnem[h].h_value = value;
} }
int mlookup(name) char *name; { int mlookup(char *name)
register unsigned h; {
unsigned int h;
h = hashname(name)%HASHSIZE; h = hashname(name)%HASHSIZE;
while (strncmp(hashmnem[h].h_name,name,3) != 0 && while (strncmp(hashmnem[h].h_name,name,3) != 0 &&
@@ -284,8 +298,8 @@ int mlookup(name) char *name; {
return(hashmnem[h].h_value&BMASK); /* 0 if not found */ return(hashmnem[h].h_value&BMASK); /* 0 if not found */
} }
main() { int main(int argc, char *argv[])
{
inithash(); inithash();
initio(); initio();
yyparse(); yyparse();
@@ -294,20 +308,21 @@ main() {
return nerrors; return nerrors;
} }
yyerror(s) char *s; { void yyerror(char *s)
{
fprintf(stderr,"line %d: %s\n",lino,s); fprintf(stderr,"line %d: %s\n",lino,s);
nerrors++; nerrors++;
} }
lookup(comm,operator,lnode,rnode) { int lookup(int comm, int operator, int lnode, int rnode)
register expr_p p; {
expr_p p;
for (p=nodes+1;p<lastnode;p++) { for (p=nodes+1;p<lastnode;p++) {
if (p->ex_operator != operator) if (p->ex_operator != operator)
continue; continue;
if (!(p->ex_lnode == lnode && p->ex_rnode == rnode || if (!((p->ex_lnode == lnode && p->ex_rnode == rnode) ||
comm && p->ex_lnode == rnode && p->ex_rnode == lnode)) (comm && p->ex_lnode == rnode && p->ex_rnode == lnode)))
continue; continue;
return(p-nodes); return(p-nodes);
} }
@@ -320,20 +335,22 @@ lookup(comm,operator,lnode,rnode) {
return(p-nodes); return(p-nodes);
} }
printnodes() { void printnodes()
register expr_p p; {
expr_p p;
printf("};\n\nshort lastind = %d;\n\nexpr_t enodes[] = {\n",prevind); printf("};\n\nshort lastind = %d;\n\nexpr_t enodes[] = {\n",prevind);
for (p=nodes;p<lastnode;p++) for (p=nodes;p<lastnode;p++)
printf("/* %3d */\t%3d,%6u,%6u,\n", printf("/* %3ld */\t%3d,%6u,%6u,\n",
p-nodes,p->ex_operator,p->ex_lnode,p->ex_rnode); p-nodes,p->ex_operator,p->ex_lnode,p->ex_rnode);
printf("};\n\niarg_t iargs[%d];\n", (maxpatlen>0 ? maxpatlen : 1)); printf("};\n\niarg_t iargs[%d];\n", (maxpatlen>0 ? maxpatlen : 1));
if (patid[0]) if (patid[0])
printf("static char rcsid[] = %s;\n",patid); printf("static char rcsid[] = %s;\n",patid);
} }
initio() { void initio()
register i; {
int i;
printf("#include \"param.h\"\n#include \"types.h\"\n"); printf("#include \"param.h\"\n#include \"types.h\"\n");
printf("#include \"pattern.h\"\n\n"); printf("#include \"pattern.h\"\n\n");
@@ -374,9 +391,9 @@ initio() {
curind = 1; curind = 1;
} }
outpat(exprno, instrno) void outpat(int exprno, int instrno)
{ {
register int i; int i;
outbyte(0); outshort(prevind); prevind=curind-3; outbyte(0); outshort(prevind); prevind=curind-3;
out(patlen); out(patlen);
@@ -399,20 +416,20 @@ outpat(exprno, instrno)
if (patlen>maxpatlen) maxpatlen=patlen; if (patlen>maxpatlen) maxpatlen=patlen;
} }
outbyte(b) { void outbyte(int b)
{
printf(",%3d",b); printf(",%3d",b);
curind++; curind++;
} }
outshort(s) { void outshort(int s)
{
outbyte(s&0377); outbyte(s&0377);
outbyte((s>>8)&0377); outbyte((s>>8)&0377);
} }
out(w) { void out(int w)
{
if (w<255) { if (w<255) {
outbyte(w); outbyte(w);
} else { } else {

View File

@@ -28,6 +28,8 @@ static char rcsid[] = "$Id$";
#include <stdio.h> #include <stdio.h>
#endif #endif
int optimize();
#define ILLHASH 0177777 #define ILLHASH 0177777
short pathash[256]; /* table of indices into pattern[] */ short pathash[256]; /* table of indices into pattern[] */
@@ -39,8 +41,8 @@ byte transl[op_plast-op_pfirst+1][3] = {
/* SEP */ { op_SEP, op_ste, op_sde } /* SEP */ { op_SEP, op_ste, op_sde }
}; };
opcheck(bp) register byte *bp; { void opcheck(byte *bp)
{
if (((*bp)&BMASK) >= op_pfirst) if (((*bp)&BMASK) >= op_pfirst)
*bp = transl[((*bp)&BMASK)-op_pfirst][opind]; *bp = transl[((*bp)&BMASK)-op_pfirst][opind];
} }
@@ -54,11 +56,12 @@ opcheck(bp) register byte *bp; {
* Estimated improvement possible: about 2% * Estimated improvement possible: about 2%
*/ */
hashpatterns() { void hashpatterns()
{
short index; short index;
register byte *bp,*tp; byte *bp,*tp;
register short i; short i;
unsigned short hashvalue; short hashvalue;
byte *save; byte *save;
int patlen; int patlen;
@@ -121,7 +124,8 @@ hashpatterns() {
} }
} }
peephole() { int peephole()
{
static bool phashed = FALSE; static bool phashed = FALSE;
if (!phashed) { if (!phashed) {
@@ -131,9 +135,10 @@ peephole() {
return optimize(); return optimize();
} }
optimize() { int optimize()
register num_p *npp,np; {
register instr; num_p *npp,np;
int instr;
bool madeopt; bool madeopt;
madeopt = basicblock(&instrs); madeopt = basicblock(&instrs);
@@ -152,15 +157,16 @@ optimize() {
return madeopt; return madeopt;
} }
offset oabs(off) offset off; { offset oabs(offset off)
{
return(off >= 0 ? off : -off); return(off >= 0 ? off : -off);
} }
line_p repline(ev,patlen) eval_t ev; { line_p repline(eval_t ev, int patlen)
register line_p lp; {
register iarg_p iap; line_p lp;
register sym_p sp; iarg_p iap;
sym_p sp;
offset diff,newdiff; offset diff,newdiff;
assert(ev.e_typ != EV_UNDEF); assert(ev.e_typ != EV_UNDEF);
@@ -226,7 +232,8 @@ line_p repline(ev,patlen) eval_t ev; {
} }
} }
offset rotate(w,amount) offset w,amount; { offset rotate(offset w, offset amount)
{
offset highmask,lowmask; offset highmask,lowmask;
#ifndef LONGOFF #ifndef LONGOFF
@@ -241,10 +248,11 @@ offset rotate(w,amount) offset w,amount; {
eval_t undefres = { EV_UNDEF }; eval_t undefres = { EV_UNDEF };
eval_t compute(pexp) register expr_p pexp; { eval_t compute(expr_p pexp)
{
eval_t leaf1,leaf2,res; eval_t leaf1,leaf2,res;
register i; int i;
register sym_p sp; sym_p sp;
offset mask; offset mask;
switch(nparam[pexp->ex_operator]) { switch(nparam[pexp->ex_operator]) {
@@ -252,15 +260,15 @@ eval_t compute(pexp) register expr_p pexp; {
assert(FALSE); assert(FALSE);
case 2: case 2:
leaf2 = compute(&enodes[pexp->ex_rnode]); leaf2 = compute(&enodes[pexp->ex_rnode]);
if (leaf2.e_typ == EV_UNDEF || if ((leaf2.e_typ == EV_UNDEF) ||
nonumlab[pexp->ex_operator] && leaf2.e_typ == EV_NUMLAB || (nonumlab[pexp->ex_operator] && leaf2.e_typ == EV_NUMLAB) ||
onlyconst[pexp->ex_operator] && leaf2.e_typ != EV_CONST) (onlyconst[pexp->ex_operator] && leaf2.e_typ != EV_CONST) )
return(undefres); return(undefres);
case 1: case 1:
leaf1 = compute(&enodes[pexp->ex_lnode]); leaf1 = compute(&enodes[pexp->ex_lnode]);
if (leaf1.e_typ == EV_UNDEF || if ((leaf1.e_typ == EV_UNDEF) ||
nonumlab[pexp->ex_operator] && leaf1.e_typ == EV_NUMLAB || (nonumlab[pexp->ex_operator] && leaf1.e_typ == EV_NUMLAB) ||
onlyconst[pexp->ex_operator] && leaf1.e_typ != EV_CONST) (onlyconst[pexp->ex_operator] && leaf1.e_typ != EV_CONST))
return(undefres); return(undefres);
case 0: case 0:
break; break;

View File

@@ -363,7 +363,7 @@ void outsym(sym_p sp)
{ {
byte *p; byte *p;
unsigned int num; unsigned int num;
warning("May do something nasty... (%s)", __func__); printf("May do something nasty... (%s)", __func__);
if (sp->s_name[0] == '.') { if (sp->s_name[0] == '.') {
num = atoi(&sp->s_name[1]); num = atoi(&sp->s_name[1]);
if (num < 256) { if (num < 256) {

View File

@@ -21,9 +21,10 @@ static char rcsid[] = "$Id$";
* Author: Hans van Staveren * Author: Hans van Staveren
*/ */
regvar(ap) register arg_p ap; { void regvar(arg_p ap)
register reg_p rp; {
register i; reg_p rp;
int i;
rp = newreg(); rp = newreg();
i=0; i=0;
@@ -46,7 +47,8 @@ regvar(ap) register arg_p ap; {
curpro.freg = rp; curpro.freg = rp;
} }
inreg(off) offset off; { int inreg(offset off)
{
register reg_p rp; register reg_p rp;
for (rp=curpro.freg; rp != (reg_p) 0; rp=rp->r_next) for (rp=curpro.freg; rp != (reg_p) 0; rp=rp->r_next)
@@ -55,9 +57,10 @@ inreg(off) offset off; {
return(FALSE); return(FALSE);
} }
outregs() { void outregs()
register reg_p rp,tp; {
register i; reg_p rp,tp;
int i;
for(rp=curpro.freg; rp != (reg_p) 0; rp = tp) { for(rp=curpro.freg; rp != (reg_p) 0; rp = tp) {
tp = rp->r_next; tp = rp->r_next;
@@ -79,8 +82,8 @@ outregs() {
} }
/* outtes() handles the output of the top elt. messages */ /* outtes() handles the output of the top elt. messages */
outtes() { void outtes() {
register num_p *npp, np; num_p *npp, np;
for (npp=curpro.numhash;npp< &curpro.numhash[NNUMHASH]; npp++) { for (npp=curpro.numhash;npp< &curpro.numhash[NNUMHASH]; npp++) {
for (np = *npp; np != (num_p) 0; np=np->n_next) { for (np = *npp; np != (num_p) 0; np=np->n_next) {
@@ -96,8 +99,9 @@ outtes() {
} }
} }
incregusage(off) offset off; { void incregusage(offset off)
register reg_p rp; {
reg_p rp;
#ifndef GLOBAL_OPT #ifndef GLOBAL_OPT
/* If we're optimizing the output of the global optimizer /* If we're optimizing the output of the global optimizer

View File

@@ -24,6 +24,9 @@ static char rcsid[] = "$Id$";
extern char *pop_push[]; extern char *pop_push[];
extern char flow_tab[]; extern char flow_tab[];
void assign_label(num_p label);
void do_inst_label(line_p lnp);
#define NON_CONTINUABLE(i) (flow_tab[i]&JUMP) #define NON_CONTINUABLE(i) (flow_tab[i]&JUMP)
#define ISABRANCH(i) (flow_tab[i]&HASLABEL) #define ISABRANCH(i) (flow_tab[i]&HASLABEL)
#define ISCONDBRANCH(i) (flow_tab[i]&CONDBRA) #define ISCONDBRANCH(i) (flow_tab[i]&CONDBRA)
@@ -39,22 +42,22 @@ extern char flow_tab[];
int state; int state;
static int stacktop = 0; static int stacktop = 0;
init_state() void init_state()
{ {
stacktop = 0; stacktop = 0;
state = KNOWN; state = KNOWN;
} }
tes_pseudos() void tes_pseudos()
{ {
register line_p lp; line_p lp;
for (lp = pseudos; lp != (line_p)0; lp = lp->l_next) { for (lp = pseudos; lp != (line_p)0; lp = lp->l_next) {
switch(INSTR(lp)) { switch(INSTR(lp)) {
case ps_con: case ps_con:
case ps_rom: case ps_rom:
if (lp->l_optyp == OPLIST) { if (lp->l_optyp == OPLIST) {
register arg_p ap = lp->l_a.la_arg; arg_p ap = lp->l_a.la_arg;
while (ap != (arg_p) 0) { while (ap != (arg_p) 0) {
if (ap->a_typ == ARGNUM) { if (ap->a_typ == ARGNUM) {
@@ -68,12 +71,11 @@ tes_pseudos()
} }
} }
tes_instr(lnp, x, y) void tes_instr(line_p lnp, line_p x, line_p y)
line_p lnp, x, y;
{ {
char *s; char *s;
register instr = INSTR(lnp); int instr = INSTR(lnp);
register int arg, argdef; int arg, argdef;
int neg = 0; int neg = 0;
if (instr == op_lab) { if (instr == op_lab) {
@@ -155,8 +157,7 @@ line_p lnp, x, y;
} }
} }
assign_label(label) void assign_label(num_p label)
register num_p label;
{ {
if (label->n_flags & NUMSET) { if (label->n_flags & NUMSET) {
if (state == NOTREACHED || stacktop > label->n_size) { if (state == NOTREACHED || stacktop > label->n_size) {
@@ -170,8 +171,7 @@ register num_p label;
} }
} }
do_inst_label(lnp) /* (re-)install a label */ void do_inst_label(line_p lnp) /* (re-)install a label */
line_p lnp;
{ {
num_p label = lnp->l_a.la_np->n_repl; num_p label = lnp->l_a.la_np->n_repl;
int instr = INSTR(lnp); int instr = INSTR(lnp);