home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-11 | 32.6 KB | 1,424 lines |
- *** src/msgout.c.o Mon Dec 7 13:13:17 1992
- --- src/msgout.c Mon Dec 7 13:13:20 1992
- ***************
- *** 49,55 ****
- # define VA_START(a,s) va_start(a,s)
- # ifdef __STDC__
- # define P1(p1, p2) (p1 p2, ...)
- ! # define P2(p1, p2, p3, p4) (p1 p2, p3, p4, ...)
- # else
- # define P1(p1, p2) (p2) p1 p2;
- # define P2(p1, p2, p3, p4) (p2, p4) p1 p2; p3 p4;
- --- 49,55 ----
- # define VA_START(a,s) va_start(a,s)
- # ifdef __STDC__
- # define P1(p1, p2) (p1 p2, ...)
- ! # define P2(p1, p2, p3, p4) (p1 p2, p3 p4, ...)
- # else
- # define P1(p1, p2) (p2) p1 p2;
- # define P2(p1, p2, p3, p4) (p2, p4) p1 p2; p3 p4;
- ***************
- *** 128,133 ****
- --- 128,134 ----
- /* ERR_FIELD */ "no field allowed here",
- /* ERR_FPCON */ "illegal floating-point constant",
- /* ERR_IDEXPECT */ "identifier expected",
- + /* ERR_ILLCAST */ "illegal cast operation",
- /* ERR_ILLCHAR */ "illegal character '%c'",
- /* ERR_ILLCLASS */ "illegal storage class",
- /* ERR_ILLINIT */ "illegal initialization",
- ***************
- *** 186,196 ****
- --- 187,199 ----
- * code, but are quite likely not be an error.
- */
- /* WARN_0TYPEDEF */ "zero-sized typedef may be changed by initialisations",
- + /* WARN_ADDARRAY */ "& operator on array ignored",
- /* WARN_ADDFUNC */ "& operator on function ignored",
- /* WARN_EMPTY */ "empty statment",
- /* WARN_HIDE */ "definition of '%s' hides an earlier definition",
- /* WARN_IMPLICIT */ "argument '%s' implicitly declared 'int'",
- /* WARN_IMPLICITFN */ "implicitly declared function: 'int %s()'",
- + /* WARN_INCOMPLETE */ "initialisation incomplete - remaining fields zeroed",
- /* WARN_NOTKANDR */ "the use of '%s' is not allowed under strict K&R C",
- /* WARN_NOTUSED */ "variable/function '%s' not used",
- /*
- ***************
- *** 224,230 ****
- /* WARN_FLDTYPE */ "bit field type should be unsigned or int",
- /* WARN_NOCOPY */ "didn't copy local struct/union in save_type",
- /* WARN_PRAGMA */ "#pragma ignored",
- - /* WARN_STRINGCUT */ "string constant cut as it exceeds %d characters",
- /*
- * Messages below this point are output without file/line number details
- */
- --- 227,232 ----
- ***************
- *** 286,292 ****
- va_list ap;
-
- VA_START (ap, formatstr);
- ! (void) vfprintf (stderr, formatstr, ap);
- va_end(ap);
- }
-
- --- 288,294 ----
- va_list ap;
-
- VA_START (ap, formatstr);
- ! VOIDCAST vfprintf (stderr, formatstr, ap);
- va_end(ap);
- }
-
- ***************
- *** 301,307 ****
- va_list ap;
-
- VA_START (ap, formatstr);
- ! (void) vfprintf (icode, formatstr, ap);
- va_end(ap);
- }
- #endif /* ICODE */
- --- 303,309 ----
- va_list ap;
-
- VA_START (ap, formatstr);
- ! VOIDCAST vfprintf (icode, formatstr, ap);
- va_end(ap);
- }
- #endif /* ICODE */
- ***************
- *** 316,322 ****
- va_list ap;
-
- VA_START (ap, formatstr);
- ! (void) vfprintf (list, formatstr, ap);
- va_end(ap);
- }
-
- --- 318,324 ----
- va_list ap;
-
- VA_START (ap, formatstr);
- ! VOIDCAST vfprintf (list, formatstr, ap);
- va_end(ap);
- }
-
- ***************
- *** 330,336 ****
- va_list ap;
-
- VA_START (ap, formatstr);
- ! (void) vfprintf (output, formatstr, ap);
- va_end(ap);
- }
-
- --- 332,338 ----
- va_list ap;
-
- VA_START (ap, formatstr);
- ! VOIDCAST vfprintf (output, formatstr, ap);
- va_end(ap);
- }
-
- ***************
- *** 344,350 ****
-
- VA_START(ap,msgnum);
- open_message("C68");
- ! (void) vfprintf (list,get_message(msgnum),ap);
- lprintf ("\n");
- va_end(ap);
- }
- --- 346,352 ----
-
- VA_START(ap,msgnum);
- open_message("C68");
- ! VOIDCAST vfprintf (list,get_message(msgnum),ap);
- lprintf ("\n");
- va_end(ap);
- }
- ***************
- *** 398,409 ****
- if (list_option) {
- /* output details to listing file */
- lprintf (" *** %s",get_message(errtype));
- ! (void) vfprintf(list, get_message(msgnum), ap);
- lprintf ("\n");
- }
- }
- /* finally we output text + newline */
- ! (void) vfprintf (stderr, get_message(msgnum), ap);
- eprintf ("\n");
-
- if (msgnum < WARN_BASE) {
- --- 400,411 ----
- if (list_option) {
- /* output details to listing file */
- lprintf (" *** %s",get_message(errtype));
- ! VOIDCAST vfprintf(list, get_message(msgnum), ap);
- lprintf ("\n");
- }
- }
- /* finally we output text + newline */
- ! VOIDCAST vfprintf (stderr, get_message(msgnum), ap);
- eprintf ("\n");
-
- if (msgnum < WARN_BASE) {
- ***************
- *** 428,438 ****
- static int beenhere = 0;
-
- VA_START (ap,msg);
- ! message(MSG_FATAL,routine);
- ! (void) vfprintf(stderr,msg,ap);
- ! message(MSG_MISSING);
- ! if (!beenhere) {
- ! beenhere = 1;
- flush_peep();
- }
- va_end(ap);
- --- 430,440 ----
- static int beenhere = 0;
-
- VA_START (ap,msg);
- ! if (!beenhere) {
- ! beenhere = 1;
- ! message(MSG_FATAL,routine);
- ! VOIDCAST vfprintf(stderr,msg,ap);
- ! message(MSG_MISSING);
- flush_peep();
- }
- va_end(ap);
- *** src/optimize.c.o Mon Dec 7 13:13:36 1992
- --- src/optimize.c Mon Dec 7 13:13:40 1992
- ***************
- *** 80,86 ****
- epf = ep0->v.f * ep1->v.f;
- break;
- case en_div:
- ! if (ep1->v.f == 0.0) {
- message(GWARN_DIVZERO);
- ep->nodetype = en_div;
- } else {
- --- 80,86 ----
- epf = ep0->v.f * ep1->v.f;
- break;
- case en_div:
- ! if (ep1->v.f == ((double) 0)) {
- message(GWARN_DIVZERO);
- ep->nodetype = en_div;
- } else {
- *** src/out386_bas.c.o Mon Dec 7 13:13:50 1992
- --- src/out386_bas.c Mon Dec 7 13:13:54 1992
- ***************
- *** 64,69 ****
- --- 64,70 ----
-
- #define BI 1
- #define SP 2
- + #define FP 4
-
- static struct oplst {
- char *s;
- ***************
- *** 71,76 ****
- --- 72,78 ----
- int sa; /* special addressing modes:
- * BI immediate is bracketed,
- * SP size prefix needed.
- + * FP 387 op
- */
- } opl[] =
-
- ***************
- *** 119,139 ****
- "rep", op_rep, SP,
- "movs", op_smov, BI | SP,
- "test", op_test, BI | SP,
- ! "fadd", op_fadd, BI | SP,
- ! "fsub", op_fsub, BI | SP,
- ! "fsubr", op_fsubr, BI | SP,
- ! "fmul", op_fmul, BI | SP,
- ! "fdiv", op_fdiv, BI | SP,
- ! "fdivr", op_fdivr, BI | SP,
- ! "fchs", op_fchs, BI | SP,
- ! "fld", op_fld, BI | SP,
- ! "fild", op_fild, BI | SP,
- ! "fst", op_fst, BI | SP,
- ! "fstp", op_fstp, BI | SP,
- ! "fstp %st(0)", op_fpop, BI | SP,
- ! "fcompp", op_fcompp, BI | SP,
- ! "ftst", op_ftst, BI | SP,
- ! "fnstsw", op_fnstsw, BI | SP,
- "sahf", op_sahf, BI | SP,
- 0, 0, 0
- };
- --- 121,143 ----
- "rep", op_rep, SP,
- "movs", op_smov, BI | SP,
- "test", op_test, BI | SP,
- ! #ifndef NOFLOAT
- ! "fadd", op_fadd, BI | SP | FP,
- ! "fsub", op_fsub, BI | SP | FP,
- ! "fsubr", op_fsubr, BI | SP | FP,
- ! "fmul", op_fmul, BI | SP | FP,
- ! "fdiv", op_fdiv, BI | SP | FP,
- ! "fdivr", op_fdivr, BI | SP | FP,
- ! "fchs", op_fchs, BI | SP | FP,
- ! "fld", op_fld, BI | SP | FP,
- ! "fild", op_fild, BI | SP | FP,
- ! "fst", op_fst, BI | SP | FP,
- ! "fstp", op_fstp, BI | SP | FP,
- ! "fstp st(0)", op_fpop, BI | SP | FP,
- ! "fcompp", op_fcompp, BI | SP | FP,
- ! "ftst", op_ftst, BI | SP | FP,
- ! "fnstsw", op_fnstsw, BI | SP | FP,
- ! #endif
- "sahf", op_sahf, BI | SP,
- 0, 0, 0
- };
- ***************
- *** 257,262 ****
- --- 261,276 ----
- break;
- }
- }
- + #ifndef NOFLOAT
- + if (sa & FP) {
- + /* assume that st(n) never appears explicitly as an operand here */
- + if (len >= 8)
- + oprintf("qword ptr ");
- + else if (len >= 4)
- + oprintf("dword ptr ");
- + /* else fnstsw should not need a length? */
- + }
- + #endif
- switch (ap->mode) {
- case am_immed:
- oprintf("#");
- ***************
- *** 290,296 ****
- oprintf("[%s+%s]",regname[ap->preg],regname[ap->sreg]);
- break;
- default:
- ! fatal("out386_bas/putamdoe","illegal address mode %d",ap->mode);
- break;
- }
- }
- --- 304,310 ----
- oprintf("[%s+%s]",regname[ap->preg],regname[ap->sreg]);
- break;
- default:
- ! fatal("out386_bas/putamode","illegal address mode %d",ap->mode);
- break;
- }
- }
- ***************
- *** 414,427 ****
- genfloat(val)
- double val;
- {
- ! oprintf("\t.float %20.15e\n",val);
- }
-
- void
- gendouble(val)
- double val;
- {
- ! oprintf("\t.double %20.15e\n",val);
- }
- #endif
-
- --- 428,453 ----
- genfloat(val)
- double val;
- {
- ! #ifndef NO_FLOAT_PRINTF
- ! oprintf("\t.float %14.7e\n",val);
- ! #else
- ! float fval;
- ! fval = (float) val;
- ! /* this type transfer won't cross compile, of course. */
- ! oprintf("\t.long %d\n", ((long *)&fval)[0]);
- ! #endif
- }
-
- void
- gendouble(val)
- double val;
- {
- ! #ifndef NO_FLOAT_PRINTF
- ! oprintf("\t.double %23.16e\n",val);
- ! #else
- ! /* this type transfer won't cross compile, of course. */
- ! oprintf("\t.long %d, %d\n", ((long *)&val)[0], ((long *)&val)[1]);
- ! #endif
- }
- #endif
-
- ***************
- *** 585,594 ****
- if (*s == '.')
- return s;
- #ifdef QDOS
- ! (void) strcpy(symbol, s);
- ! #else
- ! symbol[0] = '_';
- ! (void) strcpy(symbol + 1, s);
- #endif
- return symbol;
- }
- --- 611,620 ----
- if (*s == '.')
- return s;
- #ifdef QDOS
- ! VOIDCAST strcpy(symbol, s);
- ! #else
- ! symbol[0] = '_';
- ! VOIDCAST strcpy(symbol + 1, s);
- #endif
- return symbol;
- }
- *** src/out386_gas.c.o Mon Dec 7 13:14:05 1992
- --- src/out386_gas.c Mon Dec 7 13:14:08 1992
- ***************
- *** 86,95 ****
- if (*s == '.')
- return s;
- #ifdef QDOS
- ! (void) strcpy(symbol, s);
- ! #else
- ! symbol[0] = '_';
- ! (void) strcpy(symbol + 1, s);
- #endif
- return symbol;
- }
- --- 86,95 ----
- if (*s == '.')
- return s;
- #ifdef QDOS
- ! VOIDCAST strcpy(symbol, s);
- ! #else
- ! symbol[0] = '_';
- ! VOIDCAST strcpy(symbol + 1, s);
- #endif
- return symbol;
- }
- ***************
- *** 538,548 ****
- dumplits()
- /*
- * dump the string literal pool.
- */
- {
- char *cp;
- int len;
- ! cseg();
- while (strtab != 0) {
- nl();
- put_label((unsigned int) strtab->label);
- --- 538,553 ----
- dumplits()
- /*
- * dump the string literal pool.
- + * if we are producing single copies of strings (which should therefore
- + * be read only we put them in the text segement - else in the data segment.
- */
- {
- char *cp;
- int len;
- ! if (trad_option)
- ! dseg();
- ! else
- ! cseg();
- while (strtab != 0) {
- nl();
- put_label((unsigned int) strtab->label);
- ***************
- *** 554,559 ****
- --- 559,566 ----
- strtab = strtab->next;
- }
- nl();
- + if (trad_option)
- + cseg();
- }
-
- void
- *** src/out68k_ack.c.o Mon Dec 7 13:14:18 1992
- --- src/out68k_ack.c Mon Dec 7 13:14:21 1992
- ***************
- *** 547,557 ****
- dumplits()
- /*
- * dump the string literal pool.
- */
- {
- char *cp;
- int len;
- ! cseg();
- while (strtab != 0) {
- nl();
- put_label((unsigned int) strtab->label);
- --- 547,562 ----
- dumplits()
- /*
- * dump the string literal pool.
- + * if we are producing single copies of strings (which should therefore
- + * be read only we put them in the text segement - else in the data segment.
- */
- {
- char *cp;
- int len;
- ! if (trad_option)
- ! dseg();
- ! else
- ! cseg();
- while (strtab != 0) {
- nl();
- put_label((unsigned int) strtab->label);
- ***************
- *** 563,568 ****
- --- 568,575 ----
- strtab = strtab->next;
- }
- nl();
- + if (trad_option)
- + cseg();
- }
-
- /*ARGSUSED*/
- ***************
- *** 578,584 ****
- char *s;
- /* put the definition of a global name in the output file */
- {
- ! oprintf(".define %s\n",outlate(s));
- }
-
- void
- --- 585,591 ----
- char *s;
- /* put the definition of a global name in the output file */
- {
- ! oprintf(".extern %s\n",outlate(s));
- }
-
- void
- ***************
- *** 648,657 ****
- if (*string == '.')
- return string;
- #ifdef QDOS
- ! (void) strcpy(symname, string);
- ! #else
- ! symname[0] = '_';
- ! (void) strcpy(symname + 1, string);
- #endif
-
- if (((k = strlen(symname)) > 8) && trans_option) {
- --- 655,664 ----
- if (*string == '.')
- return string;
- #ifdef QDOS
- ! VOIDCAST strcpy(symname, string);
- ! #else
- ! symname[0] = '_';
- ! VOIDCAST strcpy(symname + 1, string);
- #endif
-
- if (((k = strlen(symname)) > 8) && trans_option) {
- *** src/out68k_cpm.c.o Mon Dec 7 13:14:31 1992
- --- src/out68k_cpm.c Mon Dec 7 13:14:34 1992
- ***************
- *** 496,506 ****
- dumplits()
- /*
- * dump the string literal pool.
- */
- {
- char *cp;
- int len;
- ! cseg();
- while (strtab != 0) {
- nl();
- put_label((unsigned int) strtab->label);
- --- 496,511 ----
- dumplits()
- /*
- * dump the string literal pool.
- + * if we are producing single copies of strings (which should therefore
- + * be read only we put them in the text segement - else in the data segment.
- */
- {
- char *cp;
- int len;
- ! if (trad_option)
- ! dseg();
- ! else
- ! cseg();
- while (strtab != 0) {
- nl();
- put_label((unsigned int) strtab->label);
- ***************
- *** 512,517 ****
- --- 517,524 ----
- strtab = strtab->next;
- }
- nl();
- + if (trad_option)
- + cseg();
- }
-
- /*ARGSUSED*/
- ***************
- *** 604,613 ****
- if (*string == '.')
- return string;
- #ifdef QDOS
- ! (void) strcpy(symname, string);
- ! #else
- ! symname[0] = '_';
- ! (void) strcpy(symname + 1, string);
- #endif
-
- if (((k = strlen(symname)) > 8) && trans_option) {
- --- 611,620 ----
- if (*string == '.')
- return string;
- #ifdef QDOS
- ! VOIDCAST strcpy(symname, string);
- ! #else
- ! symname[0] = '_';
- ! VOIDCAST strcpy(symname + 1, string);
- #endif
-
- if (((k = strlen(symname)) > 8) && trans_option) {
- *** src/out68k_gas.c.o Mon Dec 7 13:14:44 1992
- --- src/out68k_gas.c Mon Dec 7 13:14:47 1992
- ***************
- *** 445,485 ****
- dumplits()
- /*
- * dump the string literal pool.
- */
- {
- char *cp;
- int len;
- ! /*
- ! * The ACK assembler may produce a .text section of an uneven length.
- ! * This will eventually bomb the linker when it tries to relocate
- ! * something in a following (.data) section, which then is misaligned
- ! * as a whole in memory (perhaps this is just a bug in the linker).
- ! *
- ! * To avoid this (it can only happen if the string pool is the last
- ! * thing dumped to the assembler file) we count the total number of
- ! * bytes in the string pool and emit a zero filler byte if that
- ! * number was uneven.
- ! * This is perhaps an ugly hack, but in virtually all of the cases
- ! * this filler byte is inserted anyway by the assembler when
- ! * doing the alignment necessary for the next function body.
- ! */
- ! long count=0;
- !
- ! cseg();
- while (strtab != 0) {
- nl();
- put_label((unsigned int) strtab->label);
- cp = strtab->str;
- len = strtab->len;
- - count += (len+1);
- while (len--)
- genbyte(*cp++);
- genbyte(0);
- strtab = strtab->next;
- }
- ! if (count & 1)
- ! genbyte(0);
- ! nl();
- }
-
- void
- --- 445,474 ----
- dumplits()
- /*
- * dump the string literal pool.
- + * if we are producing single copies of strings (which should therefore
- + * be read only we put them in the text segement - else in the data segment.
- */
- {
- char *cp;
- int len;
- !
- ! if (trad_option)
- ! dseg();
- ! else
- ! cseg();
- while (strtab != 0) {
- nl();
- put_label((unsigned int) strtab->label);
- cp = strtab->str;
- len = strtab->len;
- while (len--)
- genbyte(*cp++);
- genbyte(0);
- strtab = strtab->next;
- }
- ! nl();
- ! if (trad_option)
- ! cseg();
- }
-
- void
- ***************
- *** 549,558 ****
- if (*s == '.')
- return s;
- #ifdef QDOS
- ! (void) strcpy(symbol, s);
- ! #else
- ! symbol[0] = '_';
- ! (void) strcpy(symbol + 1, s);
- #endif
- return symbol;
- }
- --- 538,547 ----
- if (*s == '.')
- return s;
- #ifdef QDOS
- ! VOIDCAST strcpy(symbol, s);
- ! #else
- ! symbol[0] = '_';
- ! VOIDCAST strcpy(symbol + 1, s);
- #endif
- return symbol;
- }
- *** src/peep386.c.o Tue Dec 01 23:27:19 1992
- --- src/peep386.c Wed Dec 09 18:27:50 1992
- ***************
- *** 144,149 ****
- --- 144,152 ----
- */
- {
- register struct ocode *ip;
- + struct swtab *sw;
- + struct enode *ep;
- + int i;
- /*
- * perform peephole optimizations
- */
- ***************
- *** 160,165 ****
- --- 163,184 ----
- ip = ip->fwd;
- }
- peep_head = 0;
- + ep = mk_node(en_labcon, NIL_ENODE, NIL_ENODE);
- + for(sw=swtables; sw; sw=sw->next) {
- + nl();
- + #ifdef SEPERATE_I_D
- + dseg();
- + #else
- + cseg();
- + #endif
- + put_align(AL_POINTER);
- + put_label((unsigned) sw->tablab);
- + for(i=0; i<sw->numlabs; i++) {
- + ep->v.i = sw->labels[i];
- + genptr(ep);
- + }
- + }
- + swtables = NULL;
- }
-
- static void
- ***************
- *** 382,387 ****
- --- 401,409 ----
- }
- }
-
- + #define branch(ip) ((ip->opcode >= op_je && ip->opcode <= op_jbe) || \
- + (ip->opcode == op_bra))
- +
- static void
- peep_label(ip)
- /*
- ***************
- *** 391,435 ****
- struct ocode *ip;
- {
- struct ocode *prev, *next, *target;
- long label;
- ! prev = ip->back;
- ! if ((next = ip->fwd) == 0 || next->opcode != op_bra)
- ! return;
- ! /*
- ! * To make this fast, assume that the label number is really
- ! * next->oper1->offset->v.i
- ! */
- ! label = next->oper1->offset->v.i;
- ! if (label == ip->oper1->offset->v.i)
- return;
- ! target = peep_head;
- ! /*
- ! * look for the label
- ! */
- ! while (target != 0) {
- ! if (target->opcode == op_label
- ! && target->oper1->offset->v.i == label)
- ! break;
- ! target = target->fwd;
- ! }
- ! /* we should have found it */
- ! if (target == 0) {
- ! message(MSG_PEEPLABEL);
- ! return;
- ! }
- ! /* move label */
- ! peep_delete(ip);
- ! ip->fwd = target->fwd;
- ! ip->back = target;
- ! target->fwd = ip;
- ! if (ip->fwd != 0)
- ! ip->fwd->back = ip;
- ! /* possibly remove branches */
- ! /* in fact, prev is always != 0 if peep_delete has succeeded */
- ! if (prev != 0) {
- ! if (prev->opcode == op_bra || prev->opcode == op_jmp
- ! || prev->opcode == op_ret)
- ! peep_uctran(prev);
- }
- }
-
- --- 413,498 ----
- struct ocode *ip;
- {
- struct ocode *prev, *next, *target;
- + struct swtab *sw;
- + int i;
- long label;
- !
- ! if ((next = ip->fwd) == 0)
- return;
- !
- ! switch (next->opcode) {
- ! case op_label:
- ! /* if a label is followed by a label then common them up */
- ! label = next->oper1->offset->v.i;
- ! for (target = peep_head; target != 0; target = target->fwd) {
- ! if (branch(target) && target->oper1->offset->v.i == label)
- ! target->oper1->offset->v.i = ip->oper1->offset->v.i;
- ! }
- ! for (sw=swtables; sw != 0; sw = sw->next) {
- ! for (i=0; i < sw->numlabs; i++) {
- ! if (sw->labels[i] == label) {
- ! sw->labels[i] = ip->oper1->offset->v.i;
- ! changes++;
- ! }
- ! }
- ! }
- ! peep_delete(next);
- ! break;
- !
- ! case op_bra:
- ! prev = ip->back;
- ! /*
- ! * To make this fast, assume that the label number is really
- ! * next->oper1->offset->v.i
- ! */
- ! label = next->oper1->offset->v.i;
- ! if (label == ip->oper1->offset->v.i)
- ! return;
- ! target = peep_head;
- ! /*
- ! * look for the label
- ! */
- ! while (target != 0) {
- ! if (target->opcode == op_label
- ! && target->oper1->offset->v.i == label)
- ! break;
- ! target = target->fwd;
- ! }
- ! /* we should have found it */
- ! if (target == 0) {
- ! message(MSG_PEEPLABEL);
- ! return;
- ! }
- ! /* move label */
- ! peep_delete(ip);
- ! ip->fwd = target->fwd;
- ! ip->back = target;
- ! target->fwd = ip;
- ! if (ip->fwd != 0)
- ! ip->fwd->back = ip;
- ! /* possibly remove branches */
- ! /* in fact, prev is always != 0 if peep_delete has succeeded */
- ! if (prev != 0) {
- ! if (prev->opcode == op_bra || prev->opcode == op_jmp
- ! || prev->opcode == op_ret)
- ! peep_uctran(prev);
- ! }
- ! break;
- ! default:
- ! /* check that there are still references to this label */
- ! label = ip->oper1->offset->v.i;
- ! for (target = peep_head; target != 0; target = target->fwd) {
- ! if (branch(target) && target->oper1->offset->v.i == label)
- ! return;
- ! }
- ! for (sw=swtables; sw != 0; sw = sw->next) {
- ! for (i=0; i < sw->numlabs; i++) {
- ! if (sw->labels[i] == label)
- ! return;
- ! }
- ! }
- ! peep_delete(ip);
- ! break;
- }
- }
-
- ***************
- *** 545,550 ****
- --- 608,615 ----
-
- p = ip->back;
- previous_instruction(target);
- + if (p==target)
- + return;
- /* now skip back over identical instruction sequences */
- while (same_instruction(p,target)) {
- p = p->back;
- *** src/peep68k.c.o Mon Dec 7 13:15:21 1992
- --- src/peep68k.c Mon Dec 7 13:15:27 1992
- ***************
- *** 153,158 ****
- --- 153,161 ----
- */
- {
- register struct ocode *ip;
- + struct swtab *sw;
- + struct enode *ep;
- + int i;
- opt3(); /* do the peephole optimizations */
- ip = peep_head;
- while (ip != 0) {
- ***************
- *** 163,168 ****
- --- 166,187 ----
- ip = ip->fwd;
- }
- peep_head = 0;
- + ep = mk_node(en_labcon, NIL_ENODE, NIL_ENODE);
- + for(sw=swtables; sw; sw=sw->next) {
- + nl();
- + #ifdef SEPERATE_I_D
- + dseg();
- + #else
- + cseg();
- + #endif
- + put_align(AL_POINTER);
- + put_label((unsigned) sw->tablab);
- + for(i=0; i<sw->numlabs; i++) {
- + ep->v.i = sw->labels[i];
- + genptr(ep);
- + }
- + }
- + swtables = NULL;
- }
-
- static void
- ***************
- *** 716,721 ****
- --- 735,743 ----
- }
- }
-
- +
- + #define branch(ip) (ip->opcode >= op_bra && ip->opcode <= op_bls)
- +
- static void
- peep_label(ip)
- /*
- ***************
- *** 725,769 ****
- struct ocode *ip;
- {
- struct ocode *prev, *next, *target;
- ! long label;
- ! prev = ip->back;
- ! if ((next = ip->fwd) == 0 || next->opcode != op_bra)
- ! return;
- ! /*
- ! * To make this fast, assume that the label number is really
- ! * next->oper1->offset->v.i
- ! */
- ! label = next->oper1->offset->v.i;
- ! if (label == ip->oper1->offset->v.i)
- ! return;
- ! target = peep_head;
- ! /*
- ! * look for the label
- ! */
- ! while (target != 0) {
- ! if (target->opcode == op_label
- ! && target->oper1->offset->v.i == label)
- ! break;
- ! target = target->fwd;
- ! }
- ! /* we should have found it */
- ! if (target == 0) {
- ! message(MSG_PEEPLABEL);
- ! return;
- ! }
- ! /* move label */
- ! peep_delete(ip);
- ! ip->fwd = target->fwd;
- ! ip->back = target;
- ! target->fwd = ip;
- ! if (ip->fwd != 0)
- ! ip->fwd->back = ip;
- ! /* possibly remove branches */
- ! /* in fact, prev is always != 0 if peep_delete has succeeded */
- ! if (prev != 0) {
- ! if (prev->opcode == op_bra || prev->opcode == op_jmp
- ! || prev->opcode == op_rts)
- ! peep_uctran(prev);
- }
- }
-
- --- 747,836 ----
- struct ocode *ip;
- {
- struct ocode *prev, *next, *target;
- ! struct swtab *sw;
- ! int i;
- ! long label;
- !
- ! if ((next = ip->fwd) == 0)
- ! return;
- !
- ! switch (next->opcode) {
- ! case op_label:
- ! /* if a label is followed by a label then common them up */
- ! label = next->oper1->offset->v.i;
- ! for (target = peep_head; target != 0; target = target->fwd) {
- ! if (branch(target) && target->oper1->offset->v.i == label)
- ! target->oper1->offset->v.i = ip->oper1->offset->v.i;
- ! if (target->opcode == op_dbra && target->oper2->offset->v.i == label)
- ! target->oper2->offset->v.i = ip->oper1->offset->v.i;
- ! }
- ! for (sw=swtables; sw != 0; sw = sw->next) {
- ! for (i=0; i < sw->numlabs; i++) {
- ! if (sw->labels[i] == label)
- ! sw->labels[i] = ip->oper1->offset->v.i;
- ! }
- ! }
- ! peep_delete(next);
- ! break;
- !
- ! case op_bra:
- ! prev = ip->back;
- ! /*
- ! * To make this fast, assume that the label number is really
- ! * next->oper1->offset->v.i
- ! */
- ! label = next->oper1->offset->v.i;
- ! if (label == ip->oper1->offset->v.i)
- ! return;
- ! target = peep_head;
- ! /*
- ! * look for the label
- ! */
- ! while (target != 0) {
- ! if (target->opcode == op_label
- ! && target->oper1->offset->v.i == label)
- ! break;
- ! target = target->fwd;
- ! }
- ! /* we should have found it */
- ! if (target == 0) {
- ! message(MSG_PEEPLABEL);
- ! return;
- ! }
- ! /* move label */
- ! if (target->fwd == ip)
- ! return;
- ! peep_delete(ip);
- ! ip->fwd = target->fwd;
- ! ip->back = target;
- ! target->fwd = ip;
- ! if (ip->fwd != 0)
- ! ip->fwd->back = ip;
- ! /* possibly remove branches */
- ! /* in fact, prev is always != 0 if peep_delete has succeeded */
- ! if (prev != 0) {
- ! if (prev->opcode == op_bra || prev->opcode == op_jmp
- ! || prev->opcode == op_rts)
- ! peep_uctran(prev);
- ! }
- ! break;
- ! default:
- ! /* check that there are still references to this label */
- ! label = ip->oper1->offset->v.i;
- ! for (target = peep_head; target != 0; target = target->fwd) {
- ! if (branch(target) && target->oper1->offset->v.i == label)
- ! return;
- ! if (target->opcode == op_dbra && target->oper2->offset->v.i == label)
- ! return;
- ! }
- ! for (sw=swtables; sw != 0; sw = sw->next) {
- ! for (i=0; i < sw->numlabs; i++) {
- ! if (sw->labels[i] == label)
- ! return;
- ! }
- ! }
- ! peep_delete(ip);
- ! break;
- }
- }
-
- ***************
- *** 891,896 ****
- --- 958,965 ----
-
- p = ip->back;
- previous_instruction(target);
- + if (p==target)
- + return;
- /* now skip back over identical instruction sequences */
- while (same_instruction(p,target)) {
- p = p->back;
- *** src/proto.h.o Mon Dec 7 13:15:40 1992
- --- src/proto.h Thu Nov 26 22:02:30 1992
- ***************
- *** 16,22 ****
- /* decl.c */
- char *strsave P_((char *s));
- struct typ *mk_type P_((enum e_bt bt, long siz));
- ! void decl P_((struct stab *table));
- void decl1 P_((void));
- void compile P_((void));
- void dodecl P_((enum e_sc defclass));
- --- 16,22 ----
- /* decl.c */
- char *strsave P_((char *s));
- struct typ *mk_type P_((enum e_bt bt, long siz));
- ! void decl P_((void));
- void decl1 P_((void));
- void compile P_((void));
- void dodecl P_((enum e_sc defclass));
- ***************
- *** 28,36 ****
- struct typ *exprnc P_((struct enode **node));
- struct typ *expression P_((struct enode **node));
- struct typ *cast_op P_((struct enode **ep, struct typ *tp1, struct typ *tp2, int flag));
- ! long strip_icon P_((long i, enum e_bt type));
- ! int castbegin P_((enum e_sym st));
- ! struct typ *traceexpr P_((struct enode **node));
- /* func.c */
- void funcbody P_((struct sym *sp, char *names[], int nparms));
- /* gen68k.c */ /* gen68kd.c */ /* gen386.c */
- --- 28,38 ----
- struct typ *exprnc P_((struct enode **node));
- struct typ *expression P_((struct enode **node));
- struct typ *cast_op P_((struct enode **ep, struct typ *tp1, struct typ *tp2, int flag));
- ! #ifdef TRACE
- ! void traceexpr P_((struct enode **node));
- ! #endif /* TRACE */
- ! long strip_icon P_((long i, enum e_bt type));
- ! int castbegin P_((enum e_sym st));
- /* func.c */
- void funcbody P_((struct sym *sp, char *names[], int nparms));
- /* gen68k.c */ /* gen68kd.c */ /* gen386.c */
- ***************
- *** 85,90 ****
- --- 87,93 ----
- #ifndef NOFLOAT
- double floatexpr P_((void));
- #endif
- + long arithexpr P_((void));
- long intexpr P_((void));
- /* list.c */
- void list_table P_((struct stab *t, int i));
- *** src/searchkw.c.o Mon Dec 7 13:16:04 1992
- --- src/searchkw.c Mon Dec 7 13:16:06 1992
- ***************
- *** 32,115 ****
- enum e_sym stype;
- } keywords[] = {
-
- ! {
- ! "int", kw_int
- ! }, {
- ! "char", kw_char
- ! }, {
- ! "long", kw_long
- ! },
- ! {
- ! "float", kw_float
- ! }, {
- ! "double", kw_double
- ! }, {
- ! "return", kw_return
- ! },
- ! {
- ! "struct", kw_struct
- ! }, {
- ! "union", kw_union
- ! }, {
- ! "typedef", kw_typedef
- ! },
- ! {
- ! "enum", kw_enum
- ! }, {
- ! "static", kw_static
- ! }, {
- ! "auto", kw_auto
- ! },
- ! {
- ! "sizeof", kw_sizeof
- ! }, {
- ! "do", kw_do
- ! }, {
- ! "if", kw_if
- ! },
- ! {
- ! "else", kw_else
- ! }, {
- ! "for", kw_for
- ! }, {
- ! "switch", kw_switch
- ! },
- ! {
- ! "while", kw_while
- ! }, {
- ! "short", kw_short
- ! }, {
- ! "extern", kw_extern
- ! },
- ! {
- ! "case", kw_case
- ! }, {
- ! "goto", kw_goto
- ! }, {
- ! "default", kw_default
- ! },
- ! {
- ! "register", kw_register
- ! }, {
- ! "unsigned", kw_unsigned
- ! },
- ! {
- ! "break", kw_break
- ! }, {
- ! "continue", kw_continue
- ! }, {
- ! "void", kw_void
- ! },
- ! {
- ! "signed", kw_signed
- ! }, {
- ! "const", kw_const
- ! }, {
- ! "volatile", kw_volatile
- ! },
- ! {
- ! 0, 0
- ! }
- };
-
- /*
- --- 32,72 ----
- enum e_sym stype;
- } keywords[] = {
-
- ! { "int", kw_int },
- ! { "char", kw_char },
- ! { "long", kw_long },
- ! { "float", kw_float },
- ! { "double", kw_double },
- ! { "return", kw_return },
- ! { "struct", kw_struct },
- ! { "union", kw_union },
- ! { "typedef", kw_typedef },
- ! { "enum", kw_enum },
- ! { "static", kw_static },
- ! { "auto", kw_auto },
- ! { "sizeof", kw_sizeof },
- ! { "do", kw_do },
- ! { "if", kw_if },
- ! { "else", kw_else },
- ! { "for", kw_for },
- ! { "switch", kw_switch },
- ! { "while", kw_while },
- ! { "short", kw_short },
- ! { "extern", kw_extern },
- ! { "case", kw_case },
- ! { "goto", kw_goto },
- ! { "default", kw_default },
- ! { "register", kw_register },
- ! { "unsigned", kw_unsigned },
- ! { "break", kw_break },
- ! { "continue", kw_continue },
- !
- ! { "void", kw_void },
- !
- ! { "signed", kw_signed },
- ! { "const", kw_const },
- ! { "volatile", kw_volatile },
- ! { 0, 0 }
- };
-
- /*
- ***************
- *** 136,146 ****
- switch ( (--kwbp)->stype ) {
- case kw_volatile:
- volatile_found = 1;
- case kw_signed:
- case kw_const:
- if (trad_option)
- return;
- ! /* else fall through */
- default:
- lastst = kwbp->stype;
- return;
- --- 93,104 ----
- switch ( (--kwbp)->stype ) {
- case kw_volatile:
- volatile_found = 1;
- + /* FALLTHRU */
- case kw_signed:
- case kw_const:
- if (trad_option)
- return;
- ! /* FALLTHRU */
- default:
- lastst = kwbp->stype;
- return;
- *** src/stmt.c.o Mon Dec 7 13:16:15 1992
- --- src/stmt.c Mon Dec 7 13:16:18 1992
- ***************
- *** 301,308 ****
- if (snp->exp != 0) {
- if (ret_type->type == bt_void)
- message(ERR_VOIDFUNC);
- ! else
- ! (void) cast_op(&(snp->exp), tp, ret_type, 0);
- } else if (ret_type->type != bt_void)
- message(WARN_VALRETURN);
- return_found = 1;
- --- 301,310 ----
- if (snp->exp != 0) {
- if (ret_type->type == bt_void)
- message(ERR_VOIDFUNC);
- ! else if (tp->type == bt_void)
- ! message(ERR_VOIDRETURN);
- ! else
- ! VOIDCAST cast_op(&(snp->exp), tp, ret_type, 0);
- } else if (ret_type->type != bt_void)
- message(WARN_VALRETURN);
- return_found = 1;
- ***************
- *** 390,396 ****
- sp->tp->val_flag) {
- message(ERR_ILLINIT);
- } else {
- ! (void) cast_op(&ep2, tp, sp->tp, 0);
-
- ep1 = mk_node(en_autocon, NIL_ENODE, NIL_ENODE);
- ep1->v.i = sp->value.i;
- --- 392,398 ----
- sp->tp->val_flag) {
- message(ERR_ILLINIT);
- } else {
- ! VOIDCAST cast_op(&ep2, tp, sp->tp, 0);
-
- ep1 = mk_node(en_autocon, NIL_ENODE, NIL_ENODE);
- ep1->v.i = sp->value.i;
- ***************
- *** 583,596 ****
- return 0;
- }
-
- ! static struct snode *
- ! statement()
- ! /*
- ! * statement figures out which of the statement processors should be called
- ! * and transfers control to the proper routine.
- */
- {
- struct snode *snp;
- switch (lastst) {
- case semicolon:
- getsym();
- --- 585,620 ----
- return 0;
- }
-
- ! #ifdef TRACE
- ! static struct snode *
- ! tracestmt()
- ! /*
- ! * tracestmt adds calls to a run-time tracing/debugging routine.
- */
- {
- struct snode *snp;
- + snp = (struct snode *) xalloc((int) sizeof(struct snode));
- + snp->stype = st_compound;
- + snp->s1 = (struct snode *) xalloc((int) sizeof(struct snode));
- + snp->s1->stype = st_expr;
- + traceexpr(&(snp->s1->exp));
- + return snp;
- + }
- + #endif /* TRACE */
- +
- + static struct snode *
- + statement()
- + /*
- + * statement figures out which of the statement processors should be called
- + * and transfers control to the proper routine.
- + */
- + {
- + struct snode *snp;
- + #ifdef TRACE
- + struct snode *tsnp;
- + if (trace_option)
- + tsnp = tracestmt();
- + #endif
- switch (lastst) {
- case semicolon:
- getsym();
- ***************
- *** 644,648 ****
- }
- if (snp != 0)
- snp->next = 0;
- ! return snp;
- ! }
- --- 668,678 ----
- }
- if (snp != 0)
- snp->next = 0;
- ! #ifdef TRACE
- ! if (trace_option) {
- ! tsnp->s1->next = snp;
- ! return tsnp;
- ! } else
- ! #endif /* TRACE */
- ! return snp;
- ! }
- *** src/version.h.o Mon Dec 7 13:16:36 1992
- --- src/version.h Mon Dec 7 13:13:47 1992
- ***************
- *** 1,3 ****
- ! #define VERSION "4.1"
- ! #define LAST_CHANGE_DATE "04 Oct 92"
-
- --- 1,3 ----
- ! #define VERSION "4.2"
- ! #define LAST_CHANGE_DATE "05 Dec 92"
-
-