git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1862
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+/*-----------------------------------------------------------------*/
+/* findBackwardDef - scan backwards to find deinition of operand */
+/*-----------------------------------------------------------------*/
+iCode *findBackwardDef(operand *op,iCode *ic)
+{
+ iCode *lic;
+
+ for (lic = ic; lic ; lic = lic->prev) {
+ if (IC_RESULT(lic) && isOperandEqual(op,IC_RESULT(lic)))
+ return lic;
+ }
+ return NULL;
+}
+
/*-----------------------------------------------------------------*/
/* algebraicOpts - does some algebraic optimizations */
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
/* algebraicOpts - does some algebraic optimizations */
/*-----------------------------------------------------------------*/
IC_RESULT (ic)->operand.symOperand;
}
IC_RESULT (ic)->operand.symOperand;
}
+#if 0 /* this needs furthur investigation can save a lot of code */
+ if (ASSIGN_SYM_TO_ITEMP(ic) &&
+ !SPIL_LOC(IC_RESULT(ic))) {
+ if (!OTHERS_PARM (OP_SYMBOL (IC_RIGHT (ic))))
+ SPIL_LOC (IC_RESULT (ic)) =
+ IC_RIGHT (ic)->operand.symOperand;
+ }
+#endif
if (ASSIGN_ITEMP_TO_ITEMP (ic)) {
if (!SPIL_LOC (IC_RIGHT (ic)) &&
if (ASSIGN_ITEMP_TO_ITEMP (ic)) {
if (!SPIL_LOC (IC_RIGHT (ic)) &&
/* this check is a hueristic to prevent live ranges
from becoming too long */
if (IS_PTR (operandType (IC_RESULT (ic))))
/* this check is a hueristic to prevent live ranges
from becoming too long */
if (IS_PTR (operandType (IC_RESULT (ic))))
/* check if operation with a literal */
if (!IS_OP_LITERAL (IC_RIGHT (ic)))
/* check if operation with a literal */
if (!IS_OP_LITERAL (IC_RIGHT (ic)))
void updateSpillLocation (iCode * ic,int);
void setUsesDefs (operand *, bitVect *, bitVect *, bitVect **);
void replaceAllSymBySym (iCode *, operand *, operand *, bitVect **);
void updateSpillLocation (iCode * ic,int);
void setUsesDefs (operand *, bitVect *, bitVect *, bitVect **);
void replaceAllSymBySym (iCode *, operand *, operand *, bitVect **);
+iCode *findBackwardDef(operand *,iCode *);