unsigned int hasFcall:1; /* has a function call */
unsigned int noPath:1; /* there is no path from _entry to this block */
unsigned int isLastInLoop:1; /* is the last block in a loop */
+ unsigned int hasConditionalExit; /* this block ends with a return or goto from a conditional block*/
symbol *entryLabel; /* entry label */
iCode *sch; /* pointer to start of code chain */
+//#define LIVERANGEHUNT
+#ifdef LIVERANGEHUNT
+ #define LRH(x) x
+#else
+ #define LRH(x)
+#endif
/*-------------------------------------------------------------------------
SDCCcflow.c - source file for control flow analysis
addSuccessor (ebbs[i], ebbs[j]); /* add it */
}
+ else
+ {
+ int j=i;
+ while (j--) {
+ if (ebbs[j]->ech && ebbs[j]->ech->op==IFX &&
+ (isSymbolEqual(IC_TRUE(ebbs[j]->ech), ebbs[i]->entryLabel) ||
+ isSymbolEqual(IC_FALSE(ebbs[j]->ech), ebbs[i]->entryLabel))) {
+ LRH(printf ("%s has a conditional exit from %s\n", ebbs[i]->entryLabel->name, ebbs[j]->entryLabel->name));
+ ebbs[i]->hasConditionalExit=1;
+ }
+ }
+ }
} /* no instructions in the block */
/* could happen for dummy blocks */
else
#endif
aloop->entry = ep->to;
+
+#ifdef LIVERANGEHUNT
+ // now also include those blocks that conditionally escape from this loop
+ for (i=1; i<count; i++) {
+ if (ebbs[i]->hasConditionalExit) {
+ for (block=setFirstItem(aloop->regBlocks);
+ block;
+ block=setNextItem(aloop->regBlocks)) {
+ if (isinSet(block->predList, ebbs[i])) {
+ printf ("%s has a forced exit from %s\n",
+ ebbs[i]->entryLabel->name,
+ block->entryLabel->name);
+ }
+ }
+ }
+ }
+#else
/* set max & min dfNum for loopRegion */
for ( block = setFirstItem(aloop->regBlocks); block;
block = setNextItem(aloop->regBlocks)) {
ebbs[i]->dfnum < dfMax &&
!isinSet(aloop->regBlocks,ebbs[i])) {
if (!ebbs[i]->partOfLoop) {
-#if !defined(LIVERANGEHUNT)
ebbs[i]->partOfLoop = aloop;
-#else
- loopInsert(&aloop->regBlocks,ebbs[i]);
-#endif
}
}
}
+#endif
#ifdef LIVERANGEHUNT
printf ("================\n");