From 26ade8d624457b7164502ed9c190ca3f146bda0c Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Sun, 11 Aug 2002 08:50:48 +0200 Subject: Import Dev86src-0.16.8.tar.gz --- bcc/assign.c | 2 +- bcc/bcc.c | 17 +++++++++++++++-- bcc/codefrag.c | 2 ++ bcc/debug.c | 4 ++-- bcc/declare.c | 27 +++++++++++++++++++++++++++ bcc/function.c | 26 ++++++++++++++++++++++++-- bcc/gencode.h | 1 + bcc/genloads.c | 18 +++++++++++++++--- bcc/input.c | 3 +++ bcc/preserve.c | 14 ++++++++++++-- bcc/state.c | 1 + 11 files changed, 103 insertions(+), 12 deletions(-) (limited to 'bcc') diff --git a/bcc/assign.c b/bcc/assign.c index 2dce7c4..f6b08c7 100644 --- a/bcc/assign.c +++ b/bcc/assign.c @@ -356,7 +356,7 @@ struct symstruct *target; load(target, DREG); if (target->type == sctype) sctoi(); -#ifdef I8088 +#if defined(I8088) && defined(I80386) else if (tscalar & SHORT) { if (tscalar & UNSIGNED) diff --git a/bcc/bcc.c b/bcc/bcc.c index 289767e..1a0d4e3 100644 --- a/bcc/bcc.c +++ b/bcc/bcc.c @@ -302,9 +302,9 @@ struct file_list * file; command_opts('p'); if (!opt_e) { - command_opts('c'); if (opt_arch<5 && !do_as) command_opt("-t"); + command_opts('c'); } if (!opt_I) @@ -337,6 +337,9 @@ struct file_list * file; command_reset(); newfilename(file, !(do_optim || do_as), 's', (opt_arch != 3 && opt_arch<5)); + if (opt_arch<5 && !do_as) + command_opt("-t"); + command_opts('c'); command_arch(); @@ -361,8 +364,8 @@ struct file_list * file; } command_opt(optim_rules); - command_opt("rules.start"); command_opts('o'); + command_opt("rules.start"); if (opt_O) { sprintf(buf, "rules.%c86", opt_O); @@ -435,6 +438,9 @@ run_link() command_opt("-o"); command_opt(executable_name); + if (opt_arch < 2) + command_opt("-y"); + command_opts('l'); if (opt_arch != 2) { @@ -754,6 +760,9 @@ char ** argv; case 'X': append_option(opt_arg, 'l'); break; + case 'u': + append_option(opt_arg, 'u'); + break; case 'L': append_option(argv[ar], 'l'); @@ -767,6 +776,8 @@ char ** argv; do_optim=1; if (!opt_arg[1] && ( opt_arg[0] >= '1' && opt_arg[0] <= '3' )) opt_O = opt_arg[0]; + else if (opt_arg[0] == '-') + append_option(opt_arg, 'o'); else { char * p = xalloc(strlen(opt_arg)+8); @@ -935,6 +946,8 @@ char ** argv; opt_arch = 2; prepend_option("-D__unix__", 'p'); prepend_option("-D__linux__", 'p'); + /* This one works (in Debian potato), /usr/bin/gcc crashes. */ + add_prefix("/usr/bin/i486-linuxlibc1-"); break; case '8': /* Use 'c386' program as compiler */ opt_arch = 3; diff --git a/bcc/codefrag.c b/bcc/codefrag.c index 041a148..7783562 100644 --- a/bcc/codefrag.c +++ b/bcc/codefrag.c @@ -375,6 +375,7 @@ PRIVATE void tfrlohi() outhiaccum(); outncregname(BREG); } +#ifdef I80386 PUBLIC void ustoi() { outmovzx(); @@ -383,6 +384,7 @@ PUBLIC void ustoi() outshortregname(DREG); outnl(); } +#endif /* I80386 */ #endif /* I8088 */ #ifdef MC6809 diff --git a/bcc/debug.c b/bcc/debug.c index e437f78..2b1e12e 100644 --- a/bcc/debug.c +++ b/bcc/debug.c @@ -161,7 +161,7 @@ struct nodestruct *exp; { if (!debugon) return; - comment(); + outstr("! Debug: "); if (exp->tag < FIRSTOP && exp->tag > LASTOP) outstr("unknown op"); else @@ -186,7 +186,7 @@ struct nodestruct *exp; PUBLIC void debugswap() { if (debugon) - outnstr("* swapping"); + outnstr("! Debug: expression subtree swapping"); } PRIVATE void outindchars(byte, count) diff --git a/bcc/declare.c b/bcc/declare.c index 3dfb26b..1b9e00a 100644 --- a/bcc/declare.c +++ b/bcc/declare.c @@ -693,8 +693,34 @@ PRIVATE void declfunc() if( main_flag > 2 ) globl("environ"); } +#ifdef I8088 + regfuse = 0; +#endif lbrace(); compound(); +#ifdef I8088 + if (regfuse & callee1mask) { + outstr("! Register"); + if (regfuse & INDREG0 & callee1mask) outstr(" BX"); + if (regfuse & INDREG1 & callee1mask) outstr(" SI"); + if (regfuse & INDREG2 & callee1mask) outstr(" DI"); + outstr(" used in function "); + outnstr(funcname); + if (optimise && !callersaves) { + outstr(funcname); + outnstr(".off = 0"); + } + } else + if (optimise && !callersaves) { + outstr(funcname); + outstr(".off = "); +#ifndef I80386 + outnhex(4); +#else + outnhex(i386_32?12:4); +#endif + } +#endif clearfunclabels(); } @@ -1122,6 +1148,7 @@ PUBLIC void rparen() PUBLIC void semicolon() { + outnstr("!BCC_EOS"); if (sym != SEMICOLON) need(';'); else diff --git a/bcc/function.c b/bcc/function.c index e3dcd61..1f8b6f3 100644 --- a/bcc/function.c +++ b/bcc/function.c @@ -271,7 +271,18 @@ PRIVATE void out_callstring() PUBLIC void popframe() { #ifdef STUPIDFRAME - poplist(callee1mask); /*XXX: Add if round this */ +#ifndef NO_DEL_PUSH + if (optimise && !callersaves) { + outstr("if "); + outstr(funcname); + outnstr(".off=0"); + } + poplist(callee1mask); + if (optimise && !callersaves) + outnstr("endif"); +#else + poplist(callee1mask); +#endif poplist(FRAMEREG); #else poplist(frame1list); @@ -313,7 +324,18 @@ PUBLIC void reslocals() pushreg(FRAMEREG); regtransfer(STACKREG, FRAMEREG); framep = sp; - pushlist(callee1mask); /*XXX: Add if round this */ +#ifndef NO_DEL_PUSH + if (optimise && !callersaves) { + outstr("if "); + outstr(funcname); + outnstr(".off=0"); + } + pushlist(callee1mask); + if (optimise && !callersaves) + outnstr("endif"); +#else + pushlist(callee1mask); +#endif # else /* not STUPIDFRAME */ # ifdef CANHANDLENOFRAME if (stackarg || softsp != -frameregsize) /* args or locals */ diff --git a/bcc/gencode.h b/bcc/gencode.h index 6c3908b..63d0614 100644 --- a/bcc/gencode.h +++ b/bcc/gencode.h @@ -47,6 +47,7 @@ EXTERN bool_t scanf_fp; /* nonzero if *scanf called with ptr-to-FP */ EXTERN offset_T softsp; /* software sp (leads sp during declares) */ EXTERN offset_T sp; /* hardware relative stack ptr */ /* depends on zero init */ +EXTERN store_t regfuse; /* registers in use in function. */ #ifdef FRAMEPOINTER EXTERN bool_t stackarg; /* nonzero to show function has arg on stack */ #endif diff --git a/bcc/genloads.c b/bcc/genloads.c index 9aff996..c3ac56a 100644 --- a/bcc/genloads.c +++ b/bcc/genloads.c @@ -784,10 +784,19 @@ struct symstruct *adr; bumplc(); else { + int off; if (switchnow != NULL && adr->flags == TEMP) - outswoffset(adr->offset.offi); + outswoffset(off = adr->offset.offi); else - outoffset(adr->offset.offi - framep); + outoffset(off = adr->offset.offi - framep); +#ifndef NO_DEL_PUSH + if (optimise && !callersaves && off < 0) + { + outstr("+"); + outstr(funcname); + outstr(".off"); + } +#endif } outindleft(); } @@ -948,12 +957,15 @@ store_pt reg; #endif case INDREG0: outstr(ireg0str); + regfuse |= INDREG0; break; case INDREG1: outstr(ireg1str); + regfuse |= INDREG1; break; case INDREG2: outstr(ireg2str); + regfuse |= INDREG2; break; case LOCAL: outstr(localregstr); @@ -996,7 +1008,7 @@ store_pt reg; } } -#ifdef I8088 +#if defined(I8088) && defined(I80386) /* print register name for short type */ PUBLIC void outshortregname(reg) diff --git a/bcc/input.c b/bcc/input.c index 259ae04..4ce121d 100644 --- a/bcc/input.c +++ b/bcc/input.c @@ -609,6 +609,9 @@ ts_s_includelist += sizeof *incnew; definestring("__HAS_NO_FLOATS__"); #endif ctext = flag['t']; +#ifdef DEBUG + if (ctext) debugon = 1; +#endif watchlc = flag['w']; setoutbufs(); inputinit(fname, fd); diff --git a/bcc/preserve.c b/bcc/preserve.c index c8a8cea..779efc2 100644 --- a/bcc/preserve.c +++ b/bcc/preserve.c @@ -6,6 +6,7 @@ #include "gencode.h" #include "reg.h" #include "type.h" +#include "scan.h" /* change stack ptr without changing condition codes */ @@ -18,11 +19,20 @@ bool_pt absflag; #ifdef FRAMEPOINTER if (newsp != framep || (!(bool_t) absflag && switchnow != NULL)) { + int off; outleasp(); if (!(bool_t) absflag && switchnow != NULL) - outswoffset(newsp); + outswoffset(off = newsp); else - outoffset(newsp - framep); + outoffset(off = newsp - framep); +#ifndef NO_DEL_PUSH + if (optimise && !callersaves && off < 0) + { + outstr("+"); + outstr(funcname); + outstr(".off"); + } +#endif outindframereg(); outnl(); } diff --git a/bcc/state.c b/bcc/state.c index a290e43..fef7bbd 100644 --- a/bcc/state.c +++ b/bcc/state.c @@ -779,6 +779,7 @@ more: semicolon(); break; case SEMICOLON: + outnstr("!BCC_EOS"); nextsym(); return; case ASMSYM: -- cgit v1.2.1