1) added __builtin_inp & __builtin_outp used to read in data of given length
[fw/sdcc] / src / SDCCcse.c
index 23dece6272c69be3f1935b191d15d702d80e8058..7f439dc7eba174f70f03c277cd66e9f0a3c01141 100644 (file)
@@ -571,6 +571,20 @@ DEFSETFUNC (ifDiCodeIsX)
 
 }
 
+/*-----------------------------------------------------------------*/
+/* 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               */
 /*-----------------------------------------------------------------*/
@@ -896,6 +910,14 @@ updateSpillLocation (iCode * ic, int induction)
                                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)) &&
@@ -1109,7 +1131,7 @@ constFold (iCode * ic, set * cseSet)
   /* this check is a hueristic to prevent live ranges
      from becoming too long */
   if (IS_PTR (operandType (IC_RESULT (ic))))
-    return 0;
+      return 0;
 
   /* check if operation with a literal */
   if (!IS_OP_LITERAL (IC_RIGHT (ic)))