+2003-10-05 Bernhard Held <bernhard@bernhardheld.de>
+
+ * src/SDCCloop.c (assignmentsToSym, loopInduction): cast argument of
+ setToNull() to (void *) to avoid gcc3.x's warning: "dereferencing
+ type-punned pointer will break strict-aliasing rules"
+ Old LR behaviour is again default; Klaus' LR can be choosen by
+ defining the environment variable LRKLAUS
+ * src/SDCCBBlock.h
+ * src/SDCCloop.c
+ * src/SDCCloop.h
+ * src/SDCClrange.c
+ * src/ds390/ralloc.c (spillThis): applied Klaus' patch
+
2003-10-05 Borut Razem <borut.razem@siol.net>
* src/SDCC.lex, support/Util/SDCCerr.c, sdcc/support/Util/SDCCerr.h:
2003-10-04 Frieder Ferlemann <Frieder.Ferlemann@web.de>
* doc/sdccman.lyx: various additions and updates (interrupts, inline
- assembly, critical functions, atomic, nojtbound)
-
+ assembly, critical functions, atomic, nojtbound)
+
2003-10-04 Bernhard Held <bernhard@bernhardheld.de>
Applied liferange patch from Klaus Flittner <klaus_flittner@gmx.de>
iCode *ech; /* pointer to last of code chain */
struct eBBlock *preHeader; /* preheader if this is a loop entry */
- set *partOfLoop; /* set of loop regions this block is part of */
+ set *KpartOfLoop; /* set of loop regions this block is part of */
+ struct region *partOfLoop; /* pointer to the loop region this block is part of */
/* control flow analysis */
set *succList; /* list eBBlocks which are successors */
if (ebp->depth<depth)
ebp->depth = depth;
- /* put the loop region info in the block */
- if (!isinSet (ebp->partOfLoop, lr))
- addSetHead (&ebp->partOfLoop, lr);
+ if (getenv ("LRKLAUS"))
+ {
+ /* put the loop region info in the block */
+ if (!isinSet (ebp->KpartOfLoop, lr))
+ addSetHead (&ebp->KpartOfLoop, lr);
+ }
+ else
+ {
+ /* NOTE: here we will update only the inner most loop
+ that it is a part of */
+ if (!ebp->partOfLoop)
+ ebp->partOfLoop = lr;
+ }
/* if any of the successors go out of the loop then */
/* we add this one to the exits */
in this block */
bitVect *defs = bitVectIntersect (ebp->ldefs, OP_DEFS (sym));
assigns += bitVectnBitsOn (defs);
- setToNull ((void **) &defs);
+ setToNull ((void *) &defs);
}
lastBlock->linds = bitVectUnion(lastBlock->linds,indVect);
}
- setToNull ((void **) &indVars);
+ setToNull ((void *) &indVars);
return change;
}
for (i = 0; i < count; i++)
{
- if (!ebbs[i]->partOfLoop)
+ if (!ebbs[i]->KpartOfLoop)
continue;
/* for all loops this block belongs to */
/* add inner block not already marked as part of this loop */
- aloop = setFirstItem (ebbs[i]->partOfLoop);
- for (; aloop; aloop = setNextItem (ebbs[i]->partOfLoop))
+ aloop = setFirstItem (ebbs[i]->KpartOfLoop);
+ for (; aloop; aloop = setNextItem (ebbs[i]->KpartOfLoop))
{
if (aloop->visited)
if (ebbs[j]->fSeq > seqMin && ebbs[j]->lSeq < seqMax &&
!isinSet (aloop->regBlocks, ebbs[j]))
{
- if (!isinSet (ebbs[i]->partOfLoop, aloop))
- addSetHead (&ebbs[j]->partOfLoop, aloop);
+ if (!isinSet (ebbs[j]->KpartOfLoop, aloop))
+ addSetHead (&ebbs[j]->KpartOfLoop, aloop);
}
}
}
if (usedInRemaining (op, ic))
return 0;
- /* if not then check any of the following blocks use it */
- for (i = 0; i < count; i++)
+ if (getenv ("LRKLAUS"))
{
- if (ebbs[i]->fSeq <= ebp->fSeq)
- continue;
- if (usedInRemaining (op, ebbs[i]->sch))
- return 0;
+ /* if not then check any of the following blocks use it */
+ for (i = 0; i < count; i++)
+ {
+ if (ebbs[i]->fSeq <= ebp->fSeq)
+ continue;
+ if (usedInRemaining (op, ebbs[i]->sch))
+ return 0;
+ }
+ }
+ else
+ {
+ /* if not then check any of the successor blocks use it */
+ for (i = 0; i < count;)
+ ebbs[i++]->visited = 0;
+ if (applyToSet (ebp->succList, isOpAlive, op, ebp, ic))
+ return 0;
}
/* this is the last use */
int torange = ic->seq;
/* if this is a SEND then the toRange should be extended
- to the call */
+ to the call */
if (ic->op == SEND)
{
- iCode *lic ;
- for (lic = ic->next ; lic ; lic = lic->next)
- {
- if (lic->op == CALL || lic->op == PCALL)
- break;
- }
- /* found it : mark */
- if (lic)
- torange = lic->prev->seq;
+ iCode *lic ;
+ for (lic = ic->next ; lic ; lic = lic->next)
+ {
+ if (lic->op == CALL || lic->op == PCALL)
+ break;
+ }
+ /* found it : mark */
+ if (lic)
+ torange = lic->prev->seq;
}
/* if this is the last use then if this block belongs
to a loop & some definition comes into the loop
then extend the live range to the end of the loop */
- if (ebp->partOfLoop)
+ if (getenv ("LRKLAUS"))
{
- region *aloop;
-
- aloop = setFirstItem (ebp->partOfLoop);
- for (; aloop; aloop = setNextItem (ebp->partOfLoop))
+ if (ebp->KpartOfLoop)
+ {
+ region *aloop;
+
+ aloop = setFirstItem (ebp->KpartOfLoop);
+ for (; aloop; aloop = setNextItem (ebp->KpartOfLoop))
+ {
+ if (hasIncomingDefs (aloop, op))
+ torange = findLoopEndSeq (aloop);
+ }
+ }
+ }
+ else
+ {
+ if (ebp->partOfLoop
+ && hasIncomingDefs (ebp->partOfLoop, op))
{
- if (hasIncomingDefs (aloop, op))
- torange = findLoopEndSeq (aloop);
+ torange = findLoopEndSeq (ebp->partOfLoop);
}
}
/*-----------------------------------------------------------------*/
/* computeLiveRanges - computes the live ranges for variables */
/*-----------------------------------------------------------------*/
-void
+void
computeLiveRanges (eBBlock ** ebbs, int count)
{
int i = 0;
iCodeSeqhTab = newHashTable (iCodeKey);
sequenceiCode (ebbs, count);
- /* add blocks between loop blocks as part of that loop */
- addLoopBlocks (ebbs, count);
+ if (getenv ("LRKLAUS"))
+ {
+ /* add blocks between loop blocks as part of that loop */
+ addLoopBlocks (ebbs, count);
+ }
/* call routine to mark the from & to live ranges for
variables used */
sym->regs[i] = NULL;
}
- /* if spilt on stack then free up r0 & r1
+ /* if spilt on stack then free up r0 & r1
if they could have been assigned to some
LIVE ranges */
- if (!ds390_ptrRegReq && isSpiltOnStack (sym))
+ if (!ds390_ptrRegReq && isSpiltOnStack (sym) && !options.stack10bit)
{
- ds390_ptrRegReq += !options.stack10bit;
+ ds390_ptrRegReq ++;
spillLRWithPtrReg (sym);
}