1 /*-------------------------------------------------------------------------
2 SDCCcse.c - source file for Common Subexpressions and other utility
4 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998)
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 In other words, you are welcome to use, share and improve this program.
21 You are forbidden to forbid anyone else to use, share and improve
22 what you give them. Help stamp out software-hoarding!
23 -------------------------------------------------------------------------*/
28 /*-----------------------------------------------------------------*/
29 /* newCseDef - new cseDef */
30 /*-----------------------------------------------------------------*/
32 newCseDef (operand * sym, iCode * ic)
37 cdp = Safe_alloc (sizeof (cseDef));
48 /*-----------------------------------------------------------------*/
49 /* int isCseDefEqual - two definitions are equal */
50 /*-----------------------------------------------------------------*/
52 isCseDefEqual (void *vsrc, void *vdest)
60 return (src->key == dest->key &&
61 src->diCode == dest->diCode);
65 /*-----------------------------------------------------------------*/
66 /* pcseDef - in the cseDef */
67 /*-----------------------------------------------------------------*/
69 pcseDef (void *item, va_list ap)
77 fprintf (stdout, "**null op**");
78 printOperand (cdp->sym, stdout);
79 icTab = getTableEntry (cdp->diCode->op);
80 icTab->iCodePrint (stdout, cdp->diCode, icTab->printName);
84 /*-----------------------------------------------------------------*/
85 /* replaceAllSymBySym - replaces all operands by operand in an */
86 /* instruction chain */
87 /*-----------------------------------------------------------------*/
89 replaceAllSymBySym (iCode * ic, operand * from, operand * to, bitVect ** ndpset)
93 for (lic = ic; lic; lic = lic->next)
97 /* do the special cases first */
101 IC_COND (lic)->key == from->key)
104 bitVectUnSetBit (OP_USES (from), lic->key);
105 OP_USES (to) = bitVectSetBit (OP_USES (to), lic->key);
106 siaddr = IC_COND (lic)->isaddr;
107 IC_COND (lic) = operandFromOperand (to);
108 IC_COND (lic)->isaddr = siaddr;
114 if (lic->op == JUMPTABLE)
117 IC_JTCOND (lic)->key == from->key)
120 bitVectUnSetBit (OP_USES (from), lic->key);
121 OP_USES (to) = bitVectSetBit (OP_USES (to), lic->key);
122 siaddr = IC_COND (lic)->isaddr;
123 IC_JTCOND (lic) = operandFromOperand (to);
124 IC_JTCOND (lic)->isaddr = siaddr;
130 if (IC_RESULT (lic) && IC_RESULT (lic)->key == from->key)
132 /* maintain du chains */
133 if (POINTER_SET (lic))
135 bitVectUnSetBit (OP_USES (from), lic->key);
136 OP_USES (to) = bitVectSetBit (OP_USES (to), lic->key);
138 /* also check if the "from" was in the non-dominating
139 pointer sets and replace it with "to" in the bitVector */
140 if (bitVectBitValue (*ndpset, from->key))
142 bitVectUnSetBit (*ndpset, from->key);
143 bitVectSetBit (*ndpset, to->key);
149 bitVectUnSetBit (OP_DEFS (from), lic->key);
150 OP_DEFS (to) = bitVectSetBit (OP_DEFS (to), lic->key);
152 siaddr = IC_RESULT (lic)->isaddr;
153 IC_RESULT (lic) = operandFromOperand (to);
154 IC_RESULT (lic)->isaddr = siaddr;
158 IC_RIGHT (lic) && IC_RIGHT (lic)->key == from->key)
160 bitVectUnSetBit (OP_USES (from), lic->key);
161 OP_USES (to) = bitVectSetBit (OP_USES (to), lic->key);
162 siaddr = IC_RIGHT (lic)->isaddr;
163 IC_RIGHT (lic) = operandFromOperand (to);
164 IC_RIGHT (lic)->isaddr = siaddr;
168 IC_LEFT (lic) && IC_LEFT (lic)->key == from->key)
170 bitVectUnSetBit (OP_USES (from), lic->key);
171 OP_USES (to) = bitVectSetBit (OP_USES (to), lic->key);
172 siaddr = IC_LEFT (lic)->isaddr;
173 IC_LEFT (lic) = operandFromOperand (to);
174 IC_LEFT (lic)->isaddr = siaddr;
179 /*-----------------------------------------------------------------*/
180 /* iCodeKeyIs - if the icode keys match then return 1 */
181 /*-----------------------------------------------------------------*/
182 DEFSETFUNC (iCodeKeyIs)
187 if (cdp->diCode->key == key)
193 /*-----------------------------------------------------------------*/
194 /* removeFromInExprs - removes an icode from inexpressions */
195 /*-----------------------------------------------------------------*/
196 DEFSETFUNC (removeFromInExprs)
200 V_ARG (operand *, from);
201 V_ARG (operand *, to);
202 V_ARG (eBBlock *, cbp);
208 deleteItemIf (&ebp->inExprs, iCodeKeyIs, ic->key);
209 if (ebp != cbp && !bitVectBitValue (cbp->domVect, ebp->bbnum))
210 replaceAllSymBySym (ebp->sch, from, to, &ebp->ndompset);
212 applyToSet (ebp->succList, removeFromInExprs, ic, from, to, cbp);
216 /*-----------------------------------------------------------------*/
217 /* isGlobalInNearSpace - return TRUE if valriable is a globalin data */
218 /*-----------------------------------------------------------------*/
220 isGlobalInNearSpace (operand * op)
222 sym_link *type = getSpec (operandType (op));
223 /* this is 8051 specific: optimization
224 suggested by Jean-Louis VERN, with 8051s we have no
225 advantage of putting variables in near space into
227 if (isOperandGlobal (op) && !IN_FARSPACE (SPEC_OCLS (type)) &&
228 IN_DIRSPACE (SPEC_OCLS (type)))
234 /*-----------------------------------------------------------------*/
235 /* findCheaperOp - cseBBlock support routine, will check to see if */
236 /* we have a operand previously defined */
237 /*-----------------------------------------------------------------*/
238 DEFSETFUNC (findCheaperOp)
241 V_ARG (operand *, cop);
242 V_ARG (operand **, opp);
244 /* if we have already found it */
248 /* not found it yet check if this is the one */
249 /* and this is not the defining one */
250 if (cop->key == cdp->key)
253 /* do a special check this will help in */
254 /* constant propagation & dead code elim */
255 /* for assignments only */
256 if (cdp->diCode->op == '=') {
257 /* if the result is volatile then return result */
258 if (IS_OP_VOLATILE (IC_RESULT (cdp->diCode)))
259 *opp = IC_RESULT (cdp->diCode);
261 /* if this is a straight assignment and
262 left is a temp then prefer the temporary to the
264 if (!POINTER_SET (cdp->diCode) &&
265 IS_ITEMP (IC_RESULT (cdp->diCode)) &&
266 IS_TRUE_SYMOP (IC_RIGHT (cdp->diCode)))
267 *opp = IC_RESULT (cdp->diCode);
269 /* if straight assignement && and both
270 are temps then prefer the one that
271 will not need extra space to spil, also
272 take into consideration if right side
273 an induction variable
275 if (!POINTER_SET (cdp->diCode) &&
276 IS_ITEMP (IC_RESULT (cdp->diCode)) &&
277 IS_ITEMP (IC_RIGHT (cdp->diCode)) &&
278 !OP_SYMBOL (IC_RIGHT (cdp->diCode))->isind &&
279 !OP_SYMBOL(IC_RIGHT (cdp->diCode))->isreqv &&
280 ((!SPIL_LOC (IC_RIGHT (cdp->diCode)) &&
281 SPIL_LOC (IC_RESULT (cdp->diCode))) ||
282 (SPIL_LOC (IC_RESULT (cdp->diCode)) &&
283 SPIL_LOC (IC_RESULT (cdp->diCode)) ==
284 SPIL_LOC (IC_RIGHT (cdp->diCode)))))
285 *opp = IC_RESULT (cdp->diCode);
287 *opp = IC_RIGHT (cdp->diCode);
291 *opp = IC_RESULT (cdp->diCode);
294 /* if this is an assign to a temp. then check
295 if the right side is this then return this */
296 if (IS_TRUE_SYMOP (cop) &&
297 cdp->diCode->op == '=' &&
298 !POINTER_SET (cdp->diCode) &&
299 cop->key == IC_RIGHT (cdp->diCode)->key &&
300 !isGlobalInNearSpace (IC_RIGHT (cdp->diCode)) &&
301 IS_ITEMP (IC_RESULT (cdp->diCode)))
302 *opp = IC_RESULT (cdp->diCode);
305 (isOperandLiteral(*opp) ||
306 #if 0 // jwk: because of bug #480645, this is clumsy anyway. E.g.
307 getSize(operandType(*opp)) == getSize(operandType(cop)) ||
308 (SPEC_USIGN(operandType (cop))==SPEC_USIGN(operandType (*opp)) &&
309 (SPEC_LONG(operandType (cop))==SPEC_LONG(operandType (*opp))))))
311 compareType(operandType(*opp), operandType(cop))==1))
315 if ((isGlobalInNearSpace (cop) &&
316 !isOperandLiteral (*opp)) ||
317 isOperandVolatile (*opp, FALSE)
324 if (cop->key == (*opp)->key)
330 if ((*opp)->isaddr != cop->isaddr && IS_ITEMP (cop))
332 *opp = operandFromOperand (*opp);
333 (*opp)->isaddr = cop->isaddr;
343 /*-----------------------------------------------------------------*/
344 /* findPointerSet - finds the right side of a pointer set op */
345 /*-----------------------------------------------------------------*/
346 DEFSETFUNC (findPointerSet)
349 V_ARG (operand *, op);
350 V_ARG (operand **, opp);
351 V_ARG (operand *, rop);
353 if (POINTER_SET (cdp->diCode) &&
354 IC_RESULT (cdp->diCode)->key == op->key &&
355 !isOperandVolatile (IC_RESULT (cdp->diCode), TRUE) &&
356 !isOperandVolatile (IC_RIGHT (cdp->diCode), TRUE) &&
357 getSize (operandType (IC_RIGHT (cdp->diCode))) ==
358 getSize (operandType (rop)))
360 *opp = IC_RIGHT (cdp->diCode);
367 /*-----------------------------------------------------------------*/
368 /* findPrevIc - cseBBlock support function will return the iCode */
369 /* which matches the current one */
370 /*-----------------------------------------------------------------*/
371 DEFSETFUNC (findPrevIc)
375 V_ARG (iCode **, icp);
377 /* if already found */
381 /* if the iCodes are the same */
382 if (isiCodeEqual (ic, cdp->diCode) &&
383 isOperandEqual (cdp->sym, IC_RESULT (cdp->diCode)))
389 /* if iCodes are not the same */
390 /* see the operands maybe interchanged */
391 if (ic->op == cdp->diCode->op &&
392 (ic->op == '+' || ic->op == '*') &&
393 isOperandEqual (IC_LEFT (ic), IC_RIGHT (cdp->diCode)) &&
394 isOperandEqual (IC_RIGHT (ic), IC_LEFT (cdp->diCode)))
403 /*-------------------------------------------------------------------*/
404 /* ifAssignedFromGlobal - if definition is an assignment from global */
405 /*-------------------------------------------------------------------*/
406 DEFSETFUNC (ifAssignedFromGlobal)
409 iCode *dic=cdp->diCode;
411 if (dic->op=='=' && isOperandGlobal(IC_RIGHT(dic))) {
417 /*-----------------------------------------------------------------*/
418 /* ifDefGlobal - if definition is global */
419 /*-----------------------------------------------------------------*/
420 DEFSETFUNC (ifDefGlobal)
424 return (isOperandGlobal (cdp->sym));
427 /*-----------------------------------------------------------------*/
428 /* ifAnyGetPointer - if get pointer icode */
429 /*-----------------------------------------------------------------*/
430 DEFSETFUNC (ifAnyGetPointer)
434 if (cdp->diCode && POINTER_GET (cdp->diCode))
439 /*-----------------------------------------------------------------*/
440 /* ifOperandsHave - if any of the operand are the same as this */
441 /*-----------------------------------------------------------------*/
442 DEFSETFUNC (ifOperandsHave)
445 V_ARG (operand *, op);
448 if (IC_LEFT (cdp->diCode) &&
449 IS_SYMOP (IC_LEFT (cdp->diCode)) &&
450 IC_LEFT (cdp->diCode)->key == op->key)
453 if (IC_RIGHT (cdp->diCode) &&
454 IS_SYMOP (IC_RIGHT (cdp->diCode)) &&
455 IC_RIGHT (cdp->diCode)->key == op->key)
458 /* or if any of the operands are volatile */
459 if (IC_LEFT (cdp->diCode) &&
460 IS_OP_VOLATILE (IC_LEFT (cdp->diCode)))
463 if (IC_RIGHT (cdp->diCode) &&
464 IS_OP_VOLATILE (IC_RIGHT (cdp->diCode)))
468 if (IC_RESULT (cdp->diCode) &&
469 IS_OP_VOLATILE (IC_RESULT (cdp->diCode)))
475 /*-----------------------------------------------------------------*/
476 /* ifDefSymIs - if a definition is found in the set */
477 /*-----------------------------------------------------------------*/
479 ifDefSymIs (set * cseSet, operand * sym)
484 if (!sym || !IS_SYMOP (sym))
486 for (sl = cseSet; sl; sl = sl->next)
489 if (loop->sym->key == sym->key)
496 /*-----------------------------------------------------------------*/
497 /* ifDefSymIsX - will return 1 if the symbols match */
498 /*-----------------------------------------------------------------*/
499 DEFSETFUNC (ifDefSymIsX)
502 V_ARG (operand *, op);
505 return cdp->sym->key == op->key;
507 return (isOperandEqual (cdp->sym, op));
512 /*-----------------------------------------------------------------*/
513 /* ifDiCodeIs - returns truw if diCode is same */
514 /*-----------------------------------------------------------------*/
516 ifDiCodeIs (set * cseSet, iCode * ic)
524 for (sl = cseSet; sl; sl = sl->next)
527 if (loop->diCode == ic)
534 /*-----------------------------------------------------------------*/
535 /* ifPointerGet - returns true if the icode is pointer get sym */
536 /*-----------------------------------------------------------------*/
537 DEFSETFUNC (ifPointerGet)
540 V_ARG (operand *, op);
541 iCode *dic = cdp->diCode;
542 operand *left = IC_LEFT (cdp->diCode);
544 if (POINTER_GET (dic) && left->key == op->key)
550 /*-----------------------------------------------------------------*/
551 /* ifPointerSet - returns true if the icode is pointer set sym */
552 /*-----------------------------------------------------------------*/
553 DEFSETFUNC (ifPointerSet)
556 V_ARG (operand *, op);
558 if (POINTER_SET (cdp->diCode) &&
559 IC_RESULT (cdp->diCode)->key == op->key)
565 /*-----------------------------------------------------------------*/
566 /* ifDiCodeIsX - will return 1 if the symbols match */
567 /*-----------------------------------------------------------------*/
568 DEFSETFUNC (ifDiCodeIsX)
573 return cdp->diCode == ic;
577 /*-----------------------------------------------------------------*/
578 /* algebraicOpts - does some algebraic optimizations */
579 /*-----------------------------------------------------------------*/
581 algebraicOpts (iCode * ic)
583 /* we don't deal with the following iCodes
594 /* if both operands present & ! IFX */
595 /* then if they are both literal we */
596 /* perform the operation right now */
597 if (IC_RESULT (ic) &&
600 IS_OP_LITERAL (IC_LEFT (ic)) &&
601 IS_OP_LITERAL (IC_RIGHT (ic)))
604 IC_RIGHT (ic) = operandOperation (IC_LEFT (ic),
607 operandType (IC_RESULT (ic)));
610 SET_RESULT_RIGHT (ic);
614 /* if not ifx & only one operand present */
615 if (IC_RESULT (ic) &&
617 IS_OP_LITERAL (IC_LEFT (ic)) &&
621 IC_RIGHT (ic) = operandOperation (IC_LEFT (ic),
624 operandType (IC_RESULT (ic)));
627 SET_RESULT_RIGHT (ic);
632 /* a special case : or in short a kludgy solution will think
633 about a better solution over a glass of wine someday */
634 if (ic->op == GET_VALUE_AT_ADDRESS)
637 if (IS_ITEMP (IC_RESULT (ic)) &&
638 IS_TRUE_SYMOP (IC_LEFT (ic)))
642 IC_RIGHT (ic) = operandFromOperand (IC_LEFT (ic));
643 IC_RIGHT (ic)->isaddr = 0;
645 IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
646 IC_RESULT (ic)->isaddr = 0;
647 setOperandType (IC_RESULT (ic), operandType (IC_RIGHT (ic)));
651 if (IS_ITEMP (IC_LEFT (ic)) &&
652 IS_ITEMP (IC_RESULT (ic)) &&
653 /* !OP_SYMBOL(IC_RESULT(ic))->isreqv && */
654 /* !OP_SYMBOL(IC_LEFT(ic))->isreqv && */
655 !IC_LEFT (ic)->isaddr)
658 IC_RIGHT (ic) = operandFromOperand (IC_LEFT (ic));
659 IC_RIGHT (ic)->isaddr = 0;
660 IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
661 IC_RESULT (ic)->isaddr = 0;
669 /* depending on the operation */
673 /* if adding the same thing change to left shift by 1 */
674 if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key &&
675 !IS_FLOAT (operandType (IC_RESULT (ic))))
678 IC_RIGHT (ic) = operandFromLit (1);
681 /* if addition then check if one of them is a zero */
682 /* if yes turn it into assignmnt */
683 if (IS_OP_LITERAL (IC_LEFT (ic)) &&
684 operandLitValue (IC_LEFT (ic)) == 0.0)
689 SET_ISADDR (IC_RESULT (ic), 0);
690 SET_ISADDR (IC_RIGHT (ic), 0);
693 if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
694 operandLitValue (IC_RIGHT (ic)) == 0.0)
698 IC_RIGHT (ic) = IC_LEFT (ic);
700 SET_ISADDR (IC_RIGHT (ic), 0);
701 SET_ISADDR (IC_RESULT (ic), 0);
706 /* if subtracting the the same thing then zero */
707 if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key)
710 IC_RIGHT (ic) = operandFromLit (0);
712 IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
713 IC_RESULT (ic)->isaddr = 0;
717 /* if subtraction then check if one of the operand */
718 /* is zero then depending on which operand change */
719 /* to assignment or unary minus */
720 if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
721 operandLitValue (IC_RIGHT (ic)) == 0.0)
723 /* right size zero change to assignment */
725 IC_RIGHT (ic) = IC_LEFT (ic);
727 SET_ISADDR (IC_RIGHT (ic), 0);
728 SET_ISADDR (IC_RESULT (ic), 0);
731 if (IS_OP_LITERAL (IC_LEFT (ic)) &&
732 operandLitValue (IC_LEFT (ic)) == 0.0)
734 /* left zero turn into an unary minus */
736 IC_LEFT (ic) = IC_RIGHT (ic);
737 IC_RIGHT (ic) = NULL;
741 /* if multiplication then check if either of */
742 /* them is zero then the result is zero */
743 /* if either of them is one then result is */
746 if (IS_OP_LITERAL (IC_LEFT (ic)))
749 if (operandLitValue (IC_LEFT (ic)) == 0.0)
752 IC_RIGHT (ic) = IC_LEFT (ic);
754 SET_RESULT_RIGHT (ic);
757 if (operandLitValue (IC_LEFT (ic)) == 1.0)
761 SET_RESULT_RIGHT (ic);
766 if (IS_OP_LITERAL (IC_RIGHT (ic)))
769 if (operandLitValue (IC_RIGHT (ic)) == 0.0)
773 SET_RESULT_RIGHT (ic);
777 if (operandLitValue (IC_RIGHT (ic)) == 1.0)
780 IC_RIGHT (ic) = IC_LEFT (ic);
782 SET_RESULT_RIGHT (ic);
788 /* if division by self then 1 */
789 if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key)
792 IC_RIGHT (ic) = operandFromLit (1);
794 IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
795 IC_RESULT (ic)->isaddr = 0;
797 /* if this is a division then check if right */
798 /* is one then change it to an assignment */
799 if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
800 operandLitValue (IC_RIGHT (ic)) == 1.0)
804 IC_RIGHT (ic) = IC_LEFT (ic);
806 SET_RESULT_RIGHT (ic);
810 /* if both are the same for an comparison operators */
814 if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
817 IC_RIGHT (ic) = operandFromLit (1);
819 SET_RESULT_RIGHT (ic);
825 if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
828 IC_RIGHT (ic) = operandFromLit (0);
830 SET_RESULT_RIGHT (ic);
835 sym_link *otype = operandType(IC_RIGHT(ic));
836 sym_link *ctype = operandType(IC_LEFT(ic));
837 /* if this is a cast of a literal value */
838 if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
839 !(IS_GENPTR(ctype) && (IS_PTR(otype) && !IS_GENPTR(otype)))) {
842 operandFromValue (valCastLiteral (operandType (IC_LEFT (ic)),
843 operandLitValue (IC_RIGHT (ic))));
845 SET_ISADDR (IC_RESULT (ic), 0);
847 /* if casting to the same */
848 if (compareType (operandType (IC_RESULT (ic)),
849 operandType (IC_RIGHT (ic))) == 1) {
852 SET_ISADDR (IC_RESULT (ic), 0);
857 if (IS_OP_LITERAL (IC_LEFT (ic)))
861 (operandLitValue (IC_LEFT (ic)) == 0 ?
862 operandFromLit (1) : operandFromLit (0));
864 SET_ISADDR (IC_RESULT (ic), 0);
870 #define OTHERS_PARM(s) (s->_isparm && !s->ismyparm)
871 /*-----------------------------------------------------------------*/
872 /* updateSpillLocation - keeps track of register spill location */
873 /*-----------------------------------------------------------------*/
875 updateSpillLocation (iCode * ic, int induction)
880 if (POINTER_SET (ic))
886 /* for the form true_symbol := iTempNN */
887 if (ASSIGN_ITEMP_TO_SYM (ic) &&
888 !SPIL_LOC (IC_RIGHT (ic))) {
890 setype = getSpec (operandType (IC_RESULT (ic)));
892 if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
893 !IS_VOLATILE (setype) &&
894 !IN_FARSPACE (SPEC_OCLS (setype)) &&
895 !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
897 SPIL_LOC (IC_RIGHT (ic)) =
898 IC_RESULT (ic)->operand.symOperand;
901 if (ASSIGN_ITEMP_TO_ITEMP (ic)) {
903 if (!SPIL_LOC (IC_RIGHT (ic)) &&
904 !bitVectBitsInCommon (OP_DEFS (IC_RIGHT (ic)), OP_USES (IC_RESULT (ic))) &&
905 OP_SYMBOL (IC_RESULT (ic))->isreqv) {
907 setype = getSpec (operandType (IC_RESULT (ic)));
909 if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
910 !IS_VOLATILE (setype) &&
911 !IN_FARSPACE (SPEC_OCLS (setype)) &&
912 !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
914 SPIL_LOC (IC_RIGHT (ic)) =
915 SPIL_LOC (IC_RESULT (ic));
917 /* special case for inductions */
919 OP_SYMBOL(IC_RIGHT(ic))->isreqv &&
920 !OP_SYMBOL(IC_RESULT (ic))->noSpilLoc &&
921 !SPIL_LOC(IC_RESULT(ic))) {
922 SPIL_LOC (IC_RESULT (ic)) = SPIL_LOC (IC_RIGHT (ic));
926 /*-----------------------------------------------------------------*/
927 /* setUsesDef - sets the uses def bitvector for a given operand */
928 /*-----------------------------------------------------------------*/
930 setUsesDefs (operand * op, bitVect * bdefs,
931 bitVect * idefs, bitVect ** oud)
933 /* compute the definitions alive at this point */
934 bitVect *adefs = bitVectUnion (bdefs, idefs);
936 /* of these definitions find the ones that are */
937 /* for this operand */
938 adefs = bitVectIntersect (adefs, OP_DEFS (op));
940 /* these are the definitions that this operand can use */
941 op->usesDefs = adefs;
943 /* the out defs is an union */
944 *oud = bitVectUnion (*oud, adefs);
947 /*-----------------------------------------------------------------*/
948 /* unsetDefsAndUses - clear this operation for the operands */
949 /*-----------------------------------------------------------------*/
951 unsetDefsAndUses (iCode * ic)
953 if (ic->op == JUMPTABLE)
956 /* take away this definition from the def chain of the */
957 /* result & take away from use set of the operands */
960 /* turn off def set */
961 if (IS_SYMOP (IC_RESULT (ic)))
963 if (!POINTER_SET (ic))
964 bitVectUnSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
966 bitVectUnSetBit (OP_USES (IC_RESULT (ic)), ic->key);
968 /* turn off the useSet for the operands */
969 if (IS_SYMOP (IC_LEFT (ic)))
970 bitVectUnSetBit (OP_USES (IC_LEFT (ic)), ic->key);
972 if (IS_SYMOP (IC_RIGHT (ic)))
973 bitVectUnSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
976 /* must be ifx turn off the use */ if (IS_SYMOP (IC_COND (ic)))
977 bitVectUnSetBit (OP_USES (IC_COND (ic)), ic->key);
980 /*-----------------------------------------------------------------*/
981 /* ifxOptimize - changes ifx conditions if it can */
982 /*-----------------------------------------------------------------*/
984 ifxOptimize (iCode * ic, set * cseSet,
986 eBBlock * ebb, int *change,
987 eBBlock ** ebbs, int count)
992 /* if the condition can be replaced */
996 applyToSetFTrue (cseSet, findCheaperOp, IC_COND (ic), &pdop);
1004 /* if the conditional is a literal then */
1005 if (IS_OP_LITERAL (IC_COND (ic)))
1008 if ((operandLitValue (IC_COND (ic)) != 0.0) && IC_TRUE (ic))
1011 /* change to a goto */
1013 IC_LABEL (ic) = IC_TRUE (ic);
1020 if (!operandLitValue (IC_COND (ic)) && IC_FALSE (ic))
1023 IC_LABEL (ic) = IC_FALSE (ic);
1029 /* then kill this if condition */
1030 remiCodeFromeBBlock (ebb, ic);
1034 /* now we need to recompute the control flow */
1035 /* since the control flow has changed */
1036 /* this is very expensive but it does not happen */
1037 /* too often, if it does happen then the user pays */
1039 computeControlFlow (ebbs, count, 1);
1040 if (!options.lessPedantic) {
1041 werror (W_CONTROL_FLOW, ic->filename, ic->lineno);
1046 /* if there is only one successor and that successor
1047 is the same one we are conditionally going to then
1048 we can remove this conditional statement */
1049 label = (IC_TRUE (ic) ? IC_TRUE (ic) : IC_FALSE (ic));
1050 if (elementsInSet (ebb->succList) == 1 &&
1051 isinSet (ebb->succList, eBBWithEntryLabel (ebbs, label, count)))
1054 remiCodeFromeBBlock (ebb, ic);
1055 computeControlFlow (ebbs, count, 1);
1056 if (!options.lessPedantic) {
1057 werror (W_CONTROL_FLOW, ic->filename, ic->lineno);
1063 /* if it remains an IFX the update the use Set */
1064 OP_USES (IC_COND (ic)) = bitVectSetBit (OP_USES (IC_COND (ic)), ic->key);
1065 setUsesDefs (IC_COND (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1069 /*-----------------------------------------------------------------*/
1070 /* diCodeForSym - finds the definiting instruction for a symbol */
1071 /*-----------------------------------------------------------------*/
1072 DEFSETFUNC (diCodeForSym)
1075 V_ARG (operand *, sym);
1076 V_ARG (iCode **, dic);
1078 /* if already found */
1082 /* if not if this is the defining iCode */
1083 if (sym->key == cdp->key)
1092 /*-----------------------------------------------------------------*/
1093 /* constFold - does some constant folding */
1094 /*-----------------------------------------------------------------*/
1096 constFold (iCode * ic, set * cseSet)
1100 /* this routine will change
1106 /* deal with only + & - */
1107 if (ic->op != '+' &&
1111 /* this check is a hueristic to prevent live ranges
1112 from becoming too long */
1113 if (IS_PTR (operandType (IC_RESULT (ic))))
1116 /* check if operation with a literal */
1117 if (!IS_OP_LITERAL (IC_RIGHT (ic)))
1120 /* check if we can find a definition for the
1122 if (!(applyToSet (cseSet, diCodeForSym, IC_LEFT (ic), &dic)))
1125 /* check that this is also a +/- */
1126 if (dic->op != '+' && dic->op != '-')
1129 /* with a literal */
1130 if (!IS_OP_LITERAL (IC_RIGHT (dic)))
1133 /* find the definition of the left operand
1134 of dic.then check if this defined with a
1135 get_pointer return 0 if the pointer size is
1136 less than 2 (MCS51 specific) */
1137 if (!(applyToSet (cseSet, diCodeForSym, IC_LEFT (dic), &ldic)))
1140 if (POINTER_GET (ldic) && getSize (operandType (IC_LEFT (ldic))) <= 1)
1143 /* it is if the operations are the same */
1144 /* the literal parts need to be added */
1145 IC_LEFT (ic) = operandFromOperand (IC_LEFT (dic));
1146 if (ic->op == dic->op)
1147 IC_RIGHT (ic) = operandFromLit (operandLitValue (IC_RIGHT (ic)) +
1148 operandLitValue (IC_RIGHT (dic)));
1150 IC_RIGHT (ic) = operandFromLit (operandLitValue (IC_RIGHT (ic)) -
1151 operandLitValue (IC_RIGHT (dic)));
1153 if (IS_ITEMP (IC_RESULT (ic)))
1155 SPIL_LOC (IC_RESULT (ic)) = NULL;
1156 OP_SYMBOL(IC_RESULT (ic))->noSpilLoc = 1;
1163 /*-----------------------------------------------------------------*/
1164 /* deleteGetPointers - called when a pointer is passed as parm */
1165 /* will delete from cseSet all get pointers computed from this */
1166 /* pointer. A simple ifOperandsHave is not good enough here */
1167 /*-----------------------------------------------------------------*/
1169 deleteGetPointers (set ** cseSet, set ** pss, operand * op, eBBlock * ebb)
1171 set *compItems = NULL;
1176 if (!*cseSet && !*pss)
1179 /* first find all items computed from this operand .
1180 This done fairly simply go thru the list and find
1181 those that are computed by arthimetic with this
1183 for (cdp = setFirstItem (*cseSet); cdp; cdp = setNextItem (*cseSet))
1185 if (IS_ARITHMETIC_OP (cdp->diCode))
1187 if (isOperandEqual (IC_LEFT (cdp->diCode), op) ||
1188 isOperandEqual (IC_RIGHT (cdp->diCode), op))
1190 /* save it in our list of items */
1191 addSet (&compItems, IC_RESULT (cdp->diCode));
1193 /* also check for those computed from our computed
1194 list . This will take care of situations like
1195 iTemp1 = iTemp0 + 8;
1196 iTemp2 = iTemp1 + 8; */
1197 if (isinSetWith (compItems, (void*)IC_LEFT (cdp->diCode),
1198 (insetwithFunc)isOperandEqual) ||
1199 isinSetWith (compItems, (void*)IC_RIGHT (cdp->diCode),
1200 (insetwithFunc)isOperandEqual))
1202 addSet (&compItems, IC_RESULT (cdp->diCode));
1207 /* now delete all pointer gets with this op */
1208 deleteItemIf (cseSet, ifPointerGet, op);
1209 deleteItemIf (pss, ifPointerSet, op);
1211 /* set the bit vector used by dataFlow computation later */
1212 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, op->key);
1213 /* now for the computed items */
1214 for (cop = setFirstItem (compItems); cop; cop = setNextItem (compItems))
1216 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, cop->key);
1217 deleteItemIf (cseSet, ifPointerGet, cop);
1218 deleteItemIf (pss, ifPointerSet, cop);
1222 /*-----------------------------------------------------------------*/
1223 /* delGetPointerSucc - delete get pointer from inExprs of succ with */
1224 /* dfnum > supplied */
1225 /*-----------------------------------------------------------------*/
1226 DEFSETFUNC (delGetPointerSucc)
1228 eBBlock *ebp = item;
1229 V_ARG (operand *, op);
1236 if (ebp->dfnum > dfnum)
1238 deleteItemIf (&ebp->inExprs, ifPointerGet, op);
1241 return applyToSet (ebp->succList, delGetPointerSucc, op, dfnum);
1244 /*-----------------------------------------------------------------*/
1245 /* fixUpTypes - KLUGE HACK fixup a lowering problem */
1246 /*-----------------------------------------------------------------*/
1248 fixUpTypes (iCode * ic)
1250 sym_link *t1 = operandType (IC_LEFT (ic)), *t2;
1252 /* if (TARGET_IS_DS390) */
1253 if (options.model == MODEL_FLAT24)
1259 /* for pointer_gets if the types of result & left r the
1260 same then change it type of result to next */
1262 compareType (t2 = operandType (IC_RESULT (ic)), t1) == 1)
1264 setOperandType (IC_RESULT (ic), t2->next);
1268 /*-----------------------------------------------------------------*/
1269 /* cseBBlock - common subexpression elimination for basic blocks */
1270 /* this is the hackiest kludgiest routine in the whole */
1271 /* system. also the most important, since almost all */
1272 /* data flow related information is computed by it */
1273 /*-----------------------------------------------------------------*/
1275 cseBBlock (eBBlock * ebb, int computeOnly,
1276 eBBlock ** ebbs, int count)
1282 set *ptrSetSet = NULL;
1284 /* if this block is not reachable */
1288 /* set of common subexpressions */
1289 cseSet = setFromSet (ebb->inExprs);
1291 /* these will be computed by this routine */
1292 setToNull ((void **) &ebb->outDefs);
1293 setToNull ((void **) &ebb->defSet);
1294 setToNull ((void **) &ebb->usesDefs);
1295 setToNull ((void **) &ebb->ptrsSet);
1296 setToNull ((void **) &ebb->addrOf);
1297 setToNull ((void **) &ebb->ldefs);
1299 ebb->outDefs = bitVectCopy (ebb->inDefs);
1300 bitVectDefault = iCodeKey;
1301 ebb->defSet = newBitVect (iCodeKey);
1302 ebb->usesDefs = newBitVect (iCodeKey);
1304 /* for all the instructions in this block do */
1305 for (ic = ebb->sch; ic; ic = ic->next)
1312 ic->eBBlockNum = ebb->bbnum;
1317 /* if this is an assignment from true symbol
1318 to a temp then do pointer post inc/dec optimzation */
1319 if (ic->op == '=' && !POINTER_SET (ic) &&
1320 IS_PTR (operandType (IC_RESULT (ic))))
1322 ptrPostIncDecOpt (ic);
1325 /* clear the def & use chains for the operands involved */
1326 /* in this operation . since it can change due to opts */
1327 unsetDefsAndUses (ic);
1329 if (ic->op == PCALL || ic->op == CALL || ic->op == RECEIVE)
1331 /* add to defSet of the symbol */
1332 OP_DEFS (IC_RESULT (ic)) =
1333 bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
1334 /* add to the definition set of this block */
1335 ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
1336 ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
1337 ebb->outDefs = bitVectCplAnd (ebb->outDefs, OP_DEFS (IC_RESULT (ic)));
1338 setUsesDefs (IC_RESULT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1339 /* delete global variables from the cseSet
1340 since they can be modified by the function call */
1341 deleteItemIf (&cseSet, ifDefGlobal);
1343 /* and also itemps assigned from globals */
1344 deleteItemIf (&cseSet, ifAssignedFromGlobal);
1346 /* delete all getpointer iCodes from cseSet, this should
1347 be done only for global arrays & pointers but at this
1348 point we don't know if globals, so to be safe do all */
1349 deleteItemIf (&cseSet, ifAnyGetPointer);
1352 /* for pcall & ipush we need to add to the useSet */
1353 if ((ic->op == PCALL ||
1357 IS_SYMOP (IC_LEFT (ic)))
1360 /* check if they can be replaced */
1364 applyToSetFTrue (cseSet, findCheaperOp, IC_LEFT (ic), &pdop);
1366 IC_LEFT (ic) = pdop;
1368 /* the lookup could have changed it */
1369 if (IS_SYMOP (IC_LEFT (ic)))
1371 OP_USES (IC_LEFT (ic)) =
1372 bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
1373 setUsesDefs (IC_LEFT (ic), ebb->defSet,
1374 ebb->outDefs, &ebb->usesDefs);
1378 /* if we a sending a pointer as a parameter
1379 then kill all cse since the pointed to item
1380 might be changed in the function being called */
1381 if ((ic->op == IPUSH || ic->op == SEND) &&
1382 IS_PTR (operandType (IC_LEFT (ic))))
1384 deleteGetPointers (&cseSet, &ptrSetSet, IC_LEFT (ic), ebb);
1385 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_LEFT (ic)->key);
1386 for (i = 0; i < count; ebbs[i++]->visited = 0);
1387 applyToSet (ebb->succList, delGetPointerSucc,
1388 IC_LEFT (ic), ebb->dfnum);
1393 /* if jumptable then mark the usage */
1394 if (ic->op == JUMPTABLE)
1396 OP_USES (IC_JTCOND (ic)) =
1397 bitVectSetBit (OP_USES (IC_JTCOND (ic)), ic->key);
1398 setUsesDefs (IC_JTCOND (ic), ebb->defSet,
1399 ebb->outDefs, &ebb->usesDefs);
1406 /* do some algebraic optimizations if possible */
1408 while (constFold (ic, cseSet));
1411 if (POINTER_GET (ic) && !IS_PTR (operandType (IC_LEFT (ic))))
1413 setOperandType (IC_LEFT (ic),
1414 aggrToPtr (operandType (IC_LEFT (ic)), FALSE));
1418 if (POINTER_SET (ic) && !IS_PTR (operandType (IC_RESULT (ic))))
1420 setOperandType (IC_RESULT (ic),
1421 aggrToPtr (operandType (IC_RESULT (ic)), FALSE));
1424 /* if this is a condition statment then */
1425 /* check if the condition can be replaced */
1428 ifxOptimize (ic, cseSet, computeOnly,
1434 /* if the assignment & result is a temp */
1435 /* see if we can replace it */
1439 /* update the spill location for this */
1440 updateSpillLocation (ic,0);
1442 if (POINTER_SET (ic) &&
1443 !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype)))
1446 applyToSetFTrue (cseSet, findCheaperOp, IC_RESULT (ic), &pdop);
1447 if (pdop && IS_ITEMP (pdop) && !computeOnly)
1448 IC_RESULT (ic) = pdop;
1452 /* do the operand lookup i.e. for both the */
1453 /* right & left operand : check the cseSet */
1454 /* to see if they have been replaced if yes */
1455 /* then replace them with those from cseSet */
1457 /* and left is a symbol */
1458 if (IS_SYMOP (IC_LEFT (ic)) &&
1459 !computeOnly && ic->op != ADDRESS_OF)
1463 applyToSetFTrue (cseSet, findCheaperOp, IC_LEFT (ic), &pdop);
1466 if (POINTER_GET (ic))
1468 if (IS_ITEMP (pdop) || IS_OP_LITERAL (pdop))
1470 IC_LEFT (ic) = pdop;
1473 /* check if there is a pointer set
1474 for the same pointer visible if yes
1475 then change this into an assignment */
1477 if (applyToSetFTrue (cseSet, findPointerSet, IC_LEFT (ic), &pdop, IC_RESULT (ic)) &&
1478 !bitVectBitValue (ebb->ptrsSet, pdop->key))
1481 IC_LEFT (ic) = NULL;
1482 IC_RIGHT (ic) = pdop;
1483 SET_ISADDR (IC_RESULT (ic), 0);
1489 IC_LEFT (ic) = pdop;
1496 if (IS_SYMOP (IC_RIGHT (ic)) && !computeOnly)
1500 applyToSetFTrue (cseSet, findCheaperOp, IC_RIGHT (ic), &pdop);
1503 IC_RIGHT (ic) = pdop;
1508 /* if left or right changed then do algebraic */
1512 while (constFold (ic, cseSet));
1515 /* if after all this it becomes a assignment to self
1516 then delete it and continue */
1517 if (ASSIGNMENT_TO_SELF (ic))
1519 remiCodeFromeBBlock (ebb, ic);
1523 /* now we will check to see if the entire */
1524 /* operation has been performed before */
1525 /* and is available */
1526 /* don't do assignments they will be killed */
1527 /* by dead code elimination if required do */
1528 /* it only if result is a temporary */
1530 if (!(POINTER_GET (ic) &&
1531 (IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype) ||
1532 isOperandVolatile (IC_LEFT (ic), TRUE) ||
1533 bitVectBitValue (ebb->ndompset, IC_LEFT (ic)->key))) &&
1535 IS_ITEMP (IC_RESULT (ic)) &&
1538 applyToSet (cseSet, findPrevIc, ic, &pdic);
1539 if (pdic && compareType (operandType (IC_RESULT (pdic)),
1540 operandType (IC_RESULT (ic))) != 1)
1542 if (pdic && port->cseOk && (*port->cseOk)(ic,pdic) == 0)
1546 /* Alternate code */
1547 if (pdic && IS_ITEMP(IC_RESULT(ic))) {
1548 /* if previous definition found change this to an assignment */
1551 IC_RIGHT(ic) = operandFromOperand(IC_RESULT(pdic));
1552 SET_ISADDR(IC_RESULT(ic),0);
1553 SET_ISADDR(IC_RIGHT (ic),0);
1556 if (!(POINTER_SET (ic)) && IC_RESULT (ic)) {
1557 deleteItemIf (&cseSet, ifDefSymIsX, IC_RESULT (ic));
1558 addSetHead (&cseSet, newCseDef (IC_RESULT (ic), ic));
1562 /* if assignment to a parameter which is not
1563 mine and type is a pointer then delete
1564 pointerGets to take care of aliasing */
1565 if (ASSIGNMENT (ic) &&
1566 OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))) &&
1567 IS_PTR (operandType (IC_RESULT (ic))))
1569 deleteGetPointers (&cseSet, &ptrSetSet, IC_RIGHT (ic), ebb);
1570 for (i = 0; i < count; ebbs[i++]->visited = 0);
1571 applyToSet (ebb->succList, delGetPointerSucc, IC_RIGHT (ic), ebb->dfnum);
1572 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_RIGHT (ic)->key);
1575 /* if this is a pointerget then see if we can replace
1576 this with a previously assigned pointer value */
1577 if (POINTER_GET (ic) &&
1578 !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype) ||
1579 isOperandVolatile (IC_LEFT (ic), TRUE)))
1582 applyToSet (ptrSetSet, findPointerSet, IC_LEFT (ic), &pdop, IC_RESULT (ic));
1583 /* if we find it then locally replace all
1584 references to the result with what we assigned */
1587 replaceAllSymBySym (ic->next, IC_RESULT (ic), pdop, &ebb->ndompset);
1591 /* delete from the cseSet anything that has */
1592 /* operands matching the result of this */
1593 /* except in case of pointer access */
1594 if (!(POINTER_SET (ic)) && IC_RESULT (ic))
1596 deleteItemIf (&cseSet, ifOperandsHave, IC_RESULT (ic));
1597 /* delete any previous definitions */
1598 ebb->defSet = bitVectCplAnd (ebb->defSet, OP_DEFS (IC_RESULT (ic)));
1602 /* add the left & right to the defUse set */
1603 if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)))
1605 OP_USES (IC_LEFT (ic)) =
1606 bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
1607 setUsesDefs (IC_LEFT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1611 if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)))
1613 OP_USES (IC_RIGHT (ic)) =
1614 bitVectSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
1615 setUsesDefs (IC_RIGHT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1619 /* for the result it is special case, put the result */
1620 /* in the defuseSet if it a pointer or array access */
1621 if (POINTER_SET (defic))
1623 OP_USES (IC_RESULT (ic)) =
1624 bitVectSetBit (OP_USES (IC_RESULT (ic)), ic->key);
1625 setUsesDefs (IC_RESULT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1626 deleteItemIf (&cseSet, ifPointerGet, IC_RESULT (ic));
1627 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_RESULT (ic)->key);
1628 /* delete from inexpressions of all successors which
1629 have dfNum > than this block */
1630 for (i = 0; i < count; ebbs[i++]->visited = 0);
1631 applyToSet (ebb->succList, delGetPointerSucc, IC_RESULT (ic), ebb->dfnum);
1633 /* delete from cseSet all other pointer sets
1635 deleteItemIf (&ptrSetSet, ifPointerSet, IC_RESULT (ic));
1636 /* add to the local pointerset set */
1637 addSetHead (&ptrSetSet, newCseDef (IC_RESULT (ic), ic));
1640 /* add the result to defintion set */ if (IC_RESULT (ic))
1642 OP_DEFS (IC_RESULT (ic)) =
1643 bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
1644 ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
1645 ebb->outDefs = bitVectCplAnd (ebb->outDefs, OP_DEFS (IC_RESULT (ic)));
1646 ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
1650 /* if this is an addressof instruction then */
1651 /* put the symbol in the address of list & */
1652 /* delete it from the cseSet */
1653 if (defic->op == ADDRESS_OF)
1655 addSetHead (&ebb->addrOf, IC_LEFT (ic));
1656 deleteItemIf (&cseSet, ifDefSymIsX, IC_LEFT (ic));
1660 setToNull ((void **) &ebb->outExprs);
1661 ebb->outExprs = cseSet;
1662 ebb->outDefs = bitVectUnion (ebb->outDefs, ebb->defSet);
1663 ebb->ptrsSet = bitVectUnion (ebb->ptrsSet, ebb->inPtrsSet);
1667 /*-----------------------------------------------------------------*/
1668 /* cseAllBlocks - will sequentially go thru & do cse for all blocks */
1669 /*-----------------------------------------------------------------*/
1671 cseAllBlocks (eBBlock ** ebbs, int count)
1676 /* if optimization turned off */
1678 for (i = 0; i < count; i++)
1679 change += cseBBlock (ebbs[i], FALSE, ebbs, count);