fixed bug #459459
[fw/sdcc] / src / SDCCcse.c
index ac5e66afd412e4766cd96cf66ddaf128b35c9f00..258d5fef2b5aeb21b42decdfeb67684c8106af26 100644 (file)
@@ -326,6 +326,14 @@ DEFSETFUNC (findCheaperOp)
          (*opp)->isaddr = cop->isaddr;
        }
 
+      if ((*opp)->type==VALUE && 
+         IS_SYMOP(cop) && 
+         !IS_SPEC(OP_SYMBOL(cop)->type)) {
+       // this could be a pointer to some space, so we can not
+       *opp=NULL;
+       return 0;
+      }
+
       return 1;
 
     }
@@ -893,6 +901,7 @@ updateSpillLocation (iCode * ic, int induction)
                /* special case for inductions */
                if (induction && 
                    OP_SYMBOL(IC_RIGHT(ic))->isreqv && 
+                   !OP_SYMBOL(IC_RESULT (ic))->noSpilLoc &&
                    !SPIL_LOC(IC_RESULT(ic))) {
                        SPIL_LOC (IC_RESULT (ic)) = SPIL_LOC (IC_RIGHT (ic));
                }
@@ -1220,7 +1229,8 @@ fixUpTypes (iCode * ic)
 {
   sym_link *t1 = operandType (IC_LEFT (ic)), *t2;
 
-  if (TARGET_IS_DS390)
+  /* if (TARGET_IS_DS390) */
+  if (options.model == MODEL_FLAT24)
     {
       /* hack-o-matic! */
       return;
@@ -1401,7 +1411,7 @@ cseBBlock (eBBlock * ebb, int computeOnly,
        {
 
          /* update the spill location for this */
-         updateSpillLocation (ic,1);
+         updateSpillLocation (ic,0);
 
          if (POINTER_SET (ic) &&
              !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype)))