X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCcse.c;h=4b524b0bf5fb1b82e0a148e3da5e11687f523563;hb=8a3907b5a8101a4c272b4304654469217bd0d606;hp=05c6e2e6ca5fa892d86a3accdec7452e07848938;hpb=ea914976dfeb8f841e6530ef6d81a778c8bc0e88;p=fw%2Fsdcc diff --git a/src/SDCCcse.c b/src/SDCCcse.c index 05c6e2e6..4b524b0b 100644 --- a/src/SDCCcse.c +++ b/src/SDCCcse.c @@ -1393,7 +1393,7 @@ void ifxOptimize (iCode * ic, set * cseSet, int computeOnly, eBBlock * ebb, int *change, - eBBlock ** ebbs, int count) + ebbIndex * ebbi) { operand *pdop; symbol *label; @@ -1445,7 +1445,7 @@ ifxOptimize (iCode * ic, set * cseSet, /* this is very expensive but it does not happen */ /* too often, if it does happen then the user pays */ /* the price */ - computeControlFlow (ebbs, count, 1); + computeControlFlow (ebbi); if (!options.lessPedantic) { werrorfl (ic->filename, ic->lineno, W_CONTROL_FLOW); } @@ -1457,7 +1457,7 @@ ifxOptimize (iCode * ic, set * cseSet, we can remove this conditional statement */ label = (IC_TRUE (ic) ? IC_TRUE (ic) : IC_FALSE (ic)); if (elementsInSet (ebb->succList) == 1 && - isinSet (ebb->succList, eBBWithEntryLabel (ebbs, label, count))) + isinSet (ebb->succList, eBBWithEntryLabel (ebbi, label))) { if (!options.lessPedantic) { @@ -1473,7 +1473,7 @@ ifxOptimize (iCode * ic, set * cseSet, else { remiCodeFromeBBlock (ebb, ic); - computeControlFlow (ebbs, count, 1); + computeControlFlow (ebbi); return; } } @@ -1535,7 +1535,7 @@ constFold (iCode * ic, set * cseSet) ic->op != '-') return 0; - /* this check is a hueristic to prevent live ranges + /* this check is a heuristic to prevent live ranges from becoming too long */ if (IS_PTR (operandType (IC_RESULT (ic)))) return 0; @@ -1545,7 +1545,7 @@ constFold (iCode * ic, set * cseSet) return 0; /* check if we can find a definition for the - right hand side */ + left hand side */ if (!(applyToSet (cseSet, diCodeForSym, IC_LEFT (ic), &dic))) return 0; @@ -1768,8 +1768,10 @@ dumpCseSet(set *cseSet) /*-----------------------------------------------------------------*/ int cseBBlock (eBBlock * ebb, int computeOnly, - eBBlock ** ebbs, int count) + ebbIndex * ebbi) { + eBBlock ** ebbs = ebbi->bbOrder; + int count = ebbi->count; set *cseSet; iCode *ic; int change = 0; @@ -1957,7 +1959,7 @@ cseBBlock (eBBlock * ebb, int computeOnly, { ifxOptimize (ic, cseSet, computeOnly, ebb, &change, - ebbs, count); + ebbi); continue; } @@ -2225,15 +2227,17 @@ cseBBlock (eBBlock * ebb, int computeOnly, /* cseAllBlocks - will sequentially go thru & do cse for all blocks */ /*-----------------------------------------------------------------*/ int -cseAllBlocks (eBBlock ** ebbs, int count, int computeOnly) +cseAllBlocks (ebbIndex * ebbi, int computeOnly) { + eBBlock ** ebbs = ebbi->dfOrder; + int count = ebbi->count; int i; int change = 0; /* if optimization turned off */ for (i = 0; i < count; i++) - change += cseBBlock (ebbs[i], computeOnly, ebbs, count); + change += cseBBlock (ebbs[i], computeOnly, ebbi); return change; }