- int i;
- int change = 1;
-
- while (change) {
-
- change = 0;
-
- /* for all blocks */
- for ( i = 0 ; i < count ; i++ ) {
-
- set *pred ;
- set *oldOut;
- int firstTime ;
- eBBlock *pBlock ;
-
- /* if this is the entry block then continue */
- /* since entry block can never have any inExprs */
- if (ebbs[i]->noPath)
- continue ;
-
- /* get blocks that can come to this block */
- pred = edgesTo(ebbs[i]);
-
- /* make a copy of the outExpressions : to be */
- /* used for iteration */
- oldOut = setFromSet(ebbs[i]->outExprs);
- setToNull ((void **)&ebbs[i]->inDefs);
-
- /* indefitions are easy just merge them by union */
- /* these are the definitions that can possibly */
- /* reach this block */
- firstTime = 1;
- applyToSet(pred,mergeInDefs,ebbs[i],&firstTime);
-
-
- /* if none of the edges coming to this block */
- /* dominate this block then add the immediate dominator */
- /* of this block to the list of predecessors */
- for ( pBlock = setFirstItem(pred); pBlock ;
- pBlock = setNextItem(pred)) {
- if (bitVectBitValue(ebbs[i]->domVect,pBlock->bbnum))
- break ;
+ eBBlock ** ebbs = ebbi->dfOrder;
+ int count = ebbi->count;
+ int i;
+ int change = 1;
+
+ for (i = 0; i < count; i++)
+ ebbs[i]->killedExprs = NULL;
+
+ while (change)
+ {
+ change = 0;
+
+ /* for all blocks */
+ for (i = 0; i < count; i++)
+ {
+
+ set *pred;
+ set *oldOutExprs = NULL;
+ set *oldKilledExprs = NULL;
+ bitVect *oldOutDefs = NULL;
+ int firstTime;
+ eBBlock *pBlock;
+
+ /* if this is the entry block then continue */
+ /* since entry block can never have any inExprs */
+ if (ebbs[i]->noPath)
+ continue;
+
+ /* get blocks that can come to this block */
+ pred = edgesTo (ebbs[i]);
+
+ /* make a copy of the outExpressions and outDefs : to be */
+ /* used for iteration */
+ if (optimize.global_cse)
+ {
+ oldOutExprs = setFromSet (ebbs[i]->outExprs);
+ oldKilledExprs = setFromSet (ebbs[i]->killedExprs);
+ }
+ oldOutDefs = bitVectCopy (ebbs[i]->outDefs);
+ setToNull ((void *) &ebbs[i]->inDefs);
+
+ /* indefitions are easy just merge them by union */
+ /* these are the definitions that can possibly */
+ /* reach this block */
+ firstTime = 1;
+ applyToSet (pred, mergeInDefs, ebbs[i], &firstTime);
+
+ /* if none of the edges coming to this block */
+ /* dominate this block then add the immediate dominator */
+ /* of this block to the list of predecessors */
+ for (pBlock = setFirstItem (pred); pBlock;
+ pBlock = setNextItem (pred))
+ {
+ if (bitVectBitValue (ebbs[i]->domVect, pBlock->bbnum))
+ break;
+ }
+
+ /* get the immediate dominator and put it there */
+ if (!pBlock)
+ {
+ eBBlock *idom = immedDom (ebbi, ebbs[i]);
+ if (idom)
+ addSetHead (&pred, idom);