1 /*-------------------------------------------------------------------------
2 SDCCsymt.h - Header file for Symbols table related structures and MACRO's.
3 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998)
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding!
22 -------------------------------------------------------------------------*/
27 #define MAX_NEST_LEVEL 256
28 #define SDCC_SYMNAME_MAX 64
29 #define SDCC_NAME_MAX 3*SDCC_SYMNAME_MAX // big enough for _<func>_<var>_etc
30 #include "SDCChasht.h"
31 #include "SDCCglobl.h"
33 #define INTNO_MAX 255 /* maximum allowed interrupt number */
34 #define INTNO_UNSPEC (INTNO_MAX+1) /* interrupt number unspecified */
61 // values for first byte of generic pointer.
65 #define GPTYPE_XSTACK 3
66 #define GPTYPE_GPTR 4 // Never used?
67 #define GPTYPE_IDATA 5
69 #define HASHTAB_SIZE 256
71 /* hash table bucket */
74 void *sym; /* pointer to the object */
75 char name[SDCC_NAME_MAX + 1]; /* name of this symbol */
76 int level; /* nest level for this symbol */
77 int block; /* belongs to which block */
78 struct bucket *prev; /* ptr 2 previous bucket */
79 struct bucket *next; /* ptr 2 next bucket */
83 typedef struct structdef
85 char tag[SDCC_NAME_MAX + 1]; /* tag part of structure */
86 unsigned char level; /* Nesting level */
87 struct symbol *fields; /* pointer to fields */
88 unsigned size; /* sizeof the table in bytes */
89 int type; /* STRUCT or UNION */
93 /* noun definitions */
130 /* specifier is the last in the type-chain */
131 typedef struct specifier
133 NOUN noun; /* CHAR INT STRUCTURE LABEL */
134 STORAGE_CLASS sclass; /* REGISTER,AUTO,FIX,CONSTANT */
135 struct memmap *oclass; /* output storage class */
136 unsigned _long:1; /* 1=long */
137 unsigned _short:1; /* 1=short int */
138 unsigned _unsigned:1; /* 1=unsigned, 0=signed */
139 unsigned _signed:1; /* just for sanity checks only*/
140 unsigned _static:1; /* 1=static keyword found */
141 unsigned _extern:1; /* 1=extern found */
142 unsigned _absadr:1; /* absolute address specfied */
143 unsigned _volatile:1; /* is marked as volatile */
144 unsigned _const:1; /* is a constant */
145 unsigned _typedef:1; /* is typedefed */
146 unsigned _isregparm:1; /* is the first parameter */
147 unsigned _isenum:1; /* is an enumerated type */
148 unsigned _addr; /* address of symbol */
149 unsigned _stack; /* stack offset for stacked v */
150 unsigned _bitStart; /* bit start position */
151 int _bitLength; /* bit length */
152 int argreg; /* reg no for regparm */
154 { /* Values if constant or enum */
155 TYPE_WORD v_int; /* 2 bytes: int and char values */
156 char *v_char; /* character string */
157 TYPE_UWORD v_uint; /* 2 bytes: unsigned int const value */
158 TYPE_DWORD v_long; /* 4 bytes: long constant value */
159 TYPE_UDWORD v_ulong; /* 4 bytes: unsigned long constant val */
160 double v_float; /* floating point constant value */
161 struct symbol *v_enum; /* ptr 2 enum_list if enum==1 */
164 struct structdef *v_struct; /* structure pointer */
168 /* types of declarators */
171 POINTER = 0, /* pointer to near data */
172 FPOINTER, /* pointer to far data */
173 CPOINTER, /* pointer to code space */
174 GPOINTER, /* _generic pointer */
175 PPOINTER, /* paged area pointer */
176 IPOINTER, /* pointer to upper 128 bytes */
177 UPOINTER, /* unknown pointer used only when parsing */
178 EEPPOINTER, /* pointer to eeprom */
184 typedef struct declarator
186 DECLARATOR_TYPE dcl_type; /* POINTER,ARRAY or FUNCTION */
187 unsigned int num_elem; /* # of elems if type==array */
188 unsigned ptr_const:1; /* pointer is constant */
189 unsigned ptr_volatile:1; /* pointer is volatile */
190 struct sym_link *tspec; /* pointer type specifier */
198 #define DECLSPEC2TXT(select) (select==DECLARATOR?"DECLARATOR":select==SPECIFIER?"SPECIFIER":"UNKNOW")
200 typedef struct sym_link
202 SYM_LINK_CLASS class; /* DECLARATOR or SPECIFIER */
203 unsigned tdef:1; /* current link created by */
204 /* typedef if this flag is set */
207 specifier s; /* if CLASS == SPECIFIER */
208 declarator d; /* if CLASS == DECLARATOR */
211 /* function attributes */
213 struct value *args; /* the defined arguments */
214 unsigned hasVargs:1; /* functions has varargs */
215 unsigned calleeSaves:1; /* functions uses callee save */
216 unsigned hasbody:1; /* function body defined */
217 unsigned hasFcall:1; /* does it call other functions */
218 unsigned reent:1; /* function is reentrant */
219 unsigned naked:1; /* naked function */
221 unsigned nonbanked:1; /* function has the nonbanked attribute */
222 unsigned banked:1; /* function has the banked attribute */
223 unsigned critical:1; /* critical function */
224 unsigned intrtn:1; /* this is an interrupt routin */
225 unsigned rbank:1; /* seperate register bank */
226 unsigned intno; /* 1=Interrupt svc routine */
227 unsigned regbank; /* register bank 2b used */
228 unsigned builtin; /* is a builtin function */
229 unsigned javaNative; /* is a JavaNative Function (TININative ONLY) */
230 unsigned overlay; /* force parameters & locals into overlay segment */
231 unsigned hasStackParms; /* function has parameters on stack */
234 struct sym_link *next; /* next element on the chain */
238 typedef struct symbol
240 char name[SDCC_SYMNAME_MAX + 1]; /* Input Variable Name */
241 char rname[SDCC_NAME_MAX + 1]; /* internal name */
243 short level; /* declration lev,fld offset */
244 short block; /* sequential block # of defintion */
246 unsigned implicit:1; /* implicit flag */
247 unsigned undefined:1; /* undefined variable */
248 unsigned _isparm:1; /* is a parameter */
249 unsigned ismyparm:1; /* is parameter of the function being generated */
250 unsigned isitmp:1; /* is an intermediate temp */
251 unsigned islbl:1; /* is a temporary label */
252 unsigned isref:1; /* has been referenced */
253 unsigned isind:1; /* is a induction variable */
254 unsigned isinvariant:1; /* is a loop invariant */
255 unsigned cdef:1; /* compiler defined symbol */
256 unsigned addrtaken:1; /* address of the symbol was taken */
257 unsigned isreqv:1; /* is the register quivalent of a symbol */
258 unsigned udChked:1; /* use def checking has been already done */
260 /* following flags are used by the backend
261 for code generation and can be changed
262 if a better scheme for backend is thought of */
263 unsigned isLiveFcall:1; /* is live at or across a function call */
264 unsigned isspilt:1; /* has to be spilt */
265 unsigned spillA:1; /* spilt be register allocator */
266 unsigned remat:1; /* can be remateriazed */
267 unsigned isptr:1; /* is a pointer */
268 unsigned uptr:1; /* used as a pointer */
269 unsigned isFree:1; /* used by register allocator */
270 unsigned islocal:1; /* is a local variable */
271 unsigned blockSpil:1; /* spilt at block level */
272 unsigned remainSpil:1; /* spilt because not used in remainder */
273 unsigned stackSpil:1; /* has been spilt on temp stack location */
274 unsigned onStack:1; /* this symbol allocated on the stack */
275 unsigned iaccess:1; /* indirect access */
276 unsigned ruonly:1; /* used in return statement only */
277 unsigned spildir:1; /* spilt in direct space */
278 unsigned ptrreg:1; /* this symbol assigned to a ptr reg */
279 unsigned noSpilLoc:1; /* cannot be assigned a spil location */
280 unsigned isstrlit; /* is a string literal and it's usage count */
281 unsigned accuse; /* can be left in the accumulator
282 On the Z80 accuse is devided into
283 ACCUSE_A and ACCUSE_HL as the idea
286 unsigned dptr; /* 8051 variants with multiple DPTRS
287 currently implemented in DS390 only
289 int allocreq ; /* allocation is required for this variable */
290 int stack; /* offset on stack */
291 int xstack; /* offset on xternal stack */
292 short nRegs; /* number of registers required */
293 short regType; /* type of register required */
295 struct regs *regs[4]; /* can have at the most 4 registers */
296 struct asmop *aop; /* asmoperand for this symbol */
297 struct iCode *fuse; /* furthest use */
298 struct iCode *rematiCode; /* rematerialse with which instruction */
299 struct operand *reqv; /* register equivalent of a local variable */
300 struct symbol *prereqv; /* symbol before register equiv. substituion */
301 struct symbol *psbase; /* if pseudo symbol, the symbol it is based on */
304 struct symbol *spillLoc; /* register spil location */
305 struct set *itmpStack; /* symbols spilt @ this stack location */
308 short bitVar; /* this is a bit variable */
309 unsigned offset; /* offset from top if struct */
311 int lineDef; /* defined line number */
312 char *fileDef; /* defined filename */
313 int lastLine; /* for functions the last line */
314 struct sym_link *type; /* 1st link to declator chain */
315 struct sym_link *etype; /* last link to declarator chn */
316 struct symbol *next; /* crosslink to next symbol */
317 struct symbol *localof; /* local variable of which function */
318 struct initList *ival; /* ptr to initializer if any */
319 struct bitVect *defs; /* bit vector for definitions */
320 struct bitVect *uses; /* bit vector for uses */
321 struct bitVect *regsUsed; /* for functions registers used */
322 int liveFrom; /* live from iCode sequence number */
323 int liveTo; /* live to sequence number */
324 int used; /* no. of times this was used */
325 int recvSize; /* size of first argument */
326 struct bitVect *clashes; /* overlaps with what other symbols */
330 extern sym_link *validateLink(sym_link *l,
336 /* Easy Access Macros */
337 #define DCL_TYPE(l) validateLink(l, "DCL_TYPE", #l, DECLARATOR, __FILE__, __LINE__)->select.d.dcl_type
338 #define DCL_ELEM(l) validateLink(l, "DCL_ELEM", #l, DECLARATOR, __FILE__, __LINE__)->select.d.num_elem
339 #define DCL_PTR_CONST(l) validateLink(l, "DCL_PTR_CONST", #l, DECLARATOR, __FILE__, __LINE__)->select.d.ptr_const
340 #define DCL_PTR_VOLATILE(l) validateLink(l, "DCL_PTR_VOLATILE", #l, DECLARATOR, __FILE__, __LINE__)->select.d.ptr_volatile
341 #define DCL_TSPEC(l) validateLink(l, "DCL_TSPEC", #l, DECLARATOR, __FILE__, __LINE__)->select.d.tspec
343 #define FUNC_DEBUG //assert(IS_FUNC(x));
344 #define FUNC_HASVARARGS(x) (x->funcAttrs.hasVargs)
345 #define IFFUNC_HASVARARGS(x) (IS_FUNC(x) && FUNC_HASVARARGS(x))
346 #define FUNC_ARGS(x) (x->funcAttrs.args)
347 #define IFFUNC_ARGS(x) (IS_FUNC(x) && FUNC_ARGS(x))
348 #define FUNC_HASFCALL(x) (x->funcAttrs.hasFcall)
349 #define IFFUNC_HASFCALL(x) (IS_FUNC(x) && FUNC_HASFCALL(x))
350 #define FUNC_HASBODY(x) (x->funcAttrs.hasbody)
351 #define IFFUNC_HASBODY(x) (IS_FUNC(x) && FUNC_HASBODY(x))
352 #define FUNC_CALLEESAVES(x) (x->funcAttrs.calleeSaves)
353 #define IFFUNC_CALLEESAVES(x) (IS_FUNC(x) && FUNC_CALLEESAVES(x))
354 #define FUNC_ISISR(x) (x->funcAttrs.intrtn)
355 #define IFFUNC_ISISR(x) (IS_FUNC(x) && FUNC_ISISR(x))
356 #define IFFUNC_RBANK(x) (IS_FUNC(x) && FUNC_RBANK(x))
357 #define FUNC_INTNO(x) (x->funcAttrs.intno)
358 #define FUNC_REGBANK(x) (x->funcAttrs.regbank)
359 #define FUNC_HASSTACKPARM(x) (x->funcAttrs.hasStackParms)
361 #define FUNC_ISREENT(x) (x->funcAttrs.reent)
362 #define IFFUNC_ISREENT(x) (IS_FUNC(x) && FUNC_ISREENT(x))
363 #define FUNC_ISNAKED(x) (x->funcAttrs.naked)
364 #define IFFUNC_ISNAKED(x) (IS_FUNC(x) && FUNC_ISNAKED(x))
365 #define FUNC_NONBANKED(x) (x->funcAttrs.nonbanked)
366 #define IFFUNC_NONBANKED(x) (IS_FUNC(x) && FUNC_NONBANKED(x))
367 #define FUNC_BANKED(x) (x->funcAttrs.banked)
368 #define IFFUNC_BANKED(x) (IS_FUNC(x) && FUNC_BANKED(x))
369 #define FUNC_ISCRITICAL(x) (x->funcAttrs.critical)
370 #define IFFUNC_ISCRITICAL(x) (IS_FUNC(x) && FUNC_ISCRITICAL(x))
371 #define FUNC_ISBUILTIN(x) (x->funcAttrs.builtin)
372 #define IFFUNC_ISBUILTIN(x) (IS_FUNC(x) && FUNC_ISBUILTIN(x))
373 #define FUNC_ISJAVANATIVE(x) (x->funcAttrs.javaNative)
374 #define IFFUNC_ISJAVANATIVE(x) (IS_FUNC(x) && FUNC_ISJAVANATIVE(x))
375 #define FUNC_ISOVERLAY(x) (x->funcAttrs.overlay)
376 #define IFFUNC_ISOVERLAY(x) (IS_FUNC(x) && FUNC_ISOVERLAY(x))
378 #define IFFUNC_ISBANKEDCALL(x) (!IFFUNC_NONBANKED(x) && \
379 (options.model == MODEL_LARGE || \
380 options.model == MODEL_MEDIUM || \
383 #define SPEC_NOUN(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s.noun
384 #define SPEC_LONG(x) validateLink(x, "SPEC_LONG", #x, SPECIFIER, __FILE__, __LINE__)->select.s._long
385 #define SPEC_SHORT(x) validateLink(x, "SPEC_LONG", #x, SPECIFIER, __FILE__, __LINE__)->select.s._short
386 #define SPEC_USIGN(x) validateLink(x, "SPEC_USIGN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._unsigned
387 #define SPEC_SCLS(x) validateLink(x, "SPEC_SCLS", #x, SPECIFIER, __FILE__, __LINE__)->select.s.sclass
388 #define SPEC_ENUM(x) validateLink(x, "SPEC_ENUM", #x, SPECIFIER, __FILE__, __LINE__)->select.s._isenum
389 #define SPEC_OCLS(x) validateLink(x, "SPEC_OCLS", #x, SPECIFIER, __FILE__, __LINE__)->select.s.oclass
390 #define SPEC_STAT(x) validateLink(x, "SPEC_STAT", #x, SPECIFIER, __FILE__, __LINE__)->select.s._static
391 #define SPEC_EXTR(x) validateLink(x, "SPEC_EXTR", #x, SPECIFIER, __FILE__, __LINE__)->select.s._extern
392 #define SPEC_CODE(x) validateLink(x, "SPEC_CODE", #x, SPECIFIER, __FILE__, __LINE__)->select.s._codesg
393 #define SPEC_ABSA(x) validateLink(x, "SPEC_ABSA", #x, SPECIFIER, __FILE__, __LINE__)->select.s._absadr
394 #define SPEC_BANK(x) validateLink(x, "SPEC_BANK", #x, SPECIFIER, __FILE__, __LINE__)->select.s._regbank
395 #define SPEC_ADDR(x) validateLink(x, "SPEC_ADDR", #x, SPECIFIER, __FILE__, __LINE__)->select.s._addr
396 #define SPEC_STAK(x) validateLink(x, "SPEC_STAK", #x, SPECIFIER, __FILE__, __LINE__)->select.s._stack
397 #define SPEC_CVAL(x) validateLink(x, "SPEC_CVAL", #x, SPECIFIER, __FILE__, __LINE__)->select.s.const_val
398 #define SPEC_BSTR(x) validateLink(x, "SPEC_BSTR", #x, SPECIFIER, __FILE__, __LINE__)->select.s._bitStart
399 #define SPEC_BLEN(x) validateLink(x, "SPEC_BLEN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._bitLength
401 /* Sleaze: SPEC_ISR_SAVED_BANKS is only used on
402 * function type symbols, which obviously cannot
403 * be of BIT type. Therefore, we recycle the
404 * _bitStart field instead of defining a new field.
406 #define SPEC_ISR_SAVED_BANKS(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._bitStart
407 #define SPEC_VOLATILE(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._volatile
408 #define SPEC_CONST(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._const
409 #define SPEC_STRUCT(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s.v_struct
410 #define SPEC_TYPEDEF(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._typedef
411 #define SPEC_REGPARM(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._isregparm
412 #define SPEC_ARGREG(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s.argreg
414 /* type check macros */
415 #define IS_DECL(x) ( x && x->class == DECLARATOR )
416 #define IS_SPEC(x) ( x && x->class == SPECIFIER )
417 #define IS_ARRAY(x) (IS_DECL(x) && DCL_TYPE(x) == ARRAY)
418 #define IS_DATA_PTR(x) (IS_DECL(x) && DCL_TYPE(x) == POINTER)
419 #define IS_PTR(x) (IS_DECL(x) && (DCL_TYPE(x) == POINTER || \
420 DCL_TYPE(x) == FPOINTER || \
421 DCL_TYPE(x) == GPOINTER || \
422 DCL_TYPE(x) == IPOINTER || \
423 DCL_TYPE(x) == PPOINTER || \
424 DCL_TYPE(x) == EEPPOINTER || \
425 DCL_TYPE(x) == CPOINTER || \
426 DCL_TYPE(x) == UPOINTER ))
427 #define IS_PTR_CONST(x) (IS_PTR(x) && DCL_PTR_CONST(x))
428 #define IS_FARPTR(x) (IS_DECL(x) && DCL_TYPE(x) == FPOINTER)
429 #define IS_CODEPTR(x) (IS_DECL(x) && DCL_TYPE(x) == CPOINTER)
430 #define IS_GENPTR(x) (IS_DECL(x) && DCL_TYPE(x) == GPOINTER)
431 #define IS_FUNC(x) (IS_DECL(x) && DCL_TYPE(x) == FUNCTION)
432 #define IS_LONG(x) (IS_SPEC(x) && x->select.s._long)
433 #define IS_UNSIGNED(x) (IS_SPEC(x) && x->select.s._unsigned)
434 #define IS_TYPEDEF(x)(IS_SPEC(x) && x->select.s._typedef)
435 #define IS_CONSTANT(x) (!x ? 0 : \
437 x->select.s._const : \
438 x->select.d.ptr_const)
439 #define IS_STRUCT(x) (IS_SPEC(x) && x->select.s.noun == V_STRUCT)
440 #define IS_ABSOLUTE(x) (IS_SPEC(x) && x->select.s._absadr )
441 #define IS_REGISTER(x) (IS_SPEC(x) && SPEC_SCLS(x) == S_REGISTER)
442 #define IS_RENT(x) (IS_SPEC(x) && x->select.s._reent )
443 #define IS_STATIC(x) (IS_SPEC(x) && SPEC_STAT(x))
444 #define IS_INT(x) (IS_SPEC(x) && x->select.s.noun == V_INT)
445 #define IS_VOID(x) (IS_SPEC(x) && x->select.s.noun == V_VOID)
446 #define IS_CHAR(x) (IS_SPEC(x) && x->select.s.noun == V_CHAR)
447 #define IS_EXTERN(x) (IS_SPEC(x) && x->select.s._extern)
448 #define IS_VOLATILE(x) (!x ? 0 : \
450 x->select.s._volatile : \
451 x->select.d.ptr_volatile)
452 #define IS_INTEGRAL(x) (IS_SPEC(x) && (x->select.s.noun == V_INT || \
453 x->select.s.noun == V_CHAR || \
454 x->select.s.noun == V_BITFIELD || \
455 x->select.s.noun == V_BIT || \
456 x->select.s.noun == V_SBIT ))
457 #define IS_BITFIELD(x) (IS_SPEC(x) && (x->select.s.noun == V_BITFIELD))
458 #define IS_BITVAR(x) (IS_SPEC(x) && (x->select.s.noun == V_BITFIELD || \
459 x->select.s.noun == V_BIT || \
460 x->select.s.noun == V_SBIT ))
461 #define IS_BIT(x) (IS_SPEC(x) && (x->select.s.noun == V_BIT || \
462 x->select.s.noun == V_SBIT ))
463 #define IS_FLOAT(x) (IS_SPEC(x) && x->select.s.noun == V_FLOAT)
464 #define IS_ARITHMETIC(x) (IS_INTEGRAL(x) || IS_FLOAT(x))
465 #define IS_AGGREGATE(x) (IS_ARRAY(x) || IS_STRUCT(x))
466 #define IS_LITERAL(x) (IS_SPEC(x) && x->select.s.sclass == S_LITERAL)
467 #define IS_CODE(x) (IS_SPEC(x) && SPEC_SCLS(x) == S_CODE)
468 #define IS_REGPARM(x) (IS_SPEC(x) && SPEC_REGPARM(x))
470 /* symbol check macros */
471 #define IS_AUTO(x) (x->level && !IS_STATIC(x->etype) && !IS_EXTERN(x->etype))
473 /* forward declaration for the global vars */
474 extern bucket *SymbolTab[];
475 extern bucket *StructTab[];
476 extern bucket *TypedefTab[];
477 extern bucket *LabelTab[];
478 extern bucket *enumTab[];
479 extern symbol *__fsadd;
480 extern symbol *__fssub;
481 extern symbol *__fsmul;
482 extern symbol *__fsdiv;
483 extern symbol *__fseq;
484 extern symbol *__fsneq;
485 extern symbol *__fslt;
486 extern symbol *__fslteq;
487 extern symbol *__fsgt;
488 extern symbol *__fsgteq;
490 /* Dims: mul/div/mod, BYTE/WORD/DWORD, SIGNED/UNSIGNED */
491 extern symbol *__muldiv[3][3][2];
492 /* Dims: BYTE/WORD/DWORD SIGNED/UNSIGNED */
493 extern sym_link *__multypes[3][2];
494 /* Dims: to/from float, BYTE/WORD/DWORD, SIGNED/USIGNED */
495 extern symbol *__conv[2][3][2];
496 /* Dims: shift left/shift right, BYTE/WORD/DWORD, SIGNED/UNSIGNED */
497 extern symbol *__rlrr[2][3][2];
499 #define CHARTYPE __multypes[0][0]
500 #define UCHARTYPE __multypes[0][1]
501 #define INTTYPE __multypes[1][0]
502 #define UINTTYPE __multypes[1][1]
503 #define LONGTYPE __multypes[2][0]
504 #define ULONGTYPE __multypes[2][1]
507 extern sym_link *floatType;
513 RESULT_TYPE_NONE = 0, /* operands will be promoted to int */
514 RESULT_CHECK = 0, /* TODO: replace all occurences with the appropriate type and remove me */
518 RESULT_TYPE_OTHER, /* operands will be promoted to int */
522 /* forward definitions for the symbol table related functions */
524 symbol *newSymbol (char *, int);
525 sym_link *newLink (SYM_LINK_CLASS);
526 sym_link *newFloatLink ();
527 structdef *newStruct (char *);
528 void addDecl (symbol *, int, sym_link *);
529 sym_link *mergeSpec (sym_link *, sym_link *, char *name);
530 symbol *reverseSyms (symbol *);
531 sym_link *reverseLink (sym_link *);
532 symbol *copySymbol (symbol *);
533 symbol *copySymbolChain (symbol *);
534 void printSymChain (symbol *, int);
535 void printStruct (structdef *, int);
536 char *genSymName (int);
537 sym_link *getSpec (sym_link *);
538 char *genSymName (int);
539 int compStructSize (int, structdef *);
540 sym_link *copyLinkChain (sym_link *);
541 int checkDecl (symbol *, int);
542 void checkBasic (sym_link *, sym_link *);
543 value *checkPointerIval (sym_link *, value *);
544 value *checkStructIval (symbol *, value *);
545 value *checkArrayIval (sym_link *, value *);
546 value *checkIval (sym_link *, value *);
547 unsigned int getSize (sym_link *);
548 unsigned int bitsForType (sym_link *);
549 sym_link *newIntLink ();
550 sym_link *newCharLink ();
551 sym_link *newLongLink ();
552 int compareType (sym_link *, sym_link *);
553 int compareTypeExact (sym_link *, sym_link *, int);
554 int checkFunction (symbol *, symbol *);
555 void cleanUpLevel (bucket **, int);
556 void cleanUpBlock (bucket **, int);
557 int funcInChain (sym_link *);
558 void addSymChain (symbol *);
559 sym_link *structElemType (sym_link *, value *);
560 symbol *getStructElement (structdef *, symbol *);
561 sym_link *computeType (sym_link *, sym_link *, RESULT_TYPE, int);
562 void processFuncArgs (symbol *);
563 int isSymbolEqual (symbol *, symbol *);
564 int powof2 (TYPE_UDWORD);
565 void printTypeChain (sym_link *, FILE *);
566 void printTypeChainRaw (sym_link *, FILE *);
567 void initCSupport ();
568 void initBuiltIns ();
569 void pointerTypes (sym_link *, sym_link *);
570 void cdbStructBlock (int);
572 bucket *newBucket ();
573 void addSym (bucket **, void *, char *, int, int, int checkType);
574 void deleteSym (bucket **, void *, char *);
575 void *findSym (bucket **, void *, const char *);
576 void *findSymWithLevel (bucket **, struct symbol *);
577 void *findSymWithBlock (bucket **, struct symbol *, int);
578 void changePointer (symbol * sym);
579 void checkTypeSanity(sym_link *etype, char *name);
580 sym_link *typeFromStr (char *) ;
581 STORAGE_CLASS sclsFromPtr(sym_link *ptr);
582 sym_link *newEnumType (symbol *);
583 void promoteAnonStructs (int, structdef *);
586 extern char *nounName(sym_link *); /* noun strings */
587 extern void printFromToType (sym_link *, sym_link *);