* src/SDCCsymt.c (compStructSize): make bitfields without (un)signed specifier unsigned
[fw/sdcc] / src / SDCCicode.c
index 831dfd6df7421752d9435d78db9a0364507ece09..6f8be2731863e2479e27b627f60b5a3ec9e4c30e 100644 (file)
@@ -989,6 +989,34 @@ isOperandInFarSpace (operand * op)
   return (IN_FARSPACE (SPEC_OCLS (etype)) ? TRUE : FALSE);
 }
 
+/*-----------------------------------------------------------------*/
+/* isOperandInPagedSpace - return true if operand is in pagedSpace */
+/*-----------------------------------------------------------------*/
+bool
+isOperandInPagedSpace (operand * op)
+{
+  sym_link *etype;
+
+  if (!op)
+    return FALSE;
+
+  if (!IS_SYMOP (op))
+    return FALSE;
+
+  if (!IS_TRUE_SYMOP (op))
+    {
+      if (SPIL_LOC (op))
+        etype = SPIL_LOC (op)->etype;
+      else
+        return FALSE;
+    }
+  else
+    {
+      etype = getSpec (operandType (op));
+    }
+  return (IN_PAGEDSPACE (SPEC_OCLS (etype)) ? TRUE : FALSE);
+}
+
 /*------------------------------------------------------------------*/
 /* isOperandInDirSpace - will return true if operand is in dirSpace */
 /*------------------------------------------------------------------*/
@@ -2170,7 +2198,7 @@ geniCodeMultiply (operand * left, operand * right, RESULT_TYPE resultType)
   /* code generated for 1 byte * 1 byte literal = 2 bytes result is more
      efficient in most cases than 2 bytes result = 2 bytes << literal
      if port has 1 byte muldiv */
-  if (p2 && !IS_FLOAT (letype) && !IS_FIXED (letype)
+  if ((p2 > 0) && !IS_FLOAT (letype) && !IS_FIXED (letype)
       && !((resultType == RESULT_TYPE_INT) && (getSize (resType) != getSize (ltype))
            && (port->support.muldiv == 1))
       && strcmp (port->target, "pic16") != 0  /* don't shift for pic */
@@ -2221,8 +2249,8 @@ geniCodeDivision (operand * left, operand * right, RESULT_TYPE resultType)
       !IS_FLOAT (letype) &&
       !IS_FIXED (letype) &&
       IS_UNSIGNED(letype) &&
-      (p2 = powof2 ((TYPE_UDWORD)
-                    floatFromVal (right->operand.valOperand)))) {
+      ((p2 = powof2 ((TYPE_UDWORD)
+                    floatFromVal (right->operand.valOperand))) > 0)) {
     ic = newiCode (RIGHT_OP, left, operandFromLit (p2)); /* right shift */
   }
   else
@@ -2833,6 +2861,7 @@ geniCodeAddressOf (operand * op)
   ADDTOCHAIN (ic);
   return IC_RESULT (ic);
 }
+
 /*-----------------------------------------------------------------*/
 /* setOClass - sets the output class depending on the pointer type */
 /*-----------------------------------------------------------------*/
@@ -4253,15 +4282,6 @@ ast2iCode (ast * tree,int lvl)
 #endif
 
     case '~':
-      {
-        sym_link *ltype = operandType (left);
-        operand *op = geniCodeUnary (geniCodeRValue (left, FALSE), tree->opval.op);
-        if ((SPEC_NOUN(ltype) == V_CHAR) && IS_UNSIGNED(ltype))
-          {
-            setOperandType (op, INTTYPE);
-          }
-        return op;
-      }
     case RRC:
     case RLC:
     case SWAP: