X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCsymt.h;h=b253154f955047f3d373b21e07778de117e012bc;hb=f394f02423f3b9490b60a5f603ebc4af0041b573;hp=c18f335982ea7cadf36b5160379886ee1e3e9e4f;hpb=6797e238f839e2c19c7554e6243153384e5907ee;p=fw%2Fsdcc diff --git a/src/SDCCsymt.h b/src/SDCCsymt.h index c18f3359..b253154f 100644 --- a/src/SDCCsymt.h +++ b/src/SDCCsymt.h @@ -25,7 +25,8 @@ #define SDCCSYMT_H #define MAX_NEST_LEVEL 256 -#define SDCC_NAME_MAX 64 +#define SDCC_SYMNAME_MAX 64 +#define SDCC_NAME_MAX 3*SDCC_SYMNAME_MAX // big enough for ___etc #include "SDCChasht.h" @@ -55,14 +56,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 +74,6 @@ typedef enum S_FIXED = 0, S_AUTO, S_REGISTER, - S_CONSTANT, S_SFR, S_SBIT, S_CODE, @@ -97,6 +98,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 +108,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 */ @@ -120,9 +123,9 @@ typedef struct specifier union { /* Values if constant or enum */ - int v_int; /* int and char values */ + short int v_int; /* int and char values */ char *v_char; /* character string */ - unsigned v_uint; /* unsigned int const value */ + unsigned short v_uint; /* unsigned int const value */ long v_long; /* long constant value */ unsigned long v_ulong; /* unsigned long constant val */ double v_float; /* floating point constant value */ @@ -180,7 +183,7 @@ sym_link; typedef struct symbol { - char name[SDCC_NAME_MAX + 1]; /* Input Variable Name */ + char name[SDCC_SYMNAME_MAX + 1]; /* Input Variable Name */ char rname[SDCC_NAME_MAX + 1]; /* internal name */ short level; /* declration lev,fld offset */ @@ -225,6 +228,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 +280,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 +296,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 +330,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 +386,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 +408,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 +421,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 +432,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 +452,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