From a8dbe64979fe7953792605da0d7e57b352baed1b Mon Sep 17 00:00:00 2001 From: sandeep Date: Sat, 2 Mar 2002 19:11:14 +0000 Subject: [PATCH] functions "alldefsoutofrange" and "notusedinblock" moved to SDCClrange.c git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1980 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCClrange.c | 39 +++++++++++++++++++++++++++++++++++++++ src/SDCClrange.h | 3 ++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/SDCClrange.c b/src/SDCClrange.c index 7d5646cd..6c77fd3a 100644 --- a/src/SDCClrange.c +++ b/src/SDCClrange.c @@ -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(); } + diff --git a/src/SDCClrange.h b/src/SDCClrange.h index 3aee1521..168f4c6a 100644 --- a/src/SDCClrange.h +++ b/src/SDCClrange.h @@ -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 -- 2.30.2