/* updateSpillLocation - keeps track of register spill location */
/*-----------------------------------------------------------------*/
void
-updateSpillLocation (iCode * ic)
+updateSpillLocation (iCode * ic, int induction)
{
- sym_link *setype;
+ sym_link *setype;
- if (POINTER_SET (ic))
- return;
-
- if (ic->nosupdate)
- return;
+ if (POINTER_SET (ic))
+ return;
- /* for the form true_symbol := iTempNN */
- if (ASSIGN_ITEMP_TO_SYM (ic)
- && !SPIL_LOC (IC_RIGHT (ic)))
- {
+ if (ic->nosupdate)
+ return;
- setype = getSpec (operandType (IC_RESULT (ic)));
-
- if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
- !IS_VOLATILE (setype) &&
- !IN_FARSPACE (SPEC_OCLS (setype)) &&
- /* PENDING */
- !TARGET_IS_Z80 &&
- !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
-
- SPIL_LOC (IC_RIGHT (ic)) =
- IC_RESULT (ic)->operand.symOperand;
- }
+ /* for the form true_symbol := iTempNN */
+ if (ASSIGN_ITEMP_TO_SYM (ic) &&
+ !SPIL_LOC (IC_RIGHT (ic))) {
- if (ASSIGN_ITEMP_TO_ITEMP (ic) &&
- !SPIL_LOC (IC_RIGHT (ic)) &&
- !bitVectBitsInCommon (OP_DEFS (IC_RIGHT (ic)), OP_USES (IC_RESULT (ic))) &&
- OP_SYMBOL (IC_RESULT (ic))->isreqv)
- {
+ setype = getSpec (operandType (IC_RESULT (ic)));
- setype = getSpec (operandType (IC_RESULT (ic)));
+ if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
+ !IS_VOLATILE (setype) &&
+ !IN_FARSPACE (SPEC_OCLS (setype)) &&
+ !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
- if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
- !IS_VOLATILE (setype) &&
- !IN_FARSPACE (SPEC_OCLS (setype)) &&
- /* PENDING */
- !TARGET_IS_Z80 &&
- !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
+ SPIL_LOC (IC_RIGHT (ic)) =
+ IC_RESULT (ic)->operand.symOperand;
+ }
- SPIL_LOC (IC_RIGHT (ic)) =
- SPIL_LOC (IC_RESULT (ic));
- }
+ if (ASSIGN_ITEMP_TO_ITEMP (ic)) {
+
+ if (!SPIL_LOC (IC_RIGHT (ic)) &&
+ !bitVectBitsInCommon (OP_DEFS (IC_RIGHT (ic)), OP_USES (IC_RESULT (ic))) &&
+ OP_SYMBOL (IC_RESULT (ic))->isreqv) {
+
+ setype = getSpec (operandType (IC_RESULT (ic)));
+
+ if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
+ !IS_VOLATILE (setype) &&
+ !IN_FARSPACE (SPEC_OCLS (setype)) &&
+ !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
+
+ SPIL_LOC (IC_RIGHT (ic)) =
+ SPIL_LOC (IC_RESULT (ic));
+ }
+ /* special case for inductions */
+ if (induction &&
+ OP_SYMBOL(IC_RIGHT(ic))->isreqv &&
+ !SPIL_LOC(IC_RESULT(ic))) {
+ SPIL_LOC (IC_RESULT (ic)) = SPIL_LOC (IC_RIGHT (ic));
+ }
+ }
}
-
/*-----------------------------------------------------------------*/
/* setUsesDef - sets the uses def bitvector for a given operand */
/*-----------------------------------------------------------------*/
{
/* update the spill location for this */
- updateSpillLocation (ic);
+ updateSpillLocation (ic,1);
if (POINTER_SET (ic) &&
!(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype)))
int cseAllBlocks (eBBlock **, int);
void ifxOptimize (iCode *, set *, int, eBBlock *, int *, eBBlock **, int);
void unsetDefsAndUses (iCode *);
-void updateSpillLocation (iCode * ic);
+void updateSpillLocation (iCode * ic,int);
void setUsesDefs (operand *, bitVect *, bitVect *, bitVect **);
void replaceAllSymBySym (iCode *, operand *, operand *, bitVect **);
#endif