Only build each library if configure listed it in ports.build. The
[fw/sdcc] / src / SDCCsymt.h
index 69184e9d257f2e3d37de48bab2860febb51b14b5..41e4ec78b31d1ccec5b7bb04572f567b8daca319 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
@@ -265,8 +268,6 @@ typedef struct symbol
     int liveTo;                        /* live to sequence number */
     int used;                  /* no. of times this was used */
     int recvSize;              /* size of first argument  */
-    int argStack;              /* stacks used by parameters */
-
   }
 symbol;
 
@@ -278,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
@@ -295,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
@@ -324,7 +332,6 @@ 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_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)
@@ -377,6 +384,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 */
+symbol *__rlrr[2][3][2];
 
 #define CHARTYPE       __multypes[0][0]
 #define UCHARTYPE      __multypes[0][1]
@@ -397,7 +406,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 *);
@@ -421,7 +430,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);
@@ -441,11 +450,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);
-#include "SDCCmem.h"
+void changePointer (symbol * sym);
+void checkTypeSanity(sym_link *etype, char *name);
+/* noun strings */
+extern char *nounName(sym_link *);
 
 #endif