]> git.gag.com Git - fw/sdcc/commitdiff
Next step in 16 bits short
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 13 Jun 2001 09:25:31 +0000 (09:25 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 13 Jun 2001 09:25:31 +0000 (09:25 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@884 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCC.y
src/SDCCast.c
src/SDCCcse.c
src/SDCCicode.c
src/SDCCsymt.c
src/SDCCsymt.h

index afb2e5a9232caded83d00de708aeacac31bf783e..7fe71788c8bb5d71c8d135bb40027c4fdace5b91 100644 (file)
@@ -565,7 +565,7 @@ type_specifier2
    | SHORT  {
                $$=newLink();
                $$->class = SPECIFIER   ;
-              SPEC_SHORT($$) = 1      ;
+              $$->select.s._short = 1      ;
             }
    | INT    {
                $$=newLink();
@@ -580,7 +580,7 @@ type_specifier2
    | SIGNED {
                $$=newLink();
                $$->class = SPECIFIER   ;
-               SPEC_SIGNED($$) = 1     ;
+               $$->select.s._signed = 1     ;
             }
    | UNSIGNED  {
                $$=newLink();
index 9c62ab82694c47225b089e27c8fe25a73db1d472..e76c932eefa9753782cd578ddf955fad1d329c88 100644 (file)
@@ -2299,19 +2299,17 @@ decorateType (ast * tree)
        }
 
       LRVAL (tree) = RRVAL (tree) = 1;
-      /* promote result to int if left & right are char / short 
+      /* promote result to int if left & right are char
         this will facilitate hardware multiplies 8bit x 8bit = 16bit */
-      if ((IS_CHAR(LETYPE(tree)) || IS_SHORT(LETYPE(tree))) && 
-          (IS_CHAR(RETYPE(tree)) || IS_SHORT(RETYPE(tree)))) {
-             TETYPE (tree) = getSpec (TTYPE (tree) =
-                                      computeType (LTYPE (tree),
-                                                   RTYPE (tree)));
-             SPEC_NOUN(TETYPE(tree)) = V_INT;
-             SPEC_SHORT(TETYPE(tree))=0;
+      if (IS_CHAR(LETYPE(tree)) && IS_CHAR(RETYPE(tree))) {
+       TETYPE (tree) = getSpec (TTYPE (tree) =
+                                computeType (LTYPE (tree),
+                                             RTYPE (tree)));
+       SPEC_NOUN(TETYPE(tree)) = V_INT;
       } else {
-             TETYPE (tree) = getSpec (TTYPE (tree) =
-                                      computeType (LTYPE (tree),
-                                                   RTYPE (tree)));
+       TETYPE (tree) = getSpec (TTYPE (tree) =
+                                computeType (LTYPE (tree),
+                                             RTYPE (tree)));
       }
       return tree;
 
index 5345f49e03cd2c39eb9d17b6105f8d3751f9f2cd..8d059f92d1da5bc85215c0cb5fce2f6429a91e36 100644 (file)
@@ -302,7 +302,6 @@ DEFSETFUNC (findCheaperOp)
 
   if ((*opp) && 
       (SPEC_USIGN(operandType (cop))==SPEC_USIGN(operandType (*opp))) &&
-      (SPEC_SHORT(operandType (cop))==SPEC_SHORT(operandType (*opp))) &&
       (SPEC_LONG(operandType (cop))==SPEC_LONG(operandType (*opp))))
     {
 
index 6196ce2254575208a2537cbe7ffd225073a24abc..02482ec773f07b88bfb9e92d25b27757063fe448 100644 (file)
@@ -1623,7 +1623,6 @@ geniCodeMultiply (operand * left, operand * right,int resultIsInt)
   if (resultIsInt)
     {
       SPEC_NOUN(getSpec(resType))=V_INT;
-      SPEC_SHORT(getSpec(resType))=0;
     }
 
   /* if the right is a literal & power of 2 */
index 363e39a467627377ab648d86541a73ddb181ed77..661e8e6a0cedf9af1d99ccc70a9a4dd65d28ddea 100644 (file)
@@ -30,7 +30,7 @@ char *nounName(sym_link *sl) {
     {
     case V_INT: {
       if (SPEC_LONG(sl)) return "long";
-      if (SPEC_SHORT(sl)) return "short";
+      if (sl->select.s._short) return "short";
       return "int";
     }
     case V_FLOAT: return "float";
@@ -485,27 +485,26 @@ void checkTypeSanity(sym_link *etype, char *name) {
        SPEC_NOUN(etype)==V_FLOAT || 
        SPEC_NOUN(etype)==V_DOUBLE || 
        SPEC_NOUN(etype)==V_VOID) &&
-      (SPEC_SHORT(etype) || SPEC_LONG(etype))) {
+      (etype->select.s._short || SPEC_LONG(etype))) {
     // long or short for char float double or void
     werror (E_LONG_OR_SHORT_INVALID, noun, name);
   }
   if ((SPEC_NOUN(etype)==V_FLOAT || 
        SPEC_NOUN(etype)==V_DOUBLE || 
        SPEC_NOUN(etype)==V_VOID) && 
-      (SPEC_SIGNED(etype) || SPEC_USIGN(etype))) {
+      (etype->select.s._signed || SPEC_USIGN(etype))) {
     // signed or unsigned for float double or void
     werror (E_SIGNED_OR_UNSIGNED_INVALID, noun, name);
   }
 
   if (!SPEC_NOUN(etype)) {
     // special case for just "signed" or "unsigned" or "long"
-    if (SPEC_SIGNED(etype) || SPEC_USIGN(etype) || SPEC_LONG(etype)) {
+    if (etype->select.s._signed || SPEC_USIGN(etype) || SPEC_LONG(etype)) {
       SPEC_NOUN(etype)=V_INT;
     }
     // special case for just "short"
-    if (SPEC_SHORT(etype)) {
+    if (etype->select.s._short) {
       SPEC_NOUN(etype)=V_CHAR; // or maybe V_INT
-      SPEC_SHORT(etype)=0;
     }
   }
 
@@ -514,11 +513,11 @@ void checkTypeSanity(sym_link *etype, char *name) {
     SPEC_NOUN(etype)=V_INT;
   }
 
-  if (SPEC_SIGNED(etype) && SPEC_USIGN(etype)) {
+  if (etype->select.s._signed && SPEC_USIGN(etype)) {
     // signed AND unsigned 
     werror (E_SIGNED_AND_UNSIGNED_INVALID, noun, name);
   }
-  if (SPEC_SHORT(etype) && SPEC_LONG(etype)) {
+  if (etype->select.s._short && SPEC_LONG(etype)) {
     // short AND long
     werror (E_LONG_AND_SHORT_INVALID, noun, name);
   }
@@ -539,8 +538,8 @@ mergeSpec (sym_link * dest, sym_link * src)
       /* we shouldn't redeclare the type */
       if (getenv("DEBUG_SANITY")) {
        fprintf (stderr, "mergeSpec: ");
-       werror(E_TWO_OR_MORE_DATA_TYPES, yylval.yychar);
       }
+      werror(E_TWO_OR_MORE_DATA_TYPES, yylval.yychar);
     }
   }
   
@@ -568,11 +567,11 @@ mergeSpec (sym_link * dest, sym_link * src)
   }
 #endif
   // but there are more important thing right now
-  
+
   SPEC_LONG (dest) |= SPEC_LONG (src);
-  SPEC_SHORT (dest) |= SPEC_SHORT (src);
+  dest->select.s._short=src->select.s._short;
   SPEC_USIGN (dest) |= SPEC_USIGN (src);
-  SPEC_SIGNED (dest) |= SPEC_SIGNED (src);
+  dest->select.s._signed=src->select.s._signed;
   SPEC_STAT (dest) |= SPEC_STAT (src);
   SPEC_EXTR (dest) |= SPEC_EXTR (src);
   SPEC_ABSA (dest) |= SPEC_ABSA (src);
@@ -715,7 +714,7 @@ getSize (sym_link * p)
       switch (SPEC_NOUN (p))
        {                       /* depending on the specifier type */
        case V_INT:
-         return (IS_LONG (p) ? LONGSIZE : (IS_SHORT (p) ? SHORTSIZE : INTSIZE));
+         return (IS_LONG (p) ? LONGSIZE : INTSIZE);
        case V_FLOAT:
          return FLOATSIZE;
        case V_CHAR:
@@ -774,7 +773,7 @@ bitsForType (sym_link * p)
       switch (SPEC_NOUN (p))
        {                       /* depending on the specifier type */
        case V_INT:
-         return (IS_LONG (p) ? LONGSIZE * 8 : (IS_SHORT (p) ? SHORTSIZE * 8 : INTSIZE * 8));
+         return (IS_LONG (p) ? LONGSIZE * 8 : INTSIZE * 8);
        case V_FLOAT:
          return FLOATSIZE * 8;
        case V_CHAR:
@@ -1456,17 +1455,6 @@ checkType (sym_link * dest, sym_link * src)
       SPEC_NOUN (src) == V_VOID)
     return -1;
 
-  /* char === to short */
-  if (SPEC_NOUN (dest) == V_CHAR &&
-      SPEC_NOUN (src) == V_INT &&
-      SPEC_SHORT (src))
-    return (SPEC_USIGN (src) == SPEC_USIGN (dest) ? 1 : -2);
-
-  if (SPEC_NOUN (src) == V_CHAR &&
-      SPEC_NOUN (dest) == V_INT &&
-      SPEC_SHORT (dest))
-    return (SPEC_USIGN (src) == SPEC_USIGN (dest) ? 1 : -2);
-
   /* if they are both bitfields then if the lengths
      and starts don't match */
   if (IS_BITFIELD (dest) && IS_BITFIELD (src) &&
@@ -1496,9 +1484,6 @@ checkType (sym_link * dest, sym_link * src)
   if (SPEC_LONG (dest) != SPEC_LONG (src))
     return -1;
 
-  if (SPEC_SHORT (dest) != SPEC_SHORT (src))
-    return -1;
-
   if (SPEC_USIGN (dest) != SPEC_USIGN (src))
     return -2;
 
@@ -1936,8 +1921,6 @@ printTypeChain (sym_link * type, FILE * of)
            case V_INT:
              if (IS_LONG (type))
                fprintf (of, "long ");
-             if (IS_SHORT (type))
-               fprintf (of, "short ");
              fprintf (of, "int ");
              break;
 
@@ -2031,8 +2014,6 @@ cdbTypeInfo (sym_link * type, FILE * of)
            case V_INT:
              if (IS_LONG (type))
                fprintf (of, "SL");
-             else if (IS_SHORT (type))
-               fprintf (of, "SS");
              else
                fprintf (of, "SI");
              break;
index 65270620a5b35c8728bf6c6372e7f2a51924fa36..5414d11994731f8552be268f8fe96bde6d81fdee 100644 (file)
@@ -279,9 +279,9 @@ symbol;
 #define DCL_TSPEC(l) l->select.d.tspec
 #define SPEC_NOUN(x) x->select.s.noun
 #define SPEC_LONG(x) x->select.s._long
-#define SPEC_SHORT(x) x->select.s._short
+//#define SPEC_SHORT(x) x->select.s._short // only for type checking
 #define SPEC_USIGN(x) x->select.s._unsigned
-#define SPEC_SIGNED(x) x->select.s._signed
+//#define SPEC_SIGNED(x) x->select.s._signed // only for type checking
 #define SPEC_SCLS(x) x->select.s.sclass
 #define SPEC_ENUM(x) x->select.s._isenum
 #define SPEC_OCLS(x) x->select.s.oclass
@@ -334,7 +334,7 @@ symbol;
 #define IS_GENPTR(x) (IS_DECL(x) && DCL_TYPE(x) == GPOINTER)
 #define IS_FUNC(x)   (IS_DECL(x) && DCL_TYPE(x) == FUNCTION)
 #define IS_LONG(x)   (IS_SPEC(x) && x->select.s._long)
-#define IS_SHORT(x)   (IS_SPEC(x) && x->select.s._short)
+//#define IS_SHORT(x)   (IS_SPEC(x) && x->select.s._short)
 #define IS_TYPEDEF(x)(IS_SPEC(x) && x->select.s._typedef)
 #define IS_CONSTANT(x)  (IS_SPEC(x) && ( x->select.s._const == 1))
 #define IS_STRUCT(x) (IS_SPEC(x) && x->select.s.noun == V_STRUCT)