1 /*-----------------------------------------------------------------*/
2 /* SDCCmem.c - 8051 memory management routines */
3 /*-----------------------------------------------------------------*/
8 memmap *xstack= NULL ; /* xternal stack data */
9 memmap *istack= NULL; /* internal stack */
10 memmap *code = NULL; /* code segment */
11 memmap *data = NULL; /* internal data upto 128 */
12 memmap *xdata = NULL; /* external data */
13 memmap *idata = NULL; /* internal data upto 256 */
14 memmap *bit = NULL; /* bit addressable space */
15 memmap *statsg= NULL; /* the constant data segment */
16 memmap *sfr = NULL; /* register space */
17 memmap *reg = NULL; /* register space */
18 memmap *sfrbit= NULL; /* sfr bit space */
19 memmap *generic=NULL; /* is a generic pointer */
20 memmap *overlay=NULL; /* overlay segment */
21 memmap *eeprom =NULL; /* eeprom location */
22 memmap *home =NULL; /* Unswitchable code bank */
24 /* this is a set of sets each set containing
25 symbols in a single overlay */
26 set *ovrSetSets = NULL;
29 int fatalError = 0 ;/* fatal error flag */
31 /*-----------------------------------------------------------------*/
32 /* allocMap - allocates a memory map */
33 /*-----------------------------------------------------------------*/
34 memmap *allocMap (char rspace, /* sfr space */
35 char farmap, /* far or near segment */
36 char paged , /* can this segment be paged */
37 char direct, /* directly addressable */
38 char bitaddr, /* bit addressable space*/
39 char codemap, /* this is code space */
40 unsigned sloc, /* starting location */
41 const char *name, /* 2 character name */
42 char dbName , /* debug name */
43 int ptrType /* pointer type for this space */
48 if (!(map = calloc(sizeof(memmap), 1))) {
49 werror(E_OUT_OF_MEM,__FILE__,sizeof(memmap));
53 memset(map, ZERO, sizeof(memmap));
57 map->direct = direct ;
58 map->bitsp = bitaddr ;
59 map->codesp = codemap ;
62 map->dbName = dbName ;
63 map->ptrType= ptrType;
64 if (!(map->oFile = tempfile())) {
65 werror(E_TMPFILE_FAILED);
68 addSetHead (&tmpfileSet,map->oFile);
73 /*-----------------------------------------------------------------*/
74 /* initMem - allocates and initializes all the segments */
75 /*-----------------------------------------------------------------*/
78 /* allocate all the segments */
79 /* xternal stack segment ;
87 POINTER-TYPE - FPOINTER
89 xstack = allocMap (0, 1, 1, 0, 0, 0, options.xstack_loc, XSTACK_NAME,'A',PPOINTER);
91 /* internal stack segment ;
99 POINTER-TYPE - POINTER
101 istack = allocMap (0, 0, 0, 0, 0, 0,options.stack_loc, ISTACK_NAME,'B',POINTER);
111 POINTER-TYPE - CPOINTER
113 code = allocMap (0, 1, 0, 0, 0, 1, options.code_loc, CODE_NAME,'C',CPOINTER);
123 POINTER-TYPE - CPOINTER
125 home = allocMap (0, 1, 0, 0, 0, 1, options.code_loc, CODE_NAME,'C',CPOINTER);
127 /* Static segment (code for variables );
135 POINTER-TYPE - CPOINTER
137 statsg = allocMap (0, 1, 0, 0, 0, 1,0, STATIC_NAME,'D',CPOINTER);
139 /* Data segment - internal storage segment ;
147 POINTER-TYPE - POINTER
149 data = allocMap (0, 0, 0, 1, 0, 0, options.data_loc, DATA_NAME,'E',POINTER);
151 /* overlay segment - same as internal storage segment ;
159 POINTER-TYPE - POINTER
161 overlay = allocMap (0, 0, 0, 1, 0, 0, options.data_loc, DATA_NAME,'E',POINTER);
163 /* Xternal Data segment -
171 POINTER-TYPE - FPOINTER
173 xdata = allocMap (0, 1, 0, 0, 0, 0, options.xdata_loc, XDATA_NAME,'F',FPOINTER);
175 /* Inderectly addressed internal data segment
183 POINTER-TYPE - IPOINTER
185 idata = allocMap (0, 0, 0, 0, 0, 0, options.idata_loc,IDATA_NAME,'G',IPOINTER);
187 /* Static segment (code for variables );
195 POINTER-TYPE - _NONE_
197 bit = allocMap (0, 0, 0, 1, 1, 0,0, BIT_NAME,'H',0);
199 /* Special function register space :-
207 POINTER-TYPE - _NONE_
209 sfr = allocMap (1,0, 0, 1, 0, 0,0, REG_NAME,'I',0);
219 POINTER-TYPE - _NONE_
221 reg = allocMap (1,0, 0, 0, 0, 0, 0,REG_NAME,' ',0);
231 POINTER-TYPE - _NONE_
233 sfrbit = allocMap (1,0, 0, 1, 1, 0,0, REG_NAME,'J',0);
243 POINTER-TYPE - EEPPOINTER
245 eeprom = allocMap (0,1, 0, 0, 0, 0,0, REG_NAME,'K',EEPPOINTER);
247 /* the unknown map */
248 generic = allocMap (1,0, 0, 1, 1, 0,0, REG_NAME,' ',GPOINTER);
252 /*-----------------------------------------------------------------*/
253 /* allocIntoSeg - puts a symbol into a memory segment */
254 /*-----------------------------------------------------------------*/
255 void allocIntoSeg (symbol *sym)
257 memmap *segment = SPEC_OCLS(sym->etype);
258 addSet (&segment->syms,sym);
261 /*-----------------------------------------------------------------*/
262 /* allocGlobal - aassigns the output segment to a global var */
263 /*-----------------------------------------------------------------*/
264 void allocGlobal ( symbol *sym )
267 /* symbol name is internal name */
268 if (!sym->level) /* local statics can come here */
269 sprintf (sym->rname,"%s%s", port->fun_prefix, sym->name);
271 /* add it to the operandKey reset */
272 addSet(&operKeyReset,sym);
274 /* if this is a literal e.g. enumerated type */
275 /* put it in the data segment & do nothing */
276 if (IS_LITERAL(sym->etype)) {
277 SPEC_OCLS(sym->etype) = data ;
281 /* if this is a function then assign code space */
282 if (IS_FUNC(sym->type)) {
283 SPEC_OCLS(sym->etype) = code ;
284 /* if this is an interrupt service routine
285 then put it in the interrupt service array */
286 if (IS_ISR(sym->etype)) {
288 if (interrupts[SPEC_INTN(sym->etype)])
289 werror(E_INT_DEFINED,
290 SPEC_INTN(sym->etype),
291 interrupts[SPEC_INTN(sym->etype)]->name);
293 interrupts[SPEC_INTN(sym->etype)] = sym;
295 /* automagically extend the maximum interrupts */
296 if (SPEC_INTN(sym->etype) >= maxInterrupts )
297 maxInterrupts = SPEC_INTN(sym->etype) + 1;
299 /* if it is not compiler defined */
306 /* if this is a SFR or SBIT */
307 if ( SPEC_SCLS(sym->etype) == S_SFR ||
308 SPEC_SCLS(sym->etype) == S_SBIT ) {
310 /* if both absolute address & initial */
311 /* value specified then error */
312 if ( IS_ABSOLUTE (sym->etype) && sym->ival ) {
313 werror(E_SFR_INIT,sym->name);
317 SPEC_OCLS(sym->etype) =
318 (SPEC_SCLS(sym->etype) == S_SFR ? sfr : sfrbit);
324 /* if this is a bit variable and no storage class */
325 if ( SPEC_NOUN(sym->etype) == V_BIT
326 && SPEC_SCLS(sym->etype) == S_BIT ) {
327 SPEC_OCLS(sym->etype) = bit ;
332 /* if bit storage class */
333 if ( SPEC_SCLS(sym->etype) == S_SBIT ) {
334 SPEC_OCLS(sym->etype) = bit;
339 /* register storage class ignored changed to FIXED */
340 if ( SPEC_SCLS(sym->etype) == S_REGISTER )
341 SPEC_SCLS(sym->etype) = S_FIXED ;
343 /* if data specified then */
344 if (SPEC_SCLS(sym->etype) == S_DATA) {
345 /* set the output class */
346 SPEC_OCLS(sym->etype) = data ;
347 /* generate the symbol */
352 /* if it is fixed, then allocate depending on the */
353 /* current memory model,same for automatics */
354 if ( SPEC_SCLS(sym->etype) == S_FIXED ||
355 SPEC_SCLS(sym->etype) == S_AUTO ) {
356 /* set the output class */
357 SPEC_OCLS(sym->etype) = port->mem.default_globl_map ;
358 /* generate the symbol */
363 /* if code change to constant */
364 if ( SPEC_SCLS(sym->etype) == S_CODE ||
365 SPEC_SCLS(sym->etype) == S_CONSTANT ) {
366 SPEC_OCLS(sym->etype) = statsg ;
371 if ( SPEC_SCLS(sym->etype) == S_XDATA ) {
372 SPEC_OCLS(sym->etype) = xdata ;
377 if ( SPEC_SCLS(sym->etype) == S_IDATA ) {
378 SPEC_OCLS(sym->etype) = idata ;
384 if ( SPEC_SCLS(sym->etype) == S_EEPROM ) {
385 SPEC_OCLS(sym->etype) = eeprom ;
393 /*-----------------------------------------------------------------*/
394 /* allocParms - parameters are always passed on stack */
395 /*-----------------------------------------------------------------*/
396 void allocParms ( value *val )
401 for ( lval = val ; lval ; lval = lval->next, pNum++ ) {
403 /* check the declaration */
404 checkDecl (lval->sym);
406 /* if this a register parm then allocate
407 it as a local variable by adding it
408 to the first block we see in the body */
409 if (IS_REGPARM(lval->etype))
412 /* mark it as my parameter */
413 lval->sym->ismyparm = 1;
414 lval->sym->localof = currFunc;
417 /* if automatic variables r 2b stacked */
418 if ( options.stackAuto || IS_RENT(currFunc->etype)) {
421 lval->sym->onStack = 1;
423 /* choose which stack 2 use */
424 /* use xternal stack */
425 if ( options.useXstack ) {
426 /* PENDING: stack direction support */
427 SPEC_OCLS(lval->etype) = SPEC_OCLS(lval->sym->etype) = xstack ;
428 SPEC_STAK(lval->etype) = SPEC_STAK(lval->sym->etype) = lval->sym->stack =
429 xstackPtr - getSize(lval->type);
430 xstackPtr -= getSize (lval->type);
432 else { /* use internal stack */
433 SPEC_OCLS(lval->etype) = SPEC_OCLS(lval->sym->etype) = istack ;
434 if (port->stack.direction > 0) {
435 SPEC_STAK(lval->etype) = SPEC_STAK(lval->sym->etype) = lval->sym->stack =
436 stackPtr - ( SPEC_BANK(currFunc->etype) ? port->stack.bank_overhead : 0) -
437 getSize(lval->type) -
438 (IS_ISR(currFunc->etype) ? port->stack.isr_overhead : 0);
439 stackPtr -= getSize (lval->type);
442 /* This looks like the wrong order but it turns out OK... */
443 /* PENDING: isr, bank overhead, ... */
444 SPEC_STAK(lval->etype) = SPEC_STAK(lval->sym->etype) = lval->sym->stack =
446 (IS_BANKEDCALL(currFunc->etype) ? port->stack.banked_overhead : 0) +
447 (IS_ISR(currFunc->etype) ? port->stack.isr_overhead : 0) +
449 stackPtr += getSize (lval->type);
452 allocIntoSeg(lval->sym);
454 else { /* allocate them in the automatic space */
455 /* generate a unique name */
456 sprintf (lval->sym->rname,"%s%s_PARM_%d", port->fun_prefix, currFunc->name,pNum);
457 strcpy (lval->name,lval->sym->rname);
459 /* if declared in external storage */
460 if (SPEC_SCLS(lval->etype) == S_XDATA)
461 SPEC_OCLS(lval->etype) = SPEC_OCLS(lval->sym->etype) = xdata;
463 /* other wise depending on the memory model
464 note here that we put it into the overlay segment
465 first, we will remove it from the overlay segment
466 after the overlay determination has been done */
467 if (options.model == MODEL_SMALL) {
468 SPEC_OCLS(lval->etype) = SPEC_OCLS(lval->sym->etype) =
469 ( options.model == MODEL_SMALL ? port->mem.default_local_map :
470 (options.noOverlay ? port->mem.default_local_map
473 SPEC_SCLS(lval->etype) = S_XDATA;
474 SPEC_OCLS(lval->etype) = SPEC_OCLS(lval->sym->etype) = xdata;
476 allocIntoSeg(lval->sym);
483 /*-----------------------------------------------------------------*/
484 /* deallocParms - parameters are always passed on stack */
485 /*-----------------------------------------------------------------*/
486 void deallocParms ( value *val )
490 for ( lval = val ; lval ; lval = lval->next ) {
492 /* unmark is myparm */
493 lval->sym->ismyparm = 0;
494 /* if on stack then depending on which stack */
496 /* delete it from the symbol table */
497 deleteSym (SymbolTab,lval->sym,lval->sym->name);
499 if (!lval->sym->isref) {
500 lval->sym->allocreq = 1;
501 werror(W_NO_REFERENCE,currFunc->name,
502 "function argument",lval->sym->name);
505 /* move the rname if any to the name for both val & sym */
506 /* and leave a copy of it in the symbol table */
507 if (lval->sym->rname[0]) {
508 char buffer[SDCC_NAME_MAX];
509 strcpy(buffer,lval->sym->rname);
510 lval->sym = copySymbol(lval->sym);
511 strcpy(lval->sym->rname,buffer);
512 strcpy(lval->name,strcpy(lval->sym->name,lval->sym->rname));
513 addSym (SymbolTab, lval->sym, lval->sym->name,
514 lval->sym->level,lval->sym->block);
515 lval->sym->_isparm = 1;
516 addSet(&operKeyReset,lval->sym);
524 /*-----------------------------------------------------------------*/
525 /* allocLocal - allocate local variables */
526 /*-----------------------------------------------------------------*/
527 void allocLocal ( symbol *sym )
530 /* generate an unique name */
531 sprintf(sym->rname,"%s%s_%s_%d_%d",
533 currFunc->name,sym->name,sym->level,sym->block);
536 sym->localof = currFunc;
538 /* if this is a static variable */
539 if ( IS_STATIC (sym->etype)) {
545 /* if volatile then */
546 if (IS_VOLATILE(sym->etype))
549 /* this is automatic */
551 /* if it to be placed on the stack */
552 if ( options.stackAuto || reentrant) {
555 if ( options.useXstack ) {
556 /* PENDING: stack direction for xstack */
557 SPEC_OCLS(sym->etype) = xstack ;
558 SPEC_STAK(sym->etype) = sym->stack = (xstackPtr + 1);
559 xstackPtr += getSize (sym->type) ;
562 SPEC_OCLS(sym->etype) = istack ;
563 if (port->stack.direction > 0) {
564 SPEC_STAK(sym->etype) = sym->stack = ( stackPtr + 1);
565 stackPtr += getSize (sym->type) ;
568 stackPtr -= getSize (sym->type);
569 SPEC_STAK(sym->etype) = sym->stack = stackPtr;
576 /* else depending on the storage class specified */
577 if ( SPEC_SCLS(sym->etype) == S_XDATA ) {
578 SPEC_OCLS(sym->etype) = xdata ;
583 if ( (SPEC_SCLS(sym->etype) == S_CODE ||
584 SPEC_SCLS(sym->etype) == S_CONSTANT) &&
586 SPEC_OCLS(sym->etype) = statsg ;
591 if ( SPEC_SCLS(sym->etype) == S_IDATA ) {
592 SPEC_OCLS(sym->etype) = idata ;
598 /* if this is a function then assign code space */
599 if (IS_FUNC(sym->type)) {
600 SPEC_OCLS(sym->etype) = code ;
604 /* if this is a SFR or SBIT */
605 if ( SPEC_SCLS(sym->etype) == S_SFR ||
606 SPEC_SCLS(sym->etype) == S_SBIT ) {
608 /* if both absolute address & initial */
609 /* value specified then error */
610 if ( IS_ABSOLUTE (sym->etype) && sym->ival ) {
611 werror(E_SFR_INIT,sym->name);
615 SPEC_OCLS(sym->etype) =
616 (SPEC_SCLS(sym->etype) == S_SFR ? sfr : sfrbit);
622 /* if this is a bit variable and no storage class */
623 if ( SPEC_NOUN(sym->etype) == V_BIT
624 && (SPEC_SCLS(sym->etype) == S_BIT)) {
625 SPEC_OCLS(sym->etype) = bit ;
630 if ( SPEC_SCLS(sym->etype) == S_DATA ) {
631 SPEC_OCLS(sym->etype) = (options.noOverlay ? data : overlay );
636 if ( SPEC_SCLS(sym->etype) == S_EEPROM ) {
637 SPEC_OCLS(sym->etype) = eeprom;
642 /* again note that we have put it into the overlay segment
643 will remove and put into the 'data' segment if required after
644 overlay analysis has been done */
645 SPEC_OCLS(sym->etype) = ( options.model == MODEL_SMALL ? port->mem.default_local_map :
646 (options.noOverlay ? port->mem.default_local_map
651 /*-----------------------------------------------------------------*/
652 /* deallocLocal - deallocates the local variables */
653 /*-----------------------------------------------------------------*/
654 void deallocLocal ( symbol *csym )
658 for ( sym = csym ; sym ; sym = sym->next) {
662 /* if it is on the stack */
664 if (options.useXstack)
665 xstackPtr -= getSize(sym->type);
667 stackPtr -= getSize(sym->type);
669 /* if not used give a warning */
670 if (!sym->isref && !IS_STATIC(sym->etype))
671 werror(W_NO_REFERENCE,currFunc->name,
672 "local variable",sym->name);
673 /* now delete it from the symbol table */
674 deleteSym (SymbolTab,sym,sym->name);
678 /*-----------------------------------------------------------------*/
679 /* overlay2data - moves declarations from the overlay seg to data */
680 /*-----------------------------------------------------------------*/
685 for (sym = setFirstItem(overlay->syms); sym;
686 sym = setNextItem(overlay->syms)) {
688 SPEC_OCLS(sym->etype) = data;
692 setToNull((void **) &overlay->syms);
696 /*-----------------------------------------------------------------*/
697 /* overlay2Set - will add all symbols from the overlay segment to */
698 /* the set of sets containing the overlable symbols */
699 /*-----------------------------------------------------------------*/
705 for (sym = setFirstItem(overlay->syms); sym;
706 sym = setNextItem(overlay->syms)) {
711 setToNull((void **) &overlay->syms);
712 addSet (&ovrSetSets,oset);
716 /*-----------------------------------------------------------------*/
717 /* allocVariables - creates decl & assign storage class for a v */
718 /*-----------------------------------------------------------------*/
719 int allocVariables ( symbol *symChain )
726 /* go thru the symbol chain */
727 for ( sym = symChain ; sym ; sym = sym->next ) {
729 /* if this is a typedef then add it */
730 /* to the typedef table */
731 if (IS_TYPEDEF(sym->etype)) {
732 /* check if the typedef already exists */
733 csym = findSym (TypedefTab, NULL, sym->name );
734 if ( csym && csym->level == sym->level )
735 werror(E_DUPLICATE_TYPEDEF,sym->name);
737 addSym (TypedefTab, sym , sym->name,sym->level,sym->block);
738 continue ; /* go to the next one */
740 /* make sure it already exist */
741 csym = findSymWithLevel (SymbolTab, sym);
742 if (! csym || (csym && csym->level != sym->level) )
745 /* check the declaration */
748 /* if this is a function or a pointer to function */
749 /* then args processing */
750 if (funcInChain(csym->type)) {
752 processFuncArgs (csym, 1);
753 /* if register bank specified then update maxRegBank */
754 if (maxRegBank < SPEC_BANK(csym->etype))
755 maxRegBank = SPEC_BANK(csym->etype);
758 /* if this is a extern variable then change the */
759 /* level to zero temporarily */
760 if (IS_EXTERN(csym->etype) || IS_FUNC(csym->type) ) {
761 saveLevel = csym->level ;
765 /* if this is a literal then it is an enumerated */
766 /* type so need not allocate it space for it */
767 if (IS_LITERAL(sym->etype))
770 /* generate the actual declaration */
774 stack += getSize(csym->type) ;
779 /* restore the level */
780 if (IS_EXTERN(csym->etype) || IS_FUNC(csym->type))
781 csym->level = saveLevel;
787 /*-----------------------------------------------------------------*/
788 /* redoStackOffsets :- will reassign the values for stack offsets */
789 /*-----------------------------------------------------------------*/
790 void redoStackOffsets(void)
796 /* after register allocation is complete we know
797 which variables will need to be assigned space
798 on the stack. We will eliminate those variables
799 which do not have the allocReq flag thus reducing
801 for ( sym = setFirstItem(istack->syms); sym;
802 sym = setNextItem(istack->syms)) {
804 int size = getSize(sym->type);
805 /* nothing to do with parameters so continue */
806 if ((sym->_isparm && !IS_REGPARM(sym->etype)))
809 if ( IS_AGGREGATE(sym->type)) {
810 if (port->stack.direction > 0) {
811 SPEC_STAK(sym->etype) = sym->stack = ( sPtr + 1);
816 SPEC_STAK(sym->etype) = sym->stack = sPtr;
821 /* if allocation not required then subtract
822 size from overall stack size & continue */
823 if (!sym->allocreq) {
824 currFunc->stack -= size;
825 SPEC_STAK(currFunc->etype) -= size;
829 if (port->stack.direction > 0) {
830 SPEC_STAK(sym->etype) = sym->stack = ( sPtr + 1);
835 SPEC_STAK(sym->etype) = sym->stack = sPtr;
839 /* do the same for the external stack */
841 for ( sym = setFirstItem(xstack->syms); sym;
842 sym = setNextItem(xstack->syms)) {
844 int size = getSize(sym->type);
845 /* nothing to do with parameters so continue */
846 if ((sym->_isparm && !IS_REGPARM(sym->etype)))
849 if (IS_AGGREGATE(sym->type)) {
850 SPEC_STAK(sym->etype) = sym->stack = ( xsPtr + 1);
855 /* if allocation not required then subtract
856 size from overall stack size & continue */
857 if (!sym->allocreq) {
858 currFunc->xstack -= size;
859 SPEC_STAK(currFunc->etype) -= size;
863 SPEC_STAK(sym->etype) = sym->stack = ( xsPtr + 1);
867 /* if the debug option is set then output the
868 symbols to the map file */
869 if (options.debug && !options.nodebug) {
870 for (sym = setFirstItem(istack->syms); sym;
871 sym = setNextItem(istack->syms))
872 cdbSymbol(sym,cdbFile,FALSE,FALSE);
874 for (sym = setFirstItem(xstack->syms); sym;
875 sym = setNextItem(xstack->syms))
876 cdbSymbol(sym,cdbFile,FALSE,FALSE);
880 /*-----------------------------------------------------------------*/
881 /* printAllocInfoSeg- print the allocation for a given section */
882 /*-----------------------------------------------------------------*/
883 static void printAllocInfoSeg ( memmap *map, symbol *func, FILE *of)
888 if (!map->syms) return;
890 for (sym = setFirstItem(map->syms); sym;
891 sym = setNextItem(map->syms)) {
893 if (sym->level == 0) continue;
894 if (sym->localof != func) continue ;
895 fprintf(of,";%-25s Allocated to ",sym->name);
897 /* if assigned to registers */
898 if (!sym->allocreq && sym->reqv) {
900 sym = OP_SYMBOL(sym->reqv);
901 fprintf(of,"registers ");
902 for (i = 0 ; i < 4 && sym->regs[i] ; i++)
903 fprintf(of,"%s ",port->getRegName(sym->regs[i]));
910 fprintf(of,"stack - offset %d\n",sym->stack);
914 /* otherwise give rname */
915 fprintf(of,"in memory with name '%s'\n",sym->rname);
919 /*-----------------------------------------------------------------*/
920 /* canOverlayLocals - returns true if the local variables can overlayed */
921 /*-----------------------------------------------------------------*/
922 static bool canOverlayLocals (eBBlock **ebbs, int count)
925 /* if staticAuto is in effect or the current function
926 being compiled is reentrant or the overlay segment
927 is empty or no overlay option is in effect then */
928 if (options.noOverlay ||
931 (IS_RENT(currFunc->etype) ||
932 IS_ISR(currFunc->etype))) ||
933 elementsInSet(overlay->syms) == 0)
937 /* otherwise do thru the blocks and see if there
938 any function calls if found then return false */
939 for (i = 0; i < count ; i++ ) {
942 for (ic = ebbs[i]->sch; ic ; ic = ic->next)
943 if (ic && ( ic->op == CALL || ic->op == PCALL))
947 /* no function calls found return TRUE */
951 /*-----------------------------------------------------------------*/
952 /* doOverlays - move the overlay segment to appropriate location */
953 /*-----------------------------------------------------------------*/
954 void doOverlays( eBBlock **ebbs, int count)
956 /* check if the parameters and local variables
957 of this function can be put in the overlay segment
958 This check is essentially to see if the function
959 calls any other functions if yes then we cannot
961 if (canOverlayLocals(ebbs,count))
962 /* if we can then put the parameters &
963 local variables in the overlay set */
966 /* otherwise put them into data where
971 /*-----------------------------------------------------------------*/
972 /* printAllocInfo - prints allocation information for a function */
973 /*-----------------------------------------------------------------*/
974 void printAllocInfo( symbol * func, FILE *of)
976 if (!of) of = stdout;
978 /* must be called after register allocation is complete */
979 fprintf(of,";------------------------------------------------------------\n");
980 fprintf(of,";Allocation info for local variables in function '%s'\n",func->name);
981 fprintf(of,";------------------------------------------------------------\n");
983 printAllocInfoSeg(xstack,func,of);
984 printAllocInfoSeg(istack,func,of);
985 printAllocInfoSeg(code,func,of);
986 printAllocInfoSeg(data,func,of);
987 printAllocInfoSeg(xdata,func,of);
988 printAllocInfoSeg(idata,func,of);
989 printAllocInfoSeg(sfr,func,of);
990 printAllocInfoSeg(sfrbit,func,of);