]> git.gag.com Git - fw/sdcc/commitdiff
functions "alldefsoutofrange" and "notusedinblock" moved to SDCClrange.c
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 2 Mar 2002 19:11:14 +0000 (19:11 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 2 Mar 2002 19:11:14 +0000 (19:11 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1980 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCClrange.c
src/SDCClrange.h

index 7d5646cd452abb78dca96109a73b5eb72cc329d1..6c77fd3a42dc8671b396887b098ce803fd5ac555 100644 (file)
@@ -658,6 +658,44 @@ static void computeClash ()
     }
 }
 
+/*-----------------------------------------------------------------*/
+/* allDefsOutOfRange - all definitions are out of a range          */
+/*-----------------------------------------------------------------*/
+bool
+allDefsOutOfRange (bitVect * defs, int fseq, int toseq)
+{
+  int i;
+
+  if (!defs)
+    return TRUE;
+
+  for (i = 0; i < defs->size; i++)
+    {
+      iCode *ic;
+
+      if (bitVectBitValue (defs, i) &&
+         (ic = hTabItemWithKey (iCodehTab, i)) &&
+         (ic->seq >= fseq && ic->seq <= toseq))
+
+       return FALSE;
+
+    }
+
+  return TRUE;
+}
+
+/*-----------------------------------------------------------------*/
+/* notUsedInBlock - not used in this block                         */
+/*-----------------------------------------------------------------*/
+int
+notUsedInBlock (symbol * sym, eBBlock * ebp, iCode *ic)
+{
+  return (!bitVectBitsInCommon (sym->defs, ebp->usesDefs) &&
+         allDefsOutOfRange (sym->defs, ebp->fSeq, ebp->lSeq) &&
+         allDefsOutOfRange (sym->uses, ebp->fSeq, ebp->lSeq));
+}
+
+
 /*-----------------------------------------------------------------*/
 /* computeLiveRanges - computes the live ranges for variables      */
 /*-----------------------------------------------------------------*/
@@ -687,3 +725,4 @@ computeLiveRanges (eBBlock ** ebbs, int count)
   /* compute which overlaps with what */
   computeClash();
 }
+
index 3aee152140bb25266d8f6787fc31a591ed27032b..168f4c6a88b39f47bf3839bec70cffefef570119 100644 (file)
@@ -30,6 +30,7 @@ extern hTab *liveRanges;
 extern hTab *iCodehTab;
 extern hTab *iCodeSeqhTab;
 
+int  notUsedInBlock (symbol *, eBBlock *, iCode *);
+bool allDefsOutOfRange (bitVect *, int, int);
 void computeLiveRanges (eBBlock **, int);
-
 #endif