X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCsymt.h;h=2b06d0dd653dc98e8c2d79c4edebc3246cb295e9;hb=99535cf8f5a5c9cb6db85e5f19559ebc7e993f0a;hp=c18f335982ea7cadf36b5160379886ee1e3e9e4f;hpb=6797e238f839e2c19c7554e6243153384e5907ee;p=fw%2Fsdcc diff --git a/src/SDCCsymt.h b/src/SDCCsymt.h index c18f3359..2b06d0dd 100644 --- a/src/SDCCsymt.h +++ b/src/SDCCsymt.h @@ -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 */ @@ -276,7 +278,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 +294,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 @@ -322,7 +331,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) @@ -375,6 +383,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] @@ -395,7 +405,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 *); @@ -419,7 +429,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 +449,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