See Changelog 1.204
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 7 Mar 2003 13:34:06 +0000 (13:34 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 7 Mar 2003 13:34:06 +0000 (13:34 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2340 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCBBlock.c
src/SDCCast.c
src/SDCCcflow.c
src/SDCCcse.c
src/SDCCicode.c
src/SDCCicode.h
src/SDCClabel.c
src/SDCCloop.c
src/SDCCmain.c

index dac9d8ec5ce3019245d2327fb0c88818da07628b..51b2cd69a0ac949946d0e7396001c807b43907d0 100644 (file)
@@ -84,9 +84,9 @@ newEdge (eBBlock * from, eBBlock * to)
 }
 
 /*-----------------------------------------------------------------*/
-/* appendDumpFile - if not already created, create the dump file   */
+/* createDumpFile - create the dump file                           */
 /*-----------------------------------------------------------------*/
-FILE *appendDumpFile (int id) {
+FILE *createDumpFile (int id) {
   struct _dumpFiles *dumpFilesPtr=dumpFiles;
 
   while (dumpFilesPtr->id) {
@@ -96,7 +96,7 @@ FILE *appendDumpFile (int id) {
   }
 
   if (!dumpFilesPtr->id) {
-    fprintf (stdout, "internal error: appendDumpFile: unknown dump file.\n");
+    fprintf (stdout, "internal error: createDumpFile: unknown dump file.\n");
     exit (1);
   }
 
@@ -121,7 +121,6 @@ void closeDumpFiles() {
   for (dumpFilesPtr=dumpFiles; dumpFilesPtr->id; dumpFilesPtr++) {
     if (dumpFilesPtr->filePtr) {
       fclose (dumpFilesPtr->filePtr);
-      //dprintf ("closed %s\n", dumpFilesPtr->ext);
     }
   }
 }
@@ -137,7 +136,7 @@ dumpLiveRanges (int id, hTab * liveRanges)
   int k;
 
   if (id) {
-    file=appendDumpFile(id);
+    file=createDumpFile(id);
   } else {
     file = stdout;
   }
@@ -180,7 +179,7 @@ dumpEbbsToFileExt (int id, eBBlock ** ebbs, int count)
   int i;
 
   if (id) {
-    of=appendDumpFile(id);
+    of=createDumpFile(id);
   } else {
     of = stdout;
   }
@@ -188,11 +187,10 @@ dumpEbbsToFileExt (int id, eBBlock ** ebbs, int count)
   for (i = 0; i < count; i++)
     {
       fprintf (of, "\n----------------------------------------------------------------\n");
-      fprintf (of, "Basic Block %s : loop Depth(lSeq) = %d(%d) noPath = %d , lastinLoop = %d\n",
+      fprintf (of, "Basic Block %d %s : loop Depth = %d noPath = %d lastinLoop = %d\n",
+              ebbs[i]->dfnum,
               ebbs[i]->entryLabel->name,
               ebbs[i]->depth,
-              (0 /* for now */ &
-               ebbs[i]->depth) ? findLoopEndSeq(ebbs[i]->partOfLoop) : 0,
               ebbs[i]->noPath,
               ebbs[i]->isLastInLoop);
       fprintf (of, "\ndefines bitVector :");
@@ -218,14 +216,14 @@ eBBlock *
 iCode2eBBlock (iCode * ic)
 {
   iCode *loop;
-  eBBlock *ebb = neweBBlock ();        /* a llocate an entry */
+  eBBlock *ebb = neweBBlock ();        /* allocate an entry */
 
   /* put the first one unconditionally */
   ebb->sch = ic;
 
   /* if this is a label then */
   if (ic->op == LABEL)
-    ebb->entryLabel = ic->argLabel.label;
+    ebb->entryLabel = ic->label;
   else
     {
       SNPRINTF (buffer, sizeof(buffer), "_eBBlock%d", eBBNum++);
@@ -565,7 +563,7 @@ replaceSymBySym (set * sset, operand * src, operand * dest)
            {
              bitVectUnSetBit (OP_USES (IC_COND (ic)), ic->key);
              IC_COND (ic) = operandFromOperand (dest);
-             OP_USES_SET ((dest), bitVectSetBit (OP_USES (dest), ic->key));
+             OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
              continue;
            }
 
@@ -574,7 +572,7 @@ replaceSymBySym (set * sset, operand * src, operand * dest)
              bitVectUnSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
              IC_RIGHT (ic) = operandFromOperand (dest);
              IC_RIGHT (ic)->isaddr = 0;
-             OP_USES_SET ((dest), bitVectSetBit (OP_USES (dest), ic->key));
+             OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
            }
 
          if (isOperandEqual (IC_LEFT (ic), src))
@@ -590,7 +588,7 @@ replaceSymBySym (set * sset, operand * src, operand * dest)
                  IC_LEFT (ic) = operandFromOperand (dest);
                  IC_LEFT (ic)->isaddr = 0;
                }
-             OP_USES_SET ((dest), bitVectSetBit (OP_USES (dest), ic->key));
+             OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
            }
 
          /* special case for pointer sets */
@@ -600,7 +598,7 @@ replaceSymBySym (set * sset, operand * src, operand * dest)
              bitVectUnSetBit (OP_USES (IC_RESULT (ic)), ic->key);
              IC_RESULT (ic) = operandFromOperand (dest);
              IC_RESULT (ic)->isaddr = 1;
-             OP_USES_SET ((dest), bitVectSetBit (OP_USES (dest), ic->key));
+             OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
            }
        }
     }
index b313dc793e717975922e5489a3752d15a979cf58..ddad912515bca9a6a8e6095a918ce5f87100f455 100644 (file)
@@ -3454,7 +3454,7 @@ backPatchLabels (ast * tree, symbol * trueLabel, symbol * falseLabel)
       static int localLbl = 0;
       symbol *localLabel;
 
-      SNPRINTF(buffer, sizeof(buffer), "_and_%d", localLbl++);
+      SNPRINTF(buffer, sizeof(buffer), "_andif_%d", localLbl++);
       localLabel = newSymbol (buffer, NestLevel);
 
       tree->left = backPatchLabels (tree->left, localLabel, falseLabel);
@@ -3480,7 +3480,7 @@ backPatchLabels (ast * tree, symbol * trueLabel, symbol * falseLabel)
       static int localLbl = 0;
       symbol *localLabel;
 
-      SNPRINTF(buffer, sizeof(buffer), "_or_%d", localLbl++);
+      SNPRINTF(buffer, sizeof(buffer), "_orif_%d", localLbl++);
       localLabel = newSymbol (buffer, NestLevel);
 
       tree->left = backPatchLabels (tree->left, trueLabel, localLabel);
index 424bde93bda81795e0e67c99b81a1a93f1fe6596..aff9a856b1ac0778bdcd49cefd3269a1b7638aee 100644 (file)
@@ -160,7 +160,7 @@ eBBSuccessors (eBBlock ** ebbs, int count)
              switch (ic->op)
                {
                case GOTO:      /* goto has edge to label */
-                 succ = eBBWithEntryLabel (ebbs, ic->argLabel.label, count);
+                 succ = eBBWithEntryLabel (ebbs, ic->label, count);
                  break;
 
                case IFX:       /* conditional jump */
index 4b6eadcc50c357866b0fb47df78552f6063a9e04..a3c8a027c5cd111a077f4a7678e79691ef40f4ad 100644 (file)
@@ -131,7 +131,7 @@ replaceAllSymBySym (iCode * ic, operand * from, operand * to, bitVect ** ndpset)
            {
 
              bitVectUnSetBit (OP_USES (from), lic->key);
-             OP_USES_SET ((to), bitVectSetBit (OP_USES (to), lic->key));
+             OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
              siaddr = IC_COND (lic)->isaddr;
              IC_COND (lic) = operandFromOperand (to);
              IC_COND (lic)->isaddr = siaddr;
@@ -147,7 +147,7 @@ replaceAllSymBySym (iCode * ic, operand * from, operand * to, bitVect ** ndpset)
            {
 
              bitVectUnSetBit (OP_USES (from), lic->key);
-             OP_USES_SET ((to), bitVectSetBit (OP_USES (to), lic->key));
+             OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
              siaddr = IC_COND (lic)->isaddr;
              IC_JTCOND (lic) = operandFromOperand (to);
              IC_JTCOND (lic)->isaddr = siaddr;
@@ -162,7 +162,7 @@ replaceAllSymBySym (iCode * ic, operand * from, operand * to, bitVect ** ndpset)
          if (POINTER_SET (lic))
            {
              bitVectUnSetBit (OP_USES (from), lic->key);
-             OP_USES_SET ((to), bitVectSetBit (OP_USES (to), lic->key));
+             OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
 
              /* also check if the "from" was in the non-dominating
                 pointer sets and replace it with "to" in the bitVector */
@@ -176,7 +176,7 @@ replaceAllSymBySym (iCode * ic, operand * from, operand * to, bitVect ** ndpset)
          else
            {
              bitVectUnSetBit (OP_DEFS (from), lic->key);
-             OP_DEFS_SET ((to), bitVectSetBit (OP_DEFS (to), lic->key));
+             OP_DEFS(to)=bitVectSetBit (OP_DEFS (to), lic->key);
            }
          siaddr = IC_RESULT (lic)->isaddr;
          IC_RESULT (lic) = operandFromOperand (to);
@@ -187,7 +187,7 @@ replaceAllSymBySym (iCode * ic, operand * from, operand * to, bitVect ** ndpset)
          IC_RIGHT (lic) && IC_RIGHT (lic)->key == from->key)
        {
          bitVectUnSetBit (OP_USES (from), lic->key);
-         OP_USES_SET ((to), bitVectSetBit (OP_USES (to), lic->key));
+         OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
          siaddr = IC_RIGHT (lic)->isaddr;
          IC_RIGHT (lic) = operandFromOperand (to);
          IC_RIGHT (lic)->isaddr = siaddr;
@@ -197,7 +197,7 @@ replaceAllSymBySym (iCode * ic, operand * from, operand * to, bitVect ** ndpset)
          IC_LEFT (lic) && IC_LEFT (lic)->key == from->key)
        {
          bitVectUnSetBit (OP_USES (from), lic->key);
-         OP_USES_SET ((to), bitVectSetBit (OP_USES (to), lic->key));
+         OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
          siaddr = IC_LEFT (lic)->isaddr;
          IC_LEFT (lic) = operandFromOperand (to);
          IC_LEFT (lic)->isaddr = siaddr;
@@ -1117,7 +1117,7 @@ ifxOptimize (iCode * ic, set * cseSet,
 
 
   /* if it remains an IFX the update the use Set */
-  OP_USES_SET ((IC_COND (ic)), bitVectSetBit (OP_USES (IC_COND (ic)), ic->key));
+  OP_USES(IC_COND (ic))=bitVectSetBit (OP_USES (IC_COND (ic)), ic->key);
   setUsesDefs (IC_COND (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
   return;
 }
@@ -1410,7 +1410,6 @@ cseBBlock (eBBlock * ebb, int computeOnly,
   /* for all the instructions in this block do */
   for (ic = ebb->sch; ic; ic = ic->next)
     {
-
       iCode *pdic;
       operand *pdop;
       iCode *defic;
@@ -1436,8 +1435,8 @@ cseBBlock (eBBlock * ebb, int computeOnly,
       if (ic->op == PCALL || ic->op == CALL || ic->op == RECEIVE)
        {
          /* add to defSet of the symbol */
-         OP_DEFS_SET ((IC_RESULT (ic)),
-           bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key));
+         OP_DEFS(IC_RESULT (ic))=
+           bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
          /* add to the definition set of this block */
          ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
          ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
@@ -1475,8 +1474,8 @@ cseBBlock (eBBlock * ebb, int computeOnly,
          /* the lookup could have changed it */
          if (IS_SYMOP (IC_LEFT (ic)))
            {
-             OP_USES_SET ((IC_LEFT (ic)),
-               bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key));
+             OP_USES(IC_LEFT (ic))=
+               bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
              setUsesDefs (IC_LEFT (ic), ebb->defSet,
                           ebb->outDefs, &ebb->usesDefs);
            }
@@ -1500,8 +1499,8 @@ cseBBlock (eBBlock * ebb, int computeOnly,
       /* if jumptable then mark the usage */
       if (ic->op == JUMPTABLE)
        {
-         OP_USES_SET ((IC_JTCOND (ic)),
-           bitVectSetBit (OP_USES (IC_JTCOND (ic)), ic->key));
+         OP_USES(IC_JTCOND (ic))=
+           bitVectSetBit (OP_USES (IC_JTCOND (ic)), ic->key);
          setUsesDefs (IC_JTCOND (ic), ebb->defSet,
                       ebb->outDefs, &ebb->usesDefs);
          continue;
@@ -1720,16 +1719,16 @@ cseBBlock (eBBlock * ebb, int computeOnly,
       /* add the left & right to the defUse set */
       if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)))
        {
-         OP_USES_SET ((IC_LEFT (ic)),
-           bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key));
+         OP_USES(IC_LEFT (ic))=
+           bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
          setUsesDefs (IC_LEFT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
 
        }
 
       if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)))
        {
-         OP_USES_SET ((IC_RIGHT (ic)),
-           bitVectSetBit (OP_USES (IC_RIGHT (ic)), ic->key));
+         OP_USES(IC_RIGHT (ic))=
+           bitVectSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
          setUsesDefs (IC_RIGHT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
 
        }
@@ -1738,8 +1737,8 @@ cseBBlock (eBBlock * ebb, int computeOnly,
       /* in the defuseSet if it a pointer or array access  */
       if (POINTER_SET (defic))
        {
-         OP_USES_SET ((IC_RESULT (ic)),
-           bitVectSetBit (OP_USES (IC_RESULT (ic)), ic->key));
+         OP_USES(IC_RESULT (ic))=
+           bitVectSetBit (OP_USES (IC_RESULT (ic)), ic->key);
          setUsesDefs (IC_RESULT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
          deleteItemIf (&cseSet, ifPointerGet, IC_RESULT (ic));
          ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_RESULT (ic)->key);
@@ -1757,8 +1756,8 @@ cseBBlock (eBBlock * ebb, int computeOnly,
       else
        /* add the result to defintion set */ if (IC_RESULT (ic))
        {
-         OP_DEFS_SET ((IC_RESULT (ic)),
-           bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key));
+         OP_DEFS(IC_RESULT (ic))=
+           bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
          ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
          ebb->outDefs = bitVectCplAnd (ebb->outDefs, OP_DEFS (IC_RESULT (ic)));
          ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
index 466905ff32794f1db95be924de48c993ad99c6d6..3a24fbd4a6ab0a298f42f9a6c3401742f329514a 100644 (file)
@@ -115,26 +115,6 @@ iCodeTable codeTable[] =
   {ARRAYINIT, "arrayInit", picGenericOne, NULL},
 };
 
-// this makes it more easy to catch bugs
-struct bitVect *OP_DEFS(struct operand *op) {
-  wassert (IS_SYMOP(op));
-  return OP_SYMBOL(op)->defs;
-}
-struct bitVect *OP_DEFS_SET(struct operand *op, struct bitVect *bv) {
-  wassert (IS_SYMOP(op));
-  OP_SYMBOL(op)->defs=bv;
-  return bv;
-}
-struct bitVect *OP_USES(struct operand *op) {
-  wassert (IS_SYMOP(op));
-  return OP_SYMBOL(op)->uses;
-}
-struct bitVect *OP_USES_SET(struct operand *op, struct bitVect *bv) {
-  wassert (IS_SYMOP(op));
-  OP_SYMBOL(op)->uses=bv;
-  return bv;
-}
-
 /*-----------------------------------------------------------------*/
 /* checkConstantRange: check a constant against the type           */
 /*-----------------------------------------------------------------*/
@@ -597,7 +577,7 @@ newiCodeLabelGoto (int op, symbol * label)
 
   ic = newiCode (op, NULL, NULL);
   ic->op = op;
-  ic->argLabel.label = label;
+  ic->label = label;
   IC_LEFT (ic) = NULL;
   IC_RIGHT (ic) = NULL;
   IC_RESULT (ic) = NULL;
@@ -2899,7 +2879,7 @@ geniCodeParms (ast * parms, value *argVals, int *stack,
          /* assign */
          operand *top = operandFromSymbol (argVals->sym);
          /* clear useDef and other bitVectors */
-         OP_USES_SET ((top), OP_DEFS_SET ((top), OP_SYMBOL(top)->clashes = NULL));
+         OP_USES(top)=OP_DEFS(top)=OP_SYMBOL(top)->clashes = NULL;
          geniCodeAssign (top, pval, 1);
        }
       else
index 13f97ad57dbda584a74c2768a3aa514bf7b3b4ab..c11628ff90d46ffeda2157158f7d445cbe22401d 100644 (file)
@@ -119,8 +119,7 @@ extern operand *validateOpType(operand              *op,
 #define IC_COND(x)   (x)->ulrrcnd.cnd.condition
 #define IC_TRUE(x)   (x)->ulrrcnd.cnd.trueLabel
 #define IC_FALSE(x)  (x)->ulrrcnd.cnd.falseLabel
-#define IC_LABEL(x)  (x)->argLabel.label
-// jwk #define IC_ARGS(x)   (x)->argLabel.args
+#define IC_LABEL(x)  (x)->label
 #define IC_JTCOND(x) (x)->ulrrcnd.jmpTab.condition
 #define IC_JTLABELS(x) (x)->ulrrcnd.jmpTab.labels
 #define IC_INLINE(x) (x)->inlineAsm
@@ -178,12 +177,7 @@ typedef struct iCode
       }
     ulrrcnd;
 
-    union
-      {
-       symbol *label;          /* for a goto statement     */
-       // jwk value *args;            /* for a function */
-      }
-    argLabel;
+    symbol *label;             /* for a goto statement     */
 
     char *inlineAsm;           /* pointer to inline assembler code */
     literalList *arrayInitList; /* point to array initializer list. */
@@ -284,15 +278,8 @@ iCodeTable;
 #define SET_RESULT_RIGHT(ic) {SET_ISADDR(IC_RIGHT(ic),0); SET_ISADDR(IC_RESULT(ic),0);}
 #define IS_ASSIGN_ICODE(ic) (ASSIGNMENT(ic) && !POINTER_SET(ic))
 
-#if 0 // this causes too much, extremely difficult to find, bugs
-  #define OP_DEFS(op) op->operand.symOperand->defs
-  #define OP_USES(op) op->operand.symOperand->uses
-#else
-  struct bitVect *OP_DEFS(struct operand *);
-  struct bitVect *OP_DEFS_SET(struct operand *, struct bitVect *);
-  struct bitVect *OP_USES(struct operand *);
-  struct bitVect *OP_USES_SET(struct operand *, struct bitVect *);
-#endif
+#define OP_DEFS(op) validateOpType(op, "OP_DEFS", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand->defs
+#define OP_USES(op) validateOpType(op, "OP_USES", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand->uses
 /*-----------------------------------------------------------------*/
 /* forward references for functions                                */
 /*-----------------------------------------------------------------*/
index 99e7252a237550574614dae93a4843bcca17bc88..0b6f7c0ea1b1f56ad8585e1820c10869579f178c 100644 (file)
@@ -28,7 +28,7 @@ hTab *labelRef = NULL;
 hTab *labelDef = NULL;
 
 /*-----------------------------------------------------------------*/
-/* buildLabelRefTable - creates an hashTable of label referneces   */
+/* buildLabelRefTable - creates an hashTable of label references   */
 /*-----------------------------------------------------------------*/
 void 
 buildLabelRefTable (iCode * ic)
@@ -83,7 +83,7 @@ labelGotoNext (iCode * ic)
       if (loop->op == GOTO &&  /* if this is a goto */
          loop->next &&         /* and we have a next one */
          loop->next->op == LABEL &&    /* next one is a label */
-         loop->next->argLabel.label->key == loop->argLabel.label->key)         /* same label */
+         loop->next->label->key == loop->label->key)   /* same label */
        {
          loop->prev->next = loop->next;        /* get this out of the chain */
          loop->next->prev = loop->prev;
@@ -286,7 +286,7 @@ labelGotoGoto (iCode * ic)
          stat->next != loop)
        {
 
-         symbol *repLabel = stat->next->argLabel.label;        /* replace with label */
+         symbol *repLabel = stat->next->label; /* replace with label */
 
          /* if they are the same then continue */
          if (repLabel->key == sLabel->key)
@@ -299,7 +299,7 @@ labelGotoGoto (iCode * ic)
            case GOTO:          /* for a goto statement */
 
              hTabDeleteItem (&labelRef, (IC_LABEL (loop))->key, loop, DELETE_ITEM, NULL);
-             loop->argLabel.label = repLabel;
+             loop->label = repLabel;
              hTabAddItem (&labelRef, repLabel->key, loop);
              break;
 
@@ -327,7 +327,7 @@ labelGotoGoto (iCode * ic)
 }
 
 /*-----------------------------------------------------------------*/
-/* labelUnrefLabel - remove unreferneced labels                    */
+/* labelUnrefLabel - remove unreferenced labels                    */
 /*-----------------------------------------------------------------*/
 int 
 labelUnrefLabel (iCode * ic)
@@ -341,9 +341,6 @@ labelUnrefLabel (iCode * ic)
       /* if this is a label */
       if (loop->op == LABEL)
        {
-         set *refs;
-
-         refs = NULL;
          if (((IC_LABEL (loop))->key == returnLabel->key) ||
              ((IC_LABEL (loop))->key == entryLabel->key))
            continue;
index 26262ae93c9dc78f6f883f1d10128c71e20cc7ae..9bb74e335539b7f6c08b133d4e1bddf5f864729e 100644 (file)
@@ -337,11 +337,29 @@ DEFSETFUNC (createLoop)
     if (ebbs[i]->dfnum > dfMin && 
           ebbs[i]->dfnum < dfMax &&
          !isinSet(aloop->regBlocks,ebbs[i])) {
-         if (!ebbs[i]->partOfLoop) ebbs[i]->partOfLoop = aloop;
+         if (!ebbs[i]->partOfLoop) {
+#if !defined(LIVERANGEHUNT)
+           ebbs[i]->partOfLoop = aloop;
+#else
+           loopInsert(&aloop->regBlocks,ebbs[i]);
+#endif
+         }
       }
-    LRH(printf("****** %d %d %d %x %s\n", ebbs[i]->dfnum, dfMin, dfMax, ebbs[i]->partOfLoop, ebbs[i]->entryLabel->name));
   }
 
+#ifdef LIVERANGEHUNT
+  printf ("================\n");
+  printf (" loop with entry -- > ");
+  printEntryLabel (aloop->entry, ap);
+  printf ("\n");
+  printf (" loop body --> ");
+  applyToSet (aloop->regBlocks, printEntryLabel);
+  printf ("\n");
+  printf (" loop exits --> ");
+  applyToSet (aloop->exits, printEntryLabel);
+  printf ("\n");
+#endif
+
   /* and if this is a conditional block, the other side of the IFX 
      (if any, that could have a greater dfnum) is too */
   {
@@ -434,6 +452,9 @@ isOperandInvariant (operand * op, region * theLoop, set * lInvars)
               !IS_OP_VOLATILE (op) &&
               assignmentsToSym (theLoop->regBlocks, op) == 0)
        opin = 1;
+      LRH(if (opin && IS_SYMOP(op)) {
+       printf("isOperandInvariant: %s\n", OP_SYMBOL(op)->name);
+      });
     }
   else
     opin++;
@@ -937,10 +958,10 @@ basicInduction (region * loopReg, eBBlock ** ebbs, int count)
                              iCode *newic = newiCode ('=', NULL,
                                        operandFromOperand (IC_RIGHT (ic)));
                              IC_RESULT (newic) = operandFromOperand (IC_RESULT (ic));
-                             OP_DEFS_SET ((IC_RESULT (newic)),
-                               bitVectSetBit (OP_DEFS (IC_RESULT (newic)), newic->key));
-                             OP_USES_SET ((IC_RIGHT (newic)),
-                               bitVectSetBit (OP_USES (IC_RIGHT (newic)), newic->key));
+                             OP_DEFS(IC_RESULT (newic))=
+                               bitVectSetBit (OP_DEFS (IC_RESULT (newic)), newic->key);
+                             OP_USES(IC_RIGHT (newic))=
+                               bitVectSetBit (OP_USES (IC_RIGHT (newic)), newic->key);
                              /* and add it */
                              if (eblock->sch && eblock->sch->op == LABEL)
                                addiCodeToeBBlock (eblock, newic, eblock->sch->next);
@@ -1217,7 +1238,7 @@ createLoopRegions (eBBlock ** ebbs, int count)
   int maxDepth = 0;
   region *lp;
 
-  LRH(printf ("createLoopRegions: %x\n", ebbs));
+  LRH(printf ("createLoopRegions: %p\n", ebbs));
   /* get all the back edges in the graph */
   if (!applyToSet (graphEdges, backEdges, &bEdges))
     return 0;                  /* found no loops */
index 1763c15baea83c7be46d8f81a159d06f6a95c597..005181240a880a8fed9e745a949d784a2cc1d439 100644 (file)
@@ -115,6 +115,7 @@ char DefaultExePath[128];
 #define OPTION_DATA_LOC                "--data-loc"
 #define OPTION_CODE_LOC                "--code-loc"
 #define OPTION_IDATA_LOC       "--idata-loc"
+#define OPTION_NO_LABEL_OPT     "--nolabelopt"
 #define OPTION_NO_LOOP_INV     "--noinvariant"
 #define OPTION_NO_LOOP_IND     "--noinduction"
 #define OPTION_LESS_PEDANTIC   "--lesspedantic"
@@ -152,6 +153,7 @@ optionsTable[] = {
     { 0,    "--stack-10bit",        &options.stack10bit, "use the 10bit stack for ds390 (default)" },
     { 0,    "--xstack",             &options.useXstack, "Use external stack" },
     { 0,    OPTION_NO_GCSE,         NULL, "Disable the GCSE optimisation" },
+    { 0,    OPTION_NO_LABEL_OPT,    NULL, "Disable label optimisation" },
     { 0,    OPTION_NO_LOOP_INV,     NULL, "Disable optimisation of invariants" },
     { 0,    OPTION_NO_LOOP_IND,     NULL, NULL },
     { 0,    "--nojtbound",          &optimize.noJTabBoundary, "Don't generate boundary check for jump tables" },
@@ -955,6 +957,12 @@ parseCmdLine (int argc, char **argv)
              continue;
            }
 
+         if (strcmp (argv[i], OPTION_NO_LABEL_OPT) == 0)
+           {
+             optimize.label4 = 0;
+             continue;
+           }
+
          if (strcmp (argv[i], OPTION_NO_LOOP_IND) == 0)
            {
              optimize.loopInduction = 0;