From 6cb598cc5f1c8ae6d14381c2776338584368257e Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Fri, 4 Jun 2004 20:33:25 +0200 Subject: Import Dev86src-0.16.16.tar.gz --- bcc/Makefile | 2 +- bcc/bcc.c | 11 +++++++++++ bcc/codefrag.c | 22 ++++++++++++++++++++++ bcc/const.h | 3 +-- bcc/genloads.c | 11 ++++++++++- bcc/hashcmd.c | 23 +++++++++++++++++++++++ bcc/longop.c | 13 ++++++++++++- bcc/softop.c | 11 ++++++++++- bcc/table.c | 7 +++++++ 9 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 bcc/hashcmd.c (limited to 'bcc') diff --git a/bcc/Makefile b/bcc/Makefile index 8f13f6e..169eae8 100644 --- a/bcc/Makefile +++ b/bcc/Makefile @@ -16,7 +16,7 @@ BCFLAGS=$(ANSI) $(CFLAGS) $(LDFLAGS) OBJS = bcc-cc1.o codefrag.o debug.o declare.o express.o exptree.o floatop.o \ function.o gencode.o genloads.o glogcode.o hardop.o input.o label.o \ loadexp.o longop.o output.o preproc.o preserve.o scan.o softop.o \ - state.o table.o type.o assign.o + state.o table.o type.o assign.o hashcmd.o all: bcc-cc1 bcc diff --git a/bcc/bcc.c b/bcc/bcc.c index 5efc4c6..be7ee96 100644 --- a/bcc/bcc.c +++ b/bcc/bcc.c @@ -1082,6 +1082,15 @@ char ** argv; if (opt_arch == 1) libdir_suffix = "/i386"; if (opt_arch == 4) libdir_suffix = "/m09"; + +#ifdef VERSION + { + char verbuf[64]; + sprintf(verbuf, "-D__BCC_VERSION__=0x%02x%02x%02xL", + VER_MAJ, VER_MIN, VER_PAT); + append_option(verbuf, 'p'); + } +#endif } void @@ -1222,8 +1231,10 @@ int size; void Usage() { +#ifdef VERSION if (opt_v) fprintf(stderr, "%s: version %s\n", progname, VERSION); +#endif fprintf(stderr, "Usage: %s [-ansi] [-options] [-o output] file [files].\n", progname); exit(1); diff --git a/bcc/codefrag.c b/bcc/codefrag.c index 7783562..d796810 100644 --- a/bcc/codefrag.c +++ b/bcc/codefrag.c @@ -1619,6 +1619,18 @@ offset_T value; outstr(name); outset(); outshex(value); +#ifdef FRAMEPOINTER +#ifdef I8088 +#ifndef NO_DEL_PUSH + if (framep && optimise && !callersaves && value+sp-framep >= 0 + && !(regfuse & callee1mask)) { + outbyte('-'); + outstr(funcname); + outstr(".off"); + } +#endif +#endif +#endif outnl(); #ifdef FRAMEPOINTER if (framep) @@ -1629,6 +1641,16 @@ offset_T value; outstr(name); outset(); outshex(value+sp-framep); +#ifdef I8088 +#ifndef NO_DEL_PUSH + if (optimise && !callersaves && value+sp-framep < 0 + && !(regfuse & callee1mask)) { + outbyte('+'); + outstr(funcname); + outstr(".off"); + } +#endif +#endif outnl(); } #endif diff --git a/bcc/const.h b/bcc/const.h index 7055354..1c44e19 100644 --- a/bcc/const.h +++ b/bcc/const.h @@ -21,9 +21,8 @@ #define VERY_SMALL_MEMORY #endif -#define SELFTYPECHECK /* check calculated type = runtime type */ - #ifndef VERY_SMALL_MEMORY +#define SELFTYPECHECK /* check calculated type = runtime type */ #define DEBUG /* generate compiler-debugging code */ #define OPTIMISE /* include optimisation code */ #define BUILTIN_CPP diff --git a/bcc/genloads.c b/bcc/genloads.c index cf0c792..3d0f919 100644 --- a/bcc/genloads.c +++ b/bcc/genloads.c @@ -584,7 +584,10 @@ store_pt targreg; if (strcmp (source->name.namep, "__AX") == 0) { /* Load AX register - do nothing. */ -done: source->storage = AXREG; /* in register for further use */ +done: + if (targreg != AXREG) + bugerror("specified access of register clone variable not implemented"); + source->storage = AXREG; /* in register for further use */ source->flags = 0; if (source->level == OFFKLUDGELEVEL) source->level = EXPRLEVEL; @@ -653,6 +656,12 @@ store_pt targreg; { if ((store_t) targreg & ALLDATREGS && source->type->scalar & CHAR) targreg = BREG; +#ifdef I8086 + if (source->type->scalar & CHAR && + targreg != BREG && targreg != DATREG1B ) { + bugerror("moving char sym into int register"); + } +#endif #ifdef I80386 if (i386_32 && source->type->scalar & SHORT && source->indcount <= 1) diff --git a/bcc/hashcmd.c b/bcc/hashcmd.c new file mode 100644 index 0000000..fd22166 --- /dev/null +++ b/bcc/hashcmd.c @@ -0,0 +1,23 @@ + +/* decode remaining preprocessor lines, minimal version. */ + +/* Copyright (C) GPL V2, derived from preproc.c by RDB. */ + +#include "bcc.h" +#include "input.h" +#include "os.h" +#include "output.h" +#include "parse.h" +#include "sc.h" +#include "scan.h" +#include "table.h" +#include "type.h" + +#ifndef BUILTIN_CPP +/* docontrol() - process control statement, #line and #asm only. */ + +PUBLIC void docontrol() +{ + bugerror("docontrol for tiny machines not implemented yet"); +} +#endif diff --git a/bcc/longop.c b/bcc/longop.c index 2cdf62a..9f8acb3 100644 --- a/bcc/longop.c +++ b/bcc/longop.c @@ -39,7 +39,8 @@ struct symstruct *target; else scalar |= source->type->scalar; if ((source->indcount == 0 && !shiftflag) || - source->storage & (DREG | OPREG | OPWORKREG)) + source->type->scalar & CHAR || + source->storage & (BREG | DREG | OPREG | OPWORKREG)) { pres2(source, target); push(source); @@ -60,6 +61,16 @@ struct symstruct *target; if (source->offset.offv == 0) goto shiftdone; } +#ifdef I8088 + /* This is ugly! But it works. I should be able to stop it being used + * by removing the char demotion. */ + if (source->type->scalar & CHAR && + !(source->storage & (BREG|DREG|DATREG1B))) { + load(source, DATREG1B); + outop2str("xor\tch,ch"); outnl(); + source->storage = DATREG1; + } +#endif load(source, OPWORKREG); switch ((op_t) op) { diff --git a/bcc/softop.c b/bcc/softop.c index acb7b27..dcfa8ae 100644 --- a/bcc/softop.c +++ b/bcc/softop.c @@ -219,7 +219,16 @@ struct symstruct *target; { case DIVOP: #ifdef I8088 - call("idiv_"); + if (uflag) + call("idiv_"); + else { + if (i386_32) + outnop1str("cdq"); + else + outnop1str("cwd"); + outop2str("idiv\t"); + outregname(INDREG0); + } #else call("idiv"); #endif diff --git a/bcc/table.c b/bcc/table.c index 79dcf62..fc7d3a1 100644 --- a/bcc/table.c +++ b/bcc/table.c @@ -400,6 +400,13 @@ PUBLIC void dumplocs() register struct symstruct *symptr; int i; +#ifdef ASM_USES_CALLEE_REGS + if (framep && optimise && !callersaves) { + regfuse |= callee1mask; + outnstr("! Assuming #asm uses all callee saves registers"); + } +#endif + for (i = 0; i < HASHTABSIZE; ++i) for (symptr = hashtab[i]; symptr != NULL; symptr = symptr->next) if (symptr->storage == LOCAL) -- cgit v1.2.1