]> git.gag.com Git - fw/sdcc/commitdiff
* src/ds390/main.c,
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 9 Jan 2004 06:03:09 +0000 (06:03 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 9 Jan 2004 06:03:09 +0000 (06:03 +0000)
* 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

ChangeLog
src/ds390/gen.c
src/ds390/main.c
src/z80/main.c

index fc2981a3eac934dff1999328e07d775a46b76c78..8b42de13cf4b39d6681f5bc37706ebf5a0970cb7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-09 Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+       * 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 <vrokas@otenet.gr>
 
        * src/SDCCmain.c: removed various references to DEFAULT_PORT
index 436a490b7767c136ee758698d06a74da268e52a1..e66bfc16280a82a232c64a042cfe89fe5153f74f 100644 (file)
@@ -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));
index 43918804dd21308cb5cbc0662174d4590b7d2573..cc66e1608fcc116a6c7321e1ddebddacc84aa874 100644 (file)
@@ -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
index f0a96039b74d447d2866d200e87c74d1adb4089c..cbf52a6d58176c9e839fad27191b2fd278f2d38c 100644 (file)
@@ -557,7 +557,8 @@ PORT z80_port =
     NULL,
     LINKCMD,
     NULL,
-    ".o"
+    ".o",
+    1
   },
   {
     _z80_defaultRules