+/*------------------------------------------------------------------*/
+/* findRecursiveSucc - build a bit vector of recursive successors */
+/*------------------------------------------------------------------*/
+DEFSETFUNC (findRecursiveSucc)
+{
+ eBBlock *ebp = item;
+ V_ARG (bitVect *, succVect);
+
+ if (ebp->visited)
+ return 0;
+
+ ebp->visited = 1;
+ bitVectSetBit (succVect, ebp->bbnum);
+ applyToSet (ebp->succList, findRecursiveSucc, succVect);
+ return 0;
+}
+
+
+/*------------------------------------------------------------------*/
+/* findRecursivePred - build a bit vector of recursive predecessors */
+/*------------------------------------------------------------------*/
+DEFSETFUNC (findRecursivePred)
+{
+ eBBlock *ebp = item;
+ V_ARG (bitVect *, predVect);
+
+ if (ebp->visited)
+ return 0;
+
+ ebp->visited = 1;
+ bitVectSetBit (predVect, ebp->bbnum);
+ applyToSet (ebp->predList, findRecursivePred, predVect);
+ return 0;
+}
+
+
+/*------------------------------------------------------------------*/
+/* findPrevUse - handle degenerate case of a symbol used prior to */
+/* findNextUse() marking any definition. */
+/*------------------------------------------------------------------*/
+void
+findPrevUse (eBBlock *ebp, iCode *ic, operand *op, eBBlock **ebbs, int count)
+{
+ int i;
+ bitVect * succVect;
+ bitVect * predVect;
+
+ /* If liveness is already known, then a previous call to findNextUse() */
+ /* has already taken care of everything. */
+ if (ic && bitVectBitValue(ic->rlive, op->key))
+ return;
+
+ if (op->isaddr)
+ OP_SYMBOL (op)->isptr = 1;
+
+ OP_SYMBOL (op)->key = op->key;
+
+ /* Otherwise, it appears that this symbol was used prior to definition. */
+ /* Just fix the live range; we'll deal with a diagnostic message elsewhere. */
+ /* If the symbol use was in a loop, we need to extend the live range to the */
+ /* outermost loop. */
+ unvisitBlocks (ebbs, count);
+ succVect = newBitVect (count);
+ applyToSet (ebp->succList, findRecursiveSucc, succVect);
+ unvisitBlocks (ebbs, count);
+ predVect = newBitVect (count);
+ applyToSet (ebp->predList, findRecursivePred, predVect);
+
+ /* Blocks that are both recursively predecessors and successors are in */
+ /* a loop with the current iCode. Mark the operand as alive in them. */
+ for (i = 0; i < count; i++)
+ {
+ if (bitVectBitValue(succVect, i) && bitVectBitValue(predVect, i))
+ markAlive (ebbs[i]->sch, ebbs[i]->ech, op->key);
+ }
+
+ freeBitVect (succVect);
+ freeBitVect (predVect);
+}
+