#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
unsigned rbank:1; /* seperate register bank */
unsigned intno; /* 1=Interrupt svc routine */
unsigned regbank; /* register bank 2b used */
+ unsigned builtin; /* is a builtin function */
+ unsigned javaNative; /* is a JavaNative Function (TININative ONLY) */
+ unsigned overlay; /* force parameters & locals into overlay segment */
+ unsigned hasStackParms; /* function has parameters on stack */
} funcAttrs;
struct sym_link *next; /* next element on the chain */
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 */
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 */
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 */
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;
#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)
+#define FUNC_HASSTACKPARM(x) (x->funcAttrs.hasStackParms)
#define FUNC_ISREENT(x) (x->funcAttrs.reent)
#define IFFUNC_ISREENT(x) (IS_FUNC(x) && FUNC_ISREENT(x))
#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))
+#define FUNC_ISJAVANATIVE(x) (x->funcAttrs.javaNative)
+#define IFFUNC_ISJAVANATIVE(x) (IS_FUNC(x) && FUNC_ISJAVANATIVE(x))
+#define FUNC_ISOVERLAY(x) (x->funcAttrs.overlay)
+#define IFFUNC_ISOVERLAY(x) (IS_FUNC(x) && FUNC_ISOVERLAY(x))
+
// jwk: I am not sure about this
#define IFFUNC_ISBANKEDCALL(x) (!IFFUNC_NONBANKED(x) && \
#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)
sym_link *structElemType (sym_link *, value *);
symbol *getStructElement (structdef *, symbol *);
sym_link *computeType (sym_link *, sym_link *);
-void processFuncArgs (symbol *, int);
+void processFuncArgs (symbol *);
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);
void *findSymWithBlock (bucket **, struct symbol *, int);
void changePointer (symbol * sym);
void checkTypeSanity(sym_link *etype, char *name);
-/* noun strings */
-extern char *nounName(sym_link *);
+sym_link *typeFromStr (char *) ;
+
+
+extern char *nounName(sym_link *); /* noun strings */
+extern void printFromToType (sym_link *, sym_link *);
#endif