ip->op = op;
ip->cval = constVal;
ip->ic = ic;
- updateSpillLocation(ic,1);
+//updateSpillLocation(ic,1);
return ip;
}
if (ebp->depth<depth)
ebp->depth = depth;
- /* put the loop region info in the block */
- if (!isinSet (ebp->partOfLoop, lr))
- addSetHead (&ebp->partOfLoop, lr);
+ /* 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);
}
if (SKIP_IC (ic) || POINTER_SET (ic) || ic->op == IFX)
continue;
+
+ /* iTemp assignment from a literal may be invariant, but it
+ will needlessly increase register pressure if the
+ iCode(s) that use this iTemp are not also invariant */
+ if (ic->op=='=' && IS_ITEMP (IC_RESULT (ic))
+ && IS_OP_LITERAL (IC_RIGHT (ic)))
+ continue;
/* if result is volatile then skip */
if (IC_RESULT (ic) &&
applyToSet (theLoop->regBlocks, hasNonPtrUse, IC_LEFT (ic)))
continue;
- /* if both the left & right are invariants : then check that */
+
+ /* if both the left & right are invariants : then check that */
/* this definition exists in the out definition of all the */
/* blocks, this will ensure that this is not assigned any */
/* other value in the loop , and not used in this block */
eBBlock *sBlock;
set *lSet = setFromSet (theLoop->regBlocks);
- /* if this block does not dominate all exists */
+ /* if this block does not dominate all exits */
/* make sure this defintion is not used anywhere else */
if (!domsAllExits)
{
/* now we know it is a true invariant */
/* remove it from the insts chain & put */
/* in the invariant set */
- OP_SYMBOL (IC_RESULT (ic))->isinvariant = 1;
+
+ OP_SYMBOL (IC_RESULT (ic))->isinvariant = 1;
+ SPIL_LOC (IC_RESULT (ic)) = NULL;
remiCodeFromeBBlock (lBlock, ic);
/* maintain the data flow */
lastBlock->linds = bitVectUnion(lastBlock->linds,indVect);
}
- setToNull ((void **) &indVars);
+ setToNull ((void *) &indVars);
return change;
}
return change;
}
-
-/*-----------------------------------------------------------------*/
-/* addLoopBlocks - will add all blocks inside a loop to this loop */
-/* this should fix most of the liverange problems */
-/*-----------------------------------------------------------------*/
-void
-addLoopBlocks (eBBlock ** ebbs, int count)
-{
- region *aloop;
- struct eBBlock *block;
- int seqMin, seqMax;
- int i, j;
-
- for (i = 0; i < count; i++)
- {
- if (!ebbs[i]->partOfLoop)
- 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))
- {
-
- if (aloop->visited)
- continue;
-
- aloop->visited = 1;
-
- /* set max & min Seq for loopRegion */
- block = setFirstItem (aloop->regBlocks);
- seqMax = block->lSeq;
- seqMin = block->fSeq;
- for (; block; block = setNextItem (aloop->regBlocks))
- {
- if (block->lSeq > seqMax)
- seqMax = block->lSeq;
- if (block->fSeq < seqMin)
- seqMin = block->fSeq;
- }
-
- /* add all blocks between seqMin, seqMax to loop */
- for (j = 0; j < count; j++)
- {
- 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);
- }
- }
- }
- }
-}