1 /*-------------------------------------------------------------------------
2 SDCCsymt.c - Code 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 -------------------------------------------------------------------------*/
26 #define ENABLE_MICHAELH_REGPARM_HACK 0
28 bucket *SymbolTab [256] ; /* the symbol table */
29 bucket *StructTab [256] ; /* the structure table */
30 bucket *TypedefTab[256] ; /* the typedef table */
31 bucket *LabelTab [256] ; /* the Label table */
32 bucket *enumTab [256] ; /* enumerated table */
34 extern struct set *publics;
36 /*------------------------------------------------------------------*/
37 /* initSymt () - initialises symbol table related stuff */
38 /*------------------------------------------------------------------*/
43 for ( i = 0 ; i < 256 ; i++ )
44 SymbolTab[i] = StructTab[i] = (void *) NULL ;
48 /*-----------------------------------------------------------------*/
49 /* newBucket - allocates & returns a new bucket */
50 /*-----------------------------------------------------------------*/
55 ALLOC(bp,sizeof(bucket));
60 /*-----------------------------------------------------------------*/
61 /* hashKey - computes the hashkey given a symbol name */
62 /*-----------------------------------------------------------------*/
65 unsigned long key = 0;
72 /*-----------------------------------------------------------------*/
73 /* addSym - adds a symbol to the hash Table */
74 /*-----------------------------------------------------------------*/
75 void addSym ( bucket **stab ,
81 int i ; /* index into the hash Table */
82 bucket *bp ; /* temp bucket * */
84 /* the symbols are always added at the head of the list */
86 /* get a free entry */
87 ALLOC(bp,sizeof(bucket));
89 bp->sym = sym ; /* update the symbol pointer */
90 bp->level = level; /* update the nest level */
92 strcpy(bp->name,sname); /* copy the name into place */
94 /* if this is the first entry */
95 if (stab[i] == NULL) {
96 bp->prev = bp->next = (void *) NULL ; /* point to nothing */
99 /* not first entry then add @ head of list */
108 /*-----------------------------------------------------------------*/
109 /* deleteSym - deletes a symbol from the hash Table entry */
110 /*-----------------------------------------------------------------*/
111 void deleteSym ( bucket **stab, void *sym, char *sname)
119 /* find the symbol */
121 if (bp->sym == sym) /* found it then break out */
122 break ; /* of the loop */
126 if (!bp) /* did not find it */
128 /* if this is the first one in the chain */
131 if ( stab[i] ) /* if chain ! empty */
132 stab[i]->prev = (void *) NULL ;
134 /* middle || end of chain */
136 if ( bp->next ) /* if not end of chain */
137 bp->next->prev = bp->prev ;
139 bp->prev->next = bp->next ;
144 /*-----------------------------------------------------------------*/
145 /* findSym - finds a symbol in a table */
146 /*-----------------------------------------------------------------*/
147 void *findSym ( bucket **stab, void *sym, char *sname)
151 bp = stab[hashKey(sname)] ;
154 if ( bp->sym == sym || strcmp (bp->name,sname) == 0 )
159 return ( bp ? bp->sym : (void *) NULL ) ;
162 /*-----------------------------------------------------------------*/
163 /* findSymWithLevel - finds a symbol with a name & level */
164 /*-----------------------------------------------------------------*/
165 void *findSymWithLevel ( bucket **stab, symbol *sym)
169 bp = stab[hashKey(sym->name)];
172 ** do the search from the head of the list since the
173 ** elements are added at the head it is ensured that
174 ** we will find the deeper definitions before we find
175 ** the global ones. we need to check for symbols with
176 ** level <= to the level given, if levels match then block
177 ** numbers need to match as well
181 if ( strcmp(bp->name,sym->name) == 0 && bp->level <= sym->level) {
182 /* if this is parameter then nothing else need to be checked */
183 if (((symbol *)(bp->sym))->_isparm)
185 /* if levels match then block numbers hsould also match */
186 if (bp->level && bp->level == sym->level && bp->block == sym->block )
188 /* if levels don't match then we are okay */
189 if (bp->level && bp->level != sym->level)
191 /* if this is a global variable then we are ok too */
199 return (void *) NULL ;
202 /*-----------------------------------------------------------------*/
203 /* findSymWithBlock - finds a symbol with name in with a block */
204 /*-----------------------------------------------------------------*/
205 void *findSymWithBlock ( bucket **stab, symbol *sym, int block)
209 bp = stab[hashKey(sym->name)] ;
212 if ( strcmp (bp->name,sym->name) == 0 &&
218 return ( bp ? bp->sym : (void *) NULL ) ;
221 /*------------------------------------------------------------------*/
222 /* newSymbol () - returns a new pointer to a symbol */
223 /*------------------------------------------------------------------*/
224 symbol *newSymbol (char *name, int scope )
228 ALLOC(sym,sizeof(symbol));
230 strcpy(sym->name,name); /* copy the name */
231 sym->level = scope ; /* set the level */
232 sym->block = currBlockno ;
233 sym->lineDef = yylineno ; /* set the line number */
237 /*------------------------------------------------------------------*/
238 /* newLink - creates a new link (declarator,specifier) */
239 /*------------------------------------------------------------------*/
244 ALLOC(p,sizeof(link));
249 /*------------------------------------------------------------------*/
250 /* newStruct - creats a new structdef from the free list */
251 /*------------------------------------------------------------------*/
252 structdef *newStruct ( char *tag )
256 ALLOC(s,sizeof(structdef));
258 strcpy(s->tag,tag) ; /* copy the tag */
262 /*------------------------------------------------------------------*/
263 /* pointerTypes - do the computation for the pointer types */
264 /*------------------------------------------------------------------*/
265 void pointerTypes (link *ptr, link *type)
270 /* find the first pointer type */
271 while (ptr && !IS_PTR(ptr))
274 /* could not find it */
275 if (!ptr || IS_SPEC(ptr) ||
276 DCL_TYPE(ptr) != UPOINTER)
279 /* change the pointer type depending on the
280 storage class of the type */
282 DCL_PTR_CONST(ptr) = SPEC_CONST(type);
283 DCL_PTR_VOLATILE(ptr) = SPEC_VOLATILE(type);
284 switch (SPEC_SCLS(type)) {
286 DCL_TYPE(ptr) = FPOINTER;
289 DCL_TYPE(ptr) = IPOINTER ;
292 DCL_TYPE(ptr) = PPOINTER ;
295 DCL_TYPE(ptr) = POINTER ;
298 DCL_PTR_CONST(ptr) = port->mem.code_ro;
299 DCL_TYPE(ptr) = CPOINTER ;
302 DCL_TYPE(ptr) = EEPPOINTER;
305 DCL_TYPE(ptr) = GPOINTER;
308 /* the storage class of type ends here */
311 SPEC_VOLATILE(type) = 0;
314 /* now change all the remaining unknown pointers
315 to generic pointers */
317 if (!IS_SPEC(ptr) && DCL_TYPE(ptr) == UPOINTER)
318 DCL_TYPE(ptr) = GPOINTER;
322 /* same for the type although it is highly unlikely that
323 type will have a pointer */
325 if (!IS_SPEC(type) && DCL_TYPE(type) == UPOINTER)
326 DCL_TYPE(type) = GPOINTER;
332 /*------------------------------------------------------------------*/
333 /* addDecl - adds a declarator @ the end of a chain */
334 /*------------------------------------------------------------------*/
335 void addDecl ( symbol *sym, int type , link *p )
341 /* if we are passed a link then set head & tail */
348 head = tail = newLink() ;
349 DCL_TYPE(head) = type ;
352 /* if this is the first entry */
358 if ( IS_SPEC(sym->etype) && IS_SPEC(head) && head == tail ) {
359 sym->etype = mergeSpec(sym->etype,head);
362 if ( IS_SPEC(sym->etype) && !IS_SPEC(head) && head == tail ) {
364 while (t->next != sym->etype) t = t->next ;
366 tail->next = sym->etype;
368 sym->etype->next = head;
374 /* if the type is a unknown pointer and has
375 a tspec then take the storage class const & volatile
376 attribute from the tspec & make it those of this
380 DCL_TYPE(p) == UPOINTER &&
382 if (!IS_SPEC(sym->etype)) {
383 sym->etype = sym->etype->next = newLink();
384 sym->etype->class = SPECIFIER;
386 SPEC_SCLS(sym->etype) = SPEC_SCLS(DCL_TSPEC(p));
387 SPEC_CONST(sym->etype) = SPEC_CONST(DCL_TSPEC(p));
388 SPEC_VOLATILE(sym->etype) = SPEC_VOLATILE(DCL_TSPEC(p));
394 /*------------------------------------------------------------------*/
395 /* mergeSpec - merges two specifiers and returns the new one */
396 /*------------------------------------------------------------------*/
397 link *mergeSpec ( link *dest, link *src )
399 /* if noun different then src overrides */
400 if ( SPEC_NOUN(dest) != SPEC_NOUN(src) && !SPEC_NOUN(dest))
401 SPEC_NOUN(dest) = SPEC_NOUN(src) ;
403 if (! SPEC_SCLS(dest)) /* if destination has no storage class */
404 SPEC_SCLS(dest) = SPEC_SCLS(src) ;
406 /* copy all the specifications */
407 SPEC_LONG(dest) |= SPEC_LONG(src);
408 SPEC_SHORT(dest) |= SPEC_SHORT(src);
409 SPEC_USIGN(dest) |= SPEC_USIGN(src);
410 SPEC_STAT(dest) |= SPEC_STAT(src);
411 SPEC_EXTR(dest) |= SPEC_EXTR(src);
412 SPEC_ABSA(dest) |= SPEC_ABSA(src);
413 SPEC_RENT(dest) |= SPEC_RENT(src);
414 SPEC_INTN(dest) |= SPEC_INTN(src);
415 SPEC_BANK(dest) |= SPEC_BANK(src);
416 SPEC_VOLATILE(dest) |= SPEC_VOLATILE(src);
417 SPEC_CRTCL(dest) |= SPEC_CRTCL(src);
418 SPEC_ADDR(dest) |= SPEC_ADDR(src);
419 SPEC_OCLS(dest) = SPEC_OCLS(src);
420 SPEC_BLEN(dest) |= SPEC_BLEN(src);
421 SPEC_BSTR(dest) |= SPEC_BSTR(src);
422 SPEC_TYPEDEF(dest) |= SPEC_TYPEDEF(src);
423 SPEC_NONBANKED(dest) |= SPEC_NONBANKED(src);
425 if ( IS_STRUCT(dest) && SPEC_STRUCT(dest) == NULL )
426 SPEC_STRUCT(dest) = SPEC_STRUCT(src);
431 /*------------------------------------------------------------------*/
432 /* cloneSpec - copies the entire spec and returns a new spec */
433 /*------------------------------------------------------------------*/
434 link *cloneSpec ( link *src )
438 /* go thru chain till we find the specifier */
439 while ( src && src->class != SPECIFIER )
443 memcpy (spec,src,sizeof(link));
447 /*------------------------------------------------------------------*/
448 /* genSymName - generates and returns a name used for anonymous vars*/
449 /*------------------------------------------------------------------*/
450 char *genSymName ( int level )
452 static int gCount = 0 ;
453 static char gname[SDCC_NAME_MAX+1] ;
455 sprintf (gname,"__%04d%04d",level,gCount++);
459 /*------------------------------------------------------------------*/
460 /* getSpec - returns the specifier part from a declaration chain */
461 /*------------------------------------------------------------------*/
462 link *getSpec ( link *p )
467 while ( p && ! (IS_SPEC(p)))
473 /*------------------------------------------------------------------*/
474 /* newCharLink() - creates an int type */
475 /*------------------------------------------------------------------*/
481 p->class = SPECIFIER ;
482 SPEC_NOUN(p) = V_CHAR ;
487 /*------------------------------------------------------------------*/
488 /* newFloatLink - a new Float type */
489 /*------------------------------------------------------------------*/
495 p->class = SPECIFIER ;
496 SPEC_NOUN(p) = V_FLOAT ;
501 /*------------------------------------------------------------------*/
502 /* newLongLink() - new long type */
503 /*------------------------------------------------------------------*/
509 p->class = SPECIFIER ;
510 SPEC_NOUN(p) = V_INT ;
516 /*------------------------------------------------------------------*/
517 /* newIntLink() - creates an int type */
518 /*------------------------------------------------------------------*/
524 p->class = SPECIFIER ;
525 SPEC_NOUN(p) = V_INT ;
530 /*------------------------------------------------------------------*/
531 /* getSize - returns size of a type chain in bits */
532 /*------------------------------------------------------------------*/
533 unsigned int getSize ( link *p )
535 /* if nothing return 0 */
538 if ( IS_SPEC(p) ) { /* if this is the specifier then */
539 switch (SPEC_NOUN(p)) { /* depending on the specifier type */
541 return (IS_LONG(p) ? LONGSIZE : ( IS_SHORT(p) ? SHORTSIZE: INTSIZE)) ;
549 return SPEC_STRUCT(p)->size ;
555 return ((SPEC_BLEN(p) / 8) + (SPEC_BLEN(p) % 8 ? 1 : 0)) ;
561 /* this is a specifier */
562 switch (DCL_TYPE(p)) {
566 return DCL_ELEM(p) * getSize (p->next) ;
583 /*------------------------------------------------------------------*/
584 /* bitsForType - returns # of bits required to store this type */
585 /*------------------------------------------------------------------*/
586 unsigned int bitsForType ( link *p )
588 /* if nothing return 0 */
592 if ( IS_SPEC(p) ) { /* if this is the specifier then */
594 switch (SPEC_NOUN(p)) { /* depending on the specifier type */
596 return (IS_LONG(p) ? LONGSIZE*8 : ( IS_SHORT(p) ? SHORTSIZE*8: INTSIZE*8)) ;
604 return SPEC_STRUCT(p)->size*8 ;
616 /* this is a specifier */
617 switch (DCL_TYPE(p)) {
621 return DCL_ELEM(p) * getSize (p->next) *8 ;
625 return ( PTRSIZE * 8) ;
629 return ( FPTRSIZE * 8);
631 return ( GPTRSIZE * 8);
638 /*------------------------------------------------------------------*/
639 /* copySymbolChain - copies a symbol chain */
640 /*------------------------------------------------------------------*/
641 symbol *copySymbolChain (symbol *src)
648 dest = copySymbol(src);
649 dest->next = copySymbolChain(src->next);
653 /*------------------------------------------------------------------*/
654 /* copySymbol - makes a copy of a symbol */
655 /*------------------------------------------------------------------*/
656 symbol *copySymbol (symbol *src)
663 dest = newSymbol( src->name, src->level );
664 memcpy(dest,src,sizeof(symbol));
665 dest->level = src->level ;
666 dest->block = src->block ;
667 dest->ival = copyIlist(src->ival);
668 dest->type = copyLinkChain(src->type);
669 dest->etype= getSpec(dest->type);
671 dest->args = copyValueChain (src->args);
672 dest->key = src->key;
673 dest->calleeSave = src->calleeSave;
674 dest->allocreq = src->allocreq;
678 /*------------------------------------------------------------------*/
679 /* reverseSyms - reverses the links for a symbol chain */
680 /*------------------------------------------------------------------*/
681 symbol *reverseSyms ( symbol *sym)
683 symbol *prev , *curr, *next ;
698 sym->next = (void *) NULL ;
702 /*------------------------------------------------------------------*/
703 /* reverseLink - reverses the links for a type chain */
704 /*------------------------------------------------------------------*/
705 link *reverseLink ( link *type)
707 link *prev , *curr, *next ;
722 type->next = (void *) NULL ;
726 /*------------------------------------------------------------------*/
727 /* addSymChain - adds a symbol chain to the symboltable */
728 /*------------------------------------------------------------------*/
729 void addSymChain ( symbol *symHead )
731 symbol *sym = symHead ;
732 symbol *csym = NULL ;
734 for (;sym != NULL ; sym = sym->next ) {
736 /* if already exists in the symbol table then check if
737 the previous was an extern definition if yes then
738 then check if the type match, if the types match then
739 delete the current entry and add the new entry */
740 if ((csym = findSymWithLevel (SymbolTab,sym)) &&
741 csym->level == sym->level) {
743 /* previous definition extern ? */
744 if ( IS_EXTERN(csym->etype) ) {
745 /* do types match ? */
746 if (checkType ( csym->type,sym->type) != 1)
748 werror (E_DUPLICATE,csym->name);
750 /* delete current entry */
751 deleteSym (SymbolTab, csym, csym->name );
753 addSym (SymbolTab, sym, sym->name, sym->level,sym->block);
754 } else /* not extern */
755 werror(E_DUPLICATE,sym->name) ;
759 /* check if previously defined */
760 if (csym && csym->level == sym->level ) {
761 /* if the previous one was declared as extern */
762 /* then check the type with the current one */
763 if ( IS_EXTERN(csym->etype) ) {
764 if ( checkType (csym->type, sym->type ) <= 0 )
765 werror (W_EXTERN_MISMATCH,csym->name);
769 addSym (SymbolTab,sym,sym->name,sym->level,sym->block) ;
774 /*------------------------------------------------------------------*/
775 /* funcInChain - DCL Type 'FUNCTION' found in type chain */
776 /*------------------------------------------------------------------*/
777 int funcInChain (link *lnk)
787 /*------------------------------------------------------------------*/
788 /* structElemType - returns the type info of a sturct member */
789 /*------------------------------------------------------------------*/
790 link *structElemType (link *stype, value *id ,value **argsp)
792 symbol *fields = (SPEC_STRUCT(stype) ? SPEC_STRUCT(stype)->fields : NULL);
794 if ( ! fields || ! id)
797 /* look for the id */
799 if (strcmp(fields->rname,id->name) == 0) {
801 *argsp = fields->args;
803 return copyLinkChain (fields->type) ;
805 fields = fields->next ;
807 werror(E_NOT_MEMBER,id->name);
812 /*------------------------------------------------------------------*/
813 /* getStructElement - returns element of a tructure definition */
814 /*------------------------------------------------------------------*/
815 symbol *getStructElement ( structdef *sdef, symbol *sym)
819 for ( field = sdef->fields ; field ; field = field->next )
820 if ( strcmp(field->name,sym->name) == 0)
823 werror(E_NOT_MEMBER,sym->name);
825 return sdef->fields ;
828 /*------------------------------------------------------------------*/
829 /* compStructSize - computes the size of a structure */
830 /*------------------------------------------------------------------*/
831 int compStructSize (int su, structdef *sdef )
833 int sum = 0 , usum =0;
837 /* for the identifiers */
838 loop = sdef->fields ;
841 /* create the internal name for this variable */
842 sprintf (loop->rname,"_%s",loop->name);
843 loop->offset = ( su == UNION ? sum = 0 : sum ) ;
844 SPEC_VOLATILE(loop->etype) |= (su == UNION ? 1 : 0);
846 /* if this is a bit field */
849 /* change it to a unsigned bit */
850 SPEC_NOUN(loop->etype) = V_BIT ;
851 SPEC_USIGN(loop->etype) = 1 ;
852 /* check if this fit into the remaining */
853 /* bits of this byte else align it to the */
854 /* next byte boundary */
855 if ((SPEC_BLEN(loop->etype)=loop->bitVar) <= (8 - bitOffset)) {
856 SPEC_BSTR(loop->etype) = bitOffset ;
857 sum += (loop->bitVar / 8) ;
858 bitOffset += (loop->bitVar % 8);
860 else /* does not fit */
863 loop->offset++; /* go to the next byte */
865 SPEC_BSTR(loop->etype) = bitOffset ;
866 sum += (loop->bitVar / 8) ;
867 bitOffset += (loop->bitVar % 8);
869 /* if this is the last field then pad */
870 if (!loop->next && bitOffset) {
877 sum += getSize (loop->type) ;
880 /* if function then do the arguments for it */
881 if (funcInChain(loop->type)) {
882 processFuncArgs (loop, 1);
887 /* if this is not a bitfield but the */
888 /* previous one was and did not take */
889 /* the whole byte then pad the rest */
890 if ((loop && !loop->bitVar) && bitOffset) {
895 /* if union then size = sizeof larget field */
897 usum = max(usum,sum);
901 return (su == UNION ? usum : sum);
904 /*------------------------------------------------------------------*/
905 /* checkSClass - check the storage class specification */
906 /*------------------------------------------------------------------*/
907 static void checkSClass ( symbol *sym )
909 /* type is literal can happen foe enums change
911 if (SPEC_SCLS(sym->etype) == S_LITERAL && !SPEC_ENUM(sym->etype))
912 SPEC_SCLS(sym->etype) = S_AUTO;
914 /* if sfr or sbit then must also be */
915 /* volatile the initial value will be xlated */
916 /* to an absolute address */
917 if (SPEC_SCLS(sym->etype) == S_SBIT ||
918 SPEC_SCLS(sym->etype) == S_SFR ) {
919 SPEC_VOLATILE(sym->etype) = 1;
920 /* if initial value given */
922 SPEC_ABSA(sym->etype) = 1;
923 SPEC_ADDR(sym->etype) =
924 (int) list2int(sym->ival);
929 /* if absolute address given then it mark it as
931 if (IS_ABSOLUTE(sym->etype))
932 SPEC_VOLATILE(sym->etype) = 1;
934 /* global variables declared const put into code */
935 if (sym->level == 0 &&
936 SPEC_SCLS(sym->etype) == S_CONSTANT) {
937 SPEC_SCLS(sym->etype) = S_CODE ;
938 SPEC_CONST(sym->etype) = 1;
941 /* global variable in code space is a constant */
942 if (sym->level == 0 &&
943 SPEC_SCLS(sym->etype) == S_CODE &&
945 SPEC_CONST(sym->etype) = 1;
948 /* if bit variable then no storage class can be */
949 /* specified since bit is already a storage */
950 if ( IS_BITVAR(sym->etype) &&
951 ( SPEC_SCLS(sym->etype) != S_FIXED &&
952 SPEC_SCLS(sym->etype) != S_SBIT &&
953 SPEC_SCLS(sym->etype) != S_BIT )
955 werror (E_BITVAR_STORAGE,sym->name);
956 SPEC_SCLS(sym->etype) = S_FIXED ;
959 /* extern variables cannot be initialized */
960 if (IS_EXTERN(sym->etype) && sym->ival) {
961 werror(E_EXTERN_INIT,sym->name);
965 /* if this is an automatic symbol then */
966 /* storage class will be ignored and */
967 /* symbol will be allocated on stack/ */
968 /* data depending on flag */
970 (options.stackAuto || reentrant ) &&
971 ( SPEC_SCLS(sym->etype) != S_AUTO &&
972 SPEC_SCLS(sym->etype) != S_FIXED &&
973 SPEC_SCLS(sym->etype) != S_REGISTER &&
974 SPEC_SCLS(sym->etype) != S_STACK &&
975 SPEC_SCLS(sym->etype) != S_XSTACK &&
976 SPEC_SCLS(sym->etype) != S_CONSTANT )) {
978 werror(E_AUTO_ASSUMED,sym->name) ;
979 SPEC_SCLS(sym->etype) = S_AUTO ;
982 /* automatic symbols cannot be given */
983 /* an absolute address ignore it */
985 SPEC_ABSA(sym->etype) &&
986 (options.stackAuto || reentrant) ) {
987 werror(E_AUTO_ABSA,sym->name);
988 SPEC_ABSA(sym->etype) = 0 ;
991 /* arrays & pointers cannot be defined for bits */
992 /* SBITS or SFRs or BIT */
993 if ((IS_ARRAY(sym->type) || IS_PTR(sym->type)) &&
994 ( SPEC_NOUN(sym->etype) == V_BIT ||
995 SPEC_NOUN(sym->etype) == V_SBIT ||
996 SPEC_SCLS(sym->etype) == S_SFR ))
997 werror(E_BIT_ARRAY,sym->name);
999 /* if this is a bit|sbit then set length & start */
1000 if (SPEC_NOUN(sym->etype) == V_BIT ||
1001 SPEC_NOUN(sym->etype) == V_SBIT ) {
1002 SPEC_BLEN(sym->etype) = 1 ;
1003 SPEC_BSTR(sym->etype) = 0 ;
1006 /* variables declared in CODE space must have */
1007 /* initializers if not an extern */
1008 if (SPEC_SCLS(sym->etype) == S_CODE &&
1009 sym->ival == NULL &&
1011 port->mem.code_ro &&
1012 !IS_EXTERN(sym->etype))
1013 werror(E_CODE_NO_INIT,sym->name);
1015 /* if parameter or local variable then change */
1016 /* the storage class to reflect where the var will go */
1017 if ( sym->level && SPEC_SCLS(sym->etype) == S_FIXED) {
1018 if ( options.stackAuto || (currFunc && IS_RENT(currFunc->etype)))
1019 SPEC_SCLS(sym->etype) = (options.useXstack ?
1020 S_XSTACK : S_STACK ) ;
1022 SPEC_SCLS(sym->etype) = (options.useXstack ?
1027 /*------------------------------------------------------------------*/
1028 /* changePointer - change pointer to functions */
1029 /*------------------------------------------------------------------*/
1030 void changePointer (symbol *sym)
1034 /* go thru the chain of declarations */
1035 /* if we find a pointer to a function */
1036 /* unconditionally change it to a ptr */
1038 for ( p = sym->type ; p ; p = p->next) {
1039 if ( !IS_SPEC(p) && DCL_TYPE(p) == UPOINTER)
1040 DCL_TYPE(p) = GPOINTER ;
1041 if ( IS_PTR(p) && IS_FUNC(p->next))
1042 DCL_TYPE(p) = CPOINTER ;
1046 /*------------------------------------------------------------------*/
1047 /* checkDecl - does semantic validation of a declaration */
1048 /*------------------------------------------------------------------*/
1049 int checkDecl ( symbol *sym )
1052 checkSClass (sym); /* check the storage class */
1053 changePointer(sym); /* change pointers if required */
1055 /* if this is an array without any dimension
1056 then update the dimension from the initial value */
1057 if (IS_ARRAY(sym->type) && !DCL_ELEM(sym->type))
1058 DCL_ELEM(sym->type) = getNelements (sym->type,sym->ival);
1063 /*------------------------------------------------------------------*/
1064 /* copyLinkChain - makes a copy of the link chain & rets ptr 2 head */
1065 /*------------------------------------------------------------------*/
1066 link *copyLinkChain ( link *p)
1068 link *head, *curr , *loop;
1071 head = loop = ( curr ? newLink() : (void *) NULL) ;
1073 memcpy(loop,curr,sizeof(link)) ; /* copy it */
1074 loop->next = (curr->next ? newLink() : (void *) NULL) ;
1083 /*------------------------------------------------------------------*/
1084 /* cleanUpBlock - cleansup the symbol table specified for all the */
1085 /* symbols in the given block */
1086 /*------------------------------------------------------------------*/
1087 void cleanUpBlock ( bucket **table, int block)
1092 /* go thru the entire table */
1093 for ( i = 0 ; i < 256; i++ ) {
1094 for ( chain = table[i]; chain ; chain = chain->next ) {
1095 if (chain->block >= block) {
1096 deleteSym (table,chain->sym,chain->name);
1102 /*------------------------------------------------------------------*/
1103 /* cleanUpLevel - cleansup the symbol table specified for all the */
1104 /* symbols in the given level */
1105 /*------------------------------------------------------------------*/
1106 void cleanUpLevel (bucket **table, int level )
1111 /* go thru the entire table */
1112 for ( i = 0 ; i < 256; i++ ) {
1113 for ( chain = table[i]; chain ; chain = chain->next ) {
1114 if (chain->level >= level) {
1115 deleteSym (table,chain->sym,chain->name);
1121 /*------------------------------------------------------------------*/
1122 /* computeType - computes the resultant type from two types */
1123 /*------------------------------------------------------------------*/
1124 link *computeType ( link *type1, link *type2)
1128 link *etype1 = getSpec(type1);
1129 link *etype2 = getSpec(type2);
1131 /* if one of them is a float then result is a float */
1132 /* here we assume that the types passed are okay */
1133 /* and can be cast to one another */
1134 /* which ever is greater in size */
1135 if (IS_FLOAT(etype1) || IS_FLOAT(etype2))
1136 rType = newFloatLink();
1138 /* if only one of them is a bit variable
1139 then the other one prevails */
1140 if (IS_BITVAR(etype1) && !IS_BITVAR(etype2))
1141 rType = copyLinkChain(type2);
1143 if (IS_BITVAR(etype2) && !IS_BITVAR(etype1))
1144 rType = copyLinkChain(type1);
1146 /* if one of them is a pointer then that
1149 rType = copyLinkChain(type1);
1152 rType = copyLinkChain(type2);
1154 if (getSize (type1) > getSize(type2) )
1155 rType = copyLinkChain(type1);
1157 rType = copyLinkChain(type2);
1159 reType = getSpec(rType);
1161 /* if either of them unsigned then make this unsigned */
1162 if ((SPEC_USIGN(etype1) || SPEC_USIGN(etype2)) && !IS_FLOAT(reType))
1163 SPEC_USIGN(reType) = 1;
1165 /* if result is a literal then make not so */
1166 if (IS_LITERAL(reType))
1167 SPEC_SCLS(reType) = S_REGISTER ;
1172 /*------------------------------------------------------------------*/
1173 /* checkType - will do type check return 1 if match */
1174 /*------------------------------------------------------------------*/
1175 int checkType ( link *dest, link *src )
1186 /* if dest is a declarator then */
1187 if (IS_DECL(dest)) {
1189 if (DCL_TYPE(src) == DCL_TYPE(dest))
1190 return checkType(dest->next,src->next);
1192 if (IS_PTR(src) && IS_PTR(dest))
1195 if (IS_PTR(dest) && IS_ARRAY(src))
1198 if (IS_PTR(dest) && IS_FUNC(dest->next) && IS_FUNC(src))
1199 return -1 * checkType (dest->next,src) ;
1204 if (IS_PTR(dest) && IS_INTEGRAL(src))
1210 /* if one of them is a void then ok */
1211 if (SPEC_NOUN(dest) == V_VOID &&
1212 SPEC_NOUN(src) != V_VOID )
1215 if (SPEC_NOUN(dest) != V_VOID &&
1216 SPEC_NOUN(src) == V_VOID )
1219 /* char === to short */
1220 if (SPEC_NOUN(dest) == V_CHAR &&
1221 SPEC_NOUN(src) == V_INT &&
1223 return (SPEC_USIGN(src) == SPEC_USIGN(dest) ? 1 : -2);
1225 if (SPEC_NOUN(src) == V_CHAR &&
1226 SPEC_NOUN(dest) == V_INT &&
1228 return (SPEC_USIGN(src) == SPEC_USIGN(dest) ? 1 : -2);
1230 /* if they are both bitfields then if the lengths
1231 and starts don't match */
1232 if (IS_BITFIELD(dest) && IS_BITFIELD(src) &&
1233 (SPEC_BLEN(dest) != SPEC_BLEN(src) ||
1234 SPEC_BSTR(dest) != SPEC_BSTR(src)))
1237 /* it is a specifier */
1238 if (SPEC_NOUN(dest) != SPEC_NOUN(src)) {
1239 if (SPEC_USIGN(dest) == SPEC_USIGN(src) &&
1240 IS_INTEGRAL(dest) && IS_INTEGRAL(src) &&
1241 getSize(dest) == getSize(src))
1244 if (IS_ARITHMETIC(dest) && IS_ARITHMETIC(src))
1250 if (IS_STRUCT(dest)) {
1251 if (SPEC_STRUCT(dest) != SPEC_STRUCT(src))
1256 if (SPEC_LONG(dest) != SPEC_LONG(src))
1259 if (SPEC_SHORT(dest) != SPEC_SHORT(src))
1262 if (SPEC_USIGN(dest) != SPEC_USIGN(src))
1268 /*------------------------------------------------------------------*/
1269 /* inCalleeSaveList - return 1 if found in calle save list */
1270 /*------------------------------------------------------------------*/
1271 bool inCalleeSaveList ( char *s)
1275 for (i = 0 ; options.calleeSaves[i] ; i++ )
1276 if (strcmp(options.calleeSaves[i],s) == 0)
1282 /*------------------------------------------------------------------*/
1283 /* checkFunction - does all kinds of check on a function */
1284 /*------------------------------------------------------------------*/
1285 int checkFunction (symbol *sym)
1288 value *exargs, *acargs ;
1291 /* if not type then some kind of error */
1295 /* if the function has no type then make it return int */
1296 if ( !sym->type->next )
1297 sym->type->next = sym->etype = newIntLink();
1299 /* function cannot return aggregate */
1300 if (IS_AGGREGATE(sym->type->next)) {
1301 werror(E_FUNC_AGGR,sym->name);
1305 /* function cannot return bit */
1306 if (IS_BITVAR(sym->type->next)) {
1307 werror(E_FUNC_BIT,sym->name);
1311 /* check if this function is defined as calleeSaves
1312 then mark it as such */
1313 sym->calleeSave = inCalleeSaveList(sym->name);
1315 /* if interrupt service routine */
1316 /* then it cannot have arguments */
1317 if ( sym->args && IS_ISR(sym->etype) && !IS_VOID(sym->args->type)) {
1318 werror(E_INT_ARGS,sym->name);
1322 if (!(csym = findSym (SymbolTab, sym, sym->name )))
1323 return 1 ; /* not defined nothing more to check */
1325 /* check if body already present */
1326 if ( csym && csym->fbody ) {
1327 werror(E_FUNC_BODY,sym->name);
1331 /* check the return value type */
1332 if (checkType (csym->type,sym->type) <= 0) {
1333 werror(E_PREV_DEF_CONFLICT,csym->name,"type") ;
1334 werror (E_CONTINUE,"previous defintion type ");
1335 printTypeChain(csym->type,stderr);fprintf(stderr,"\n");
1336 werror (E_CONTINUE,"current definition type ");
1337 printTypeChain(sym->type,stderr);fprintf(stderr,"\n");
1341 if ( SPEC_INTRTN(csym->etype) != SPEC_INTRTN(sym->etype)) {
1342 werror (E_PREV_DEF_CONFLICT,csym->name,"interrupt");
1346 if (SPEC_BANK(csym->etype) != SPEC_BANK(sym->etype)) {
1347 werror (E_PREV_DEF_CONFLICT,csym->name,"using");
1351 /* compare expected agrs with actual args */
1352 exargs = csym->args ;
1353 acargs = sym->args ;
1355 /* for all the expected args do */
1358 exargs = exargs->next, acargs = acargs->next, argCnt++ ) {
1359 if ( checkType(exargs->type,acargs->type) <= 0) {
1360 werror(E_ARG_TYPE,argCnt);
1365 /* if one them ended we have a problem */
1366 if ((exargs && !acargs && !IS_VOID(exargs->type)) ||
1367 (!exargs && acargs && !IS_VOID(acargs->type)))
1368 werror(E_ARG_COUNT);
1370 /* replace with this defition */
1371 sym->cdef = csym->cdef;
1372 deleteSym (SymbolTab,csym,csym->name);
1373 addSym (SymbolTab,sym,sym->name,sym->level,sym->block);
1374 if (IS_EXTERN(csym->etype) && !
1375 IS_EXTERN(sym->etype)) {
1376 addSet(&publics,sym);
1381 /*-----------------------------------------------------------------*/
1382 /* processFuncArgs - does some processing with function args */
1383 /*-----------------------------------------------------------------*/
1384 void processFuncArgs (symbol *func, int ignoreName)
1390 /* if this function has variable argument list */
1391 /* then make the function a reentrant one */
1393 SPEC_RENT(func->etype) = 1;
1395 /* check if this function is defined as calleeSaves
1396 then mark it as such */
1397 func->calleeSave = inCalleeSaveList(func->name);
1399 val = func->args; /* loop thru all the arguments */
1401 /* if it is void then remove parameters */
1402 if (val && IS_VOID(val->type)) {
1407 /* reset regparm for the port */
1408 (*port->reset_regparms)();
1409 /* if any of the arguments is an aggregate */
1410 /* change it to pointer to the same type */
1412 /* mark it as a register parameter if
1413 the function does not have VA_ARG
1414 and as port dictates
1415 not inhibited by command line option or #pragma */
1416 if (!func->hasVargs &&
1417 !options.noregparms &&
1418 (*port->reg_parm)(val->type)) {
1420 SPEC_REGPARM(val->etype) = 1;
1423 #if ENABLE_MICHAELH_REGPARM_HACK
1424 /* HACK: pull out later */
1427 !strcmp(func->name, "memcpy") ||
1428 !strcmp(func->name, "strcpy") ||
1429 !strcmp(func->name, "strcmp") ||
1432 port->reg_parm(val->type)) {
1433 SPEC_REGPARM(val->etype) = 1;
1437 if ( IS_AGGREGATE(val->type)) {
1438 /* if this is a structure */
1439 /* then we need to add a new link */
1440 if (IS_STRUCT(val->type)) {
1441 /* first lets add DECLARATOR type */
1442 link *p = val->type ;
1444 werror(W_STRUCT_AS_ARG,val->name);
1445 val->type = newLink();
1446 val->type->next = p ;
1449 /* change to a pointer depending on the */
1450 /* storage class specified */
1451 switch (SPEC_SCLS(val->etype)) {
1453 DCL_TYPE(val->type) = IPOINTER;
1456 DCL_TYPE(val->type) = PPOINTER;
1462 DCL_TYPE(val->type) = POINTER ;
1465 DCL_TYPE(val->type) = CPOINTER;
1468 DCL_TYPE(val->type) = FPOINTER;
1471 DCL_TYPE(val->type) = EEPPOINTER;
1474 DCL_TYPE(val->type) = GPOINTER;
1477 /* is there is a symbol associated then */
1478 /* change the type of the symbol as well*/
1480 val->sym->type = copyLinkChain(val->type);
1481 val->sym->etype = getSpec(val->sym->type);
1489 /* if this function is reentrant or */
1490 /* automatics r 2b stacked then nothing */
1491 if (IS_RENT(func->etype) || options.stackAuto )
1498 /* if a symbolname is not given */
1499 /* synthesize a variable name */
1502 sprintf(val->name,"_%s_PARM_%d",func->name,pNum++);
1503 val->sym = newSymbol(val->name,1);
1504 SPEC_OCLS(val->etype) = (options.model ? xdata : data);
1505 val->sym->type = copyLinkChain (val->type);
1506 val->sym->etype = getSpec (val->sym->type);
1507 val->sym->_isparm = 1;
1508 strcpy (val->sym->rname,val->name);
1509 SPEC_STAT(val->etype) = SPEC_STAT(val->sym->etype) =
1510 SPEC_STAT(func->etype);
1511 addSymChain(val->sym);
1514 else /* symbol name given create synth name */ {
1516 sprintf(val->name,"_%s_PARM_%d",func->name,pNum++);
1517 strcpy (val->sym->rname,val->name);
1518 val->sym->_isparm = 1;
1519 SPEC_OCLS(val->etype) = SPEC_OCLS(val->sym->etype) =
1520 (options.model ? xdata : data);
1521 SPEC_STAT(val->etype) = SPEC_STAT(val->sym->etype) =
1522 SPEC_STAT(func->etype);
1528 /*-----------------------------------------------------------------*/
1529 /* isSymbolEqual - compares two symbols return 1 if they match */
1530 /*-----------------------------------------------------------------*/
1531 int isSymbolEqual (symbol *dest, symbol *src)
1533 /* if pointers match then equal */
1537 /* if one of them is null then don't match */
1541 /* if both of them have rname match on rname */
1542 if (dest->rname[0] && src->rname[0])
1543 return (!strcmp(dest->rname,src->rname));
1545 /* otherwise match on name */
1546 return (!strcmp(dest->name,src->name));
1549 /*-----------------------------------------------------------------*/
1550 /* printTypeChain - prints the type chain in human readable form */
1551 /*-----------------------------------------------------------------*/
1552 void printTypeChain (link *type, FILE *of)
1562 if (IS_DECL(type)) {
1563 switch (DCL_TYPE(type)) {
1565 fprintf (of,"function ");
1568 fprintf (of,"_generic * ");
1569 if (DCL_PTR_CONST(type))
1570 fprintf(of,"const ");
1573 fprintf (of,"_code * ");
1574 if (DCL_PTR_CONST(type))
1575 fprintf(of,"const ");
1578 fprintf (of,"_far * ");
1579 if (DCL_PTR_CONST(type))
1580 fprintf(of,"const ");
1583 fprintf (of,"_eeprom * ");
1584 if (DCL_PTR_CONST(type))
1585 fprintf(of,"const ");
1589 fprintf (of,"_near * ");
1590 if (DCL_PTR_CONST(type))
1591 fprintf(of,"const ");
1594 fprintf (of,"_idata *");
1595 if (DCL_PTR_CONST(type))
1596 fprintf(of,"const ");
1599 fprintf (of,"_pdata *");
1600 if (DCL_PTR_CONST(type))
1601 fprintf(of,"const ");
1604 fprintf (of," _unkown *");
1605 if (DCL_PTR_CONST(type))
1606 fprintf(of,"const ");
1610 fprintf (of,"array of ");
1614 if (SPEC_VOLATILE(type))
1615 fprintf (of,"volatile ");
1616 if (SPEC_USIGN(type))
1617 fprintf (of,"unsigned ");
1619 switch (SPEC_NOUN(type)) {
1622 fprintf (of,"long ");
1625 fprintf (of,"short ");
1627 fprintf (of,"int ");
1631 fprintf(of,"char ");
1635 fprintf(of,"void ");
1639 fprintf(of,"float ");
1643 fprintf(of,"struct %s",SPEC_STRUCT(type)->tag);
1647 fprintf(of,"sbit ");
1651 fprintf(of,"bit {%d,%d}",SPEC_BSTR(type),SPEC_BLEN(type));
1664 /*-----------------------------------------------------------------*/
1665 /* cdbTypeInfo - print the type information for debugger */
1666 /*-----------------------------------------------------------------*/
1667 void cdbTypeInfo (link *type,FILE *of)
1669 fprintf(of,"{%d}",getSize(type));
1671 if (IS_DECL(type)) {
1672 switch (DCL_TYPE(type)) {
1698 fprintf (of,"DA%d,",DCL_ELEM(type));
1704 switch (SPEC_NOUN(type)) {
1728 fprintf(of,"ST%s",SPEC_STRUCT(type)->tag);
1736 fprintf(of,"SB%d$%d",SPEC_BSTR(type),SPEC_BLEN(type));
1743 if (SPEC_USIGN(type))
1751 /*-----------------------------------------------------------------*/
1752 /* cdbSymbol - prints a symbol & its type information for debugger */
1753 /*-----------------------------------------------------------------*/
1754 void cdbSymbol ( symbol *sym, FILE *of, int isStructSym, int isFunc)
1766 fprintf(of,"S:"); /* symbol record */
1767 /* if this is not a structure symbol then
1768 we need to figure out the scope information */
1772 if (IS_STATIC(sym->etype))
1773 fprintf(of,"F%s$",moduleName); /* scope is file */
1775 fprintf(of,"G$"); /* scope is global */
1778 /* symbol is local */
1779 fprintf(of,"L%s$",(sym->localof ? sym->localof->name : "-null-"));
1781 fprintf(of,"S$"); /* scope is structure */
1783 /* print the name, & mangled name */
1784 fprintf(of,"%s$%d$%d(",sym->name,
1785 sym->level,sym->block);
1787 cdbTypeInfo(sym->type,of);
1790 /* print the address space */
1791 map = SPEC_OCLS(sym->etype);
1792 fprintf(of,"%c,%d,%d",
1793 (map ? map->dbName : 'Z') ,sym->onStack,SPEC_STAK(sym->etype));
1795 /* if assigned to registers then output register names */
1796 /* if this is a function then print
1797 if is it an interrupt routine & interrupt number
1798 and the register bank it is using */
1800 fprintf(of,",%d,%d,%d",SPEC_INTRTN(sym->etype),
1801 SPEC_INTN(sym->etype),SPEC_BANK(sym->etype));
1802 /* alternate location to find this symbol @ : eg registers
1809 /*-----------------------------------------------------------------*/
1810 /* cdbStruct - print a structure for debugger */
1811 /*-----------------------------------------------------------------*/
1812 void cdbStruct ( structdef *sdef,int block,FILE *of,
1813 int inStruct, char *tag)
1818 /* if block # then must have function scope */
1819 fprintf(of,"F%s$",moduleName);
1820 fprintf(of,"%s[",(tag ? tag : sdef->tag));
1821 for (sym=sdef->fields ; sym ; sym = sym->next) {
1822 fprintf(of,"({%d}",sym->offset);
1823 cdbSymbol(sym,of,TRUE,FALSE);
1831 /*------------------------------------------------------------------*/
1832 /* cdbStructBlock - calls struct printing for a blcks */
1833 /*------------------------------------------------------------------*/
1834 void cdbStructBlock (int block , FILE *of)
1837 bucket **table = StructTab;
1840 /* go thru the entire table */
1841 for ( i = 0 ; i < 256; i++ ) {
1842 for ( chain = table[i]; chain ; chain = chain->next ) {
1843 if (chain->block >= block) {
1844 cdbStruct((structdef *)chain->sym, chain->block ,of,0,NULL);
1850 /*-----------------------------------------------------------------*/
1851 /* powof2 - returns power of two for the number if number is pow 2 */
1852 /*-----------------------------------------------------------------*/
1853 int powof2 (unsigned long num)
1859 if (num & 1) n1s++ ;
1864 if (n1s > 1 || nshifts == 0) return 0;
1865 return nshifts - 1 ;
1879 /* Dims: mul/div/mod, BYTE/WORD/DWORD, SIGNED/UNSIGNED */
1880 symbol *__muldiv[3][3][2];
1881 /* Dims: BYTE/WORD/DWORD SIGNED/UNSIGNED */
1882 link *__multypes[3][2];
1883 /* Dims: to/from float, BYTE/WORD/DWORD, SIGNED/USIGNED */
1884 symbol *__conv[2][3][2];
1888 #if ENABLE_MICHAELH_REGPARM_HACK
1889 static void _makeRegParam(symbol *sym)
1893 val = sym->args; /* loop thru all the arguments */
1895 /* reset regparm for the port */
1896 (*port->reset_regparms)();
1898 SPEC_REGPARM(val->etype) = 1;
1899 sym->argStack -= getSize(val->type);
1905 /*-----------------------------------------------------------------*/
1906 /* initCSupport - create functions for C support routines */
1907 /*-----------------------------------------------------------------*/
1908 void initCSupport ()
1910 const char *smuldivmod[] = {
1913 const char *sbwd[] = {
1914 "char", "int", "long"
1916 const char *ssu[] = {
1920 int bwd, su, muldivmod, tofrom;
1922 floatType= newFloatLink();
1924 for (bwd = 0; bwd < 3; bwd++) {
1939 __multypes[bwd][0] = l;
1940 __multypes[bwd][1] = copyLinkChain(l);
1941 SPEC_USIGN(__multypes[bwd][1]) = 1;
1944 __fsadd = funcOfType ("__fsadd", floatType, floatType, 2, options.float_rent);
1945 __fssub = funcOfType ("__fssub", floatType, floatType, 2, options.float_rent);
1946 __fsmul = funcOfType ("__fsmul", floatType, floatType, 2, options.float_rent);
1947 __fsdiv = funcOfType ("__fsdiv", floatType, floatType, 2, options.float_rent);
1948 __fseq = funcOfType ("__fseq", CHARTYPE, floatType, 2, options.float_rent);
1949 __fsneq = funcOfType ("__fsneq", CHARTYPE, floatType, 2, options.float_rent);
1950 __fslt = funcOfType ("__fslt", CHARTYPE, floatType, 2, options.float_rent);
1951 __fslteq= funcOfType ("__fslteq", CHARTYPE, floatType, 2, options.float_rent);
1952 __fsgt = funcOfType ("__fsgt", CHARTYPE, floatType, 2, options.float_rent);
1953 __fsgteq= funcOfType ("__fsgteq", CHARTYPE, floatType, 2, options.float_rent);
1955 for (tofrom = 0; tofrom < 2; tofrom++) {
1956 for (bwd = 0; bwd < 3; bwd++) {
1957 for (su = 0; su < 2; su++) {
1959 sprintf(buffer, "__fs2%s%s", ssu[su], sbwd[bwd]);
1960 __conv[tofrom][bwd][su] = funcOfType(buffer, __multypes[bwd][su], floatType, 1, options.float_rent);
1963 sprintf(buffer, "__%s%s2fs", ssu[su], sbwd[bwd]);
1964 __conv[tofrom][bwd][su] = funcOfType(buffer, floatType, __multypes[bwd][su], 1, options.float_rent);
1970 for (muldivmod = 0; muldivmod < 3; muldivmod++) {
1971 for (bwd = 0; bwd < 3; bwd++) {
1972 for (su = 0; su < 2; su++) {
1973 sprintf(buffer, "_%s%s%s",
1974 smuldivmod[muldivmod],
1977 __muldiv[muldivmod][bwd][su] = funcOfType(buffer, __multypes[bwd][su], __multypes[bwd][su], 2, options.intlong_rent);
1978 SPEC_NONBANKED(__muldiv[muldivmod][bwd][su]->etype) = 1;
1979 #if ENABLE_MICHAELH_REGPARM_HACK
1981 _makeRegParam(__muldiv[muldivmod][bwd][su]);