diff options
author | Robert de Bath <rdebath@poboxes.com> | 1998-07-01 01:00:00 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:40:31 +0200 |
commit | ec5f28e3f1400b5dacb88eda2d9db472a20b4349 (patch) | |
tree | b3215b2306709d0412fd7845c78ca63ccaa2e29b /bcc | |
parent | 2f828530e36a02c5b4c534e42ab812370c2bf7d9 (diff) | |
download | dev86-ec5f28e3f1400b5dacb88eda2d9db472a20b4349.tar.gz |
Import Dev86src-0.14.3.tar.gzv0.14.3
Diffstat (limited to 'bcc')
-rw-r--r-- | bcc/assign.c | 26 | ||||
-rw-r--r-- | bcc/floatop.c | 34 | ||||
-rw-r--r-- | bcc/function.c | 50 | ||||
-rw-r--r-- | bcc/gencode.c | 8 | ||||
-rw-r--r-- | bcc/genloads.c | 58 | ||||
-rw-r--r-- | bcc/preproc.c | 3 |
6 files changed, 145 insertions, 34 deletions
diff --git a/bcc/assign.c b/bcc/assign.c index 27d1366..73a9883 100644 --- a/bcc/assign.c +++ b/bcc/assign.c @@ -61,11 +61,33 @@ struct symstruct *target; { /* XXX - 386 only */ storereg(DREG, target); +#ifdef I80386 + if (i386_32) + { + if (tscalar & DOUBLE) + { + target->indcount = 1; /* XXX outnnadr clobbers this */ + target->offset.offi += accregsize; + storereg(doubleregs & ~DREG, target); + } + } + else +#endif if (tscalar & DOUBLE) { - target->indcount = 1; /* XXX - outnnadr clobbers this */ + int i; + for(i=1; i; i<<=1) if( i!= DREG && (doubleregs & i) ) + { + target->indcount = 1; /* XXX outnnadr clobbers this */ + target->offset.offi += accregsize; + storereg(i, target); + } + } + else if (tscalar & FLOAT) + { + target->indcount = 1; /* XXX outnnadr clobbers this */ target->offset.offi += accregsize; - storereg(doubleregs & ~DREG, target); + storereg(DATREG2, target); } target->storage = source->storage; target->offset.offi = 0; diff --git a/bcc/floatop.c b/bcc/floatop.c index 38b0e52..199c562 100644 --- a/bcc/floatop.c +++ b/bcc/floatop.c @@ -22,18 +22,38 @@ struct symstruct *target; { if (target->storage == CONSTANT) { - /* XXX - more for non-386 */ - if (target->type->scalar & FLOAT) +#ifdef I80386 + if (i386_32) { - float val; + if (target->type->scalar & FLOAT) + { + float val; - val = *target->offset.offd; - push(constsym(((value_t *) &val)[0])); + val = *target->offset.offd; + push(constsym(((value_t *) &val)[0])); + } + else + { + push(constsym(((value_t *) target->offset.offd)[1])); + push(constsym(((value_t *) target->offset.offd)[0])); + } } else +#endif { - push(constsym(((value_t *) target->offset.offd)[1])); - push(constsym(((value_t *) target->offset.offd)[0])); + if (target->type->scalar & FLOAT) + { + float val = *target->offset.offd; + push(constsym( ((unsigned short*) &val)[1] )); + push(constsym( ((unsigned short*) &val)[0] )); + } + else + { + push(constsym(((unsigned short*) target->offset.offd)[3])); + push(constsym(((unsigned short*) target->offset.offd)[2])); + push(constsym(((unsigned short*) target->offset.offd)[1])); + push(constsym(((unsigned short*) target->offset.offd)[0])); + } } } else if (target->type->scalar & FLOAT) diff --git a/bcc/function.c b/bcc/function.c index 85bf007..db2745d 100644 --- a/bcc/function.c +++ b/bcc/function.c @@ -85,14 +85,24 @@ struct symstruct *source; #endif source->storage = BREG; } - else if (source->type->scalar & DOUBLE) - source->storage = doublreturnregs & ~DREG; -#if 0 - else if (source->type->scalar & FLOAT) - source->storage = floatreturnregs /* XXX? & ~DREG */; -#endif +#ifdef I80386 + else if (i386_32) + { + if (source->type->scalar & DOUBLE) + source->storage = doublreturnregs & ~DREG; + else + source->storage = RETURNREG; + } else - source->storage = RETURNREG; +#endif + { + if (source->type->scalar & DOUBLE) + source->storage = doublreturnregs; + else if (source->type->scalar & FLOAT) + source->storage = RETURNREG|DATREG2; + else + source->storage = RETURNREG; + } source->offset.offi = source->indcount = 0; if (source->level == OFFKLUDGELEVEL) source->level = EXPRLEVEL; @@ -186,14 +196,26 @@ PUBLIC void loadretexpression() } else #endif - if (returntype->scalar & DOUBLE) - loadexpression(doublreturnregs & ~DREG, returntype); -#if 0 - else if (returntype->scalar & FLOAT) - loadexpression(floatreturnregs /* XXX? & ~DREG */, returntype); + { +#ifdef I80386 + if (i386_32) + { + if (returntype->scalar & DOUBLE) + loadexpression(doublreturnregs & ~DREG, returntype); + else + loadexpression(RETURNREG, returntype); + } + else #endif - else - loadexpression(RETURNREG, returntype); + { + if (returntype->scalar & DOUBLE) + loadexpression(doublreturnregs, returntype); + else if (returntype->scalar & FLOAT) + loadexpression(/* REURNREG|*/ DATREG2, returntype); + else + loadexpression(RETURNREG, returntype); + } + } } PUBLIC void listo(target, lastargsp) diff --git a/bcc/gencode.c b/bcc/gencode.c index 8e0a0f5..9498159 100644 --- a/bcc/gencode.c +++ b/bcc/gencode.c @@ -42,9 +42,9 @@ PUBLIC bool_t arg1inreg = FALSE; PUBLIC store_pt calleemask = INDREG1 | INDREG2; PUBLIC bool_t callersaves = FALSE; PUBLIC char *callstring = "call\t"; -PUBLIC store_pt doubleargregs = DREG | INDREG0 | INDREG1 | INDREG2; -PUBLIC store_pt doubleregs = DREG | INDREG0 | INDREG1 | INDREG2; -PUBLIC store_pt doublreturnregs = DREG | INDREG0 | INDREG1 | INDREG2; +PUBLIC store_pt doubleargregs = DREG | INDREG0 | DATREG1 | DATREG2; +PUBLIC store_pt doubleregs = DREG | INDREG0 | DATREG1 | DATREG2; +PUBLIC store_pt doublreturnregs = DREG | INDREG0 | DATREG1 | DATREG2; PUBLIC offset_T jcclonger = 3; PUBLIC offset_T jmplonger = 1; PUBLIC char *jumpstring = "br \t"; @@ -546,7 +546,7 @@ struct nodestruct *exp; if (regmark & doublreturnregs) savelist = doublreturnregs; } - else if (regmark & RETURNREG) + else if (regmark & RETURNREG) /* XXX size long == float ? */ savelist = exp->nodetype->scalar & DLONG ? LONGRETURNREGS : RETURNREG; if (savelist != 0) diff --git a/bcc/genloads.c b/bcc/genloads.c index e90dd5d..b39856e 100644 --- a/bcc/genloads.c +++ b/bcc/genloads.c @@ -348,9 +348,24 @@ store_pt targreg; return; if (source->storage == CONSTANT) { - /* XXX - more for non-386 */ - loadconst(((offset_T *) source->offset.offd)[0], DREG); - loadconst(((offset_T *) source->offset.offd)[1], targreg); + if (i386_32) + { + loadconst(((offset_T *) source->offset.offd)[0], DREG); + loadconst(((offset_T *) source->offset.offd)[1], targreg&~DREG); + } + else /* XXX - more for non-386 */ + { + int regs, i, off=1; + loadconst(((unsigned short *) source->offset.offd)[0], DREG); + regs = (targreg&~DREG); + for(i=1; i; i<<=1) + { + if( regs&i ) + loadconst( + ((unsigned short *) source->offset.offd)[off++], + i); + } + } } else { @@ -369,7 +384,28 @@ store_pt targreg; float val; val = *source->offset.offd; - loadconst(((offset_T *) &val)[0], targreg); +#ifdef I80386 + if (i386_32) + loadconst(((offset_T *) &val)[0], targreg); /* XXX 386 */ + else +#endif + { + loadconst(((unsigned short *) &val)[0], DREG); + loadconst(((unsigned short *) &val)[1], targreg&~DREG); + } + } + else if (!i386_32 && source->type->scalar & FLOAT) + { + /* Treat a float just like a long ... */ + if (source->indcount == 0) + { + if (source->storage != (store_t) targreg) + transfer(source, targreg); + if (source->offset.offi != 0) + bugerror("loading direct float with offset not implemented"); + } + else + loadlongindirect(source, targreg); } else if (source->indcount == 0 && source->storage != CONSTANT) loadadr(source, targreg); @@ -937,7 +973,19 @@ store_pt reg; break; #endif default: - outstr(badregstr); + { int i; + if (reg) + for(i=1; i; i<<=1) + { + if( reg&i ) + { + outregname(i); + outstr(" "); + } + } + else + outstr(badregstr); + } break; } } diff --git a/bcc/preproc.c b/bcc/preproc.c index a455ee2..507591f 100644 --- a/bcc/preproc.c +++ b/bcc/preproc.c @@ -355,8 +355,7 @@ ts_s_macstring += 2; oldlevel(); locptr = locmark; } - if (asmmode) - equ(sname, macstring); +/* if (asmmode) equ(sname, macstring); */ if ((symptr = findlorg(sname)) != NULL && symptr->flags == DEFINITION) { |