* src/mcs51/gen.c (loadDptrFromOperand, genFarPointerGet,
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 19 Sep 2003 21:28:08 +0000 (21:28 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 19 Sep 2003 21:28:08 +0000 (21:28 +0000)
genCodePointerGet, genGenPointerGet, genFarPointerSet,
genGenPointerSet): handle AOP_DPTR correctly when loading dptr
(ralloc doesn't intentionally do this now, but perhaps later)
* src/mcs51/ralloc.c (serialRegAssign, fillGaps),
* src/ds390/ralloc.c (serialRegAssign, fillGaps): fixed some
register positioning bugs (Fixed bug #762602 and #795325)
* src/SDCCicode.c (geniCodeDerefPtr): Track output class correctly
(Fixed bug #808779)
* src/z80/gen.c: increased _vemit2's buffer[] to handle long
lines that --i-code-in-asm generates

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2899 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCicode.c
src/ds390/ralloc.c
src/mcs51/gen.c
src/mcs51/ralloc.c
src/z80/gen.c

index 51b6f2f2fdd7582cb3883df98fe9e4545642fef6..f87c628dc9235779d09d1058cda5f8afed9ce9ee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2003-09-19  Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+       * src/mcs51/gen.c (loadDptrFromOperand, genFarPointerGet,
+       genCodePointerGet, genGenPointerGet, genFarPointerSet,
+       genGenPointerSet): handle AOP_DPTR correctly when loading dptr
+       (ralloc doesn't intentionally do this now, but perhaps later)
+       * src/mcs51/ralloc.c (serialRegAssign, fillGaps),
+       * src/ds390/ralloc.c (serialRegAssign, fillGaps): fixed some
+       register positioning bugs (Fixed bug #762602 and #795325)
+       * src/SDCCicode.c (geniCodeDerefPtr): Track output class correctly
+       (Fixed bug #808779)
+       * src/z80/gen.c: increased _vemit2's buffer[] to handle long
+       lines that --i-code-in-asm generates
+
 2003-09-18  Jesus Calvino-Fraga <jesusc@ece.ubc.ca>
 
        *link/z80/lklibr.c, as/mcs51/lklibr.c: Fixed Linux segfaults when
index 44dddc1175750e87adfba60a77b369db35302d45..381e43fa46688418d6f0acea0ae8dc4db3cf94eb 100644 (file)
@@ -51,6 +51,7 @@ operand *geniCodeArray2Ptr (operand *);
 operand *geniCodeRValue (operand *, bool);
 operand *geniCodeDerefPtr (operand *,int);
 int isLvaluereq(int lvl);
+void  setOClass (sym_link * ptr, sym_link * spec);
 
 #define PRINTFUNC(x) void x (FILE *of, iCode *ic, char *s)
 /* forward definition of ic print functions */
@@ -1800,7 +1801,7 @@ geniCodeCast (sym_link * type, operand * op, bool implicit)
       if (IS_INTEGRAL(optype)) { 
        // maybe this is NULL, than it's ok. 
        if (!(IS_LITERAL(optype) && (SPEC_CVAL(optype).v_ulong ==0))) {
-         if (!TARGET_IS_Z80 && !TARGET_IS_GBZ80 && IS_GENPTR(type)) {
+         if (port->s.gptr_size > port->s.fptr_size && IS_GENPTR(type)) {
            // no way to set the storage
            if (IS_LITERAL(optype)) {
              werror(E_LITERAL_GENERIC);
@@ -1823,7 +1824,7 @@ geniCodeCast (sym_link * type, operand * op, bool implicit)
        }
       }
     } else { // from a pointer to a pointer
-      if (!TARGET_IS_Z80 && !TARGET_IS_GBZ80) {
+      if (port->s.gptr_size > port->s.fptr_size /*!TARGET_IS_Z80 && !TARGET_IS_GBZ80*/) {
        // if not a pointer to a function
        if (!(IS_CODEPTR(type) && IS_FUNC(type->next) && IS_FUNC(optype))) {
          if (implicit) { // if not to generic, they have to match 
@@ -2189,7 +2190,6 @@ aggrToPtr (sym_link * type, bool force)
   sym_link *etype;
   sym_link *ptype;
 
-
   if (IS_PTR (type) && !force)
     return type;
 
@@ -2288,14 +2288,14 @@ geniCodeStruct (operand * left, operand * right, bool islval)
   retype = getSpec (operandType (IC_RESULT (ic)));
   SPEC_SCLS (retype) = SPEC_SCLS (etype);
   SPEC_OCLS (retype) = SPEC_OCLS (etype);
-  SPEC_VOLATILE (retype) |= SPEC_VOLATILE (etype); /* EEP - I'm doubtful about this */
-
+  SPEC_VOLATILE (retype) |= SPEC_VOLATILE (etype);
+  SPEC_CONST (retype) |= SPEC_CONST (etype);
+  
   if (IS_PTR (element->type))
     setOperandType (IC_RESULT (ic), aggrToPtr (operandType (IC_RESULT (ic)), TRUE));
-
+  
   IC_RESULT (ic)->isaddr = (!IS_AGGREGATE (element->type));
 
-
   ADDTOCHAIN (ic);
   return (islval ? IC_RESULT (ic) : geniCodeRValue (IC_RESULT (ic), TRUE));
 }
@@ -2594,11 +2594,10 @@ geniCodeDerefPtr (operand * op,int lvl)
   else
     {
       retype = getSpec (rtype = copyLinkChain (optype->next));
+      /* outputclass needs 2b updated */
+      setOClass (optype, retype);
     }
-
-  /* outputclass needs 2b updated */
-  setOClass (optype, retype);
-
+  
   op->isGptr = IS_GENPTR (optype);
 
   op->isaddr = (IS_PTR (rtype) ||
index 7af5833ca041cd4d980ca516cf3a7fd0bd21292f..3f04aa2312638b1c16eeba0efed61b278221e105 100644 (file)
@@ -1337,17 +1337,25 @@ serialRegAssign (eBBlock ** ebbs, int count)
                  if (!sym->regs[j])
                    break;
                }
-             /* if it shares registers with operands make sure
+             
+              /* if it shares registers with operands make sure
                 that they are in the same position */
-             if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)) &&
-                 OP_SYMBOL (IC_LEFT (ic))->nRegs && ic->op != '=')
-               positionRegs (OP_SYMBOL (IC_RESULT (ic)),
-                             OP_SYMBOL (IC_LEFT (ic)));
-             /* do the same for the right operand */
-             if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)) &&
-                 OP_SYMBOL (IC_RIGHT (ic))->nRegs)
-               positionRegs (OP_SYMBOL (IC_RESULT (ic)),
-                             OP_SYMBOL (IC_RIGHT (ic)));
+             if (!POINTER_SET(ic) && !POINTER_GET(ic))
+                {
+                 if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)) &&
+                     OP_SYMBOL (IC_LEFT (ic))->nRegs)
+                    {
+                     positionRegs (OP_SYMBOL (IC_RESULT (ic)),
+                                   OP_SYMBOL (IC_LEFT (ic)));
+                   }
+                 /* do the same for the right operand */
+                 if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)) &&
+                     OP_SYMBOL (IC_RIGHT (ic))->nRegs)
+                    {
+                     positionRegs (OP_SYMBOL (IC_RESULT (ic)),
+                                   OP_SYMBOL (IC_RIGHT (ic)));
+                   }
+                }
 
              if (ptrRegSet)
                {
@@ -1474,11 +1482,11 @@ static void fillGaps()
                    /* if left is assigned to registers */
                    if (IS_SYMOP(IC_LEFT(ic)) && 
                        bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_LEFT(ic))->key)) {
-                       pdone += positionRegs(sym,OP_SYMBOL(IC_LEFT(ic)));
+                       pdone += (positionRegs(sym,OP_SYMBOL(IC_LEFT(ic)))>0);
                    }
                    if (IS_SYMOP(IC_RIGHT(ic)) && 
                        bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_RIGHT(ic))->key)) {
-                       pdone += positionRegs(sym,OP_SYMBOL(IC_RIGHT(ic)));
+                       pdone += (positionRegs(sym,OP_SYMBOL(IC_RIGHT(ic)))>0);
                    }
                    if (pdone > 1) break;
                }
@@ -1488,12 +1496,12 @@ static void fillGaps()
                    iCode *ic;
                    if (!(ic = hTabItemWithKey(iCodehTab,i))) continue ;
                    if (SKIP_IC(ic)) continue;
-                   if (!IS_ASSIGN_ICODE(ic)) continue ;
+                   if (POINTER_SET(ic) || POINTER_GET(ic)) continue ;
                    
                    /* if result is assigned to registers */
                    if (IS_SYMOP(IC_RESULT(ic)) && 
                        bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_RESULT(ic))->key)) {
-                       pdone += positionRegs(sym,OP_SYMBOL(IC_RESULT(ic)));
+                       pdone += (positionRegs(sym,OP_SYMBOL(IC_RESULT(ic)))>0);
                    }
                    if (pdone > 1) break;
                }
index b71930550139a4a9939e6667938046590c64abb0..89a30529d41cc2d374c77d6f4040a25db6c2ad3f 100644 (file)
@@ -420,6 +420,9 @@ aopForSym (iCode * ic, symbol * sym, bool result)
   /* if it is in direct space */
   if (IN_DIRSPACE (space))
     {
+      //printf("aopForSym, using AOP_DIR for %s (%x)\n", sym->name, sym);
+      //printTypeChainRaw(sym->type, NULL);
+      //printf("space = %s\n", space ? space->sname : "NULL");
       sym->aop = aop = newAsmop (AOP_DIR);
       aop->aopu.aop_dir = sym->rname;
       aop->size = getSize (sym->type);
@@ -875,7 +878,6 @@ aopGetUsesAcc (asmop *aop, int offset)
     }
 }
 
-
 /*-----------------------------------------------------------------*/
 /* aopGet - for fetching value of the aop                          */
 /*-----------------------------------------------------------------*/
@@ -7539,6 +7541,66 @@ genPagedPointerGet (operand * left,
 
 }
 
+/*--------------------------------------------------------------------*/
+/* loadDptrFromOperand - load dptr (and optionally B) from operand op */
+/*--------------------------------------------------------------------*/
+static void
+loadDptrFromOperand (operand *op, bool loadBToo)
+{
+  if (AOP_TYPE (op) != AOP_STR)
+    {
+      /* if this is remateriazable */
+      if (AOP_TYPE (op) == AOP_IMMD)
+       {
+         emitcode ("mov", "dptr,%s", aopGet (AOP (op), 0, TRUE, FALSE));
+          if (loadBToo)
+            {
+             if (AOP(op)->aopu.aop_immd.from_cast_remat) 
+               emitcode ("mov", "b,%s",aopGet(AOP (op), AOP_SIZE(op)-1, FALSE, FALSE));
+             else
+                {
+                  wassertl(FALSE, "need pointerCode");
+                  emitcode ("", "; mov b,???");
+                  /* genPointerGet and genPointerSet originally did different
+                  ** things for this case. Both seem wrong.
+                  ** from genPointerGet:
+                 **  emitcode ("mov", "b,#%d", pointerCode (retype));
+                  ** from genPointerSet:
+                 **  emitcode ("mov", "b,%s + 1", aopGet (AOP (result), 0, TRUE, FALSE));
+                  */
+                }
+            }
+       }
+      else if (AOP_TYPE (op) == AOP_DPTR)
+       {
+         if (loadBToo)
+           {
+             MOVA (aopGet (AOP (op), 0, FALSE, FALSE));
+             emitcode ("push", "acc");
+             MOVA (aopGet (AOP (op), 1, FALSE, FALSE));
+             emitcode ("push", "acc");
+             emitcode ("mov", "b,%s", aopGet (AOP (op), 2, FALSE, FALSE));
+             emitcode ("pop", "dph");
+             emitcode ("pop", "dpl");
+           }
+         else
+           {
+             MOVA (aopGet (AOP (op), 0, FALSE, FALSE));
+             emitcode ("push", "acc");
+             emitcode ("mov", "dph,%s", aopGet (AOP (op), 1, FALSE, FALSE));
+             emitcode ("pop", "dpl");
+           }
+       }
+      else
+       {                       /* we need to get it byte by byte */
+         emitcode ("mov", "dpl,%s", aopGet (AOP (op), 0, FALSE, FALSE));
+         emitcode ("mov", "dph,%s", aopGet (AOP (op), 1, FALSE, FALSE));
+         if (loadBToo)
+           emitcode ("mov", "b,%s", aopGet (AOP (op), 2, FALSE, FALSE));
+       }
+    }
+}
+
 /*-----------------------------------------------------------------*/
 /* genFarPointerGet - gget value from far space                    */
 /*-----------------------------------------------------------------*/
@@ -7552,21 +7614,9 @@ genFarPointerGet (operand * left,
   D(emitcode (";     genFarPointerGet",""));
 
   aopOp (left, ic, FALSE);
-
-  /* if the operand is already in dptr
-     then we do nothing else we move the value to dptr */
-  if (AOP_TYPE (left) != AOP_STR)
-    {
-      /* if this is remateriazable */
-      if (AOP_TYPE (left) == AOP_IMMD)
-       emitcode ("mov", "dptr,%s", aopGet (AOP (left), 0, TRUE, FALSE));
-      else
-       {                       /* we need to get it byte by byte */
-         emitcode ("mov", "dpl,%s", aopGet (AOP (left), 0, FALSE, FALSE));
-         emitcode ("mov", "dph,%s", aopGet (AOP (left), 1, FALSE, FALSE));
-       }
-    }
-  /* so dptr know contains the address */
+  loadDptrFromOperand (left, FALSE);
+  
+  /* so dptr now contains the address */
   aopOp (result, ic, FALSE);
 
   /* if bit then unpack */
@@ -7608,21 +7658,9 @@ genCodePointerGet (operand * left,
   D(emitcode (";     genCodePointerGet",""));
 
   aopOp (left, ic, FALSE);
-
-  /* if the operand is already in dptr
-     then we do nothing else we move the value to dptr */
-  if (AOP_TYPE (left) != AOP_STR)
-    {
-      /* if this is remateriazable */
-      if (AOP_TYPE (left) == AOP_IMMD)
-       emitcode ("mov", "dptr,%s", aopGet (AOP (left), 0, TRUE, FALSE));
-      else
-       {                       /* we need to get it byte by byte */
-         emitcode ("mov", "dpl,%s", aopGet (AOP (left), 0, FALSE, FALSE));
-         emitcode ("mov", "dph,%s", aopGet (AOP (left), 1, FALSE, FALSE));
-       }
-    }
-  /* so dptr know contains the address */
+  loadDptrFromOperand (left, FALSE);
+  
+  /* so dptr now contains the address */
   aopOp (result, ic, FALSE);
 
   /* if bit then unpack */
@@ -7673,27 +7711,8 @@ genGenPointerGet (operand * left,
   D(emitcode (";     genGenPointerGet",""));
 
   aopOp (left, ic, FALSE);
-
-  /* if the operand is already in dptr
-     then we do nothing else we move the value to dptr */
-  if (AOP_TYPE (left) != AOP_STR)
-    {
-      /* if this is remateriazable */
-      if (AOP_TYPE (left) == AOP_IMMD)
-       {
-         emitcode ("mov", "dptr,%s", aopGet (AOP (left), 0, TRUE, FALSE));
-         if (AOP(left)->aopu.aop_immd.from_cast_remat) 
-                 emitcode ("mov", "b,%s",aopGet(AOP (left), AOP_SIZE(left)-1, FALSE, FALSE));
-         else
-                 emitcode ("mov", "b,#%d", pointerCode (retype));
-       }
-      else
-       {                       /* we need to get it byte by byte */
-         emitcode ("mov", "dpl,%s", aopGet (AOP (left), 0, FALSE, FALSE));
-         emitcode ("mov", "dph,%s", aopGet (AOP (left), 1, FALSE, FALSE));
-         emitcode ("mov", "b,%s", aopGet (AOP (left), 2, FALSE, FALSE));
-       }
-    }
+  loadDptrFromOperand (left, TRUE);
+  
   /* so dptr know contains the address */
   aopOp (result, ic, FALSE);
 
@@ -8185,20 +8204,8 @@ genFarPointerSet (operand * right,
   D(emitcode (";     genFarPointerSet",""));
 
   aopOp (result, ic, FALSE);
-
-  /* if the operand is already in dptr
-     then we do nothing else we move the value to dptr */
-  if (AOP_TYPE (result) != AOP_STR)
-    {
-      /* if this is remateriazable */
-      if (AOP_TYPE (result) == AOP_IMMD)
-       emitcode ("mov", "dptr,%s", aopGet (AOP (result), 0, TRUE, FALSE));
-      else
-       {                       /* we need to get it byte by byte */
-         emitcode ("mov", "dpl,%s", aopGet (AOP (result), 0, FALSE, FALSE));
-         emitcode ("mov", "dph,%s", aopGet (AOP (result), 1, FALSE, FALSE));
-       }
-    }
+  loadDptrFromOperand (result, FALSE);
+  
   /* so dptr know contains the address */
   aopOp (right, ic, FALSE);
 
@@ -8242,27 +8249,8 @@ genGenPointerSet (operand * right,
   D(emitcode (";     genGenPointerSet",""));
 
   aopOp (result, ic, FALSE);
-
-  /* if the operand is already in dptr
-     then we do nothing else we move the value to dptr */
-  if (AOP_TYPE (result) != AOP_STR)
-    {
-      /* if this is remateriazable */
-      if (AOP_TYPE (result) == AOP_IMMD)
-       {
-         emitcode ("mov", "dptr,%s", aopGet (AOP (result), 0, TRUE, FALSE));
-         if (AOP(result)->aopu.aop_immd.from_cast_remat) 
-                 emitcode ("mov", "b,%s",aopGet(AOP (result), AOP_SIZE(result)-1, FALSE, FALSE));
-         else 
-                 emitcode ("mov", "b,%s + 1", aopGet (AOP (result), 0, TRUE, FALSE));
-       }
-      else
-       {                       /* we need to get it byte by byte */
-         emitcode ("mov", "dpl,%s", aopGet (AOP (result), 0, FALSE, FALSE));
-         emitcode ("mov", "dph,%s", aopGet (AOP (result), 1, FALSE, FALSE));
-         emitcode ("mov", "b,%s", aopGet (AOP (result), 2, FALSE, FALSE));
-       }
-    }
+  loadDptrFromOperand (result, TRUE);
+  
   /* so dptr know contains the address */
   aopOp (right, ic, FALSE);
 
index a97776bea7b6b80c9b5534bd6feb75f8a27d5215..da326da82a1edfae7343dab3fc858a90c6dc7af5 100644 (file)
@@ -1225,19 +1225,21 @@ serialRegAssign (eBBlock ** ebbs, int count)
                    }
                }
 
-               /* if it shares registers with operands make sure
-                  that they are in the same position */
-               if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)) &&
-                   OP_SYMBOL (IC_LEFT (ic))->nRegs && ic->op != '=') {
-                   positionRegs (OP_SYMBOL (IC_RESULT (ic)),
-                                 OP_SYMBOL (IC_LEFT (ic)));
-               }
-               /* do the same for the right operand */
-               if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)) &&
-                   OP_SYMBOL (IC_RIGHT (ic))->nRegs) {
-                   positionRegs (OP_SYMBOL (IC_RESULT (ic)),
-                                 OP_SYMBOL (IC_RIGHT (ic)));
-               }
+               if (!POINTER_SET(ic) && !POINTER_GET(ic)) {
+                    /* if it shares registers with operands make sure
+                      that they are in the same position */
+                   if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)) &&
+                       OP_SYMBOL (IC_LEFT (ic))->nRegs) {
+                       positionRegs (OP_SYMBOL (IC_RESULT (ic)),
+                                     OP_SYMBOL (IC_LEFT (ic)));
+                   }
+                   /* do the same for the right operand */
+                   if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)) &&
+                       OP_SYMBOL (IC_RIGHT (ic))->nRegs) {
+                       positionRegs (OP_SYMBOL (IC_RESULT (ic)),
+                                     OP_SYMBOL (IC_RIGHT (ic)));
+                   }
+                }
 
                if (ptrRegSet) {
                    mcs51_ptrRegReq--;
@@ -1311,14 +1313,14 @@ static void fillGaps()
                if (!(ic = hTabItemWithKey(iCodehTab,i))) continue ;
                if (SKIP_IC(ic)) continue;
                assert(isSymbolEqual(sym,OP_SYMBOL(IC_RESULT(ic)))); /* just making sure */
-               /* if left is assigned to registers */
+                /* if left is assigned to registers */
                if (IS_SYMOP(IC_LEFT(ic)) && 
                    bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_LEFT(ic))->key)) {
-                   pdone += positionRegs(sym,OP_SYMBOL(IC_LEFT(ic)));
+                   pdone += (positionRegs(sym,OP_SYMBOL(IC_LEFT(ic)))>0);
                }
                if (IS_SYMOP(IC_RIGHT(ic)) && 
                    bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_RIGHT(ic))->key)) {
-                   pdone += positionRegs(sym,OP_SYMBOL(IC_RIGHT(ic)));
+                   pdone += (positionRegs(sym,OP_SYMBOL(IC_RIGHT(ic)))>0);
                }
                if (pdone > 1) break;
            }
@@ -1328,12 +1330,12 @@ static void fillGaps()
                iCode *ic;
                if (!(ic = hTabItemWithKey(iCodehTab,i))) continue ;
                if (SKIP_IC(ic)) continue;
-               if (!IS_ASSIGN_ICODE(ic)) continue ;
+               if (POINTER_SET(ic) || POINTER_GET(ic)) continue ;
 
                /* if result is assigned to registers */
                if (IS_SYMOP(IC_RESULT(ic)) && 
                    bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_RESULT(ic))->key)) {
-                   pdone += positionRegs(sym,OP_SYMBOL(IC_RESULT(ic)));
+                   pdone += (positionRegs(sym,OP_SYMBOL(IC_RESULT(ic)))>0);
                }
                if (pdone > 1) break;
            }
@@ -1570,7 +1572,7 @@ regTypeNum (eBBlock *ebbs)
          if (sym->ruonly || sym->accuse)
            {
              if (IS_AGGREGATE (sym->type) || sym->isptr)
-               sym->type = aggrToPtr (sym->type, FALSE);
+               sym->type = aggrToPtr (sym->type, FALSE);
              continue;
            }
 
@@ -1586,7 +1588,7 @@ regTypeNum (eBBlock *ebbs)
 
 
              /* and that pointer is remat in data space */
-             if (IS_SYMOP (IC_LEFT (ic)) &&
+              if (IS_SYMOP (IC_LEFT (ic)) &&
                  OP_SYMBOL (IC_LEFT (ic))->remat &&
                  !IS_CAST_ICODE(OP_SYMBOL (IC_LEFT (ic))->rematiCode) &&
                  DCL_TYPE (aggrToPtr (operandType(IC_LEFT(ic)), FALSE)) == POINTER)
@@ -1595,6 +1597,7 @@ regTypeNum (eBBlock *ebbs)
                  symbol *psym = newSymbol (rematStr (OP_SYMBOL (IC_LEFT (ic))), 1);
                  psym->type = sym->type;
                  psym->etype = sym->etype;
+                  
                  strcpy (psym->rname, psym->name);
                  sym->isspilt = 1;
                  sym->usl.spillLoc = psym;
@@ -1703,23 +1706,40 @@ farSpacePackable (iCode * ic)
          getSize (aggrToPtr (operandType (IC_RESULT (dic)), FALSE)) > 1)
        return NULL;
 
-      /* if any three is a true symbol in far space */
-      if (IC_RESULT (dic) &&
-         IS_TRUE_SYMOP (IC_RESULT (dic)) &&
-         isOperandInFarSpace (IC_RESULT (dic)))
-       return NULL;
+      if (dic->op == IFX)
+        {
+          if (IC_COND (dic) &&
+             IS_TRUE_SYMOP (IC_COND (dic)) &&
+             isOperandInFarSpace (IC_COND (dic)))
+           return NULL;
+        }
+      else if (dic->op == JUMPTABLE)
+        {
+          if (IC_JTCOND (dic) &&
+             IS_TRUE_SYMOP (IC_JTCOND (dic)) &&
+             isOperandInFarSpace (IC_JTCOND (dic)))
+           return NULL;
+        }
+      else
+        {
+          /* if any three is a true symbol in far space */
+          if (IC_RESULT (dic) &&
+             IS_TRUE_SYMOP (IC_RESULT (dic)) &&
+             isOperandInFarSpace (IC_RESULT (dic)))
+           return NULL;
 
-      if (IC_RIGHT (dic) &&
-         IS_TRUE_SYMOP (IC_RIGHT (dic)) &&
-         isOperandInFarSpace (IC_RIGHT (dic)) &&
-         !isOperandEqual (IC_RIGHT (dic), IC_RESULT (ic)))
-       return NULL;
+          if (IC_RIGHT (dic) &&
+             IS_TRUE_SYMOP (IC_RIGHT (dic)) &&
+             isOperandInFarSpace (IC_RIGHT (dic)) &&
+             !isOperandEqual (IC_RIGHT (dic), IC_RESULT (ic)))
+           return NULL;
 
-      if (IC_LEFT (dic) &&
-         IS_TRUE_SYMOP (IC_LEFT (dic)) &&
-         isOperandInFarSpace (IC_LEFT (dic)) &&
-         !isOperandEqual (IC_LEFT (dic), IC_RESULT (ic)))
-       return NULL;
+          if (IC_LEFT (dic) &&
+             IS_TRUE_SYMOP (IC_LEFT (dic)) &&
+             isOperandInFarSpace (IC_LEFT (dic)) &&
+             !isOperandEqual (IC_LEFT (dic), IC_RESULT (ic)))
+           return NULL;
+        }
 
       if (isOperandEqual (IC_RIGHT (ic), IC_RESULT (dic)))
        {
@@ -1780,43 +1800,56 @@ packRegsForAssign (iCode * ic, eBBlock * ebp)
       if (SKIP_IC2 (dic))
        continue;
 
-      if (IS_TRUE_SYMOP (IC_RESULT (dic)) &&
-         IS_OP_VOLATILE (IC_RESULT (dic)))
-       {
-         dic = NULL;
-         break;
-       }
+      if (dic->op == IFX)
+        {
+          if (IS_SYMOP (IC_COND (dic)) &&
+             (IC_COND (dic)->key == IC_RESULT (ic)->key ||
+              IC_COND (dic)->key == IC_RIGHT (ic)->key))
+           {
+             dic = NULL;
+             break;
+           }
+        }
+      else
+        {
+          if (IS_TRUE_SYMOP (IC_RESULT (dic)) &&
+             IS_OP_VOLATILE (IC_RESULT (dic)))
+           {
+             dic = NULL;
+             break;
+           }
 
-      if (IS_SYMOP (IC_RESULT (dic)) &&
-         IC_RESULT (dic)->key == IC_RIGHT (ic)->key)
-       {
-         if (POINTER_SET (dic))
-           dic = NULL;
+          if (IS_SYMOP (IC_RESULT (dic)) &&
+             IC_RESULT (dic)->key == IC_RIGHT (ic)->key)
+           {
+             if (POINTER_SET (dic))
+               dic = NULL;
 
-         break;
-       }
+             break;
+           }
 
-      if (IS_SYMOP (IC_RIGHT (dic)) &&
-         (IC_RIGHT (dic)->key == IC_RESULT (ic)->key ||
-          IC_RIGHT (dic)->key == IC_RIGHT (ic)->key))
-       {
-         dic = NULL;
-         break;
-       }
+          if (IS_SYMOP (IC_RIGHT (dic)) &&
+             (IC_RIGHT (dic)->key == IC_RESULT (ic)->key ||
+              IC_RIGHT (dic)->key == IC_RIGHT (ic)->key))
+           {
+             dic = NULL;
+             break;
+           }
 
-      if (IS_SYMOP (IC_LEFT (dic)) &&
-         (IC_LEFT (dic)->key == IC_RESULT (ic)->key ||
-          IC_LEFT (dic)->key == IC_RIGHT (ic)->key))
-       {
-         dic = NULL;
-         break;
-       }
+          if (IS_SYMOP (IC_LEFT (dic)) &&
+             (IC_LEFT (dic)->key == IC_RESULT (ic)->key ||
+              IC_LEFT (dic)->key == IC_RIGHT (ic)->key))
+           {
+             dic = NULL;
+             break;
+           }
 
-      if (POINTER_SET (dic) &&
-         IC_RESULT (dic)->key == IC_RESULT (ic)->key)
-       {
-         dic = NULL;
-         break;
+          if (POINTER_SET (dic) &&
+             IC_RESULT (dic)->key == IC_RESULT (ic)->key)
+           {
+             dic = NULL;
+             break;
+           }
        }
     }
 
@@ -1913,14 +1946,28 @@ findAssignToSym (operand * op, iCode * ic)
        break;  /* found where this temp was defined */
 
       /* if we find an usage then we cannot delete it */
-      if (IC_LEFT (dic) && IC_LEFT (dic)->key == op->key)
-       return NULL;
+      
+      if (dic->op == IFX)
+        {
+          if (IC_COND (dic) && IC_COND (dic)->key == op->key)
+            return NULL;
+        }
+      else if (dic->op == JUMPTABLE)
+        {
+          if (IC_JTCOND (dic) && IC_JTCOND (dic)->key == op->key)
+            return NULL;
+        }
+      else
+        {
+          if (IC_LEFT (dic) && IC_LEFT (dic)->key == op->key)
+           return NULL;
 
-      if (IC_RIGHT (dic) && IC_RIGHT (dic)->key == op->key)
-       return NULL;
+          if (IC_RIGHT (dic) && IC_RIGHT (dic)->key == op->key)
+           return NULL;
 
-      if (POINTER_SET (dic) && IC_RESULT (dic)->key == op->key)
-       return NULL;
+          if (POINTER_SET (dic) && IC_RESULT (dic)->key == op->key)
+           return NULL;
+       }
     }
 
   if (!dic)
@@ -2793,8 +2840,10 @@ mcs51_assignRegisters (eBBlock ** ebbs, int count)
 
   /* change assignments this will remove some
      live ranges reducing some register pressure */
+  
   for (i = 0; i < count; i++)
     packRegisters (ebbs, i);
+  
 
   if (options.dump_pack)
     dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
index f822996156bc4d626f0533bcbe15ec5f6dccb4cb..07e257fd3f502aa2193f40ce76d28ee5b4eb0395 100644 (file)
@@ -397,7 +397,7 @@ _newLineNode (char *line)
 static void
 _vemit2 (const char *szFormat, va_list ap)
 {
-  char buffer[256];
+  char buffer[INITIAL_INLINEASM];
 
   tvsprintf (buffer, sizeof(buffer), szFormat, ap);