X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCmem.c;h=5bc6bb92c31ea1354df22ec3801954349b6dbacc;hb=fd94924a3d743c1c82f4b370d9401d7239172789;hp=351e59c9fecf6defe350a8e5ee9d1949ef1749f7;hpb=46510ebbda96fa191888dccffff4185aa17f1f09;p=fw%2Fsdcc diff --git a/src/SDCCmem.c b/src/SDCCmem.c index 351e59c9..5bc6bb92 100644 --- a/src/SDCCmem.c +++ b/src/SDCCmem.c @@ -33,7 +33,6 @@ memmap *home = NULL; /* Unswitchable code bank */ symbols in a single overlay */ set *ovrSetSets = NULL; -int maxRegBank = 0; int fatalError = 0; /* fatal error flag */ /*-----------------------------------------------------------------*/ @@ -411,7 +410,7 @@ allocDefault (symbol * sym) if (sym->_isparm) return FALSE; /* if code change to constant */ - if (sym->ival && (sym->level==0) && SPEC_ABSA (sym->etype)) + if (sym->ival && SPEC_ABSA (sym->etype)) { SPEC_OCLS(sym->etype) = c_abs; } @@ -422,7 +421,7 @@ allocDefault (symbol * sym) break; case S_XDATA: /* absolute initialized global */ - if (sym->ival && (sym->level==0) && SPEC_ABSA (sym->etype)) + if (sym->ival && SPEC_ABSA (sym->etype)) { SPEC_OCLS(sym->etype) = x_abs; } @@ -438,7 +437,7 @@ allocDefault (symbol * sym) break; case S_DATA: /* absolute initialized global */ - if (sym->ival && (sym->level==0) && SPEC_ABSA (sym->etype)) + if (sym->ival && SPEC_ABSA (sym->etype)) { SPEC_OCLS(sym->etype) = d_abs; } @@ -449,7 +448,7 @@ allocDefault (symbol * sym) break; case S_IDATA: /* absolute initialized global */ - if (sym->ival && (sym->level==0) && SPEC_ABSA (sym->etype)) + if (sym->ival && SPEC_ABSA (sym->etype)) { SPEC_OCLS(sym->etype) = i_abs; } @@ -698,11 +697,16 @@ deallocParms (value * val) if (lval->sym->rname[0]) { char buffer[SDCC_NAME_MAX]; + symbol * argsym = lval->sym; + strncpyz (buffer, lval->sym->rname, sizeof(buffer)); lval->sym = copySymbol (lval->sym); strncpyz (lval->sym->rname, buffer, sizeof(lval->sym->rname)); + strncpyz (lval->sym->name, buffer, sizeof(lval->sym->name)); - strncpyz (lval->name, buffer, sizeof(lval->name)); + /* need to keep the original name for inlining to work */ + /*strncpyz (lval->name, buffer, sizeof(lval->name)); */ + addSym (SymbolTab, lval->sym, lval->sym->name, lval->sym->level, lval->sym->block, 1); lval->sym->_isparm = 1; @@ -710,6 +714,9 @@ deallocParms (value * val) { addSet(&operKeyReset, lval->sym); } + + /* restore the original symbol */ + lval->sym = argsym; } } return; @@ -907,9 +914,9 @@ allocVariables (symbol * symChain) SPEC_EXTR (sym->etype) = 0; addSym (TypedefTab, sym, sym->name, sym->level, sym->block, 0); - continue; /* go to the next one */ + continue; /* go to the next one */ } - /* make sure it already exist */ + /* make sure it already exists */ csym = findSymWithLevel (SymbolTab, sym); if (!csym || (csym && csym->level != sym->level)) csym = sym; @@ -917,21 +924,15 @@ allocVariables (symbol * symChain) /* check the declaration */ checkDecl (csym,0); - /* if this is a function or a pointer to function */ - /* then args processing */ + /* if this is a function or a pointer to a */ + /* function then do args processing */ if (funcInChain (csym->type)) { processFuncArgs (csym); - - /* if register bank specified then update maxRegBank */ - if (maxRegBank < FUNC_REGBANK (csym->type)) - maxRegBank = FUNC_REGBANK (csym->type); - /*JCF: Mark the register bank as used*/ - RegBankUsed[FUNC_REGBANK(csym->type)]=1; } /* if this is a extern variable then change the */ - /* level to zero temporarily */ + /* level to zero temporarily */ if (IS_EXTERN (csym->etype) || IS_FUNC (csym->type)) { saveLevel = csym->level; @@ -943,7 +944,7 @@ allocVariables (symbol * symChain) if (IS_LITERAL (sym->etype)) continue; - /* generate the actual declaration */ + /* generate the actual declaration */ if (csym->level) { allocLocal (csym);