Another batch...
This commit is contained in:
parent
653bd13b40
commit
674eb61908
@ -32,7 +32,7 @@ extern line_p reg_mes(); /* (offset tmp; short size; int typ,score)
|
||||
* given arguments.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
extern bblock_p common_dom(); /* (bblock_p a,b)
|
||||
|
||||
@ -17,14 +17,62 @@
|
||||
#include "debug.h"
|
||||
#include "global.h"
|
||||
|
||||
|
||||
|
||||
int linecount; /* # lines in this file */
|
||||
bool verbose_flag = FALSE; /* generate verbose output ? */
|
||||
|
||||
/* VARARGS1 */
|
||||
error(s,a) char *s,*a; {
|
||||
#ifdef __STDC__
|
||||
|
||||
/* 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);
|
||||
if (filename != (char *) 0) {
|
||||
fprintf(stderr," file %s",filename);
|
||||
@ -38,9 +86,7 @@ error(s,a) char *s,*a; {
|
||||
|
||||
#ifdef TRACE
|
||||
/* VARARGS1 */
|
||||
OUTTRACE(s,n)
|
||||
char *s;
|
||||
int n;
|
||||
void OUTTRACE(char *s, int n)
|
||||
{
|
||||
fprintf(stderr,"> ");
|
||||
fprintf(stderr,s,n);
|
||||
@ -50,9 +96,7 @@ OUTTRACE(s,n)
|
||||
|
||||
#ifdef VERBOSE
|
||||
/* VARARGS1 */
|
||||
OUTVERBOSE(s,n1,n2)
|
||||
char *s;
|
||||
int n1,n2;
|
||||
void OUTVERBOSE(char *s, int n1, int n2)
|
||||
{
|
||||
if (verbose_flag) {
|
||||
fprintf(stderr,"optimization: ");
|
||||
@ -62,17 +106,18 @@ OUTVERBOSE(s,n1,n2)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#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);
|
||||
error("assertion");
|
||||
}
|
||||
/* Valid Address */
|
||||
|
||||
VA(a) short *a; {
|
||||
void VA(short *a)
|
||||
{
|
||||
if (a == (short *) 0) error("VA: 0 argument");
|
||||
if ( ((unsigned) a & 01) == 01) {
|
||||
/* MACHINE DEPENDENT TEST */
|
||||
@ -83,14 +128,16 @@ VA(a) short *a; {
|
||||
|
||||
/* Valid Instruction code */
|
||||
|
||||
VI(i) short i; {
|
||||
void VI(short i)
|
||||
{
|
||||
if (i > ps_last) error("VI: illegal instr: %d", i);
|
||||
}
|
||||
|
||||
|
||||
/* Valid Line */
|
||||
|
||||
VL(l) line_p l; {
|
||||
void VL(line_p l)
|
||||
{
|
||||
byte instr, optype;
|
||||
|
||||
VA((short *) l);
|
||||
@ -106,7 +153,8 @@ VL(l) line_p l; {
|
||||
|
||||
/* Valid Data block */
|
||||
|
||||
VD(d) dblock_p d; {
|
||||
void VD(dblock_p d)
|
||||
{
|
||||
byte pseudo;
|
||||
|
||||
VA((short *) d);
|
||||
@ -119,7 +167,8 @@ VD(d) dblock_p d; {
|
||||
|
||||
/* Valid Object */
|
||||
|
||||
VO(o) obj_p o; {
|
||||
void VO(obj_p o)
|
||||
{
|
||||
offset off;
|
||||
|
||||
VA((short *) o);
|
||||
@ -133,7 +182,8 @@ VO(o) obj_p o; {
|
||||
|
||||
/* Valid Proc */
|
||||
|
||||
VP(p) proc_p p; {
|
||||
void VP(proc_p p)
|
||||
{
|
||||
proc_id pid;
|
||||
int nrlabs;
|
||||
|
||||
|
||||
@ -11,20 +11,42 @@
|
||||
extern int linecount; /* # lines in this file */
|
||||
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 */
|
||||
extern error();
|
||||
|
||||
|
||||
#ifdef TRACE
|
||||
# ifdef TRACE
|
||||
extern OUTTRACE();
|
||||
#else
|
||||
#define OUTTRACE(s,n)
|
||||
#endif
|
||||
#ifdef VERBOSE
|
||||
# else /* TRACE */
|
||||
# define OUTTRACE(s,n)
|
||||
# endif /* TRACE */
|
||||
|
||||
# ifdef VERBOSE
|
||||
extern OUTVERBOSE();
|
||||
#else
|
||||
#define OUTVERBOSE(s,n1,n2)
|
||||
#endif
|
||||
# else /* VERBOSE */
|
||||
# define OUTVERBOSE(s,n1,n2)
|
||||
# endif /* VERBOSE */
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
/* Some (all?) Unix debuggers don't particularly like
|
||||
|
||||
@ -29,9 +29,7 @@ STATIC bool core_flag = FALSE; /* report core usage? */
|
||||
#endif
|
||||
|
||||
|
||||
STATIC mach_init(machfile,phase_machinit)
|
||||
char *machfile;
|
||||
int (*phase_machinit)();
|
||||
STATIC void mach_init(char *machfile, int (*phase_machinit)(FILE *))
|
||||
{
|
||||
/* Read target machine dependent information */
|
||||
|
||||
@ -47,13 +45,9 @@ STATIC mach_init(machfile,phase_machinit)
|
||||
|
||||
|
||||
|
||||
go(argc,argv,initialize,optimize,phase_machinit,proc_flag)
|
||||
int argc;
|
||||
char *argv[];
|
||||
int (*initialize)();
|
||||
int (*optimize)();
|
||||
int (*phase_machinit)();
|
||||
int (*proc_flag)();
|
||||
void go(int argc, char *argv[], int (*initialize)(void),
|
||||
int (*optimize)(proc_p), int (*phase_machinit)(FILE *),
|
||||
int (*proc_flag)(char *))
|
||||
{
|
||||
FILE *f, *gf, *f2, *gf2; /* The EM input and output and
|
||||
* 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
|
||||
if (core_flag) {
|
||||
@ -151,9 +148,7 @@ core_usage()
|
||||
#endif
|
||||
}
|
||||
|
||||
report(s,n)
|
||||
char *s;
|
||||
int n;
|
||||
void report(char *s, int n)
|
||||
{
|
||||
/* Report number of optimizations found, if report_flag is set */
|
||||
|
||||
|
||||
@ -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[];
|
||||
* int (*initialize)(); int (*optimize)();
|
||||
@ -37,3 +49,5 @@ extern report(); /* ( char *s; int n)
|
||||
* Report number of optimizations found, if
|
||||
* report_flag is set
|
||||
*/
|
||||
|
||||
#endif
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string.h>
|
||||
/* MAKECLASSDEF
|
||||
*
|
||||
* This program is used by several phases of the optimizer
|
||||
@ -25,8 +25,9 @@
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
convert(mnemfile,classfile)
|
||||
FILE *mnemfile, *classfile;
|
||||
void error(char *);
|
||||
|
||||
void convert(FILE *mnemfile, FILE *classfile)
|
||||
{
|
||||
char mnem1[10], mnem2[10],def[10];
|
||||
int src,res,newcl,opc;
|
||||
@ -61,19 +62,13 @@ convert(mnemfile,classfile)
|
||||
printf("};\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
error(s)
|
||||
char *s;
|
||||
void error(char *s)
|
||||
{
|
||||
fprintf(stderr,"%s\n",s);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *f1,*f2;
|
||||
|
||||
|
||||
@ -87,6 +87,7 @@ int asizetab[] = {
|
||||
void oldline(line_p lnp);
|
||||
void oldargb(argb_p abp);
|
||||
void oldreg(reg_p rp);
|
||||
void oldargs(arg_p ap);
|
||||
|
||||
/*
|
||||
* alloc routines:
|
||||
@ -131,7 +132,7 @@ arg_p newarg(int kind)
|
||||
return(ap);
|
||||
}
|
||||
|
||||
void ldargs(arg_p ap)
|
||||
void oldargs(arg_p ap)
|
||||
{
|
||||
arg_p next;
|
||||
|
||||
|
||||
@ -21,14 +21,19 @@ static char rcsid[] = "$Id$";
|
||||
* Author: Hans van Staveren
|
||||
*/
|
||||
|
||||
flow() {
|
||||
void findreach();
|
||||
void reach(line_p lnp);
|
||||
void cleaninstrs();
|
||||
|
||||
void flow()
|
||||
{
|
||||
findreach(); /* determine reachable labels */
|
||||
cleaninstrs(); /* throw away unreachable code */
|
||||
}
|
||||
|
||||
findreach() {
|
||||
register num_p *npp,np;
|
||||
void findreach()
|
||||
{
|
||||
num_p *npp,np;
|
||||
|
||||
reach(instrs);
|
||||
for(npp=curpro.numhash;npp< &curpro.numhash[NNUMHASH]; npp++)
|
||||
@ -51,8 +56,9 @@ findreach() {
|
||||
}
|
||||
}
|
||||
|
||||
reach(lnp) register line_p lnp; {
|
||||
register num_p np;
|
||||
void reach(line_p lnp)
|
||||
{
|
||||
num_p np;
|
||||
|
||||
for (;lnp != (line_p) 0; lnp = lnp->l_next) {
|
||||
if(lnp->l_optyp == OPNUMLAB) {
|
||||
@ -88,9 +94,10 @@ reach(lnp) register line_p lnp; {
|
||||
}
|
||||
}
|
||||
|
||||
cleaninstrs() {
|
||||
register line_p *lpp,lp,*lastbra;
|
||||
bool reachable,superfluous;
|
||||
void cleaninstrs()
|
||||
{
|
||||
line_p *lpp, lp, *lastbra;
|
||||
bool reachable, superfluous;
|
||||
int instr;
|
||||
|
||||
lpp = &instrs; lastbra = (line_p *) 0; reachable = TRUE;
|
||||
|
||||
@ -46,6 +46,16 @@ int CBO_instrs[] = {
|
||||
/* 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 rplCBO;
|
||||
%}
|
||||
@ -242,8 +252,9 @@ struct hashmnem {
|
||||
byte h_value;
|
||||
} hashmnem[HASHSIZE];
|
||||
|
||||
inithash() {
|
||||
register i;
|
||||
void inithash()
|
||||
{
|
||||
int i;
|
||||
|
||||
enter("lab",op_lab);
|
||||
enter("LLP",op_LLP);
|
||||
@ -255,8 +266,9 @@ inithash() {
|
||||
enter(em_mnem[i],i+sp_fmnem);
|
||||
}
|
||||
|
||||
unsigned hashname(name) register char *name; {
|
||||
register unsigned h;
|
||||
unsigned int hashname(char *name)
|
||||
{
|
||||
unsigned int h;
|
||||
|
||||
h = (*name++)&BMASK;
|
||||
h = (h<<4)^((*name++)&BMASK);
|
||||
@ -264,8 +276,9 @@ unsigned hashname(name) register char *name; {
|
||||
return(h);
|
||||
}
|
||||
|
||||
enter(name,value) char *name; {
|
||||
register unsigned h;
|
||||
void enter(char *name, int value)
|
||||
{
|
||||
unsigned int h;
|
||||
|
||||
h=hashname(name)%HASHSIZE;
|
||||
while (hashmnem[h].h_name[0] != 0)
|
||||
@ -274,8 +287,9 @@ enter(name,value) char *name; {
|
||||
hashmnem[h].h_value = value;
|
||||
}
|
||||
|
||||
int mlookup(name) char *name; {
|
||||
register unsigned h;
|
||||
int mlookup(char *name)
|
||||
{
|
||||
unsigned int h;
|
||||
|
||||
h = hashname(name)%HASHSIZE;
|
||||
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 */
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
inithash();
|
||||
initio();
|
||||
yyparse();
|
||||
@ -294,20 +308,21 @@ main() {
|
||||
return nerrors;
|
||||
}
|
||||
|
||||
yyerror(s) char *s; {
|
||||
|
||||
void yyerror(char *s)
|
||||
{
|
||||
fprintf(stderr,"line %d: %s\n",lino,s);
|
||||
nerrors++;
|
||||
}
|
||||
|
||||
lookup(comm,operator,lnode,rnode) {
|
||||
register expr_p p;
|
||||
int lookup(int comm, int operator, int lnode, int rnode)
|
||||
{
|
||||
expr_p p;
|
||||
|
||||
for (p=nodes+1;p<lastnode;p++) {
|
||||
if (p->ex_operator != operator)
|
||||
continue;
|
||||
if (!(p->ex_lnode == lnode && p->ex_rnode == rnode ||
|
||||
comm && p->ex_lnode == rnode && p->ex_rnode == lnode))
|
||||
if (!((p->ex_lnode == lnode && p->ex_rnode == rnode) ||
|
||||
(comm && p->ex_lnode == rnode && p->ex_rnode == lnode)))
|
||||
continue;
|
||||
return(p-nodes);
|
||||
}
|
||||
@ -320,20 +335,22 @@ lookup(comm,operator,lnode,rnode) {
|
||||
return(p-nodes);
|
||||
}
|
||||
|
||||
printnodes() {
|
||||
register expr_p p;
|
||||
void printnodes()
|
||||
{
|
||||
expr_p p;
|
||||
|
||||
printf("};\n\nshort lastind = %d;\n\nexpr_t enodes[] = {\n",prevind);
|
||||
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);
|
||||
printf("};\n\niarg_t iargs[%d];\n", (maxpatlen>0 ? maxpatlen : 1));
|
||||
if (patid[0])
|
||||
printf("static char rcsid[] = %s;\n",patid);
|
||||
}
|
||||
|
||||
initio() {
|
||||
register i;
|
||||
void initio()
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("#include \"param.h\"\n#include \"types.h\"\n");
|
||||
printf("#include \"pattern.h\"\n\n");
|
||||
@ -374,9 +391,9 @@ initio() {
|
||||
curind = 1;
|
||||
}
|
||||
|
||||
outpat(exprno, instrno)
|
||||
void outpat(int exprno, int instrno)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
outbyte(0); outshort(prevind); prevind=curind-3;
|
||||
out(patlen);
|
||||
@ -399,20 +416,20 @@ outpat(exprno, instrno)
|
||||
if (patlen>maxpatlen) maxpatlen=patlen;
|
||||
}
|
||||
|
||||
outbyte(b) {
|
||||
|
||||
void outbyte(int b)
|
||||
{
|
||||
printf(",%3d",b);
|
||||
curind++;
|
||||
}
|
||||
|
||||
outshort(s) {
|
||||
|
||||
void outshort(int s)
|
||||
{
|
||||
outbyte(s&0377);
|
||||
outbyte((s>>8)&0377);
|
||||
}
|
||||
|
||||
out(w) {
|
||||
|
||||
void out(int w)
|
||||
{
|
||||
if (w<255) {
|
||||
outbyte(w);
|
||||
} else {
|
||||
|
||||
@ -28,6 +28,8 @@ static char rcsid[] = "$Id$";
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
int optimize();
|
||||
|
||||
#define ILLHASH 0177777
|
||||
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 }
|
||||
};
|
||||
|
||||
opcheck(bp) register byte *bp; {
|
||||
|
||||
void opcheck(byte *bp)
|
||||
{
|
||||
if (((*bp)&BMASK) >= op_pfirst)
|
||||
*bp = transl[((*bp)&BMASK)-op_pfirst][opind];
|
||||
}
|
||||
@ -54,11 +56,12 @@ opcheck(bp) register byte *bp; {
|
||||
* Estimated improvement possible: about 2%
|
||||
*/
|
||||
|
||||
hashpatterns() {
|
||||
void hashpatterns()
|
||||
{
|
||||
short index;
|
||||
register byte *bp,*tp;
|
||||
register short i;
|
||||
unsigned short hashvalue;
|
||||
byte *bp,*tp;
|
||||
short i;
|
||||
short hashvalue;
|
||||
byte *save;
|
||||
int patlen;
|
||||
|
||||
@ -121,7 +124,8 @@ hashpatterns() {
|
||||
}
|
||||
}
|
||||
|
||||
peephole() {
|
||||
int peephole()
|
||||
{
|
||||
static bool phashed = FALSE;
|
||||
|
||||
if (!phashed) {
|
||||
@ -131,9 +135,10 @@ peephole() {
|
||||
return optimize();
|
||||
}
|
||||
|
||||
optimize() {
|
||||
register num_p *npp,np;
|
||||
register instr;
|
||||
int optimize()
|
||||
{
|
||||
num_p *npp,np;
|
||||
int instr;
|
||||
bool madeopt;
|
||||
|
||||
madeopt = basicblock(&instrs);
|
||||
@ -152,15 +157,16 @@ optimize() {
|
||||
return madeopt;
|
||||
}
|
||||
|
||||
offset oabs(off) offset off; {
|
||||
|
||||
offset oabs(offset off)
|
||||
{
|
||||
return(off >= 0 ? off : -off);
|
||||
}
|
||||
|
||||
line_p repline(ev,patlen) eval_t ev; {
|
||||
register line_p lp;
|
||||
register iarg_p iap;
|
||||
register sym_p sp;
|
||||
line_p repline(eval_t ev, int patlen)
|
||||
{
|
||||
line_p lp;
|
||||
iarg_p iap;
|
||||
sym_p sp;
|
||||
offset diff,newdiff;
|
||||
|
||||
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;
|
||||
|
||||
#ifndef LONGOFF
|
||||
@ -241,10 +248,11 @@ offset rotate(w,amount) offset w,amount; {
|
||||
|
||||
eval_t undefres = { EV_UNDEF };
|
||||
|
||||
eval_t compute(pexp) register expr_p pexp; {
|
||||
eval_t compute(expr_p pexp)
|
||||
{
|
||||
eval_t leaf1,leaf2,res;
|
||||
register i;
|
||||
register sym_p sp;
|
||||
int i;
|
||||
sym_p sp;
|
||||
offset mask;
|
||||
|
||||
switch(nparam[pexp->ex_operator]) {
|
||||
@ -252,15 +260,15 @@ eval_t compute(pexp) register expr_p pexp; {
|
||||
assert(FALSE);
|
||||
case 2:
|
||||
leaf2 = compute(&enodes[pexp->ex_rnode]);
|
||||
if (leaf2.e_typ == EV_UNDEF ||
|
||||
nonumlab[pexp->ex_operator] && leaf2.e_typ == EV_NUMLAB ||
|
||||
onlyconst[pexp->ex_operator] && leaf2.e_typ != EV_CONST)
|
||||
if ((leaf2.e_typ == EV_UNDEF) ||
|
||||
(nonumlab[pexp->ex_operator] && leaf2.e_typ == EV_NUMLAB) ||
|
||||
(onlyconst[pexp->ex_operator] && leaf2.e_typ != EV_CONST) )
|
||||
return(undefres);
|
||||
case 1:
|
||||
leaf1 = compute(&enodes[pexp->ex_lnode]);
|
||||
if (leaf1.e_typ == EV_UNDEF ||
|
||||
nonumlab[pexp->ex_operator] && leaf1.e_typ == EV_NUMLAB ||
|
||||
onlyconst[pexp->ex_operator] && leaf1.e_typ != EV_CONST)
|
||||
if ((leaf1.e_typ == EV_UNDEF) ||
|
||||
(nonumlab[pexp->ex_operator] && leaf1.e_typ == EV_NUMLAB) ||
|
||||
(onlyconst[pexp->ex_operator] && leaf1.e_typ != EV_CONST))
|
||||
return(undefres);
|
||||
case 0:
|
||||
break;
|
||||
|
||||
@ -363,7 +363,7 @@ void outsym(sym_p sp)
|
||||
{
|
||||
byte *p;
|
||||
unsigned int num;
|
||||
warning("May do something nasty... (%s)", __func__);
|
||||
printf("May do something nasty... (%s)", __func__);
|
||||
if (sp->s_name[0] == '.') {
|
||||
num = atoi(&sp->s_name[1]);
|
||||
if (num < 256) {
|
||||
|
||||
@ -21,9 +21,10 @@ static char rcsid[] = "$Id$";
|
||||
* Author: Hans van Staveren
|
||||
*/
|
||||
|
||||
regvar(ap) register arg_p ap; {
|
||||
register reg_p rp;
|
||||
register i;
|
||||
void regvar(arg_p ap)
|
||||
{
|
||||
reg_p rp;
|
||||
int i;
|
||||
|
||||
rp = newreg();
|
||||
i=0;
|
||||
@ -46,7 +47,8 @@ regvar(ap) register arg_p ap; {
|
||||
curpro.freg = rp;
|
||||
}
|
||||
|
||||
inreg(off) offset off; {
|
||||
int inreg(offset off)
|
||||
{
|
||||
register reg_p rp;
|
||||
|
||||
for (rp=curpro.freg; rp != (reg_p) 0; rp=rp->r_next)
|
||||
@ -55,9 +57,10 @@ inreg(off) offset off; {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
outregs() {
|
||||
register reg_p rp,tp;
|
||||
register i;
|
||||
void outregs()
|
||||
{
|
||||
reg_p rp,tp;
|
||||
int i;
|
||||
|
||||
for(rp=curpro.freg; rp != (reg_p) 0; rp = tp) {
|
||||
tp = rp->r_next;
|
||||
@ -79,8 +82,8 @@ outregs() {
|
||||
}
|
||||
|
||||
/* outtes() handles the output of the top elt. messages */
|
||||
outtes() {
|
||||
register num_p *npp, np;
|
||||
void outtes() {
|
||||
num_p *npp, np;
|
||||
|
||||
for (npp=curpro.numhash;npp< &curpro.numhash[NNUMHASH]; npp++) {
|
||||
for (np = *npp; np != (num_p) 0; np=np->n_next) {
|
||||
@ -96,8 +99,9 @@ outtes() {
|
||||
}
|
||||
}
|
||||
|
||||
incregusage(off) offset off; {
|
||||
register reg_p rp;
|
||||
void incregusage(offset off)
|
||||
{
|
||||
reg_p rp;
|
||||
|
||||
#ifndef GLOBAL_OPT
|
||||
/* If we're optimizing the output of the global optimizer
|
||||
|
||||
@ -24,6 +24,9 @@ static char rcsid[] = "$Id$";
|
||||
extern char *pop_push[];
|
||||
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 ISABRANCH(i) (flow_tab[i]&HASLABEL)
|
||||
#define ISCONDBRANCH(i) (flow_tab[i]&CONDBRA)
|
||||
@ -39,22 +42,22 @@ extern char flow_tab[];
|
||||
int state;
|
||||
static int stacktop = 0;
|
||||
|
||||
init_state()
|
||||
void init_state()
|
||||
{
|
||||
stacktop = 0;
|
||||
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) {
|
||||
switch(INSTR(lp)) {
|
||||
case ps_con:
|
||||
case ps_rom:
|
||||
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) {
|
||||
if (ap->a_typ == ARGNUM) {
|
||||
@ -68,12 +71,11 @@ tes_pseudos()
|
||||
}
|
||||
}
|
||||
|
||||
tes_instr(lnp, x, y)
|
||||
line_p lnp, x, y;
|
||||
void tes_instr(line_p lnp, line_p x, line_p y)
|
||||
{
|
||||
char *s;
|
||||
register instr = INSTR(lnp);
|
||||
register int arg, argdef;
|
||||
int instr = INSTR(lnp);
|
||||
int arg, argdef;
|
||||
int neg = 0;
|
||||
|
||||
if (instr == op_lab) {
|
||||
@ -155,8 +157,7 @@ line_p lnp, x, y;
|
||||
}
|
||||
}
|
||||
|
||||
assign_label(label)
|
||||
register num_p label;
|
||||
void assign_label(num_p label)
|
||||
{
|
||||
if (label->n_flags & NUMSET) {
|
||||
if (state == NOTREACHED || stacktop > label->n_size) {
|
||||
@ -170,8 +171,7 @@ register num_p label;
|
||||
}
|
||||
}
|
||||
|
||||
do_inst_label(lnp) /* (re-)install a label */
|
||||
line_p lnp;
|
||||
void do_inst_label(line_p lnp) /* (re-)install a label */
|
||||
{
|
||||
num_p label = lnp->l_a.la_np->n_repl;
|
||||
int instr = INSTR(lnp);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user