{
edge *ep = item;
V_ARG (set **, allRegion);
- V_ARG (eBBlock **,ebbs);
- V_ARG (int,count);
region *aloop = newRegion ();
eBBlock *block;
- int dfMin = count ,dfMax =0, i;
/* make sure regionStack is empty */
while (!STACK_EMPTY (regionStack))
}
aloop->entry = ep->to;
- /* set max & min dfNum for loopRegion */
- for ( block = setFirstItem(aloop->regBlocks); block;
- block = setNextItem(aloop->regBlocks)) {
- if (block->dfnum > dfMax) dfMax = block->dfnum;
- if (block->dfnum < dfMin) dfMin = block->dfnum;
- }
-
- /* all blocks that have dfnumbers between dfMin & dfMax are also
- part of loop */
- for (i = 0 ; i < count ; i++) {
- if (ebbs[i]->dfnum > dfMin && ebbs[i]->dfnum < dfMax) {
- loopInsert(&aloop->regBlocks,ebbs[i]);
- }
- }
+
/* now add it to the set */
addSetHead (allRegion, aloop);
return 0;
V_ARG (int, count);
addSetHead (&ebp->inExprs, cdp);
- cseBBlock (ebp, 0, ebbs, count);
+ cseBBlock (ebp, optimize.global_cse, ebbs, count);
return 0;
}
int lin, rin;
cseDef *ivar;
- /* jwk: TODO this is only needed if the call is between
+ /* TODO this is only needed if the call is between
here and the definition, but I am too lazy to do that now */
/* if there are function calls in this block */
iCode *newic = newiCode ('=', NULL,
operandFromOperand (IC_RIGHT (ic)));
IC_RESULT (newic) = operandFromOperand (IC_RESULT (ic));
- OP_DEFS (IC_RESULT (newic)) =
+ OP_DEFS(IC_RESULT (newic))=
bitVectSetBit (OP_DEFS (IC_RESULT (newic)), newic->key);
- OP_USES (IC_RIGHT (newic)) =
+ OP_USES(IC_RIGHT (newic))=
bitVectSetBit (OP_USES (IC_RIGHT (newic)), newic->key);
/* and add it */
if (eblock->sch && eblock->sch->op == LABEL)
if (lp->entry == theLoop->entry)
{
theLoop->regBlocks = unionSets (theLoop->regBlocks,
- lp->regBlocks, THROW_BOTH);
+ lp->regBlocks, THROW_DEST);
lp->merged = 1;
}
}
/* for each of these back edges get the blocks that */
/* constitute the loops */
- applyToSet (bEdges, createLoop, &allRegion, ebbs,count);
+ applyToSet (bEdges, createLoop, &allRegion);
/* now we will create regions from these loops */
/* loops with the same entry points are considered to be the */
applyToSet (allRegion, mergeInnerLoops, allRegion, &maxDepth);
maxDepth++;
+
/* now create all the exits .. also */
/* create an ordered set of loops */
/* i.e. we process loops in the inner to outer order */