__rlrr array lacking extern
[fw/sdcc] / src / SDCCsymt.h
index c18f335982ea7cadf36b5160379886ee1e3e9e4f..88a5d546795b6ab582408d15486324fb87040bd9 100644 (file)
@@ -55,14 +55,15 @@ structdef;
 /* noun definitions */
 typedef enum
   {
-    V_INT = 0,
+    V_INT = 1,
     V_FLOAT,
     V_CHAR,
     V_VOID,
     V_STRUCT,
     V_LABEL,
     V_BIT,
-    V_SBIT
+    V_SBIT,
+    V_DOUBLE
   }
 NOUN;
 
@@ -72,7 +73,6 @@ typedef enum
     S_FIXED = 0,
     S_AUTO,
     S_REGISTER,
-    S_CONSTANT,
     S_SFR,
     S_SBIT,
     S_CODE,
@@ -97,6 +97,7 @@ typedef struct specifier
     unsigned _long:1;          /* 1=long            */
     unsigned _short:1;         /* 1=short int    */
     unsigned _unsigned:1;      /* 1=unsigned, 0=signed       */
+    unsigned _signed:1;         /* just for sanity checks only*/
     unsigned _static:1;                /* 1=static keyword found     */
     unsigned _extern:1;                /* 1=extern found             */
     unsigned _absadr:1;                /* absolute address specfied  */
@@ -106,6 +107,7 @@ typedef struct specifier
     unsigned _volatile:1;      /* is marked as volatile      */
     unsigned _const:1;         /* is a constant              */
     unsigned _critical:1;      /* critical function          */
+    unsigned _naked:1;         /* naked function             */
     unsigned _typedef:1;       /* is typedefed               */
     unsigned _isregparm:1;     /* is the first parameter     */
     unsigned _isenum:1;                /* is an enumerated type      */
@@ -225,6 +227,7 @@ typedef struct symbol
     unsigned ruonly:1;         /* used in return statement only */
     unsigned spildir:1;                /* spilt in direct space */
     unsigned ptrreg:1;         /* this symbol assigned to a ptr reg */
+    unsigned noSpilLoc:1;      /* cannot be assigned a spil location */
     unsigned accuse;           /* can be left in the accumulator
                                   On the Z80 accuse is devided into
                                   ACCUSE_A and ACCUSE_HL as the idea
@@ -276,7 +279,6 @@ 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_USIGN(x) x->select.s._unsigned
 #define SPEC_SCLS(x) x->select.s.sclass
 #define SPEC_ENUM(x) x->select.s._isenum
@@ -293,9 +295,17 @@ symbol;
 #define SPEC_CVAL(x) x->select.s.const_val
 #define SPEC_BSTR(x) x->select.s._bitStart
 #define SPEC_BLEN(x) x->select.s._bitLength
+
+/* Sleaze: SPEC_ISR_SAVED_BANKS is only used on 
+ * function type symbols, which obviously cannot
+ * be of BIT type. Therefore, we recycle the 
+ * _bitStart field instead of defining a new field.
+ */
+#define SPEC_ISR_SAVED_BANKS(x) x->select.s._bitStart
 #define SPEC_BNKF(x) x->select.s._rbank
 #define SPEC_INTRTN(x) x->select.s._intrtn
 #define SPEC_CRTCL(x) x->select.s._critical
+#define SPEC_NAKED(x) x->select.s._naked
 #define SPEC_VOLATILE(x) x->select.s._volatile
 #define SPEC_CONST(x) x->select.s._const
 #define SPEC_STRUCT(x) x->select.s.v_struct
@@ -319,10 +329,10 @@ symbol;
                                      DCL_TYPE(x) == UPOINTER  ))
 #define IS_PTR_CONST(x) (IS_PTR(x) && DCL_PTR_CONST(x))
 #define IS_FARPTR(x) (IS_DECL(x) && DCL_TYPE(x) == FPOINTER)
+#define IS_CODEPTR(x) (IS_DECL(x) && DCL_TYPE(x) == CPOINTER)
 #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_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)
@@ -375,6 +385,8 @@ extern symbol *__muldiv[3][3][2];
 extern sym_link *__multypes[3][2];
 /* Dims: to/from float, BYTE/WORD/DWORD, SIGNED/USIGNED */
 extern symbol *__conv[2][3][2];
+/* Dims: shift left/shift right, BYTE/WORD/DWORD, SIGNED/UNSIGNED */
+extern symbol *__rlrr[2][3][2];
 
 #define CHARTYPE       __multypes[0][0]
 #define UCHARTYPE      __multypes[0][1]
@@ -395,7 +407,7 @@ sym_link *newLink ();
 sym_link *newFloatLink ();
 structdef *newStruct (char *);
 void addDecl (symbol *, int, sym_link *);
-sym_link *mergeSpec (sym_link *, sym_link *);
+sym_link *mergeSpec (sym_link *, sym_link *, char *name);
 sym_link *cloneSpec (sym_link *);
 symbol *reverseSyms (symbol *);
 sym_link *reverseLink (sym_link *);
@@ -408,7 +420,7 @@ sym_link *getSpec (sym_link *);
 char *genSymName (int);
 int compStructSize (int, structdef *);
 sym_link *copyLinkChain (sym_link *);
-int checkDecl (symbol *);
+int checkDecl (symbol *, int);
 void checkBasic (sym_link *, sym_link *);
 value *checkPointerIval (sym_link *, value *);
 value *checkStructIval (symbol *, value *);
@@ -419,7 +431,7 @@ unsigned int bitsForType (sym_link *);
 sym_link *newIntLink ();
 sym_link *newCharLink ();
 sym_link *newLongLink ();
-int checkType (sym_link *, sym_link *);
+int compareType (sym_link *, sym_link *);
 int checkFunction (symbol *);
 void cleanUpLevel (bucket **, int);
 void cleanUpBlock (bucket **, int);
@@ -439,13 +451,14 @@ void cdbSymbol (symbol *, FILE *, int, int);
 void cdbStructBlock (int, FILE *);
 void initHashT ();
 bucket *newBucket ();
-void addSym (bucket **, void *, char *, int, int);
+void addSym (bucket **, void *, char *, int, int, int checkType);
 void deleteSym (bucket **, void *, char *);
 void *findSym (bucket **, void *, const char *);
 void *findSymWithLevel (bucket **, struct symbol *);
 void *findSymWithBlock (bucket **, struct symbol *, int);
 void changePointer (symbol * sym);
-
-#include "SDCCmem.h"
+void checkTypeSanity(sym_link *etype, char *name);
+/* noun strings */
+extern char *nounName(sym_link *);
 
 #endif