* src/port.h (struct PORT),
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 20 Mar 2005 19:31:19 +0000 (19:31 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 20 Mar 2005 19:31:19 +0000 (19:31 +0000)
* src/avr/ralloc.c (avr_assignRegisters),
* src/avr/main.c,
* src/ds390/ralloc.c (ds390_assignRegisters),
* src/ds390/main.c,
* src/hc08/ralloc.c (hc08_assignRegisters),
* src/hc08/main.c,
* src/mcs51/ralloc.c (mcs51_assignRegisters),
* src/mcs51/main.c,
* src/pic/ralloc.c (pic14_assignRegisters),
* src/pic/main.c,
* src/pic16/ralloc.c (pic16_assignRegisters),
* src/pic16/main.c,
* src/xa51/ralloc.c (xa51_assignRegisters),
* src/xa51/main.c,
* src/z80/ralloc.c (z80_assignRegisters),
* src/z80/ralloc.h,
* src/SDCCopt.c (eBBlockFromiCode, replaceRegEqv, killDeadCode),
* src/SDCCcse.c (ifxOptimize, cseBBlock, cseAllBlocks),
* src/SDCCcse.h,
* src/SDCCdflow.c (computeDataFlow),
* src/SDCCdflow.h,
* src/SDCCloop.c (addDefInExprs, loopInvariants, loopOptimizations),
* src/SDCCloop.h,
* src/SDCCcflow.c (*),
* src/SDCCcflow.h,
* src/SDCCBBlock.c (iCodeBreakDown, dumpEbbsToFileExt, eBBWithEntryLabel),
* src/SDCCBBlock.h (struct ebbIndex): new struct that keeps two copies
of the eBBlock list, sorted by both bbnum and dfnum. (fixes bug with
immedDom() returning wrong block; probably fixes bug #1160833)

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

29 files changed:
ChangeLog
src/SDCCBBlock.c
src/SDCCBBlock.h
src/SDCCcflow.c
src/SDCCcflow.h
src/SDCCcse.c
src/SDCCcse.h
src/SDCCdflow.c
src/SDCCdflow.h
src/SDCCloop.c
src/SDCCloop.h
src/SDCCopt.c
src/avr/main.c
src/avr/ralloc.c
src/ds390/main.c
src/ds390/ralloc.c
src/hc08/main.c
src/hc08/ralloc.c
src/mcs51/main.c
src/mcs51/ralloc.c
src/pic/main.c
src/pic/ralloc.c
src/pic16/main.c
src/pic16/ralloc.c
src/port.h
src/xa51/main.c
src/xa51/ralloc.c
src/z80/ralloc.c
src/z80/ralloc.h

index 436ffeb36a77ca7604956370d35af9178eb9fb2c..2eefe5e9b74e4bbe23d0a0fe0316d2bc2d8363ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2005-03-20 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+
+       * src/port.h (struct PORT),
+       * src/avr/ralloc.c (avr_assignRegisters),
+       * src/avr/main.c,
+       * src/ds390/ralloc.c (ds390_assignRegisters),
+       * src/ds390/main.c,
+       * src/hc08/ralloc.c (hc08_assignRegisters),
+       * src/hc08/main.c,
+       * src/mcs51/ralloc.c (mcs51_assignRegisters),
+       * src/mcs51/main.c,
+       * src/pic/ralloc.c (pic14_assignRegisters),
+       * src/pic/main.c,
+       * src/pic16/ralloc.c (pic16_assignRegisters),
+       * src/pic16/main.c,
+       * src/xa51/ralloc.c (xa51_assignRegisters),
+       * src/xa51/main.c,
+       * src/z80/ralloc.c (z80_assignRegisters),
+       * src/z80/ralloc.h,
+       * src/SDCCopt.c (eBBlockFromiCode, replaceRegEqv, killDeadCode),
+       * src/SDCCcse.c (ifxOptimize, cseBBlock, cseAllBlocks),
+       * src/SDCCcse.h,
+       * src/SDCCdflow.c (computeDataFlow),
+       * src/SDCCdflow.h,
+       * src/SDCCloop.c (addDefInExprs, loopInvariants, loopOptimizations),
+       * src/SDCCloop.h,
+       * src/SDCCcflow.c (*),
+       * src/SDCCcflow.h,
+       * src/SDCCBBlock.c (iCodeBreakDown, dumpEbbsToFileExt, eBBWithEntryLabel),
+       * src/SDCCBBlock.h (struct ebbIndex): new struct that keeps two copies
+       of the eBBlock list, sorted by both bbnum and dfnum. (fixes bug with
+       immedDom() returning wrong block; probably fixes bug #1160833)
+
 2005-03-20 Borut Razem <borut.razem AT siol.net>
 
        * support/scripts/inc2h.pl: WIN32 port
index 931fefcd38652ba4b5def589005cbe0a3ae698b4..1156434e59f5d056fd2c92fd7d09540ccb40cc7b 100644 (file)
@@ -182,16 +182,19 @@ dumpLiveRanges (int id, hTab * liveRanges)
   fflush(file);
 }
 
+
 /*-----------------------------------------------------------------*/
 /* dumpEbbsToFileExt - writeall the basic blocks to a file         */
 /*-----------------------------------------------------------------*/
 void 
-dumpEbbsToFileExt (int id, eBBlock ** ebbs, int count)
+dumpEbbsToFileExt (int id, ebbIndex * ebbi)
 {
   FILE *of;
   int i;
   eBBlock *bb;
   set *cseSet;
+  eBBlock ** ebbs = ebbi->dfOrder ? ebbi->dfOrder : ebbi->bbOrder;
+  int count = ebbi->count;
 
   if (id) {
     of=createDumpFile(id);
@@ -228,7 +231,7 @@ dumpEbbsToFileExt (int id, eBBlock ** ebbs, int count)
        fprintf (of, "\ndominators: ");
        for (d=0; d<ebbs[i]->domVect->size; d++) {
          if (bitVectBitValue(ebbs[i]->domVect, d)) {
-           fprintf (of, "%s ", ebbs[d]->entryLabel->name);
+           fprintf (of, "%s ", ebbi->bbOrder[d]->entryLabel->name); //ebbs[d]->entryLabel->name);
          }
        }
       }
@@ -353,8 +356,10 @@ iCode2eBBlock (iCode * ic)
 /* eBBWithEntryLabel - finds the basic block with the entry label  */
 /*-----------------------------------------------------------------*/
 eBBlock *
-eBBWithEntryLabel (eBBlock ** ebbs, symbol * eLabel, int count)
+eBBWithEntryLabel (ebbIndex * ebbi, symbol * eLabel)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   int i;
 
   for (i = 0; i < count; i++)
@@ -506,17 +511,21 @@ remiCodeFromeBBlock (eBBlock * ebb, iCode * ic)
 /*-----------------------------------------------------------------*/
 /* iCodeBreakDown : breakDown iCode chain to blocks                */
 /*-----------------------------------------------------------------*/
-eBBlock **
-iCodeBreakDown (iCode * ic, int *count)
+ebbIndex *
+iCodeBreakDown (iCode * ic)
 {
   eBBlock **ebbs = NULL;
   iCode *loop = ic;
-
-  *count = 0;
+  ebbIndex *ebbi;
+  
+  ebbi = Safe_alloc (sizeof (ebbIndex *));
+  ebbi->count = 0;
+  ebbi->dfOrder = NULL; /* no depth first order information yet */
 
   /* allocate for the first entry */
 
   ebbs = Safe_alloc (sizeof (eBBlock **));
+  ebbi->bbOrder = ebbs;
 
   while (loop)
     {
@@ -528,36 +537,37 @@ iCodeBreakDown (iCode * ic, int *count)
       ebb->ech->next = NULL;   /* mark the end of this chain */
       if (loop)
        loop->prev = NULL;
-      ebb->bbnum = *count;     /* save this block number     */
+      ebb->bbnum = ebbi->count;        /* save this block number     */
       /* put it in the array */
-      ebbs[(*count)++] = ebb;
+      ebbs[(ebbi->count)++] = ebb;
 
       /* allocate for the next one. Remember to clear the new */
       /*  pointer at the end, that was created by realloc. */
 
-      ebbs = Safe_realloc (ebbs, (*count + 1) * sizeof (eBBlock **));
+      ebbs = Safe_realloc (ebbs, (ebbi->count + 1) * sizeof (eBBlock **));
+      ebbi->bbOrder = ebbs;
 
-      ebbs[*count] = 0;
+      ebbs[ebbi->count] = 0;
 
       /* if this one ends in a goto or a conditional */
       /* branch then check if the block it is going  */
       /* to already exists, if yes then this could   */
       /* be a loop, add a preheader to the block it  */
       /* goes to  if it does not already have one    */
-      if (ebbs[(*count) - 1]->ech &&
-         (ebbs[(*count) - 1]->ech->op == GOTO ||
-          ebbs[(*count) - 1]->ech->op == IFX))
+      if (ebbs[(ebbi->count) - 1]->ech &&
+         (ebbs[(ebbi->count) - 1]->ech->op == GOTO ||
+          ebbs[(ebbi->count) - 1]->ech->op == IFX))
        {
 
          symbol *label;
          eBBlock *destBlock;
 
-         if (ebbs[(*count) - 1]->ech->op == GOTO)
-           label = IC_LABEL (ebbs[(*count) - 1]->ech);
-         else if (!(label = IC_TRUE (ebbs[(*count) - 1]->ech)))
-           label = IC_FALSE (ebbs[(*count) - 1]->ech);
+         if (ebbs[(ebbi->count) - 1]->ech->op == GOTO)
+           label = IC_LABEL (ebbs[(ebbi->count) - 1]->ech);
+         else if (!(label = IC_TRUE (ebbs[(ebbi->count) - 1]->ech)))
+           label = IC_FALSE (ebbs[(ebbi->count) - 1]->ech);
 
-         if ((destBlock = eBBWithEntryLabel (ebbs, label, (*count))) &&
+         if ((destBlock = eBBWithEntryLabel (ebbi, label)) &&
              destBlock->preHeader == NULL &&
              otherPathsPresent (ebbs, destBlock))
            {
@@ -568,24 +578,25 @@ iCodeBreakDown (iCode * ic, int *count)
 
              /* go thru all block replacing the entryLabel with new label */
              /* till we reach the block , then we insert a new ebblock    */
-             for (i = 0; i < (*count); i++)
+             for (i = 0; i < (ebbi->count); i++)
                {
                  if (ebbs[i] == destBlock)
                    break;
                  replaceLabel (ebbs[i], label, preHeaderLabel);
                }
 
-             (*count)++;
+             (ebbi->count)++;
 
              /* if we have stopped at the block , allocate for an extra one */
 
-             ebbs = Safe_realloc (ebbs, (*count + 1) * sizeof (eBBlock **));
+             ebbs = Safe_realloc (ebbs, (ebbi->count + 1) * sizeof (eBBlock **));
+             ebbi->bbOrder = ebbs;
 
-             ebbs[*count] = 0;
+             ebbs[ebbi->count] = 0;
 
              /* then move the block down one count */
              pBlock = ebbs[j = i];
-             for (i += 1; i < (*count); i++)
+             for (i += 1; i < (ebbi->count); i++)
                {
                  eBBlock *xBlock;
 
@@ -605,9 +616,9 @@ iCodeBreakDown (iCode * ic, int *count)
     }
 
   /* mark the end */
-  ebbs[*count] = NULL;
+  ebbs[ebbi->count] = NULL;
 
-  return ebbs;
+  return ebbi;
 }
 
 /*-----------------------------------------------------------------*/
index 8f0429c7666a3888ea91ff2cbe67eb4aa7f41a30..1f853df87d61af37a5e8aaa9092e3453b6b67e94 100644 (file)
@@ -49,9 +49,9 @@ typedef struct eBBlock
 
     /* control flow analysis */
     set *succList;             /* list eBBlocks which are successors  */
-    bitVect *succVect;         /* bitVector of successors             */
+    bitVect *succVect;         /* bitVector of successors (index is bbnum) */
     set *predList;             /* predecessors of this basic block    */
-    bitVect *domVect;          /* list of nodes this is dominated by  */
+    bitVect *domVect;          /* list of nodes this is dominated by (index is bbnum) */
 
     /* data flow analysis */
     set *inExprs;              /* in coming common expressions    */
@@ -71,6 +71,14 @@ typedef struct eBBlock
   }
 eBBlock;
 
+typedef struct ebbIndex
+  {
+    int count;                 /* number of blocks in the index */
+    eBBlock **bbOrder;         /* blocks in bbnum order */
+    eBBlock **dfOrder;         /* blocks in dfnum (depth first) order */
+  }
+ebbIndex;
+
 typedef struct edge
   {
 
@@ -79,6 +87,7 @@ typedef struct edge
   }
 edge;
 
+
 extern int eBBNum;
 extern set *graphEdges;
 
@@ -86,17 +95,17 @@ extern set *graphEdges;
 DEFSETFUNC (printEntryLabel);
 eBBlock *neweBBlock ();
 edge *newEdge (eBBlock *, eBBlock *);
-eBBlock *eBBWithEntryLabel (eBBlock **, symbol *, int);
+eBBlock *eBBWithEntryLabel (ebbIndex *, symbol *);
 DEFSETFUNC (ifFromIs);
 set *edgesTo (eBBlock *);
 void remiCodeFromeBBlock (eBBlock *, iCode *);
 void addiCodeToeBBlock (eBBlock *, iCode *, iCode *);
-eBBlock **iCodeBreakDown (iCode *, int *);
+ebbIndex *iCodeBreakDown (iCode *);
 void replaceSymBySym (set *, operand *, operand *);
 iCode *iCodeFromeBBlock (eBBlock **, int);
 int otherPathsPresent (eBBlock **, eBBlock *);
 void replaceLabel (eBBlock *, symbol *, symbol *);
-void dumpEbbsToFileExt (int, eBBlock **, int);
+void dumpEbbsToFileExt (int, ebbIndex *);
 void dumpLiveRanges (int, hTab * liveRanges);
 void closeDumpFiles();
 
index 0b307797ef5ac2cfa3da2c8547aff70af1917a66..cb6bf7a6e075a2e3f484e3f6e20ffb0e49de4aa3 100644 (file)
 
 #include "common.h"
 
+static void computeDFOrdering (eBBlock *, int *);
+
 /*-----------------------------------------------------------------*/
 /* domSetFromVect - creates a domset from the vector               */
 /*-----------------------------------------------------------------*/
-set *
-domSetFromVect (eBBlock ** ebbs, bitVect * domVect)
+static set *
+domSetFromVect (ebbIndex *ebbi, bitVect * domVect)
 {
   int i = 0;
   set *domSet = NULL;
@@ -39,7 +41,7 @@ domSetFromVect (eBBlock ** ebbs, bitVect * domVect)
 
   for (i = 0; i < domVect->size; i++)
     if (bitVectBitValue (domVect, i))
-      addSet (&domSet, ebbs[i]);
+      addSet (&domSet, ebbi->bbOrder[i]);
   return domSet;
 }
 
@@ -48,7 +50,7 @@ domSetFromVect (eBBlock ** ebbs, bitVect * domVect)
 /* addSuccessor - will add bb to succ also add it to the pred of   */
 /*                the next one :                                   */
 /*-----------------------------------------------------------------*/
-void 
+static void 
 addSuccessor (eBBlock * thisBlock, eBBlock * succ)
 {
   /* check for boundary conditions */
@@ -68,9 +70,11 @@ addSuccessor (eBBlock * thisBlock, eBBlock * succ)
 /*-----------------------------------------------------------------*/
 /* eBBPredecessors - find the predecessors for each block          */
 /*-----------------------------------------------------------------*/
-void 
-eBBPredecessors (eBBlock ** ebbs, int count)
+static void 
+eBBPredecessors (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   int i = 0, j;
 
   /* for each block do */
@@ -96,9 +100,11 @@ eBBPredecessors (eBBlock ** ebbs, int count)
 /*-----------------------------------------------------------------*/
 /* eBBSuccessors- find out the successors of all the nodes         */
 /*-----------------------------------------------------------------*/
-void 
-eBBSuccessors (eBBlock ** ebbs, int count)
+static void 
+eBBSuccessors (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   int i = 0;
 
   /* for all the blocks do */
@@ -156,7 +162,7 @@ eBBSuccessors (eBBlock ** ebbs, int count)
              for (lbl = setFirstItem (IC_JTLABELS (ic)); lbl;
                   lbl = setNextItem (IC_JTLABELS (ic)))
                addSuccessor (ebbs[i],
-                             eBBWithEntryLabel (ebbs, lbl, count));
+                             eBBWithEntryLabel (ebbi, lbl));
            }
          else
            {
@@ -166,19 +172,19 @@ eBBSuccessors (eBBlock ** ebbs, int count)
              switch (ic->op)
                {
                case GOTO:      /* goto has edge to label */
-                 succ = eBBWithEntryLabel (ebbs, ic->label, count);
+                 succ = eBBWithEntryLabel (ebbi, ic->label);
                  break;
 
                case IFX:       /* conditional jump */
                  /* if true label is present */
                  if (IC_TRUE (ic))
-                   succ = eBBWithEntryLabel (ebbs, IC_TRUE (ic), count);
+                   succ = eBBWithEntryLabel (ebbi, IC_TRUE (ic));
                  else
-                   succ = eBBWithEntryLabel (ebbs, IC_FALSE (ic), count);
+                   succ = eBBWithEntryLabel (ebbi, IC_FALSE (ic));
                  break;
 
                case RETURN:    /* block with return */
-                 succ = eBBWithEntryLabel (ebbs, returnLabel, count);
+                 succ = eBBWithEntryLabel (ebbi, returnLabel);
                  break;
                }
 
@@ -195,9 +201,11 @@ eBBSuccessors (eBBlock ** ebbs, int count)
 /* computeDominance - computes the dominance graph                 */
 /* for algorithm look at Dragon book section 10.10, algo 10.16     */
 /*-----------------------------------------------------------------*/
-void 
-computeDominance (eBBlock ** ebbs, int count)
+static void 
+computeDominance (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   int i, j;
 
   /* now do the initialisation */
@@ -259,16 +267,17 @@ computeDominance (eBBlock ** ebbs, int count)
       if (!change)
        break;
     }
+  
 }
 
 /*-----------------------------------------------------------------*/
 /* immedDom - returns the immediate dominator of a block           */
 /*-----------------------------------------------------------------*/
 eBBlock *
-immedDom (eBBlock ** ebbs, eBBlock * ebp)
+immedDom (ebbIndex * ebbi, eBBlock * ebp)
 {
   /* first delete self from the list */
-  set *iset = domSetFromVect (ebbs, ebp->domVect);
+  set *iset = domSetFromVect (ebbi, ebp->domVect);
   eBBlock *loop;
   eBBlock *idom = NULL;
 
@@ -306,7 +315,7 @@ DEFSETFUNC (DFOrdering)
 /* computeDFOrdering - computes the depth first ordering of the    */
 /*                     flowgraph                                   */
 /*-----------------------------------------------------------------*/
-void 
+static void 
 computeDFOrdering (eBBlock * ebbp, int *count)
 {
 
@@ -323,22 +332,23 @@ computeDFOrdering (eBBlock * ebbp, int *count)
 /* disconBBlock - removes all control flow links for a block       */
 /*-----------------------------------------------------------------*/
 void 
-disconBBlock (eBBlock * ebp, eBBlock ** ebbs, int count)
+disconBBlock (eBBlock * ebp, ebbIndex * ebbi)
 {
   /* mark this block as noPath & recompute control flow */
   ebp->noPath = 1;
-  computeControlFlow (ebbs, count, TRUE);
+  computeControlFlow (ebbi);
 }
 
 /*-----------------------------------------------------------------*/
 /* markNoPath - marks those blocks which cannot be reached from top */
 /*-----------------------------------------------------------------*/
-void 
-markNoPath (eBBlock ** ebbs, int count)
+static void 
+markNoPath (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   int i;
 
-
   /* for all blocks if the visited flag is not set : then there */
   /* is no path from _entry to this block push them down in the */
   /* depth first order */
@@ -346,55 +356,20 @@ markNoPath (eBBlock ** ebbs, int count)
     if (!ebbs[i]->visited)
       ebbs[i]->noPath = 1;
 }
-/*-----------------------------------------------------------------*/
-/* dfNumCompare - used by qsort to sort by dfNumber                */
-/*-----------------------------------------------------------------*/
-int 
-dfNumCompare (const void *a, const void *b)
-{
-  const eBBlock *const *i = a;
-  const eBBlock *const *j = b;
-
-  if ((*i)->dfnum > (*j)->dfnum)
-    return 1;
-
-  if ((*i)->dfnum < (*j)->dfnum)
-    return -1;
-
-  return 0;
-}
-
-/*-----------------------------------------------------------------*/
-/* bbNumCompare - used by qsort to sort by bbNumber                */
-/*-----------------------------------------------------------------*/
-int 
-bbNumCompare (const void *a, const void *b)
-{
-  const eBBlock *const *i = a;
-  const eBBlock *const *j = b;
-
-  if ((*i)->bbnum > (*j)->bbnum)
-    return 1;
-
-  if ((*i)->bbnum < (*j)->bbnum)
-    return -1;
-
-  return 0;
-}
-
 
 /*-----------------------------------------------------------------*/
 /* computeControlFlow - does the control flow computation          */
 /*-----------------------------------------------------------------*/
 void 
-computeControlFlow (eBBlock ** ebbs, int count, int reSort)
+computeControlFlow (ebbIndex * ebbi)
 {
-  int saveCount = count;
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int dfCount = ebbi->count;
   int i;
 
   /* initialise some things */
 
-  for (i = 0; i < count; i++)
+  for (i = 0; i < ebbi->count; i++)
     {
       setToNull ((void *) &ebbs[i]->predList);
       setToNull ((void *) &ebbs[i]->domVect);
@@ -404,30 +379,33 @@ computeControlFlow (eBBlock ** ebbs, int count, int reSort)
       ebbs[i]->dfnum = 0;
     }
 
-  if (reSort)
-    /* sort it back by block number */
-    qsort (ebbs, saveCount, sizeof (eBBlock *), bbNumCompare);
-
   setToNull ((void *) &graphEdges);
   /* this will put in the  */
   /* successor information for each blk */
-  eBBSuccessors (ebbs, count);
+  eBBSuccessors (ebbi);
 
   /* compute the depth first ordering */
-  computeDFOrdering (ebbs[0], &count);
+  computeDFOrdering (ebbi->bbOrder[0], &dfCount);
 
   /* mark blocks with no paths to them */
-  markNoPath (ebbs, saveCount);
+  markNoPath (ebbi);
 
   /* with the depth first info in place */
   /* add the predecessors for the blocks */
-  eBBPredecessors (ebbs, saveCount);
+  eBBPredecessors (ebbi);
 
   /* compute the dominance graph */
-  computeDominance (ebbs, saveCount);
+  computeDominance (ebbi);
 
   /* sort it by dfnumber */
-  qsort (ebbs, saveCount, sizeof (eBBlock *), dfNumCompare);
+  if (!ebbi->dfOrder)
+    ebbi->dfOrder = Safe_alloc ((ebbi->count+1) * sizeof (eBBlock *));
+  for (i = 0; i < (ebbi->count+1); i++)
+    {
+      ebbi->dfOrder[i] = ebbi->bbOrder[i];
+    }
+      
+  qsort (ebbi->dfOrder, ebbi->count, sizeof (eBBlock *), dfNumCompare);
 
 }
 
index 4d6af9f5e68d61c3249ae2a23b2bc2e1b27c378d..ef0b33020b4f8d2714c8a5c46b279b8b9a84051d 100644 (file)
 #ifndef SDCCCFLOW_H
 #define SDCCCFLOW_H 1
 
-void computeDFOrdering (eBBlock *, int *);
-set *domSetFromVect (eBBlock **, bitVect *);
-void addSuccessor (eBBlock *, eBBlock *);
-void eBBSuccessors (eBBlock **, int);
-void eBBPredecessors (eBBlock **, int);
-eBBlock *immedDom (eBBlock **, eBBlock *);
-DEFSETFUNC (DFOrdering);
-void markNoPath (eBBlock **, int);
-void computeControlFlow (eBBlock **, int, int);
-int dfNumCompare (const void *, const void *);
-int bbNumCompare (const void *, const void *);
-void disconBBlock (eBBlock *, eBBlock **, int);
+eBBlock *immedDom (ebbIndex *, eBBlock *);
+void computeControlFlow (ebbIndex *);
+void disconBBlock (eBBlock *, ebbIndex *);
 int returnAtEnd (eBBlock *) ;
 #endif
index 05c6e2e6ca5fa892d86a3accdec7452e07848938..ad94b3a58a55a5e38d4245dd87f8c9b7f8246c97 100644 (file)
@@ -1393,7 +1393,7 @@ void
 ifxOptimize (iCode * ic, set * cseSet,
              int computeOnly,
              eBBlock * ebb, int *change,
-             eBBlock ** ebbs, int count)
+             ebbIndex * ebbi)
 {
   operand *pdop;
   symbol *label;
@@ -1445,7 +1445,7 @@ ifxOptimize (iCode * ic, set * cseSet,
       /* this is very expensive but it does not happen */
       /* too often, if it does happen then the user pays */
       /* the price */
-      computeControlFlow (ebbs, count, 1);
+      computeControlFlow (ebbi);
       if (!options.lessPedantic) {
         werrorfl (ic->filename, ic->lineno, W_CONTROL_FLOW);
       }
@@ -1457,7 +1457,7 @@ ifxOptimize (iCode * ic, set * cseSet,
      we can remove this conditional statement */
   label = (IC_TRUE (ic) ? IC_TRUE (ic) : IC_FALSE (ic));
   if (elementsInSet (ebb->succList) == 1 &&
-      isinSet (ebb->succList, eBBWithEntryLabel (ebbs, label, count)))
+      isinSet (ebb->succList, eBBWithEntryLabel (ebbi, label)))
     {
 
       if (!options.lessPedantic) {
@@ -1473,7 +1473,7 @@ ifxOptimize (iCode * ic, set * cseSet,
       else
         {
           remiCodeFromeBBlock (ebb, ic);
-          computeControlFlow (ebbs, count, 1);
+          computeControlFlow (ebbi);
           return;
         }
     }
@@ -1768,8 +1768,10 @@ dumpCseSet(set *cseSet)
 /*-----------------------------------------------------------------*/
 int
 cseBBlock (eBBlock * ebb, int computeOnly,
-           eBBlock ** ebbs, int count)
+           ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   set *cseSet;
   iCode *ic;
   int change = 0;
@@ -1957,7 +1959,7 @@ cseBBlock (eBBlock * ebb, int computeOnly,
         {
           ifxOptimize (ic, cseSet, computeOnly,
                        ebb, &change,
-                       ebbs, count);
+                       ebbi);
           continue;
         }
 
@@ -2225,15 +2227,17 @@ cseBBlock (eBBlock * ebb, int computeOnly,
 /* cseAllBlocks - will sequentially go thru & do cse for all blocks */
 /*-----------------------------------------------------------------*/
 int
-cseAllBlocks (eBBlock ** ebbs, int count, int computeOnly)
+cseAllBlocks (ebbIndex * ebbi, int computeOnly)
 {
+  eBBlock ** ebbs = ebbi->dfOrder;
+  int count = ebbi->count;
   int i;
   int change = 0;
 
   /* if optimization turned off */
 
   for (i = 0; i < count; i++)
-    change += cseBBlock (ebbs[i], computeOnly, ebbs, count);
+    change += cseBBlock (ebbs[i], computeOnly, ebbi);
 
   return change;
 }
index 0e7c9c8ab39721b39aff805e439050d40c394e51..1926dd84a4112b19ddf87caa6e0f9d5ddf0da0ae 100644 (file)
@@ -52,9 +52,8 @@ int ifDefSymIs (set *, operand *);
 DEFSETFUNC (findPrevIc);
 DEFSETFUNC (ifOperandsHave);
 DEFSETFUNC (findCheaperOp);
-int cseBBlock (eBBlock *, int, eBBlock **, int);
-int cseAllBlocks (eBBlock **, int, int computeOnly);
-void ifxOptimize (iCode *, set *, int, eBBlock *, int *, eBBlock **, int);
+int cseBBlock (eBBlock *, int, ebbIndex *);
+int cseAllBlocks (ebbIndex *, int computeOnly);
 void unsetDefsAndUses (iCode *);
 void updateSpillLocation (iCode * ic,int);
 void setUsesDefs (operand *, bitVect *, bitVect *, bitVect **);
index 8fa4f0c10df2233ec1de4217d352a14b5fcf6df1..a45eb174b19f702ddf294e622eb0dd5153a6113b 100644 (file)
@@ -123,6 +123,9 @@ DEFSETFUNC (mergeInExprs)
     }
   else
     {
+      //if (dest != ebp)
+      //  dest->inExprs = intersectSets (dest->inExprs, ebp->outExprs, THROW_DEST);
+        
       /* delete only if killed in this block*/
       deleteItemIf (&dest->inExprs, ifKilledInBlock, ebp);
       /* union the ndompset with pointers set in this block */
@@ -162,8 +165,10 @@ DEFSETFUNC (mergeInDefs)
 /* computeDataFlow - does computations for data flow accross blocks */
 /*-----------------------------------------------------------------*/
 void 
-computeDataFlow (eBBlock ** ebbs, int count)
+computeDataFlow (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->dfOrder;
+  int count = ebbi->count;
   int i;
   int change = 1;
   
@@ -222,7 +227,7 @@ computeDataFlow (eBBlock ** ebbs, int count)
          /* get the immediate dominator and put it there */
          if (!pBlock)
            {
-             eBBlock *idom = immedDom (ebbs, ebbs[i]);
+             eBBlock *idom = immedDom (ebbi, ebbs[i]);
              if (idom)
                addSetHead (&pred, idom);
            }
@@ -239,7 +244,7 @@ computeDataFlow (eBBlock ** ebbs, int count)
 
          /* do cse with computeOnly flag set to TRUE */
          /* this by far the quickest way of computing */
-         cseBBlock (ebbs[i], TRUE, ebbs, count);
+         cseBBlock (ebbs[i], TRUE, ebbi);
 
          /* if it change we will need to iterate */
          if (optimize.global_cse)
index 02fafaafc1d1457d46acd9a621a88368b537026b..6e484d451c2f9806b3920ef52b1f43d9599c632d 100644 (file)
@@ -31,7 +31,7 @@
 
 DEFSETFUNC (mergeInExprs);
 DEFSETFUNC (ifKilledInBlock);
-void computeDataFlow (eBBlock **, int);
+void computeDataFlow (ebbIndex *);
 DEFSETFUNC (mergeInDefs);
 DEFSETFUNC (isDefAlive);
 iCode *usedInRemaining (operand *, iCode *);
index 476554a6d6d200ca469cfed57c2e38e715d695b7..0ecfe9446497fce864216199db13f10af98874ec 100644 (file)
@@ -302,11 +302,10 @@ DEFSETFUNC (addDefInExprs)
 {
   eBBlock *ebp = item;
   V_ARG (cseDef *, cdp);
-  V_ARG (eBBlock **, ebbs);
-  V_ARG (int, count);
+  V_ARG (ebbIndex *, ebbi);
 
   addSetHead (&ebp->inExprs, cdp);
-  cseBBlock (ebp, optimize.global_cse, ebbs, count);
+  cseBBlock (ebp, optimize.global_cse, ebbi);
   return 0;
 }
 
@@ -417,8 +416,10 @@ DEFSETFUNC (hasNonPtrUse)
 /* loopInvariants - takes loop invariants out of region            */
 /*-----------------------------------------------------------------*/
 int
-loopInvariants (region * theLoop, eBBlock ** ebbs, int count)
+loopInvariants (region * theLoop, ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->dfOrder;
+  int count = ebbi->count;
   eBBlock *lBlock;
   set *lInvars = NULL;
 
@@ -616,7 +617,7 @@ loopInvariants (region * theLoop, eBBlock ** ebbs, int count)
              bitVectUnSetBit (lBlock->defSet, ic->key);
              bitVectUnSetBit (lBlock->ldefs, ic->key);
              ivar = newCseDef (IC_RESULT (ic), ic);
-             applyToSet (theLoop->regBlocks, addDefInExprs, ivar, ebbs, count);
+             applyToSet (theLoop->regBlocks, addDefInExprs, ivar, ebbi);
              addSet (&lInvars, ivar);
            }
        }
@@ -984,8 +985,10 @@ basicInduction (region * loopReg, eBBlock ** ebbs, int count)
 /* loopInduction - remove induction variables from a loop          */
 /*-----------------------------------------------------------------*/
 int
-loopInduction (region * loopReg, eBBlock ** ebbs, int count)
+loopInduction (region * loopReg, ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->dfOrder;
+  int count = ebbi->count;
   int change = 0;
   eBBlock *lBlock, *owner, *lastBlock = NULL;
   set *indVars = NULL;
@@ -1231,7 +1234,7 @@ DEFSETFUNC (mergeInnerLoops)
 /* createLoopRegions - will detect and create a set of natural loops */
 /*-----------------------------------------------------------------*/
 hTab *
-createLoopRegions (eBBlock ** ebbs, int count)
+createLoopRegions (ebbIndex * ebbi)
 {
   set *allRegion = NULL;       /* set of all loops */
   hTab *orderedLoops = NULL;
@@ -1279,7 +1282,7 @@ createLoopRegions (eBBlock ** ebbs, int count)
 /* loopOptimizations - identify region & remove invariants & ind   */
 /*-----------------------------------------------------------------*/
 int
-loopOptimizations (hTab * orderedLoops, eBBlock ** ebbs, int count)
+loopOptimizations (hTab * orderedLoops, ebbIndex * ebbi)
 {
   region *lp;
   int change = 0;
@@ -1299,10 +1302,10 @@ loopOptimizations (hTab * orderedLoops, eBBlock ** ebbs, int count)
     {
 
       if (optimize.loopInvariant)
-       change += loopInvariants (lp, ebbs, count);
+       change += loopInvariants (lp, ebbi);
 
       if (optimize.loopInduction)
-       change += loopInduction (lp, ebbs, count);
+       change += loopInduction (lp, ebbi);
     }
 
   return change;
index 65f35731d9b59e8fe73ddce5e35155faaa27c446..e23933700c849938adfe2a004284569d9849269c 100644 (file)
@@ -54,12 +54,11 @@ induction;
 DEFSETFUNC (backEdges);
 DEFSETFUNC (pregion);
 DEFSETFUNC (pinduction);
-int loopOptimizations (hTab *, eBBlock **, int);
+int loopOptimizations (hTab *, ebbIndex *);
 int addressTaken (set *, operand *);
-hTab *createLoopRegions (eBBlock **, int);
+hTab *createLoopRegions (ebbIndex *);
 iCode *findDefInRegion (set *, operand *, eBBlock **);
 int hasIncomingDefs (region *, operand *);
 int findLoopEndSeq (region *);
-void addLoopBlocks (eBBlock ** ebbs, int count);
 
 #endif
index ed0ef8a7108a2e4ca1c5464ecbc97932b4807e42..b837e93532986cb39a235f2619701d271aa59387 100644 (file)
@@ -645,15 +645,17 @@ isLocalWithoutDef (symbol * sym)
 /* replaceRegEqv - replace all local variables with their reqv     */
 /*-----------------------------------------------------------------*/
 static void 
-replaceRegEqv (eBBlock ** ebbs, int count)
+replaceRegEqv (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   int i;
 
   /* Update the symbols' def bitvector so we know if there is   */
   /* a defining iCode or not. Only replace a local variable     */
   /* with its register equivalent if there is a defining iCode; */
   /* otherwise, the port's register allocater may choke.        */
-  cseAllBlocks (ebbs, count, TRUE);
+  cseAllBlocks (ebbi, TRUE);
 
   for (i = 0; i < count; i++)
     {
@@ -828,8 +830,10 @@ findReqv (symbol * prereqv, eBBlock ** ebbs, int count)
 /* killDeadCode - eliminates dead assignments                      */
 /*-----------------------------------------------------------------*/
 int 
-killDeadCode (eBBlock ** ebbs, int count)
+killDeadCode (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->dfOrder;
+  int count = ebbi->count;
   int change = 1;
   int gchange = 0;
   int i = 0;
@@ -936,6 +940,11 @@ killDeadCode (eBBlock ** ebbs, int count)
                  /* a dead address-of operation should die, even if volatile */
                  if (ic->op == ADDRESS_OF)
                    volLeft = FALSE;
+              
+                 //if (ic->op == CAST && isOperandVolatile (IC_LEFT (ic), FALSE))
+                 //  {
+                 //    volRight = IS_SYMOP (IC_RIGHT (ic));
+                 //  }
 
                  if (ic->next && ic->seqPoint == ic->next->seqPoint
                      && (ic->next->op == '+' || ic->next->op == '-'))
@@ -957,7 +966,7 @@ killDeadCode (eBBlock ** ebbs, int count)
                        }
                      continue;
                    }
-                 
+                                 
                  change = 1;
                  gchange++;
                  
@@ -1023,7 +1032,7 @@ killDeadCode (eBBlock ** ebbs, int count)
            }                   /* end of all instructions */
 
          if (!ebbs[i]->sch && !ebbs[i]->noPath)
-           disconBBlock (ebbs[i], ebbs, count);
+           disconBBlock (ebbs[i], ebbi);
 
        }                       /* end of for all blocks */
 
@@ -1160,9 +1169,10 @@ optimizeCastCast (eBBlock ** ebbs, int count)
 eBBlock **
 eBBlockFromiCode (iCode * ic)
 {
-  eBBlock **ebbs = NULL;
-  int count = 0;
-  int saveCount = 0;
+  ebbIndex *ebbi = NULL;
+  //eBBlock **ebbs = NULL;
+  //int count = 0;
+  //int saveCount = 0;
   int change = 1;
   int lchange = 0;
   int kchange = 0;
@@ -1172,7 +1182,7 @@ eBBlockFromiCode (iCode * ic)
   if (!ic)
     return NULL;
 
-  count = 0;
+  //count = 0;
   eBBNum = 0;
 
   /* optimize the chain for labels & gotos 
@@ -1181,73 +1191,72 @@ eBBlockFromiCode (iCode * ic)
   ic = iCodeLabelOptimize (ic);
 
   /* break it down into basic blocks */
-  ebbs = iCodeBreakDown (ic, &count);
-  saveCount = count;
-
+  ebbi = iCodeBreakDown (ic);
+  
   /* hash the iCode keys so that we can quickly index */
   /* them in the rest of the optimization steps */
   setToNull ((void *) &iCodehTab);
   iCodehTab = newHashTable (iCodeKey);
-  hashiCodeKeys (ebbs, count);
+  hashiCodeKeys (ebbi->bbOrder, ebbi->count);
   
   /* compute the control flow */
-  computeControlFlow (ebbs, count, 0);
+  computeControlFlow (ebbi);
 
   /* dumpraw if asked for */
   if (options.dump_raw)
-    dumpEbbsToFileExt (DUMP_RAW0, ebbs, count);
+    dumpEbbsToFileExt (DUMP_RAW0, ebbi);
 
   /* replace the local variables with their
      register equivalents : the liveRange computation
      along with the register allocation will determine
      if it finally stays in the registers */
-  replaceRegEqv (ebbs, count);
+  replaceRegEqv (ebbi);
 
   /* create loop regions */
-  loops = createLoopRegions (ebbs, count);
+  loops = createLoopRegions (ebbi);
 
   /* dumpraw if asked for */
   if (options.dump_raw)
-    dumpEbbsToFileExt (DUMP_RAW1, ebbs, count);
+    dumpEbbsToFileExt (DUMP_RAW1, ebbi);
 
-  optimizeCastCast (ebbs, saveCount);
+  optimizeCastCast (ebbi->bbOrder, ebbi->count);
     
   /* do common subexpression elimination for each block */
-  change = cseAllBlocks (ebbs, saveCount, FALSE);
+  change = cseAllBlocks (ebbi, FALSE);
 
   /* dumpraw if asked for */
   if (options.dump_raw)
-    dumpEbbsToFileExt (DUMP_CSE, ebbs, count);
+    dumpEbbsToFileExt (DUMP_CSE, ebbi);
 
   /* compute the data flow */
-  computeDataFlow (ebbs, saveCount);
+  computeDataFlow (ebbi);
 
   /* dumpraw if asked for */
   if (options.dump_raw)
-    dumpEbbsToFileExt (DUMP_DFLOW, ebbs, count);
+    dumpEbbsToFileExt (DUMP_DFLOW, ebbi);
 
   /* global common subexpression elimination  */
   if (optimize.global_cse)
     {
-      change += cseAllBlocks (ebbs, saveCount, FALSE);
+      change += cseAllBlocks (ebbi, FALSE);
       if (options.dump_gcse)
-       dumpEbbsToFileExt (DUMP_GCSE, ebbs, saveCount);
+       dumpEbbsToFileExt (DUMP_GCSE, ebbi);
     }
   else
     {
       // compute the dataflow only
-      assert(cseAllBlocks (ebbs, saveCount, TRUE)==0);
+      assert(cseAllBlocks (ebbi, TRUE)==0);
     }
   /* kill dead code */
-  kchange = killDeadCode (ebbs, saveCount);
+  kchange = killDeadCode (ebbi);
 
   if (options.dump_kill)
-    dumpEbbsToFileExt (DUMP_DEADCODE, ebbs, count);
+    dumpEbbsToFileExt (DUMP_DEADCODE, ebbi);
 
   /* do loop optimizations */
-  change += (lchange = loopOptimizations (loops, ebbs, count));
+  change += (lchange = loopOptimizations (loops, ebbi));
   if (options.dump_loop)
-    dumpEbbsToFileExt (DUMP_LOOP, ebbs, count);
+    dumpEbbsToFileExt (DUMP_LOOP, ebbi);
 
   /* recompute the data flow and apply global cse again 
      if loops optimizations or dead code caused a change:
@@ -1258,24 +1267,24 @@ eBBlockFromiCode (iCode * ic)
      subexpression once more */
   if (lchange || kchange)
     {
-      computeDataFlow (ebbs, saveCount);
-      change += cseAllBlocks (ebbs, saveCount, FALSE);
+      computeDataFlow (ebbi);
+      change += cseAllBlocks (ebbi, FALSE);
       if (options.dump_loop)
-       dumpEbbsToFileExt (DUMP_LOOPG, ebbs, count);
+       dumpEbbsToFileExt (DUMP_LOOPG, ebbi);
 
       /* if loop optimizations caused a change then do
          dead code elimination once more : this will
          get rid of the extra assignments to the induction
          variables created during loop optimizations */
-      killDeadCode (ebbs, saveCount);
+      killDeadCode (ebbi);
 
       if (options.dump_loop)
-       dumpEbbsToFileExt (DUMP_LOOPD, ebbs, count);
+       dumpEbbsToFileExt (DUMP_LOOPD, ebbi);
 
     }
 
   /* sort it back by block number */
-  qsort (ebbs, saveCount, sizeof (eBBlock *), bbNumCompare);
+  //qsort (ebbs, saveCount, sizeof (eBBlock *), bbNumCompare);
 
   if (!options.lessPedantic) {
     // this is a good place to check missing return values
@@ -1285,9 +1294,9 @@ eBBlockFromiCode (iCode * ic)
        && !FUNC_ISNAKED(currFunc->type)) {
        eBBlock *bp;
        // make sure all predecessors of the last block end in a return
-       for (bp=setFirstItem(ebbs[saveCount-1]->predList); 
+       for (bp=setFirstItem(ebbi->bbOrder[ebbi->count-1]->predList); 
             bp; 
-            bp=setNextItem(ebbs[saveCount-1]->predList)) {
+            bp=setNextItem(ebbi->bbOrder[ebbi->count-1]->predList)) {
          if (bp->ech->op != RETURN) {
            werrorfl (bp->ech->filename, bp->ech->lineno,
                      W_VOID_FUNC, currFunc->name);
@@ -1299,31 +1308,30 @@ eBBlockFromiCode (iCode * ic)
 
   /* if cyclomatic info requested then print it */
   if (options.cyclomatic)
-    printCyclomatic (ebbs, saveCount);
+    printCyclomatic (ebbi->bbOrder, ebbi->count);
 
   /* convert operations with support routines
      written in C to function calls : Iam doing
      this at this point since I want all the
      operations to be as they are for optimzations */
-  convertToFcall (ebbs, count);
+  convertToFcall (ebbi->bbOrder, ebbi->count);
 
   /* compute the live ranges */
-  computeLiveRanges (ebbs, count);
+  computeLiveRanges (ebbi->bbOrder, ebbi->count);
 
   if (options.dump_range)
-    dumpEbbsToFileExt (DUMP_RANGE, ebbs, count);
+    dumpEbbsToFileExt (DUMP_RANGE, ebbi);
 
   /* Now that we have the live ranges, discard parameter
    * receives for unused parameters.
    */
-  discardDeadParamReceives (ebbs, count);
+  discardDeadParamReceives (ebbi->bbOrder, ebbi->count);
 
   /* allocate registers & generate code */
-  port->assignRegisters (ebbs, count);
+  port->assignRegisters (ebbi);
 
   /* throw away blocks */
   setToNull ((void *) &graphEdges);
-  ebbs = NULL;
   
   return NULL;
 }
index c5ff36229b5b4dc900abe1f9161e571e370fee43..5c499e9ecafd643c6797ba377894cfcc6a2f3e75 100644 (file)
@@ -69,7 +69,7 @@ _avr_regparm (sym_link * l)
        return 0;
 }
 
-void avr_assignRegisters (eBBlock ** ebbs, int count);
+void avr_assignRegisters (ebbIndex *);
 
 static bool
 _avr_parseOptions (int *pargc, char **argv, int *i)
index 96426bb469d760067f25e802f44e8ec15d705903..9f0ab65b28613f89fce0f1188a9bcc8cab5ad371 100644 (file)
@@ -2236,8 +2236,10 @@ setDefaultRegs (eBBlock ** ebbs, int count)
 /* assignRegisters - assigns registers to each live range as need  */
 /*-----------------------------------------------------------------*/
 void
-avr_assignRegisters (eBBlock ** ebbs, int count)
+avr_assignRegisters (ebbIndex * ebbi)
 {
+       eBBlock ** ebbs = ebbi->bbOrder;
+       int count = ebbi->count;
        iCode *ic;
        int i;
 
@@ -2254,7 +2256,7 @@ avr_assignRegisters (eBBlock ** ebbs, int count)
        recomputeLiveRanges (ebbs, count);
 
        if (options.dump_pack)
-               dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
+               dumpEbbsToFileExt (DUMP_PACK, ebbi);
 
        /* first determine for each live range the number of 
           registers & the type of registers required for each */
@@ -2287,7 +2289,7 @@ avr_assignRegisters (eBBlock ** ebbs, int count)
        redoStackOffsets ();
 
        if (options.dump_rassgn)
-               dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
+               dumpEbbsToFileExt (DUMP_RASSGN, ebbi);
 
        /* now get back the chain */
        ic = iCodeLabelOptimize (iCodeFromeBBlock (ebbs, count));
index 17b52ae02c3a2c118cd1eda1c9656d7f2c8803fe..9d41bf2645f8e9d05c07763442a09e8c2b819468 100644 (file)
@@ -59,7 +59,7 @@ static builtins __ds390_builtins[] = {
     { "__builtin_memcmp_c2x","c",3,{"cx*","cp*","i"}}, /* void __builtin_memcmp_c2x (xdata char *,code  char *,int) */
     { NULL , NULL,0, {NULL}}                      /* mark end of table */
 };
-void ds390_assignRegisters (eBBlock ** ebbs, int count);
+void ds390_assignRegisters (ebbIndex * ebbi);
 
 static int regParmFlg = 0;     /* determine if we can register a parameter */
 
index 627cc4756f95f04f7d4a9cdcc39a3ed8d1c88ae5..3e39ee755ef144c49bc10ec9a805493c3ecadecb 100644 (file)
@@ -3124,8 +3124,10 @@ packRegisters (eBBlock * ebp)
 /* assignRegisters - assigns registers to each live range as need  */
 /*-----------------------------------------------------------------*/
 void
-ds390_assignRegisters (eBBlock ** ebbs, int count)
+ds390_assignRegisters (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   iCode *ic;
   int i;
 
@@ -3146,7 +3148,7 @@ ds390_assignRegisters (eBBlock ** ebbs, int count)
   recomputeLiveRanges (ebbs, count);
 
   if (options.dump_pack)
-    dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
+    dumpEbbsToFileExt (DUMP_PACK, ebbi);
 
   /* first determine for each live range the number of
      registers & the type of registers required for each */
@@ -3192,7 +3194,7 @@ ds390_assignRegisters (eBBlock ** ebbs, int count)
     }
 
   if (options.dump_rassgn) {
-    dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
+    dumpEbbsToFileExt (DUMP_RASSGN, ebbi);
     dumpLiveRanges (DUMP_LRANGE, liveRanges);
   }
 
index 13a23d684f1fe4fb88bb7dc223b126264b942de9..a4399cfc666a917242019fa8d1366bd3669ddc32 100644 (file)
@@ -51,7 +51,7 @@ static char *_hc08_keywords[] =
 };
 
 
-void hc08_assignRegisters (eBBlock ** ebbs, int count);
+void hc08_assignRegisters (ebbIndex *);
 
 static int regParmFlg = 0;     /* determine if we can register a parameter */
 
index 97a6cdafbb8caa16ec4cac53daa3ac7451a5c2b7..13a4e2fc8f9a68e55fda5127b0474cc15fbc6341 100644 (file)
@@ -3055,8 +3055,10 @@ packRegisters (eBBlock ** ebpp, int blockno)
 /* assignRegisters - assigns registers to each live range as need  */
 /*-----------------------------------------------------------------*/
 void
-hc08_assignRegisters (eBBlock ** ebbs, int count)
+hc08_assignRegisters (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   iCode *ic;
   int i;
 
@@ -3083,7 +3085,7 @@ hc08_assignRegisters (eBBlock ** ebbs, int count)
   recomputeLiveRanges (ebbs, count);
 
   if (options.dump_pack)
-    dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
+    dumpEbbsToFileExt (DUMP_PACK, ebbi);
 
   /* first determine for each live range the number of
      registers & the type of registers required for each */
@@ -3123,7 +3125,7 @@ hc08_assignRegisters (eBBlock ** ebbs, int count)
 
   if (options.dump_rassgn)
     {
-      dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
+      dumpEbbsToFileExt (DUMP_RASSGN, ebbi);
       dumpLiveRanges (DUMP_LRANGE, liveRanges);
     }
 
index 6112bee356a3d2c43885f5891c2e0e2deae2ab17..0ea349c4f2f2c99db9c11426a6546a73c84bad56 100644 (file)
@@ -47,7 +47,7 @@ static char *_mcs51_keywords[] =
 
 
 
-void mcs51_assignRegisters (eBBlock ** ebbs, int count);
+void mcs51_assignRegisters (ebbIndex *);
 
 static int regParmFlg = 0;      /* determine if we can register a parameter */
 
index f606f076e7eaacec5a029989fa0012f5f27b1e5e..7d065b27cb177ba2267f12c28b7ea8c557fec161 100644 (file)
@@ -3132,8 +3132,10 @@ packRegisters (eBBlock ** ebpp, int blockno)
 /* assignRegisters - assigns registers to each live range as need  */
 /*-----------------------------------------------------------------*/
 void
-mcs51_assignRegisters (eBBlock ** ebbs, int count)
+mcs51_assignRegisters (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   iCode *ic;
   int i;
 
@@ -3154,7 +3156,7 @@ mcs51_assignRegisters (eBBlock ** ebbs, int count)
   recomputeLiveRanges (ebbs, count);
 
   if (options.dump_pack)
-    dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
+    dumpEbbsToFileExt (DUMP_PACK, ebbi);
 
   /* first determine for each live range the number of
      registers & the type of registers required for each */
@@ -3202,7 +3204,7 @@ mcs51_assignRegisters (eBBlock ** ebbs, int count)
 
   if (options.dump_rassgn)
     {
-      dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
+      dumpEbbsToFileExt (DUMP_RASSGN, ebbi);
       dumpLiveRanges (DUMP_LRANGE, liveRanges);
     }
 
index e8eaaacbf1ccb85906b25cfcf0bf7109d36726f1..34784358ab3bb82c94491b2d9ffb8847a0eb2acb 100644 (file)
@@ -49,7 +49,7 @@ static char *_pic14_keywords[] =
 
 void  pCodeInitRegisters(void);
 
-void pic14_assignRegisters (eBBlock ** ebbs, int count);
+void pic14_assignRegisters (ebbIndex *);
 
 /* Also defined in gen.h, but the #include is commented out */
 /* for an unknowned reason. - EEP */
index d836a1682ceb2b5d1a2d66ded8f3ff46b8b8ca3c..44b0c50079539549d84087a51f31dd874f4dafd1 100644 (file)
@@ -4126,8 +4126,10 @@ dumpEbbsToDebug (eBBlock ** ebbs, int count)
 /* assignRegisters - assigns registers to each live range as need  */
 /*-----------------------------------------------------------------*/
 void
-pic14_assignRegisters (eBBlock ** ebbs, int count)
+pic14_assignRegisters (ebbIndex * ebbi)
 {
+       eBBlock ** ebbs = ebbi->bbOrder;
+       int count = ebbi->count;
        iCode *ic;
        int i;
        
@@ -4160,7 +4162,7 @@ pic14_assignRegisters (eBBlock ** ebbs, int count)
        }
        
        if (options.dump_pack)
-               dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
+               dumpEbbsToFileExt (DUMP_PACK, ebbi);
        
        /* first determine for each live range the number of 
        registers & the type of registers required for each */
@@ -4192,7 +4194,7 @@ pic14_assignRegisters (eBBlock ** ebbs, int count)
        redoStackOffsets ();
        
        if (options.dump_rassgn)
-               dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
+               dumpEbbsToFileExt (DUMP_RASSGN, ebbi);
        
        /* now get back the chain */
        ic = iCodeLabelOptimize (iCodeFromeBBlock (ebbs, count));
index 606eea417a79be65a18493b63ab09a2b68861d7d..53af64d4cb1e04197e1bcd3c227418bc68966c94 100644 (file)
@@ -80,7 +80,7 @@ extern char *pic16_processor_base_name(void);
 
 void  pic16_pCodeInitRegisters(void);
 
-void pic16_assignRegisters (eBBlock ** ebbs, int count);
+void pic16_assignRegisters (ebbIndex *);
 
 static int regParmFlg = 0;     /* determine if we can register a parameter */
 
index 1ffe986308f70d90adb9ad85d7b8e6418d4d3124..829ba99df82f3855902181f15ec4091158fdd206 100644 (file)
@@ -4263,8 +4263,10 @@ dumpEbbsToDebug (eBBlock ** ebbs, int count)
 /* pic16_assignRegisters - assigns registers to each live range as need  */
 /*-----------------------------------------------------------------*/
 void
-pic16_assignRegisters (eBBlock ** ebbs, int count)
+pic16_assignRegisters (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   iCode *ic;
   int i;
 
@@ -4304,7 +4306,7 @@ pic16_assignRegisters (eBBlock ** ebbs, int count)
   recomputeLiveRanges (ebbs, count);
 
   if (options.dump_pack)
-    dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
+    dumpEbbsToFileExt (DUMP_PACK, ebbi);
 
   /* first determine for each live range the number of 
      registers & the type of registers required for each */
@@ -4346,7 +4348,7 @@ pic16_assignRegisters (eBBlock ** ebbs, int count)
   redoStackOffsets ();
 
   if (options.dump_rassgn)
-    dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
+    dumpEbbsToFileExt (DUMP_RASSGN, ebbi);
 
   /* now get back the chain */
   ic = iCodeLabelOptimize (iCodeFromeBBlock (ebbs, count));
index a93a2edb00c9f74b6087096fda8284dd7cf6a6c2..06210e57ff073beb8f1ecf352045b189decc2420 100644 (file)
@@ -44,6 +44,8 @@ typedef struct builtins
     char *parm_types[MAX_BUILTIN_ARGS]; /* each parm type as string : see typeFromStr */
 } builtins ;
 
+struct ebbIndex;
+
 /* Processor specific names */
 typedef struct
   {
@@ -246,7 +248,7 @@ typedef struct
        options are parsed. */
     void (*setDefaultOptions) (void);
 /** Does the dirty work. */
-    void (*assignRegisters) (struct eBBlock **, int);
+    void (*assignRegisters) (struct ebbIndex *);
 
     /** Returns the register name of a symbol.
        Used so that 'regs' can be an incomplete type. */
index 3c1d73fb951a9af227a8bb7c72bda042bbdadfd5..37bf599eb709c4ad5a69e8c20d08b63d23b180e2 100755 (executable)
@@ -53,7 +53,7 @@ void   _xa51_genAssemblerEnd (FILE * of)
   //rewinds==1 ? '\0' : 's');
 }
 
-void xa51_assignRegisters (eBBlock ** ebbs, int count);
+void xa51_assignRegisters (ebbIndex *);
 
 static int regParmFlg = 0;     /* determine if we can register a parameter */
 
index e53ea595c02c987a99c39502c29283de222a8549..e9fc42f5725d1fbd2b5626c9451f37f7a6eea47a 100755 (executable)
@@ -2059,8 +2059,10 @@ static void packRegisters (eBBlock * ebp) {
 /* assignRegisters - assigns registers to each live range as need  */
 /*-----------------------------------------------------------------*/
 void
-xa51_assignRegisters (eBBlock ** ebbs, int count)
+xa51_assignRegisters (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   iCode *ic;
   int i;
   
@@ -2078,7 +2080,7 @@ xa51_assignRegisters (eBBlock ** ebbs, int count)
   recomputeLiveRanges (ebbs, count);
 
   if (options.dump_pack)
-    dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
+    dumpEbbsToFileExt (DUMP_PACK, ebbi);
   
   /* first determine for each live range the number of 
      registers & the type of registers required for each */
@@ -2106,7 +2108,7 @@ xa51_assignRegisters (eBBlock ** ebbs, int count)
   
   if (options.dump_rassgn)
     {
-      dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
+      dumpEbbsToFileExt (DUMP_RASSGN, ebbi);
       dumpLiveRanges (DUMP_LRANGE, liveRanges);
     }
   
index 2b44c0e0fb42943f7d0c225762f5dde9f71f08d9..ca66aa9a051220df8cab5cacc5f01c94fbc61ea6 100644 (file)
@@ -3101,8 +3101,10 @@ joinPushes (iCode *lic)
 /* assignRegisters - assigns registers to each live range as need  */
 /*-----------------------------------------------------------------*/
 void 
-z80_assignRegisters (eBBlock ** ebbs, int count)
+z80_assignRegisters (ebbIndex * ebbi)
 {
+  eBBlock ** ebbs = ebbi->bbOrder;
+  int count = ebbi->count;
   iCode *ic;
   int i;
 
@@ -3134,7 +3136,7 @@ z80_assignRegisters (eBBlock ** ebbs, int count)
   recomputeLiveRanges (ebbs, count);
 
   if (options.dump_pack)
-    dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
+    dumpEbbsToFileExt (DUMP_PACK, ebbi);
 
   /* first determine for each live range the number of 
      registers & the type of registers required for each */
@@ -3162,7 +3164,7 @@ z80_assignRegisters (eBBlock ** ebbs, int count)
     }
 
   if (options.dump_rassgn) {
-    dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
+    dumpEbbsToFileExt (DUMP_RASSGN, ebbi);
     dumpLiveRanges (DUMP_LRANGE, liveRanges);
   }
 
index fb93bdc993aba1bbebb271212b212f4887d674a2..b0714af94c1551d5f441604e87ac89317ec4294a 100644 (file)
@@ -74,7 +74,7 @@ extern regs *regsZ80;
 void assignRegisters (eBBlock **, int);
 regs *regWithIdx (int);
 
-void z80_assignRegisters (eBBlock ** ebbs, int count);
+void z80_assignRegisters (ebbIndex *);
 bitVect *z80_rUmaskForOp (operand * op);
 
 #endif