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 */
58 // values for first byte of generic pointer.
62 #define GPTYPE_XSTACK 3
63 #define GPTYPE_GPTR 4 // Never used?
64 #define GPTYPE_IDATA 5
66 #define HASHTAB_SIZE 256
68 /* hash table bucket */
71 void *sym; /* pointer to the object */
72 char name[SDCC_NAME_MAX + 1]; /* name of this symbol */
73 int level; /* nest level for this symbol */
74 int block; /* belongs to which block */
75 struct bucket *prev; /* ptr 2 previous bucket */
76 struct bucket *next; /* ptr 2 next bucket */
80 typedef struct structdef
82 char tag[SDCC_NAME_MAX + 1]; /* tag part of structure */
83 unsigned char level; /* Nesting level */
84 struct symbol *fields; /* pointer to fields */
85 unsigned size; /* sizeof the table in bytes */
89 /* noun definitions */
125 /* specifier is the last in the type-chain */
126 typedef struct specifier
128 NOUN noun; /* CHAR INT STRUCTURE LABEL */
129 STORAGE_CLASS sclass; /* REGISTER,AUTO,FIX,CONSTANT */
130 struct memmap *oclass; /* output storage class */
131 unsigned _long:1; /* 1=long */
132 unsigned _short:1; /* 1=short int */
133 unsigned _unsigned:1; /* 1=unsigned, 0=signed */
134 unsigned _signed:1; /* just for sanity checks only*/
135 unsigned _static:1; /* 1=static keyword found */
136 unsigned _extern:1; /* 1=extern found */
137 unsigned _absadr:1; /* absolute address specfied */
138 unsigned _volatile:1; /* is marked as volatile */
139 unsigned _const:1; /* is a constant */
140 unsigned _typedef:1; /* is typedefed */
141 unsigned _isregparm:1; /* is the first parameter */
142 unsigned _isenum:1; /* is an enumerated type */
143 unsigned _addr; /* address of symbol */
144 unsigned _stack; /* stack offset for stacked v */
145 unsigned _bitStart; /* bit start position */
146 int _bitLength; /* bit length */
147 int argreg; /* reg no for regparm */
149 { /* Values if constant or enum */
150 TYPE_WORD v_int; /* 2 bytes: int and char values */
151 char *v_char; /* character string */
152 TYPE_UWORD v_uint; /* 2 bytes: unsigned int const value */
153 TYPE_DWORD v_long; /* 4 bytes: long constant value */
154 TYPE_UDWORD v_ulong; /* 4 bytes: unsigned long constant val */
155 double v_float; /* floating point constant value */
156 struct symbol *v_enum; /* ptr 2 enum_list if enum==1 */
159 struct structdef *v_struct; /* structure pointer */
163 /* types of declarators */
166 POINTER = 0, /* pointer to near data */
167 FPOINTER, /* pointer to far data */
168 CPOINTER, /* pointer to code space */
169 GPOINTER, /* _generic pointer */
170 PPOINTER, /* paged area pointer */
171 IPOINTER, /* pointer to upper 128 bytes */
172 UPOINTER, /* unknown pointer used only when parsing */
173 EEPPOINTER, /* pointer to eeprom */
179 typedef struct declarator
181 DECLARATOR_TYPE dcl_type; /* POINTER,ARRAY or FUNCTION */
182 unsigned int num_elem; /* # of elems if type==array */
183 unsigned ptr_const:1; /* pointer is constant */
184 unsigned ptr_volatile:1; /* pointer is volatile */
185 struct sym_link *tspec; /* pointer type specifier */
193 #define DECLSPEC2TXT(select) (select==DECLARATOR?"DECLARATOR":select==SPECIFIER?"SPECIFIER":"UNKNOW")
195 typedef struct sym_link
197 SYM_LINK_CLASS class; /* DECLARATOR or SPECIFIER */
198 unsigned tdef:1; /* current link created by */
199 /* typedef if this flag is set */
202 specifier s; /* if CLASS == SPECIFIER */
203 declarator d; /* if CLASS == DECLARATOR */
206 /* function attributes */
208 struct value *args; /* the defined arguments */
209 unsigned hasVargs:1; /* functions has varargs */
210 unsigned calleeSaves:1; /* functions uses callee save */
211 unsigned hasbody:1; /* function body defined */
212 unsigned hasFcall:1; /* does it call other functions */
213 unsigned reent:1; /* function is reentrant */
214 unsigned naked:1; /* naked function */
216 unsigned nonbanked:1; /* function has the nonbanked attribute */
217 unsigned banked:1; /* function has the banked attribute */
218 unsigned critical:1; /* critical function */
219 unsigned intrtn:1; /* this is an interrupt routin */
220 unsigned rbank:1; /* seperate register bank */
221 unsigned intno; /* 1=Interrupt svc routine */
222 unsigned regbank; /* register bank 2b used */
223 unsigned builtin; /* is a builtin function */
224 unsigned javaNative; /* is a JavaNative Function (TININative ONLY) */
225 unsigned overlay; /* force parameters & locals into overlay segment */
226 unsigned hasStackParms; /* function has parameters on stack */
229 struct sym_link *next; /* next element on the chain */
233 typedef struct symbol
235 char name[SDCC_SYMNAME_MAX + 1]; /* Input Variable Name */
236 char rname[SDCC_NAME_MAX + 1]; /* internal name */
238 short level; /* declration lev,fld offset */
239 short block; /* sequential block # of defintion */
241 unsigned implicit:1; /* implicit flag */
242 unsigned undefined:1; /* undefined variable */
243 unsigned _isparm:1; /* is a parameter */
244 unsigned ismyparm:1; /* is parameter of the function being generated */
245 unsigned isitmp:1; /* is an intermediate temp */
246 unsigned islbl:1; /* is a temporary label */
247 unsigned isref:1; /* has been referenced */
248 unsigned isind:1; /* is a induction variable */
249 unsigned isinvariant:1; /* is a loop invariant */
250 unsigned cdef:1; /* compiler defined symbol */
251 unsigned addrtaken:1; /* address of the symbol was taken */
252 unsigned isreqv:1; /* is the register quivalent of a symbol */
253 unsigned udChked:1; /* use def checking has been already done */
255 /* following flags are used by the backend
256 for code generation and can be changed
257 if a better scheme for backend is thought of */
258 unsigned isLiveFcall:1; /* is live at or across a function call */
259 unsigned isspilt:1; /* has to be spilt */
260 unsigned spillA:1; /* spilt be register allocator */
261 unsigned remat:1; /* can be remateriazed */
262 unsigned isptr:1; /* is a pointer */
263 unsigned uptr:1; /* used as a pointer */
264 unsigned isFree:1; /* used by register allocator */
265 unsigned islocal:1; /* is a local variable */
266 unsigned blockSpil:1; /* spilt at block level */
267 unsigned remainSpil:1; /* spilt because not used in remainder */
268 unsigned stackSpil:1; /* has been spilt on temp stack location */
269 unsigned onStack:1; /* this symbol allocated on the stack */
270 unsigned iaccess:1; /* indirect access */
271 unsigned ruonly:1; /* used in return statement only */
272 unsigned spildir:1; /* spilt in direct space */
273 unsigned ptrreg:1; /* this symbol assigned to a ptr reg */
274 unsigned noSpilLoc:1; /* cannot be assigned a spil location */
275 unsigned isstrlit; /* is a string literal and it's usage count */
276 unsigned accuse; /* can be left in the accumulator
277 On the Z80 accuse is devided into
278 ACCUSE_A and ACCUSE_HL as the idea
281 unsigned dptr; /* 8051 variants with multiple DPTRS
282 currently implemented in DS390 only
284 int allocreq ; /* allocation is required for this variable */
285 int stack; /* offset on stack */
286 int xstack; /* offset on xternal stack */
287 short nRegs; /* number of registers required */
288 short regType; /* type of register required */
290 struct regs *regs[4]; /* can have at the most 4 registers */
291 struct asmop *aop; /* asmoperand for this symbol */
292 struct iCode *fuse; /* furthest use */
293 struct iCode *rematiCode; /* rematerialse with which instruction */
294 struct operand *reqv; /* register equivalent of a local variable */
297 struct symbol *spillLoc; /* register spil location */
298 struct set *itmpStack; /* symbols spilt @ this stack location */
301 short bitVar; /* this is a bit variable */
302 unsigned offset; /* offset from top if struct */
304 int lineDef; /* defined line number */
305 int lastLine; /* for functions the last line */
306 struct sym_link *type; /* 1st link to declator chain */
307 struct sym_link *etype; /* last link to declarator chn */
308 struct symbol *next; /* crosslink to next symbol */
309 struct symbol *localof; /* local variable of which function */
310 struct initList *ival; /* ptr to initializer if any */
311 struct bitVect *defs; /* bit vector for definitions */
312 struct bitVect *uses; /* bit vector for uses */
313 struct bitVect *regsUsed; /* for functions registers used */
314 int liveFrom; /* live from iCode sequence number */
315 int liveTo; /* live to sequence number */
316 int used; /* no. of times this was used */
317 int recvSize; /* size of first argument */
318 struct bitVect *clashes; /* overlaps with what other symbols */
322 extern sym_link *validateLink(sym_link *l,
328 /* Easy Access Macros */
329 #define DCL_TYPE(l) validateLink(l, "DCL_TYPE", #l, DECLARATOR, __FILE__, __LINE__)->select.d.dcl_type
330 #define DCL_ELEM(l) validateLink(l, "DCL_ELEM", #l, DECLARATOR, __FILE__, __LINE__)->select.d.num_elem
331 #define DCL_PTR_CONST(l) validateLink(l, "DCL_PTR_CONST", #l, DECLARATOR, __FILE__, __LINE__)->select.d.ptr_const
332 #define DCL_PTR_VOLATILE(l) validateLink(l, "DCL_PTR_VOLATILE", #l, DECLARATOR, __FILE__, __LINE__)->select.d.ptr_volatile
333 #define DCL_TSPEC(l) validateLink(l, "DCL_TSPEC", #l, DECLARATOR, __FILE__, __LINE__)->select.d.tspec
335 #define FUNC_DEBUG //assert(IS_FUNC(x));
336 #define FUNC_HASVARARGS(x) (x->funcAttrs.hasVargs)
337 #define IFFUNC_HASVARARGS(x) (IS_FUNC(x) && FUNC_HASVARARGS(x))
338 #define FUNC_ARGS(x) (x->funcAttrs.args)
339 #define IFFUNC_ARGS(x) (IS_FUNC(x) && FUNC_ARGS(x))
340 #define FUNC_HASFCALL(x) (x->funcAttrs.hasFcall)
341 #define IFFUNC_HASFCALL(x) (IS_FUNC(x) && FUNC_HASFCALL(x))
342 #define FUNC_HASBODY(x) (x->funcAttrs.hasbody)
343 #define IFFUNC_HASBODY(x) (IS_FUNC(x) && FUNC_HASBODY(x))
344 #define FUNC_CALLEESAVES(x) (x->funcAttrs.calleeSaves)
345 #define IFFUNC_CALLEESAVES(x) (IS_FUNC(x) && FUNC_CALLEESAVES(x))
346 #define FUNC_ISISR(x) (x->funcAttrs.intrtn)
347 #define IFFUNC_ISISR(x) (IS_FUNC(x) && FUNC_ISISR(x))
348 #define IFFUNC_RBANK(x) (IS_FUNC(x) && FUNC_RBANK(x))
349 #define FUNC_INTNO(x) (x->funcAttrs.intno)
350 #define FUNC_REGBANK(x) (x->funcAttrs.regbank)
351 #define FUNC_HASSTACKPARM(x) (x->funcAttrs.hasStackParms)
353 #define FUNC_ISREENT(x) (x->funcAttrs.reent)
354 #define IFFUNC_ISREENT(x) (IS_FUNC(x) && FUNC_ISREENT(x))
355 #define FUNC_ISNAKED(x) (x->funcAttrs.naked)
356 #define IFFUNC_ISNAKED(x) (IS_FUNC(x) && FUNC_ISNAKED(x))
357 #define FUNC_NONBANKED(x) (x->funcAttrs.nonbanked)
358 #define IFFUNC_NONBANKED(x) (IS_FUNC(x) && FUNC_NONBANKED(x))
359 #define FUNC_BANKED(x) (x->funcAttrs.banked)
360 #define IFFUNC_BANKED(x) (IS_FUNC(x) && FUNC_BANKED(x))
361 #define FUNC_ISCRITICAL(x) (x->funcAttrs.critical)
362 #define IFFUNC_ISCRITICAL(x) (IS_FUNC(x) && FUNC_ISCRITICAL(x))
363 #define FUNC_ISBUILTIN(x) (x->funcAttrs.builtin)
364 #define IFFUNC_ISBUILTIN(x) (IS_FUNC(x) && FUNC_ISBUILTIN(x))
365 #define FUNC_ISJAVANATIVE(x) (x->funcAttrs.javaNative)
366 #define IFFUNC_ISJAVANATIVE(x) (IS_FUNC(x) && FUNC_ISJAVANATIVE(x))
367 #define FUNC_ISOVERLAY(x) (x->funcAttrs.overlay)
368 #define IFFUNC_ISOVERLAY(x) (IS_FUNC(x) && FUNC_ISOVERLAY(x))
370 #define IFFUNC_ISBANKEDCALL(x) (!IFFUNC_NONBANKED(x) && \
371 (options.model == MODEL_LARGE || \
372 options.model == MODEL_MEDIUM || \
375 #define SPEC_NOUN(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s.noun
376 #define SPEC_LONG(x) validateLink(x, "SPEC_LONG", #x, SPECIFIER, __FILE__, __LINE__)->select.s._long
377 #define SPEC_USIGN(x) validateLink(x, "SPEC_USIGN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._unsigned
378 #define SPEC_SCLS(x) validateLink(x, "SPEC_SCLS", #x, SPECIFIER, __FILE__, __LINE__)->select.s.sclass
379 #define SPEC_ENUM(x) validateLink(x, "SPEC_ENUM", #x, SPECIFIER, __FILE__, __LINE__)->select.s._isenum
380 #define SPEC_OCLS(x) validateLink(x, "SPEC_OCLS", #x, SPECIFIER, __FILE__, __LINE__)->select.s.oclass
381 #define SPEC_STAT(x) validateLink(x, "SPEC_STAT", #x, SPECIFIER, __FILE__, __LINE__)->select.s._static
382 #define SPEC_EXTR(x) validateLink(x, "SPEC_EXTR", #x, SPECIFIER, __FILE__, __LINE__)->select.s._extern
383 #define SPEC_CODE(x) validateLink(x, "SPEC_CODE", #x, SPECIFIER, __FILE__, __LINE__)->select.s._codesg
384 #define SPEC_ABSA(x) validateLink(x, "SPEC_ABSA", #x, SPECIFIER, __FILE__, __LINE__)->select.s._absadr
385 #define SPEC_BANK(x) validateLink(x, "SPEC_BANK", #x, SPECIFIER, __FILE__, __LINE__)->select.s._regbank
386 #define SPEC_ADDR(x) validateLink(x, "SPEC_ADDR", #x, SPECIFIER, __FILE__, __LINE__)->select.s._addr
387 #define SPEC_STAK(x) validateLink(x, "SPEC_STAK", #x, SPECIFIER, __FILE__, __LINE__)->select.s._stack
388 #define SPEC_CVAL(x) validateLink(x, "SPEC_CVAL", #x, SPECIFIER, __FILE__, __LINE__)->select.s.const_val
389 #define SPEC_BSTR(x) validateLink(x, "SPEC_BSTR", #x, SPECIFIER, __FILE__, __LINE__)->select.s._bitStart
390 #define SPEC_BLEN(x) validateLink(x, "SPEC_BLEN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._bitLength
392 /* Sleaze: SPEC_ISR_SAVED_BANKS is only used on
393 * function type symbols, which obviously cannot
394 * be of BIT type. Therefore, we recycle the
395 * _bitStart field instead of defining a new field.
397 #define SPEC_ISR_SAVED_BANKS(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._bitStart
398 #define SPEC_VOLATILE(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._volatile
399 #define SPEC_CONST(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._const
400 #define SPEC_STRUCT(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s.v_struct
401 #define SPEC_TYPEDEF(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._typedef
402 #define SPEC_REGPARM(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._isregparm
403 #define SPEC_ARGREG(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s.argreg
405 /* type check macros */
406 #define IS_DECL(x) ( x && x->class == DECLARATOR )
407 #define IS_SPEC(x) ( x && x->class == SPECIFIER )
408 #define IS_ARRAY(x) (IS_DECL(x) && DCL_TYPE(x) == ARRAY)
409 #define IS_DATA_PTR(x) (IS_DECL(x) && DCL_TYPE(x) == POINTER)
410 #define IS_PTR(x) (IS_DECL(x) && (DCL_TYPE(x) == POINTER || \
411 DCL_TYPE(x) == FPOINTER || \
412 DCL_TYPE(x) == GPOINTER || \
413 DCL_TYPE(x) == IPOINTER || \
414 DCL_TYPE(x) == PPOINTER || \
415 DCL_TYPE(x) == EEPPOINTER || \
416 DCL_TYPE(x) == CPOINTER || \
417 DCL_TYPE(x) == UPOINTER ))
418 #define IS_PTR_CONST(x) (IS_PTR(x) && DCL_PTR_CONST(x))
419 #define IS_FARPTR(x) (IS_DECL(x) && DCL_TYPE(x) == FPOINTER)
420 #define IS_CODEPTR(x) (IS_DECL(x) && DCL_TYPE(x) == CPOINTER)
421 #define IS_GENPTR(x) (IS_DECL(x) && DCL_TYPE(x) == GPOINTER)
422 #define IS_FUNC(x) (IS_DECL(x) && DCL_TYPE(x) == FUNCTION)
423 #define IS_LONG(x) (IS_SPEC(x) && x->select.s._long)
424 #define IS_UNSIGNED(x) (IS_SPEC(x) && x->select.s._unsigned)
425 #define IS_TYPEDEF(x)(IS_SPEC(x) && x->select.s._typedef)
426 #define IS_CONSTANT(x) (!x ? 0 : \
428 x->select.s._const : \
429 x->select.d.ptr_const)
430 #define IS_STRUCT(x) (IS_SPEC(x) && x->select.s.noun == V_STRUCT)
431 #define IS_ABSOLUTE(x) (IS_SPEC(x) && x->select.s._absadr )
432 #define IS_REGISTER(x) (IS_SPEC(x) && SPEC_SCLS(x) == S_REGISTER)
433 #define IS_RENT(x) (IS_SPEC(x) && x->select.s._reent )
434 #define IS_STATIC(x) (IS_SPEC(x) && SPEC_STAT(x))
435 #define IS_INT(x) (IS_SPEC(x) && x->select.s.noun == V_INT)
436 #define IS_VOID(x) (IS_SPEC(x) && x->select.s.noun == V_VOID)
437 #define IS_CHAR(x) (IS_SPEC(x) && x->select.s.noun == V_CHAR)
438 #define IS_EXTERN(x) (IS_SPEC(x) && x->select.s._extern)
439 #define IS_VOLATILE(x) (!x ? 0 : \
441 x->select.s._volatile : \
442 x->select.d.ptr_volatile)
443 #define IS_INTEGRAL(x) (IS_SPEC(x) && (x->select.s.noun == V_INT || \
444 x->select.s.noun == V_CHAR || \
445 x->select.s.noun == V_BIT || \
446 x->select.s.noun == V_SBIT ))
447 #define IS_BITFIELD(x) (IS_SPEC(x) && (x->select.s.noun == V_BIT))
448 #define IS_BITVAR(x) (IS_SPEC(x) && (x->select.s.noun == V_BIT || \
449 x->select.s.noun == V_SBIT ))
450 #define IS_FLOAT(x) (IS_SPEC(x) && x->select.s.noun == V_FLOAT)
451 #define IS_ARITHMETIC(x) (IS_INTEGRAL(x) || IS_FLOAT(x))
452 #define IS_AGGREGATE(x) (IS_ARRAY(x) || IS_STRUCT(x))
453 #define IS_LITERAL(x) (IS_SPEC(x) && x->select.s.sclass == S_LITERAL)
454 #define IS_CODE(x) (IS_SPEC(x) && SPEC_SCLS(x) == S_CODE)
455 #define IS_REGPARM(x) (IS_SPEC(x) && SPEC_REGPARM(x))
457 /* forward declaration for the global vars */
458 extern bucket *SymbolTab[];
459 extern bucket *StructTab[];
460 extern bucket *TypedefTab[];
461 extern bucket *LabelTab[];
462 extern bucket *enumTab[];
463 extern symbol *__fsadd;
464 extern symbol *__fssub;
465 extern symbol *__fsmul;
466 extern symbol *__fsdiv;
467 extern symbol *__fseq;
468 extern symbol *__fsneq;
469 extern symbol *__fslt;
470 extern symbol *__fslteq;
471 extern symbol *__fsgt;
472 extern symbol *__fsgteq;
474 /* Dims: mul/div/mod, BYTE/WORD/DWORD, SIGNED/UNSIGNED */
475 extern symbol *__muldiv[3][3][2];
476 /* Dims: BYTE/WORD/DWORD SIGNED/UNSIGNED */
477 extern sym_link *__multypes[3][2];
478 /* Dims: to/from float, BYTE/WORD/DWORD, SIGNED/USIGNED */
479 extern symbol *__conv[2][3][2];
480 /* Dims: shift left/shift right, BYTE/WORD/DWORD, SIGNED/UNSIGNED */
481 extern symbol *__rlrr[2][3][2];
483 #define CHARTYPE __multypes[0][0]
484 #define UCHARTYPE __multypes[0][1]
485 #define INTTYPE __multypes[1][0]
486 #define UINTTYPE __multypes[1][1]
487 #define LONGTYPE __multypes[2][0]
488 #define ULONGTYPE __multypes[2][1]
491 extern sym_link *floatType;
495 /* forward definitions for the symbol table related functions */
497 symbol *newSymbol (char *, int);
498 sym_link *newLink (SYM_LINK_CLASS);
499 sym_link *newFloatLink ();
500 structdef *newStruct (char *);
501 void addDecl (symbol *, int, sym_link *);
502 sym_link *mergeSpec (sym_link *, sym_link *, char *name);
503 symbol *reverseSyms (symbol *);
504 sym_link *reverseLink (sym_link *);
505 symbol *copySymbol (symbol *);
506 symbol *copySymbolChain (symbol *);
507 void printSymChain (symbol *, int);
508 void printStruct (structdef *, int);
509 char *genSymName (int);
510 sym_link *getSpec (sym_link *);
511 char *genSymName (int);
512 int compStructSize (int, structdef *);
513 sym_link *copyLinkChain (sym_link *);
514 int checkDecl (symbol *, int);
515 void checkBasic (sym_link *, sym_link *);
516 value *checkPointerIval (sym_link *, value *);
517 value *checkStructIval (symbol *, value *);
518 value *checkArrayIval (sym_link *, value *);
519 value *checkIval (sym_link *, value *);
520 unsigned int getSize (sym_link *);
521 unsigned int bitsForType (sym_link *);
522 sym_link *newIntLink ();
523 sym_link *newCharLink ();
524 sym_link *newLongLink ();
525 int compareType (sym_link *, sym_link *);
526 int checkFunction (symbol *, symbol *);
527 void cleanUpLevel (bucket **, int);
528 void cleanUpBlock (bucket **, int);
529 int funcInChain (sym_link *);
530 void addSymChain (symbol *);
531 sym_link *structElemType (sym_link *, value *);
532 symbol *getStructElement (structdef *, symbol *);
533 sym_link *computeType (sym_link *, sym_link *);
534 void processFuncArgs (symbol *);
535 int isSymbolEqual (symbol *, symbol *);
536 int powof2 (unsigned long);
537 void printTypeChain (sym_link *, FILE *);
538 void initCSupport ();
539 void initBuiltIns ();
540 void pointerTypes (sym_link *, sym_link *);
541 void cdbStructBlock (int);
543 bucket *newBucket ();
544 void addSym (bucket **, void *, char *, int, int, int checkType);
545 void deleteSym (bucket **, void *, char *);
546 void *findSym (bucket **, void *, const char *);
547 void *findSymWithLevel (bucket **, struct symbol *);
548 void *findSymWithBlock (bucket **, struct symbol *, int);
549 void changePointer (symbol * sym);
550 void checkTypeSanity(sym_link *etype, char *name);
551 sym_link *typeFromStr (char *) ;
554 extern char *nounName(sym_link *); /* noun strings */
555 extern void printFromToType (sym_link *, sym_link *);