From: epetrich Date: Fri, 9 Jan 2004 06:03:09 +0000 (+0000) Subject: * src/ds390/main.c, X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=29664046339501e0cb6b77286ea02a51e9acd266;p=fw%2Fsdcc * src/ds390/main.c, * src/z80/main.c: added missed needLinkerScript flags (more than one port structure defined in these file) * src/ds390/gen.c (aopForSym, aopOp, operandsEqu, aopOp3): fixed bug #795325 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3100 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index fc2981a3..8b42de13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-01-09 Erik Petrich + + * src/ds390/main.c, + * src/z80/main.c: added missed needLinkerScript flags (more than + one port structure defined in these file) + * src/ds390/gen.c (aopForSym, aopOp, operandsEqu, aopOp3): fixed + bug #795325 + 2004-01-08 Vangelis Rokas * src/SDCCmain.c: removed various references to DEFAULT_PORT diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 436a490b..e66bfc16 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -516,7 +516,13 @@ aopForSym (iCode * ic, symbol * sym, bool result, bool useDP2) /* if already has one */ if (sym->aop) - return sym->aop; + { + if ((sym->aop->type == AOP_DPTR && useDP2) + || (sym->aop->type == AOP_DPTR2 && !useDP2)) + sym->aop = NULL; + else + return sym->aop; + } /* assign depending on the storage class */ /* if it is on the stack or indirectly addressable */ @@ -862,6 +868,14 @@ operandsEqu (operand * op1, operand * op2) (sym2->usl.spillLoc == sym1)) return TRUE; + /* are they spilt to the same location */ + if (IS_ITEMP (op2) && + IS_ITEMP (op1) && + sym2->isspilt && + sym1->isspilt && + (sym1->usl.spillLoc == sym1->usl.spillLoc)) + return TRUE; + return FALSE; } @@ -921,13 +935,23 @@ aopOp (operand * op, iCode * ic, bool result, bool useDP2) /* if already has a asmop then continue */ if (op->aop) - return; + { + if ((op->aop->type == AOP_DPTR && useDP2) + || (op->aop->type == AOP_DPTR2 && !useDP2)) + op->aop = NULL; + else + return; + } /* if the underlying symbol has a aop */ if (IS_SYMOP (op) && OP_SYMBOL (op)->aop) { op->aop = OP_SYMBOL (op)->aop; - return; + if ((op->aop->type == AOP_DPTR && useDP2) + || (op->aop->type == AOP_DPTR2 && !useDP2)) + op->aop = NULL; + else + return; } /* if this is a true symbol */ @@ -3919,7 +3943,8 @@ bool aopOp3(iCode * ic) } aopOp(IC_LEFT(ic), ic, FALSE, useDp2); - + + // We've op'd the left & right. So, if left or right are the same operand as result, // we know aopOp will succeed, and we can just do it & bail. if (isOperandEqual(IC_LEFT(ic),IC_RESULT(ic)) || @@ -3930,6 +3955,19 @@ bool aopOp3(iCode * ic) return TRUE; } + // Operands may be equivalent (but not equal) if they share a spill location. If + // so, use the same DPTR or DPTR2. + if (operandsEqu (IC_LEFT(ic), IC_RESULT(ic))) + { + aopOp (IC_RESULT (ic), ic, TRUE, AOP_USESDPTR2 (IC_LEFT (ic))); + return TRUE; + } + if (operandsEqu (IC_RIGHT(ic), IC_RESULT(ic))) + { + aopOp (IC_RESULT (ic), ic, TRUE, AOP_USESDPTR2 (IC_RIGHT (ic))); + return TRUE; + } + // Note which dptrs are currently in use. dp1InUse = AOP_USESDPTR(IC_LEFT(ic)) || AOP_USESDPTR(IC_RIGHT(ic)); dp2InUse = AOP_USESDPTR2(IC_LEFT(ic)) || AOP_USESDPTR2(IC_RIGHT(ic)); diff --git a/src/ds390/main.c b/src/ds390/main.c index 43918804..cc66e160 100644 --- a/src/ds390/main.c +++ b/src/ds390/main.c @@ -381,7 +381,8 @@ PORT ds390_port = _linkCmd, NULL, NULL, - ".rel" + ".rel", + 1 }, { _defaultRules @@ -676,6 +677,7 @@ PORT tininative_port = NULL, NULL, ".tlib", + 1 }, { _defaultRules diff --git a/src/z80/main.c b/src/z80/main.c index f0a96039..cbf52a6d 100644 --- a/src/z80/main.c +++ b/src/z80/main.c @@ -557,7 +557,8 @@ PORT z80_port = NULL, LINKCMD, NULL, - ".o" + ".o", + 1 }, { _z80_defaultRules