Fixed up s51 autodetect
[fw/sdcc] / src / SDCCsymt.h
index 9aca29752c1b5d8c97a6beda6f29e3e09237898b..8660ad3a894e84f735ffb44c0bc40d949dbc5ed4 100644 (file)
 #define SDCC_NAME_MAX  3*SDCC_SYMNAME_MAX // big enough for _<func>_<var>_etc
 #include "SDCChasht.h"
 
+enum {
+    TYPEOF_INT=1,
+    TYPEOF_SHORT,
+    TYPEOF_CHAR,
+    TYPEOF_LONG,
+    TYPEOF_FLOAT,
+    TYPEOF_BIT,
+    TYPEOF_SBIT,
+    TYPEOF_SFR,
+    TYPEOF_VOID,
+    TYPEOF_STRUCT,
+    TYPEOF_ARRAY,
+    TYPEOF_FUNCTION,
+    TYPEOF_POINTER,
+    TYPEOF_FPOINTER,
+    TYPEOF_CPOINTER,
+    TYPEOF_GPOINTER,
+    TYPEOF_PPOINTER,
+    TYPEOF_IPOINTER,
+    TYPEOF_EEPPOINTER
+};
 
 #define HASHTAB_SIZE 256
 
@@ -185,6 +206,7 @@ typedef struct sym_link
       unsigned rbank:1;                /* seperate register bank     */
       unsigned intno;          /* 1=Interrupt svc routine    */
       unsigned regbank;                /* register bank 2b used      */
+      unsigned builtin;                /* is a builtin function      */
     } funcAttrs;
 
     struct sym_link *next;     /* next element on the chain  */
@@ -210,7 +232,6 @@ typedef struct symbol
     unsigned isinvariant:1;    /* is a loop invariant  */
     unsigned isstrlit:1;       /* is a string literal  */
     unsigned cdef:1;           /* compiler defined symbol */
-    unsigned allocreq:1;       /* allocation is required for this variable */
     unsigned addrtaken:1;      /* address of the symbol was taken */
     unsigned isreqv:1;         /* is the register quivalent of a symbol */
     unsigned udChked:1;                /* use def checking has been already done */
@@ -220,6 +241,7 @@ typedef struct symbol
        if a better scheme for backend is thought of */
     unsigned isLiveFcall:1;    /* is live at or across a function call */
     unsigned isspilt:1;                /* has to be spilt */
+    unsigned spillA:1;         /* spilt be register allocator */
     unsigned remat:1;          /* can be remateriazed */
     unsigned isptr:1;          /* is a pointer */
     unsigned uptr:1;           /* used as a pointer */
@@ -240,6 +262,7 @@ typedef struct symbol
                                   is quite similar.
                                 */
 
+    int allocreq ;             /* allocation is required for this variable */
     int stack;                 /* offset on stack      */
     int xstack;                        /* offset on xternal stack */
     short nRegs;               /* number of registers required */
@@ -273,6 +296,7 @@ typedef struct symbol
     int liveTo;                        /* live to sequence number */
     int used;                  /* no. of times this was used */
     int recvSize;              /* size of first argument  */
+    struct bitVect *clashes;    /* overlaps with what other symbols */
   }
 symbol;
 
@@ -296,7 +320,6 @@ symbol;
 #define IFFUNC_CALLEESAVES(x) (IS_FUNC(x) && FUNC_CALLEESAVES(x))
 #define FUNC_ISISR(x) (x->funcAttrs.intrtn)
 #define IFFUNC_ISISR(x) (IS_FUNC(x) && FUNC_ISISR(x))
-//#define FUNC_RBANK(x) (x->funcAttrs.rbank)
 #define IFFUNC_RBANK(x) (IS_FUNC(x) && FUNC_RBANK(x))
 #define FUNC_INTNO(x) (x->funcAttrs.intno)
 #define FUNC_REGBANK(x) (x->funcAttrs.regbank)
@@ -311,6 +334,8 @@ symbol;
 #define IFFUNC_BANKED(x) (IS_FUNC(x) && FUNC_BANKED(x))
 #define FUNC_ISCRITICAL(x) (x->funcAttrs.critical)
 #define IFFUNC_ISCRITICAL(x) (IS_FUNC(x) && FUNC_ISCRITICAL(x))
+#define FUNC_ISBUILTIN(x) (x->funcAttrs.builtin)
+#define IFFUNC_ISBUILTIN(x) (IS_FUNC(x) && FUNC_ISBUILTIN(x))
 
 // jwk: I am not sure about this
 #define IFFUNC_ISBANKEDCALL(x) (!IFFUNC_NONBANKED(x) && \
@@ -366,6 +391,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_UNSIGNED(x) (IS_SPEC(x) && x->select.s._unsigned)
 #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)
@@ -474,6 +500,7 @@ int isSymbolEqual (symbol *, symbol *);
 int powof2 (unsigned long);
 void printTypeChain (sym_link *, FILE *);
 void initCSupport ();
+void initBuiltIns ();
 void pointerTypes (sym_link *, sym_link *);
 void cdbTypeInfo (sym_link *, FILE *);
 void cdbSymbol (symbol *, FILE *, int, int);
@@ -487,6 +514,8 @@ void *findSymWithLevel (bucket **, struct symbol *);
 void *findSymWithBlock (bucket **, struct symbol *, int);
 void changePointer (symbol * sym);
 void checkTypeSanity(sym_link *etype, char *name);
+sym_link *typeFromStr (char *) ;
+
 
 extern char *nounName(sym_link *); /* noun strings */
 extern void printFromToType (sym_link *, sym_link *);