save 2 bytes stack space with the option --main-return. The ljmp could probably be...
[fw/sdcc] / src / SDCCcse.c
index a8b556101ea91972d425907df6e52249d887f78e..c57509201370e3d868ad059ec95cfe12ba7293a5 100644 (file)
@@ -914,6 +914,7 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
              else
                {
                  ic->op = CAST;
+                 IC_LEFT (ic) = operandFromOperand (IC_LEFT (ic));
                  IC_LEFT (ic)->type = TYPE;
                  IC_LEFT (ic)->isLiteral = 0;
                  setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
@@ -952,7 +953,7 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
                  ic->op = CAST;
                  op = IC_RIGHT (ic);
                  IC_RIGHT (ic) = IC_LEFT (ic);
-                 IC_LEFT (ic) = op;
+                 IC_LEFT (ic) = operandFromOperand (op);
                  IC_LEFT (ic)->type = TYPE;
                  IC_LEFT (ic)->isLiteral = 0;
                  setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
@@ -1295,10 +1296,13 @@ updateSpillLocation (iCode * ic, int induction)
                        if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
                            !IS_VOLATILE (setype) &&
                            !IN_FARSPACE (SPEC_OCLS (setype)) &&
-                           !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
+                           !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic)))) {
 
                                SPIL_LOC (IC_RIGHT (ic)) =
                                        SPIL_LOC (IC_RESULT (ic));
+                               OP_SYMBOL (IC_RIGHT (ic))->prereqv =
+                                       OP_SYMBOL (IC_RESULT (ic))->prereqv;
+                       }
                }
                /* special case for inductions */
                if (induction && 
@@ -1306,6 +1310,8 @@ updateSpillLocation (iCode * ic, int induction)
                    !OP_SYMBOL(IC_RESULT (ic))->noSpilLoc &&
                    !SPIL_LOC(IC_RESULT(ic))) {
                        SPIL_LOC (IC_RESULT (ic)) = SPIL_LOC (IC_RIGHT (ic));
+                       OP_SYMBOL (IC_RESULT (ic))->prereqv =
+                               OP_SYMBOL (IC_RIGHT (ic))->prereqv;
                }
        }
 }
@@ -1424,7 +1430,7 @@ ifxOptimize (iCode * ic, set * cseSet,
       /* the price */
       computeControlFlow (ebbs, count, 1);
       if (!options.lessPedantic) {
-       werror (W_CONTROL_FLOW, ic->filename, ic->lineno);
+       werrorfl (ic->filename, ic->lineno, W_CONTROL_FLOW);
       }
       return;
     }
@@ -1438,7 +1444,7 @@ ifxOptimize (iCode * ic, set * cseSet,
     {
 
       if (!options.lessPedantic) {
-       werror (W_CONTROL_FLOW, ic->filename, ic->lineno);
+       werrorfl (ic->filename, ic->lineno, W_CONTROL_FLOW);
       }
       if (IS_OP_VOLATILE (IC_COND (ic)))
        {