removed options.ANSIint
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 13 May 2001 15:26:13 +0000 (15:26 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 13 May 2001 15:26:13 +0000 (15:26 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@808 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCglobl.h
src/SDCCicode.c
src/SDCCmain.c

index c21af2bc46ac461ec011477ea1fd815dd4c98325..8bed6bafc9193d679609a34e03acc94b9268a6ff 100644 (file)
@@ -217,7 +217,6 @@ struct options
     int nostdlib:1;            /* Don't use standard lib files */
     int nostdinc:1;            /* Don't use standard include files */
     int verbose:1;             /* Show what the compiler is doing */
-    int ANSIint:1;             /* Use ANSI integer promotion rules in expressions. */
 
     char *calleeSaves[128];    /* list of functions using callee save */
     char *excludeRegs[32];     /* registers excluded from saving */
index 748a9daf0b9827ae9356e766f104e938d9e262f8..1ab038c57aa3aa5a39f796cc727dd243caeaf2da 100644 (file)
@@ -1406,122 +1406,17 @@ usualUnaryConversions (operand * op)
 sym_link *
 usualBinaryConversions (operand ** op1, operand ** op2)
 {
-  if (!options.ANSIint)
-    {
-      /* "Classic" SDCC behavior. */
-      sym_link *ctype;
-      sym_link *rtype = operandType (*op2);
-      sym_link *ltype = operandType (*op1);
-
-      ctype = computeType (ltype, rtype);
-      *op1 = geniCodeCast (ctype, *op1, TRUE);
-      *op2 = geniCodeCast (ctype, *op2, TRUE);
-
-      return ctype;
-    }
-
-  *op1 = usualUnaryConversions (*op1);
-  *op2 = usualUnaryConversions (*op2);
-
-  /* Try to make the two operands of the same type, following
-   * the "usual binary conversions" promotion rules.
-   *
-   * NB: floating point types are not yet properly handled; we
-   * follow the "classic" behavior.
-   */
-
-  if (IS_FLOAT (operandType (*op1)) || IS_FLOAT (operandType (*op2)))
-    {
-      return newFloatLink ();
-    }
-
-  if (!IS_INTEGRAL (operandType (*op1)) || !IS_INTEGRAL (operandType (*op2)))
-    {
-      /* if either is not an integer type, we're done. */
-      return copyLinkChain (operandType (*op1));       /* Punt! we should never get here. */
-    }
-
-  /* If either is an unsigned long, make sure both are. */
-  if (SPEC_USIGN (operandType (*op1)) && IS_LONG (operandType (*op1)))
-    {
-      if (!SPEC_USIGN (operandType (*op2)) || !IS_LONG (operandType (*op2)))
-       {
-         *op2 = geniCodeCast (ULONGTYPE, *op2, TRUE);
-       }
-      return copyLinkChain (operandType (*op1));
-    }
-
-  if (SPEC_USIGN (operandType (*op2)) && IS_LONG (operandType (*op2)))
-    {
-      if (!SPEC_USIGN (operandType (*op1)) || !IS_LONG (operandType (*op1)))
-       {
-         *op1 = geniCodeCast (ULONGTYPE, *op1, TRUE);
-       }
-      return copyLinkChain (operandType (*op2));
-    }
-
-  /* Next, if one is long and the other is int (signed or un),
-   * cast both to long.
-   *
-   * Note that because in our environment a long can hold all
-   * the values of an unsigned int, the "long/unsigned int" pair
-   * in the ANSI conversion table is unnecessary; this test
-   * handles that case implicitly.
-   */
-  if (IS_LONG (operandType (*op1)))
-    {
-      /* NB: because of the unary conversions, op2 cannot
-       * be smaller than int. Therefore, if it is not
-       * long, it is a regular int.
-       */
-      if (!IS_LONG (operandType (*op2)))
-       {
-         *op2 = geniCodeCast (LONGTYPE, *op2, TRUE);
-       }
-      return copyLinkChain (operandType (*op1));
-    }
-
-  if (IS_LONG (operandType (*op2)))
-    {
-      /* NB: because of the unary conversions, op2 cannot
-       * be smaller than int. Therefore, if it is not
-       * long, it is a regular int.
-       */
-      if (!IS_LONG (operandType (*op1)))
-       {
-         *op1 = geniCodeCast (LONGTYPE, *op1, TRUE);
-       }
-      return copyLinkChain (operandType (*op2));
-    }
-
-  /* All right, neither is long; they must both be integers.
-
-   * Only remaining issue is signed vs. unsigned; if one is unsigned
-   * and the other isn't, convert both to unsigned.
-   */
-  if (SPEC_USIGN (operandType (*op1)))
-    {
-      if (!SPEC_USIGN (operandType (*op2)))
-       {
-         *op2 = geniCodeCast (UINTTYPE, *op2, TRUE);
-       }
-      return copyLinkChain (operandType (*op1));
-    }
-
-  if (SPEC_USIGN (operandType (*op2)))
-    {
-      if (!SPEC_USIGN (operandType (*op1)))
-       {
-         *op1 = geniCodeCast (UINTTYPE, *op1, TRUE);
-       }
-      return copyLinkChain (operandType (*op2));
-    }
-
-  /* Done! */
-  return copyLinkChain (operandType (*op1));
+  sym_link *ctype;
+  sym_link *rtype = operandType (*op2);
+  sym_link *ltype = operandType (*op1);
+  
+  ctype = computeType (ltype, rtype);
+  *op1 = geniCodeCast (ctype, *op1, TRUE);
+  *op2 = geniCodeCast (ctype, *op2, TRUE);
+  
+  return ctype;
 }
 
-
 /*-----------------------------------------------------------------*/
 /* geniCodeValueAtAddress - generate intermeditate code for value  */
 /*                          at address                             */
@@ -1690,7 +1585,6 @@ geniCodeMultiply (operand * left, operand * right,int resultIsInt)
 {
   iCode *ic;
   int p2 = 0;
-  int saveOption=0;
   sym_link *resType;
   LRTYPE;
 
@@ -1703,11 +1597,6 @@ geniCodeMultiply (operand * left, operand * right,int resultIsInt)
     p2 = powof2 ((unsigned long) floatFromVal (right->operand.valOperand));
   }
 
-  if (resultIsInt)
-    {
-      saveOption = options.ANSIint;
-      options.ANSIint = 0;
-    }
   resType = usualBinaryConversions (&left, &right);
 #if 1
   rtype = operandType (right);
@@ -1717,7 +1606,6 @@ geniCodeMultiply (operand * left, operand * right,int resultIsInt)
 #endif
   if (resultIsInt)
     {
-      options.ANSIint = saveOption;
       SPEC_NOUN(getSpec(resType))=V_INT;
       SPEC_SHORT(getSpec(resType))=0;
     }
@@ -2446,16 +2334,6 @@ geniCodeLeftShift (operand * left, operand * right)
 {
   iCode *ic;
 
-
-  /* Note that we don't use the usual binary conversions for the
-   * shift operations, in accordance with our ANSI friends.
-   */
-  if (options.ANSIint)
-    {
-      right = usualUnaryConversions (right);
-      left = usualUnaryConversions (left);
-    }
-
   ic = newiCode (LEFT_OP, left, right);
   IC_RESULT (ic) = newiTempOperand (operandType (left), 0);
   ADDTOCHAIN (ic);
@@ -2470,16 +2348,6 @@ geniCodeRightShift (operand * left, operand * right)
 {
   iCode *ic;
 
-
-  /* Note that we don't use the usual binary conversions for the
-   * shift operations, in accordance with our ANSI friends.
-   */
-  if (options.ANSIint)
-    {
-      right = usualUnaryConversions (right);
-      left = usualUnaryConversions (left);
-    }
-
   ic = newiCode (RIGHT_OP, left, right);
   IC_RESULT (ic) = newiTempOperand (operandType (left), 0);
   ADDTOCHAIN (ic);
index 1eedfda51c9b8a50eda25a5196c1c7d8df8f3e48..84a7c08f38f7f4e8e9d4cecc08e088f435674745 100644 (file)
@@ -130,7 +130,6 @@ char DefaultExePath[128];
 #define OPTION_NOSTDLIB     "-nostdlib"
 #define OPTION_NOSTDINC     "-nostdinc"
 #define OPTION_VERBOSE      "-verbose"
-#define OPTION_ANSIINT      "-ansiint"
 static const char *_preCmd[] =
 {
   "sdcpp", "-Wall", "-lang-c++", "-DSDCC=1",
@@ -935,12 +934,6 @@ parseCmdLine (int argc, char **argv)
              continue;
            }
 
-         if (strcmp (&argv[i][1], OPTION_ANSIINT) == 0)
-           {
-             options.ANSIint = 1;
-             continue;
-           }
-
          if (!port->parseOption (&argc, argv, &i))
            {
              werror (W_UNKNOWN_OPTION, argv[i]);