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_calloc (1, 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 ((!SPIL_LOC (IC_RIGHT (cdp->diCode)) &&
280 SPIL_LOC (IC_RESULT (cdp->diCode))) ||
281 (SPIL_LOC (IC_RESULT (cdp->diCode)) &&
282 SPIL_LOC (IC_RESULT (cdp->diCode)) ==
283 SPIL_LOC (IC_RIGHT (cdp->diCode)))))
284 *opp = IC_RESULT (cdp->diCode);
286 *opp = IC_RIGHT (cdp->diCode);
290 *opp = IC_RESULT (cdp->diCode);
293 /* if this is an assign to a temp. then check
294 if the right side is this then return this */
295 if (IS_TRUE_SYMOP (cop) &&
296 cdp->diCode->op == '=' &&
297 !POINTER_SET (cdp->diCode) &&
298 cop->key == IC_RIGHT (cdp->diCode)->key &&
299 !isGlobalInNearSpace (IC_RIGHT (cdp->diCode)) &&
300 IS_ITEMP (IC_RESULT (cdp->diCode)))
301 *opp = IC_RESULT (cdp->diCode);
304 (SPEC_USIGN(operandType (cop))==SPEC_USIGN(operandType (*opp))) &&
305 (SPEC_LONG(operandType (cop))==SPEC_LONG(operandType (*opp))))
308 if ((isGlobalInNearSpace (cop) &&
309 !isOperandLiteral (*opp)) ||
310 isOperandVolatile (*opp, FALSE)
317 if (cop->key == (*opp)->key)
323 if ((*opp)->isaddr != cop->isaddr && IS_ITEMP (cop))
325 *opp = operandFromOperand (*opp);
326 (*opp)->isaddr = cop->isaddr;
329 if ((*opp)->type==VALUE &&
330 IS_SYMOP(cop) && IS_GENPTR(OP_SYMBOL(cop)->type)) {
331 // This is a value assigned to a gpointer
333 // this value is used for a cast, so we can not
346 /*-----------------------------------------------------------------*/
347 /* findPointerSet - finds the right side of a pointer set op */
348 /*-----------------------------------------------------------------*/
349 DEFSETFUNC (findPointerSet)
352 V_ARG (operand *, op);
353 V_ARG (operand **, opp);
354 V_ARG (operand *, rop);
356 if (POINTER_SET (cdp->diCode) &&
357 IC_RESULT (cdp->diCode)->key == op->key &&
358 !isOperandVolatile (IC_RESULT (cdp->diCode), TRUE) &&
359 !isOperandVolatile (IC_RIGHT (cdp->diCode), TRUE) &&
360 getSize (operandType (IC_RIGHT (cdp->diCode))) ==
361 getSize (operandType (rop)))
363 *opp = IC_RIGHT (cdp->diCode);
370 /*-----------------------------------------------------------------*/
371 /* findPrevIc - cseBBlock support function will return the iCode */
372 /* which matches the current one */
373 /*-----------------------------------------------------------------*/
374 DEFSETFUNC (findPrevIc)
378 V_ARG (iCode **, icp);
380 /* if already found */
384 /* if the iCodes are the same */
385 if (isiCodeEqual (ic, cdp->diCode) &&
386 isOperandEqual (cdp->sym, IC_RESULT (cdp->diCode)))
392 /* if iCodes are not the same */
393 /* see the operands maybe interchanged */
394 if (ic->op == cdp->diCode->op &&
395 (ic->op == '+' || ic->op == '*') &&
396 isOperandEqual (IC_LEFT (ic), IC_RIGHT (cdp->diCode)) &&
397 isOperandEqual (IC_RIGHT (ic), IC_LEFT (cdp->diCode)))
406 /*-----------------------------------------------------------------*/
407 /* ifDefGlobal - if definition is global */
408 /*-----------------------------------------------------------------*/
409 DEFSETFUNC (ifDefGlobal)
413 return (isOperandGlobal (cdp->sym));
416 /*-----------------------------------------------------------------*/
417 /* ifAnyGetPointer - if get pointer icode */
418 /*-----------------------------------------------------------------*/
419 DEFSETFUNC (ifAnyGetPointer)
423 if (cdp->diCode && POINTER_GET (cdp->diCode))
428 /*-----------------------------------------------------------------*/
429 /* ifOperandsHave - if any of the operand are the same as this */
430 /*-----------------------------------------------------------------*/
431 DEFSETFUNC (ifOperandsHave)
434 V_ARG (operand *, op);
437 if (IC_LEFT (cdp->diCode) &&
438 IS_SYMOP (IC_LEFT (cdp->diCode)) &&
439 IC_LEFT (cdp->diCode)->key == op->key)
442 if (IC_RIGHT (cdp->diCode) &&
443 IS_SYMOP (IC_RIGHT (cdp->diCode)) &&
444 IC_RIGHT (cdp->diCode)->key == op->key)
447 /* or if any of the operands are volatile */
448 if (IC_LEFT (cdp->diCode) &&
449 IS_OP_VOLATILE (IC_LEFT (cdp->diCode)))
452 if (IC_RIGHT (cdp->diCode) &&
453 IS_OP_VOLATILE (IC_RIGHT (cdp->diCode)))
457 if (IC_RESULT (cdp->diCode) &&
458 IS_OP_VOLATILE (IC_RESULT (cdp->diCode)))
464 /*-----------------------------------------------------------------*/
465 /* ifDefSymIs - if a definition is found in the set */
466 /*-----------------------------------------------------------------*/
468 ifDefSymIs (set * cseSet, operand * sym)
473 if (!sym || !IS_SYMOP (sym))
475 for (sl = cseSet; sl; sl = sl->next)
478 if (loop->sym->key == sym->key)
485 /*-----------------------------------------------------------------*/
486 /* ifDefSymIsX - will return 1 if the symbols match */
487 /*-----------------------------------------------------------------*/
488 DEFSETFUNC (ifDefSymIsX)
491 V_ARG (operand *, op);
494 return cdp->sym->key == op->key;
496 return (isOperandEqual (cdp->sym, op));
501 /*-----------------------------------------------------------------*/
502 /* ifDiCodeIs - returns truw if diCode is same */
503 /*-----------------------------------------------------------------*/
505 ifDiCodeIs (set * cseSet, iCode * ic)
513 for (sl = cseSet; sl; sl = sl->next)
516 if (loop->diCode == ic)
523 /*-----------------------------------------------------------------*/
524 /* ifPointerGet - returns true if the icode is pointer get sym */
525 /*-----------------------------------------------------------------*/
526 DEFSETFUNC (ifPointerGet)
529 V_ARG (operand *, op);
530 iCode *dic = cdp->diCode;
531 operand *left = IC_LEFT (cdp->diCode);
533 if (POINTER_GET (dic) && left->key == op->key)
539 /*-----------------------------------------------------------------*/
540 /* ifPointerSet - returns true if the icode is pointer set sym */
541 /*-----------------------------------------------------------------*/
542 DEFSETFUNC (ifPointerSet)
545 V_ARG (operand *, op);
547 if (POINTER_SET (cdp->diCode) &&
548 IC_RESULT (cdp->diCode)->key == op->key)
554 /*-----------------------------------------------------------------*/
555 /* ifDiCodeIsX - will return 1 if the symbols match */
556 /*-----------------------------------------------------------------*/
557 DEFSETFUNC (ifDiCodeIsX)
562 return cdp->diCode == ic;
566 /*-----------------------------------------------------------------*/
567 /* algebraicOpts - does some algebraic optimizations */
568 /*-----------------------------------------------------------------*/
570 algebraicOpts (iCode * ic)
572 /* we don't deal with the following iCodes
583 /* if both operands present & ! IFX */
584 /* then if they are both literal we */
585 /* perform the operation right now */
586 if (IC_RESULT (ic) &&
589 IS_OP_LITERAL (IC_LEFT (ic)) &&
590 IS_OP_LITERAL (IC_RIGHT (ic)))
593 IC_RIGHT (ic) = operandOperation (IC_LEFT (ic),
596 operandType (IC_RESULT (ic)));
599 SET_RESULT_RIGHT (ic);
603 /* if not ifx & only one operand present */
604 if (IC_RESULT (ic) &&
606 IS_OP_LITERAL (IC_LEFT (ic)) &&
610 IC_RIGHT (ic) = operandOperation (IC_LEFT (ic),
613 operandType (IC_RESULT (ic)));
616 SET_RESULT_RIGHT (ic);
621 /* a special case : or in short a kludgy solution will think
622 about a better solution over a glass of wine someday */
623 if (ic->op == GET_VALUE_AT_ADDRESS)
626 if (IS_ITEMP (IC_RESULT (ic)) &&
627 IS_TRUE_SYMOP (IC_LEFT (ic)))
631 IC_RIGHT (ic) = operandFromOperand (IC_LEFT (ic));
632 IC_RIGHT (ic)->isaddr = 0;
634 IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
635 IC_RESULT (ic)->isaddr = 0;
636 setOperandType (IC_RESULT (ic), operandType (IC_RIGHT (ic)));
640 if (IS_ITEMP (IC_LEFT (ic)) &&
641 IS_ITEMP (IC_RESULT (ic)) &&
642 /* !OP_SYMBOL(IC_RESULT(ic))->isreqv && */
643 /* !OP_SYMBOL(IC_LEFT(ic))->isreqv && */
644 !IC_LEFT (ic)->isaddr)
647 IC_RIGHT (ic) = operandFromOperand (IC_LEFT (ic));
648 IC_RIGHT (ic)->isaddr = 0;
649 IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
650 IC_RESULT (ic)->isaddr = 0;
658 /* depending on the operation */
662 /* if adding the same thing change to left shift by 1 */
663 if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key &&
664 !IS_FLOAT (operandType (IC_RESULT (ic))))
667 IC_RIGHT (ic) = operandFromLit (1);
670 /* if addition then check if one of them is a zero */
671 /* if yes turn it into assignmnt */
672 if (IS_OP_LITERAL (IC_LEFT (ic)) &&
673 operandLitValue (IC_LEFT (ic)) == 0.0)
678 SET_ISADDR (IC_RESULT (ic), 0);
679 SET_ISADDR (IC_RIGHT (ic), 0);
682 if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
683 operandLitValue (IC_RIGHT (ic)) == 0.0)
687 IC_RIGHT (ic) = IC_LEFT (ic);
689 SET_ISADDR (IC_RIGHT (ic), 0);
690 SET_ISADDR (IC_RESULT (ic), 0);
695 /* if subtracting the the same thing then zero */
696 if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key)
699 IC_RIGHT (ic) = operandFromLit (0);
701 IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
702 IC_RESULT (ic)->isaddr = 0;
706 /* if subtraction then check if one of the operand */
707 /* is zero then depending on which operand change */
708 /* to assignment or unary minus */
709 if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
710 operandLitValue (IC_RIGHT (ic)) == 0.0)
712 /* right size zero change to assignment */
714 IC_RIGHT (ic) = IC_LEFT (ic);
716 SET_ISADDR (IC_RIGHT (ic), 0);
717 SET_ISADDR (IC_RESULT (ic), 0);
720 if (IS_OP_LITERAL (IC_LEFT (ic)) &&
721 operandLitValue (IC_LEFT (ic)) == 0.0)
723 /* left zero turn into an unary minus */
725 IC_LEFT (ic) = IC_RIGHT (ic);
726 IC_RIGHT (ic) = NULL;
730 /* if multiplication then check if either of */
731 /* them is zero then the result is zero */
732 /* if either of them is one then result is */
735 if (IS_OP_LITERAL (IC_LEFT (ic)))
738 if (operandLitValue (IC_LEFT (ic)) == 0.0)
741 IC_RIGHT (ic) = IC_LEFT (ic);
743 SET_RESULT_RIGHT (ic);
746 if (operandLitValue (IC_LEFT (ic)) == 1.0)
750 SET_RESULT_RIGHT (ic);
755 if (IS_OP_LITERAL (IC_RIGHT (ic)))
758 if (operandLitValue (IC_RIGHT (ic)) == 0.0)
762 SET_RESULT_RIGHT (ic);
766 if (operandLitValue (IC_RIGHT (ic)) == 1.0)
769 IC_RIGHT (ic) = IC_LEFT (ic);
771 SET_RESULT_RIGHT (ic);
777 /* if division by self then 1 */
778 if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key)
781 IC_RIGHT (ic) = operandFromLit (1);
783 IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
784 IC_RESULT (ic)->isaddr = 0;
786 /* if this is a division then check if right */
787 /* is one then change it to an assignment */
788 if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
789 operandLitValue (IC_RIGHT (ic)) == 1.0)
793 IC_RIGHT (ic) = IC_LEFT (ic);
795 SET_RESULT_RIGHT (ic);
799 /* if both are the same for an comparison operators */
803 if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
806 IC_RIGHT (ic) = operandFromLit (1);
808 SET_RESULT_RIGHT (ic);
814 if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
817 IC_RIGHT (ic) = operandFromLit (0);
819 SET_RESULT_RIGHT (ic);
823 /* if this is a cast of a literal value */
824 if (IS_OP_LITERAL (IC_RIGHT (ic)))
828 operandFromValue (valCastLiteral (operandType (IC_LEFT (ic)),
829 operandLitValue (IC_RIGHT (ic))));
831 SET_ISADDR (IC_RESULT (ic), 0);
833 /* if casting to the same */
834 if (compareType (operandType (IC_RESULT (ic)),
835 operandType (IC_RIGHT (ic))) == 1)
839 SET_ISADDR (IC_RESULT (ic), 0);
843 if (IS_OP_LITERAL (IC_LEFT (ic)))
847 (operandLitValue (IC_LEFT (ic)) == 0 ?
848 operandFromLit (1) : operandFromLit (0));
850 SET_ISADDR (IC_RESULT (ic), 0);
856 #define OTHERS_PARM(s) (s->_isparm && !s->ismyparm)
857 /*-----------------------------------------------------------------*/
858 /* updateSpillLocation - keeps track of register spill location */
859 /*-----------------------------------------------------------------*/
861 updateSpillLocation (iCode * ic, int induction)
866 if (POINTER_SET (ic))
872 /* for the form true_symbol := iTempNN */
873 if (ASSIGN_ITEMP_TO_SYM (ic) &&
874 !SPIL_LOC (IC_RIGHT (ic))) {
876 setype = getSpec (operandType (IC_RESULT (ic)));
878 if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
879 !IS_VOLATILE (setype) &&
880 !IN_FARSPACE (SPEC_OCLS (setype)) &&
881 !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
883 SPIL_LOC (IC_RIGHT (ic)) =
884 IC_RESULT (ic)->operand.symOperand;
887 if (ASSIGN_ITEMP_TO_ITEMP (ic)) {
889 if (!SPIL_LOC (IC_RIGHT (ic)) &&
890 !bitVectBitsInCommon (OP_DEFS (IC_RIGHT (ic)), OP_USES (IC_RESULT (ic))) &&
891 OP_SYMBOL (IC_RESULT (ic))->isreqv) {
893 setype = getSpec (operandType (IC_RESULT (ic)));
895 if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
896 !IS_VOLATILE (setype) &&
897 !IN_FARSPACE (SPEC_OCLS (setype)) &&
898 !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
900 SPIL_LOC (IC_RIGHT (ic)) =
901 SPIL_LOC (IC_RESULT (ic));
903 /* special case for inductions */
905 OP_SYMBOL(IC_RIGHT(ic))->isreqv &&
906 !OP_SYMBOL(IC_RESULT (ic))->noSpilLoc &&
907 !SPIL_LOC(IC_RESULT(ic))) {
908 SPIL_LOC (IC_RESULT (ic)) = SPIL_LOC (IC_RIGHT (ic));
912 /*-----------------------------------------------------------------*/
913 /* setUsesDef - sets the uses def bitvector for a given operand */
914 /*-----------------------------------------------------------------*/
916 setUsesDefs (operand * op, bitVect * bdefs,
917 bitVect * idefs, bitVect ** oud)
919 /* compute the definitions alive at this point */
920 bitVect *adefs = bitVectUnion (bdefs, idefs);
922 /* of these definitions find the ones that are */
923 /* for this operand */
924 adefs = bitVectIntersect (adefs, OP_DEFS (op));
926 /* these are the definitions that this operand can use */
927 op->usesDefs = adefs;
929 /* the out defs is an union */
930 *oud = bitVectUnion (*oud, adefs);
933 /*-----------------------------------------------------------------*/
934 /* unsetDefsAndUses - clear this operation for the operands */
935 /*-----------------------------------------------------------------*/
937 unsetDefsAndUses (iCode * ic)
939 if (ic->op == JUMPTABLE)
942 /* take away this definition from the def chain of the */
943 /* result & take away from use set of the operands */
946 /* turn off def set */
947 if (IS_SYMOP (IC_RESULT (ic)))
949 if (!POINTER_SET (ic))
950 bitVectUnSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
952 bitVectUnSetBit (OP_USES (IC_RESULT (ic)), ic->key);
954 /* turn off the useSet for the operands */
955 if (IS_SYMOP (IC_LEFT (ic)))
956 bitVectUnSetBit (OP_USES (IC_LEFT (ic)), ic->key);
958 if (IS_SYMOP (IC_RIGHT (ic)))
959 bitVectUnSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
962 /* must be ifx turn off the use */ if (IS_SYMOP (IC_COND (ic)))
963 bitVectUnSetBit (OP_USES (IC_COND (ic)), ic->key);
966 /*-----------------------------------------------------------------*/
967 /* ifxOptimize - changes ifx conditions if it can */
968 /*-----------------------------------------------------------------*/
970 ifxOptimize (iCode * ic, set * cseSet,
972 eBBlock * ebb, int *change,
973 eBBlock ** ebbs, int count)
978 /* if the condition can be replaced */
982 applyToSetFTrue (cseSet, findCheaperOp, IC_COND (ic), &pdop);
990 /* if the conditional is a literal then */
991 if (IS_OP_LITERAL (IC_COND (ic)))
994 if ((operandLitValue (IC_COND (ic)) != 0.0) && IC_TRUE (ic))
997 /* change to a goto */
999 IC_LABEL (ic) = IC_TRUE (ic);
1006 if (!operandLitValue (IC_COND (ic)) && IC_FALSE (ic))
1009 IC_LABEL (ic) = IC_FALSE (ic);
1015 /* then kill this if condition */
1016 remiCodeFromeBBlock (ebb, ic);
1020 /* now we need to recompute the control flow */
1021 /* since the control flow has changed */
1022 /* this is very expensive but it does not happen */
1023 /* too often, if it does happen then the user pays */
1025 computeControlFlow (ebbs, count, 1);
1026 werror (W_CONTROL_FLOW, ic->filename, ic->lineno);
1030 /* if there is only one successor and that successor
1031 is the same one we are conditionally going to then
1032 we can remove this conditional statement */
1033 label = (IC_TRUE (ic) ? IC_TRUE (ic) : IC_FALSE (ic));
1034 if (elementsInSet (ebb->succList) == 1 &&
1035 isinSet (ebb->succList, eBBWithEntryLabel (ebbs, label, count)))
1038 remiCodeFromeBBlock (ebb, ic);
1039 computeControlFlow (ebbs, count, 1);
1040 werror (W_CONTROL_FLOW, ic->filename, ic->lineno);
1045 /* if it remains an IFX the update the use Set */
1046 OP_USES (IC_COND (ic)) = bitVectSetBit (OP_USES (IC_COND (ic)), ic->key);
1047 setUsesDefs (IC_COND (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1051 /*-----------------------------------------------------------------*/
1052 /* diCodeForSym - finds the definiting instruction for a symbol */
1053 /*-----------------------------------------------------------------*/
1054 DEFSETFUNC (diCodeForSym)
1057 V_ARG (operand *, sym);
1058 V_ARG (iCode **, dic);
1060 /* if already found */
1064 /* if not if this is the defining iCode */
1065 if (sym->key == cdp->key)
1074 /*-----------------------------------------------------------------*/
1075 /* constFold - does some constant folding */
1076 /*-----------------------------------------------------------------*/
1078 constFold (iCode * ic, set * cseSet)
1082 /* this routine will change
1088 /* deal with only + & - */
1089 if (ic->op != '+' &&
1093 /* this check is a hueristic to prevent live ranges
1094 from becoming too long */
1095 if (IS_PTR (operandType (IC_RESULT (ic))))
1098 /* check if operation with a literal */
1099 if (!IS_OP_LITERAL (IC_RIGHT (ic)))
1102 /* check if we can find a definition for the
1104 if (!(applyToSet (cseSet, diCodeForSym, IC_LEFT (ic), &dic)))
1107 /* check that this is also a +/- */
1108 if (dic->op != '+' && dic->op != '-')
1111 /* with a literal */
1112 if (!IS_OP_LITERAL (IC_RIGHT (dic)))
1115 /* find the definition of the left operand
1116 of dic.then check if this defined with a
1117 get_pointer return 0 if the pointer size is
1118 less than 2 (MCS51 specific) */
1119 if (!(applyToSet (cseSet, diCodeForSym, IC_LEFT (dic), &ldic)))
1122 if (POINTER_GET (ldic) && getSize (operandType (IC_LEFT (ldic))) <= 1)
1125 /* it is if the operations are the same */
1126 /* the literal parts need to be added */
1127 IC_LEFT (ic) = operandFromOperand (IC_LEFT (dic));
1128 if (ic->op == dic->op)
1129 IC_RIGHT (ic) = operandFromLit (operandLitValue (IC_RIGHT (ic)) +
1130 operandLitValue (IC_RIGHT (dic)));
1132 IC_RIGHT (ic) = operandFromLit (operandLitValue (IC_RIGHT (ic)) -
1133 operandLitValue (IC_RIGHT (dic)));
1135 if (IS_ITEMP (IC_RESULT (ic)))
1137 SPIL_LOC (IC_RESULT (ic)) = NULL;
1138 OP_SYMBOL(IC_RESULT (ic))->noSpilLoc = 1;
1145 /*-----------------------------------------------------------------*/
1146 /* deleteGetPointers - called when a pointer is passed as parm */
1147 /* will delete from cseSet all get pointers computed from this */
1148 /* pointer. A simple ifOperandsHave is not good enough here */
1149 /*-----------------------------------------------------------------*/
1151 deleteGetPointers (set ** cseSet, set ** pss, operand * op, eBBlock * ebb)
1153 set *compItems = NULL;
1158 if (!*cseSet && !*pss)
1161 /* first find all items computed from this operand .
1162 This done fairly simply go thru the list and find
1163 those that are computed by arthimetic with this
1165 for (cdp = setFirstItem (*cseSet); cdp; cdp = setNextItem (*cseSet))
1167 if (IS_ARITHMETIC_OP (cdp->diCode))
1169 if (isOperandEqual (IC_LEFT (cdp->diCode), op) ||
1170 isOperandEqual (IC_RIGHT (cdp->diCode), op))
1172 /* save it in our list of items */
1173 addSet (&compItems, IC_RESULT (cdp->diCode));
1175 /* also check for those computed from our computed
1176 list . This will take care of situations like
1177 iTemp1 = iTemp0 + 8;
1178 iTemp2 = iTemp1 + 8; */
1179 if (isinSetWith (compItems, (void*)IC_LEFT (cdp->diCode),
1180 (insetwithFunc)isOperandEqual) ||
1181 isinSetWith (compItems, (void*)IC_RIGHT (cdp->diCode),
1182 (insetwithFunc)isOperandEqual))
1184 addSet (&compItems, IC_RESULT (cdp->diCode));
1189 /* now delete all pointer gets with this op */
1190 deleteItemIf (cseSet, ifPointerGet, op);
1191 deleteItemIf (pss, ifPointerSet, op);
1193 /* set the bit vector used by dataFlow computation later */
1194 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, op->key);
1195 /* now for the computed items */
1196 for (cop = setFirstItem (compItems); cop; cop = setNextItem (compItems))
1198 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, cop->key);
1199 deleteItemIf (cseSet, ifPointerGet, cop);
1200 deleteItemIf (pss, ifPointerSet, cop);
1204 /*-----------------------------------------------------------------*/
1205 /* delGetPointerSucc - delete get pointer from inExprs of succ with */
1206 /* dfnum > supplied */
1207 /*-----------------------------------------------------------------*/
1208 DEFSETFUNC (delGetPointerSucc)
1210 eBBlock *ebp = item;
1211 V_ARG (operand *, op);
1218 if (ebp->dfnum > dfnum)
1220 deleteItemIf (&ebp->inExprs, ifPointerGet, op);
1223 return applyToSet (ebp->succList, delGetPointerSucc, op, dfnum);
1226 /*-----------------------------------------------------------------*/
1227 /* fixUpTypes - KLUGE HACK fixup a lowering problem */
1228 /*-----------------------------------------------------------------*/
1230 fixUpTypes (iCode * ic)
1232 sym_link *t1 = operandType (IC_LEFT (ic)), *t2;
1234 /* if (TARGET_IS_DS390) */
1235 if (options.model == MODEL_FLAT24)
1241 /* for pointer_gets if the types of result & left r the
1242 same then change it type of result to next */
1244 compareType (t2 = operandType (IC_RESULT (ic)), t1) == 1)
1246 setOperandType (IC_RESULT (ic), t2->next);
1250 /*-----------------------------------------------------------------*/
1251 /* cseBBlock - common subexpression elimination for basic blocks */
1252 /* this is the hackiest kludgiest routine in the whole */
1253 /* system. also the most important, since almost all */
1254 /* data flow related information is computed by it */
1255 /*-----------------------------------------------------------------*/
1257 cseBBlock (eBBlock * ebb, int computeOnly,
1258 eBBlock ** ebbs, int count)
1264 set *ptrSetSet = NULL;
1266 /* if this block is not reachable */
1270 /* set of common subexpressions */
1271 cseSet = setFromSet (ebb->inExprs);
1273 /* these will be computed by this routine */
1274 setToNull ((void **) &ebb->outDefs);
1275 setToNull ((void **) &ebb->defSet);
1276 setToNull ((void **) &ebb->usesDefs);
1277 setToNull ((void **) &ebb->ptrsSet);
1278 setToNull ((void **) &ebb->addrOf);
1279 setToNull ((void **) &ebb->ldefs);
1281 ebb->outDefs = bitVectCopy (ebb->inDefs);
1282 bitVectDefault = iCodeKey;
1283 ebb->defSet = newBitVect (iCodeKey);
1284 ebb->usesDefs = newBitVect (iCodeKey);
1286 /* for all the instructions in this block do */
1287 for (ic = ebb->sch; ic; ic = ic->next)
1297 /* if this is an assignment from true symbol
1298 to a temp then do pointer post inc/dec optimzation */
1299 if (ic->op == '=' && !POINTER_SET (ic) &&
1300 IS_PTR (operandType (IC_RESULT (ic))))
1302 ptrPostIncDecOpt (ic);
1305 /* clear the def & use chains for the operands involved */
1306 /* in this operation . since it can change due to opts */
1307 unsetDefsAndUses (ic);
1309 if (ic->op == PCALL || ic->op == CALL || ic->op == RECEIVE)
1311 /* add to defSet of the symbol */
1312 OP_DEFS (IC_RESULT (ic)) =
1313 bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
1314 /* add to the definition set of this block */
1315 ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
1316 ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
1317 ebb->outDefs = bitVectCplAnd (ebb->outDefs, OP_DEFS (IC_RESULT (ic)));
1318 setUsesDefs (IC_RESULT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1319 /* delete global variables from the cseSet
1320 since they can be modified by the function call */
1321 deleteItemIf (&cseSet, ifDefGlobal);
1322 /* delete all getpointer iCodes from cseSet, this should
1323 be done only for global arrays & pointers but at this
1324 point we don't know if globals, so to be safe do all */
1325 deleteItemIf (&cseSet, ifAnyGetPointer);
1328 /* for pcall & ipush we need to add to the useSet */
1329 if ((ic->op == PCALL ||
1333 IS_SYMOP (IC_LEFT (ic)))
1336 /* check if they can be replaced */
1340 applyToSetFTrue (cseSet, findCheaperOp, IC_LEFT (ic), &pdop);
1342 IC_LEFT (ic) = pdop;
1344 /* the lookup could have changed it */
1345 if (IS_SYMOP (IC_LEFT (ic)))
1347 OP_USES (IC_LEFT (ic)) =
1348 bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
1349 setUsesDefs (IC_LEFT (ic), ebb->defSet,
1350 ebb->outDefs, &ebb->usesDefs);
1354 /* if we a sending a pointer as a parameter
1355 then kill all cse since the pointed to item
1356 might be changed in the function being called */
1357 if ((ic->op == IPUSH || ic->op == SEND) &&
1358 IS_PTR (operandType (IC_LEFT (ic))))
1360 deleteGetPointers (&cseSet, &ptrSetSet, IC_LEFT (ic), ebb);
1361 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_LEFT (ic)->key);
1362 for (i = 0; i < count; ebbs[i++]->visited = 0);
1363 applyToSet (ebb->succList, delGetPointerSucc,
1364 IC_LEFT (ic), ebb->dfnum);
1369 /* if jumptable then mark the usage */
1370 if (ic->op == JUMPTABLE)
1372 OP_USES (IC_JTCOND (ic)) =
1373 bitVectSetBit (OP_USES (IC_JTCOND (ic)), ic->key);
1374 setUsesDefs (IC_JTCOND (ic), ebb->defSet,
1375 ebb->outDefs, &ebb->usesDefs);
1382 /* do some algebraic optimizations if possible */
1384 while (constFold (ic, cseSet));
1387 if (POINTER_GET (ic) && !IS_PTR (operandType (IC_LEFT (ic))))
1389 setOperandType (IC_LEFT (ic),
1390 aggrToPtr (operandType (IC_LEFT (ic)), FALSE));
1394 if (POINTER_SET (ic) && !IS_PTR (operandType (IC_RESULT (ic))))
1396 setOperandType (IC_RESULT (ic),
1397 aggrToPtr (operandType (IC_RESULT (ic)), FALSE));
1400 /* if this is a condition statment then */
1401 /* check if the condition can be replaced */
1404 ifxOptimize (ic, cseSet, computeOnly,
1410 /* if the assignment & result is a temp */
1411 /* see if we can replace it */
1415 /* update the spill location for this */
1416 updateSpillLocation (ic,0);
1418 if (POINTER_SET (ic) &&
1419 !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype)))
1422 applyToSetFTrue (cseSet, findCheaperOp, IC_RESULT (ic), &pdop);
1423 if (pdop && IS_ITEMP (pdop) && !computeOnly)
1424 IC_RESULT (ic) = pdop;
1428 /* do the operand lookup i.e. for both the */
1429 /* right & left operand : check the cseSet */
1430 /* to see if they have been replaced if yes */
1431 /* then replace them with those from cseSet */
1433 /* and left is a symbol */
1434 if (IS_SYMOP (IC_LEFT (ic)) &&
1435 !computeOnly && ic->op != ADDRESS_OF)
1439 applyToSetFTrue (cseSet, findCheaperOp, IC_LEFT (ic), &pdop);
1442 if (POINTER_GET (ic))
1444 if (IS_ITEMP (pdop) || IS_OP_LITERAL (pdop))
1446 IC_LEFT (ic) = pdop;
1449 /* check if there is a pointer set
1450 for the same pointer visible if yes
1451 then change this into an assignment */
1453 if (applyToSetFTrue (cseSet, findPointerSet, IC_LEFT (ic), &pdop, IC_RESULT (ic)) &&
1454 !bitVectBitValue (ebb->ptrsSet, pdop->key))
1457 IC_LEFT (ic) = NULL;
1458 IC_RIGHT (ic) = pdop;
1459 SET_ISADDR (IC_RESULT (ic), 0);
1465 IC_LEFT (ic) = pdop;
1472 if (IS_SYMOP (IC_RIGHT (ic)) && !computeOnly)
1476 applyToSetFTrue (cseSet, findCheaperOp, IC_RIGHT (ic), &pdop);
1480 IC_RIGHT (ic) = pdop;
1485 /* if left or right changed then do algebraic */
1489 while (constFold (ic, cseSet));
1492 /* if after all this it becomes a assignment to self
1493 then delete it and continue */
1494 if (ASSIGNMENT_TO_SELF (ic))
1496 remiCodeFromeBBlock (ebb, ic);
1500 /* now we will check to see if the entire */
1501 /* operation has been performed before */
1502 /* and is available */
1503 /* don't do assignments they will be killed */
1504 /* by dead code elimination if required do */
1505 /* it only if result is a temporary */
1507 if (!(POINTER_GET (ic) &&
1508 (IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype) ||
1509 isOperandVolatile (IC_LEFT (ic), TRUE) ||
1510 bitVectBitValue (ebb->ndompset, IC_LEFT (ic)->key))) &&
1512 IS_ITEMP (IC_RESULT (ic)) &&
1515 applyToSet (cseSet, findPrevIc, ic, &pdic);
1516 if (pdic && compareType (operandType (IC_RESULT (pdic)),
1517 operandType (IC_RESULT (ic))) != 1)
1521 /* if found then eliminate this and add to */
1522 /* to cseSet an element containing result */
1523 /* of this with previous opcode */
1527 if (IS_ITEMP (IC_RESULT (ic)))
1530 /* replace in the remaining of this block */
1531 replaceAllSymBySym (ic->next, IC_RESULT (ic), IC_RESULT (pdic), &ebb->ndompset);
1532 /* remove this iCode from inexpressions of all
1533 its successors, it cannot be in the in expressions
1534 of any of the predecessors */
1535 for (i = 0; i < count; ebbs[i++]->visited = 0);
1536 applyToSet (ebb->succList, removeFromInExprs, ic, IC_RESULT (ic),
1537 IC_RESULT (pdic), ebb);
1539 /* if this was moved from another block */
1540 /* then replace in those blocks too */
1544 for (owner = setFirstItem (ic->movedFrom); owner;
1545 owner = setNextItem (ic->movedFrom))
1546 replaceAllSymBySym (owner->sch, IC_RESULT (ic), IC_RESULT (pdic), &owner->ndompset);
1548 pdic->movedFrom = unionSets (pdic->movedFrom, ic->movedFrom, THROW_NONE);
1551 addSetHead (&cseSet, newCseDef (IC_RESULT (ic), pdic));
1554 /* eliminate this */
1555 remiCodeFromeBBlock (ebb, ic);
1560 if (IS_ITEMP (IC_RESULT (ic)))
1567 /* just add this as a previous expression except in */
1568 /* case of a pointer access in which case this is a */
1569 /* usage not a definition */
1570 if (!(POINTER_SET (ic)) && IC_RESULT (ic))
1572 deleteItemIf (&cseSet, ifDefSymIsX, IC_RESULT (ic));
1573 addSetHead (&cseSet, newCseDef (IC_RESULT (ic), ic));
1579 /* if assignment to a parameter which is not
1580 mine and type is a pointer then delete
1581 pointerGets to take care of aliasing */
1582 if (ASSIGNMENT (ic) &&
1583 OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))) &&
1584 IS_PTR (operandType (IC_RESULT (ic))))
1586 deleteGetPointers (&cseSet, &ptrSetSet, IC_RIGHT (ic), ebb);
1587 for (i = 0; i < count; ebbs[i++]->visited = 0);
1588 applyToSet (ebb->succList, delGetPointerSucc, IC_RIGHT (ic), ebb->dfnum);
1589 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_RIGHT (ic)->key);
1592 /* if this is a pointerget then see if we can replace
1593 this with a previously assigned pointer value */
1594 if (POINTER_GET (ic) &&
1595 !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype) ||
1596 isOperandVolatile (IC_LEFT (ic), TRUE)))
1599 applyToSet (ptrSetSet, findPointerSet, IC_LEFT (ic), &pdop, IC_RESULT (ic));
1600 /* if we find it then locally replace all
1601 references to the result with what we assigned */
1604 replaceAllSymBySym (ic->next, IC_RESULT (ic), pdop, &ebb->ndompset);
1608 /* delete from the cseSet anything that has */
1609 /* operands matching the result of this */
1610 /* except in case of pointer access */
1611 if (!(POINTER_SET (ic)) && IC_RESULT (ic))
1613 deleteItemIf (&cseSet, ifOperandsHave, IC_RESULT (ic));
1614 /* delete any previous definitions */
1615 ebb->defSet = bitVectCplAnd (ebb->defSet, OP_DEFS (IC_RESULT (ic)));
1619 /* add the left & right to the defUse set */
1620 if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)))
1622 OP_USES (IC_LEFT (ic)) =
1623 bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
1624 setUsesDefs (IC_LEFT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1628 if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)))
1630 OP_USES (IC_RIGHT (ic)) =
1631 bitVectSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
1632 setUsesDefs (IC_RIGHT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1636 /* for the result it is special case, put the result */
1637 /* in the defuseSet if it a pointer or array access */
1638 if (POINTER_SET (defic))
1640 OP_USES (IC_RESULT (ic)) =
1641 bitVectSetBit (OP_USES (IC_RESULT (ic)), ic->key);
1642 setUsesDefs (IC_RESULT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
1643 deleteItemIf (&cseSet, ifPointerGet, IC_RESULT (ic));
1644 ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_RESULT (ic)->key);
1645 /* delete from inexpressions of all successors which
1646 have dfNum > than this block */
1647 for (i = 0; i < count; ebbs[i++]->visited = 0);
1648 applyToSet (ebb->succList, delGetPointerSucc, IC_RESULT (ic), ebb->dfnum);
1650 /* delete from cseSet all other pointer sets
1652 deleteItemIf (&ptrSetSet, ifPointerSet, IC_RESULT (ic));
1653 /* add to the local pointerset set */
1654 addSetHead (&ptrSetSet, newCseDef (IC_RESULT (ic), ic));
1657 /* add the result to defintion set */ if (IC_RESULT (ic))
1659 OP_DEFS (IC_RESULT (ic)) =
1660 bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
1661 ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
1662 ebb->outDefs = bitVectCplAnd (ebb->outDefs, OP_DEFS (IC_RESULT (ic)));
1663 ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
1667 /* if this is an addressof instruction then */
1668 /* put the symbol in the address of list & */
1669 /* delete it from the cseSet */
1670 if (defic->op == ADDRESS_OF)
1672 addSetHead (&ebb->addrOf, IC_LEFT (ic));
1673 deleteItemIf (&cseSet, ifDefSymIsX, IC_LEFT (ic));
1677 setToNull ((void **) &ebb->outExprs);
1678 ebb->outExprs = cseSet;
1679 ebb->outDefs = bitVectUnion (ebb->outDefs, ebb->defSet);
1680 ebb->ptrsSet = bitVectUnion (ebb->ptrsSet, ebb->inPtrsSet);
1684 /*-----------------------------------------------------------------*/
1685 /* cseAllBlocks - will sequentially go thru & do cse for all blocks */
1686 /*-----------------------------------------------------------------*/
1688 cseAllBlocks (eBBlock ** ebbs, int count)
1693 /* if optimization turned off */
1695 for (i = 0; i < count; i++)
1696 change += cseBBlock (ebbs[i], FALSE, ebbs, count);