- /* if found then eliminate this and add to */
- /* to cseSet an element containing result */
- /* of this with previous opcode */
- if (pdic)
- {
-
- if (IS_ITEMP (IC_RESULT (ic)))
- {
-
- /* replace in the remaining of this block */
- replaceAllSymBySym (ic->next, IC_RESULT (ic), IC_RESULT (pdic), &ebb->ndompset);
- /* remove this iCode from inexpressions of all
- its successors, it cannot be in the in expressions
- of any of the predecessors */
- for (i = 0; i < count; ebbs[i++]->visited = 0);
- applyToSet (ebb->succList, removeFromInExprs, ic, IC_RESULT (ic),
- IC_RESULT (pdic), ebb);
-
- /* if this was moved from another block */
- /* then replace in those blocks too */
- if (ic->movedFrom)
- {
- eBBlock *owner;
- for (owner = setFirstItem (ic->movedFrom); owner;
- owner = setNextItem (ic->movedFrom))
- replaceAllSymBySym (owner->sch, IC_RESULT (ic), IC_RESULT (pdic), &owner->ndompset);
- }
- pdic->movedFrom = unionSets (pdic->movedFrom, ic->movedFrom, THROW_NONE);
- }
- else
- addSetHead (&cseSet, newCseDef (IC_RESULT (ic), pdic));
-
- if (!computeOnly)
- /* eliminate this */
- remiCodeFromeBBlock (ebb, ic);
-
- defic = pdic;
- change++;
-
- if (IS_ITEMP (IC_RESULT (ic)))
- continue;
-
- }
- else
- {
-
- /* just add this as a previous expression except in */
- /* case of a pointer access in which case this is a */
- /* usage not a definition */
- if (!(POINTER_SET (ic)) && IC_RESULT (ic))
- {
- deleteItemIf (&cseSet, ifDefSymIsX, IC_RESULT (ic));
- addSetHead (&cseSet, newCseDef (IC_RESULT (ic), ic));
- }
- defic = ic;
+ /* Alternate code */
+ if (pdic && IS_ITEMP(IC_RESULT(ic))) {
+ /* if previous definition found change this to an assignment */
+ ic->op = '=';
+ IC_LEFT(ic) = NULL;
+ IC_RIGHT(ic) = operandFromOperand(IC_RESULT(pdic));
+ SET_ISADDR(IC_RESULT(ic),0);
+ SET_ISADDR(IC_RIGHT (ic),0);
+ }