DEBUG-NAME - 'B'
POINTER-TYPE - POINTER
*/
- istack = allocMap (0, 0, 0, 0, 0, 0, options.stack_loc, ISTACK_NAME, 'B', POINTER);
+ if (ISTACK_NAME) {
+ istack = allocMap (0, 0, 0, 0, 0, 0, options.stack_loc,
+ ISTACK_NAME, 'B', POINTER);
+ } else {
+ istack=NULL;
+ }
/* code segment ;
SFRSPACE - NO
DEBUG-NAME - 'E'
POINTER-TYPE - POINTER
*/
- overlay = allocMap (0, 0, 0, 1, 0, 0, options.data_loc, DATA_NAME, 'E', POINTER);
+ if (OVERLAY_NAME) {
+ overlay = allocMap (0, 0, 0, 1, 0, 0, options.data_loc, DATA_NAME, 'E', POINTER);
+ } else {
+ overlay = NULL;
+ }
/* Xternal Data segment -
SFRSPACE - NO
DEBUG-NAME - 'G'
POINTER-TYPE - IPOINTER
*/
- idata = allocMap (0, 0, 0, 0, 0, 0, options.idata_loc, IDATA_NAME, 'G', IPOINTER);
+ if (IDATA_NAME) {
+ idata = allocMap (0, 0, 0, 0, 0, 0, options.idata_loc,
+ IDATA_NAME, 'G', IPOINTER);
+ } else {
+ idata=NULL;
+ }
/* Static segment (code for variables );
SFRSPACE - NO
/* symbol name is internal name */
if (!sym->level) /* local statics can come here */
- sprintf (sym->rname, "%s%s", port->fun_prefix, sym->name);
+ SNPRINTF (sym->rname, sizeof(sym->rname),
+ "%s%s", port->fun_prefix, sym->name);
/* add it to the operandKey reset */
- addSet (&operKeyReset, sym);
+ if (!isinSet (operKeyReset, sym)) {
+ addSet(&operKeyReset, sym);
+ }
/* if this is a literal e.g. enumerated type */
/* put it in the data segment & do nothing */
SPEC_OCLS (sym->etype) = code;
/* if this is an interrupt service routine
then put it in the interrupt service array */
- if (FUNC_ISISR (sym->type))
+ if (FUNC_ISISR (sym->type) && !options.noiv
+ && (FUNC_INTNO (sym->type) != INTNO_UNSPEC))
{
-
if (interrupts[FUNC_INTNO (sym->type)])
werror (E_INT_DEFINED,
FUNC_INTNO (sym->type),
SPEC_SCLS (sym->etype) == S_SBIT)
{
- /* if both absolute address & initial */
- /* value specified then error */
- if (IS_ABSOLUTE (sym->etype) && sym->ival)
- {
- werror (E_SFR_INIT, sym->name);
- sym->ival = NULL;
- }
-
SPEC_OCLS (sym->etype) =
(SPEC_SCLS (sym->etype) == S_SFR ? sfr : sfrbit);
else
{ /* allocate them in the automatic space */
/* generate a unique name */
- sprintf (lval->sym->rname, "%s%s_PARM_%d", port->fun_prefix, currFunc->name, pNum);
- strcpy (lval->name, lval->sym->rname);
+ SNPRINTF (lval->sym->rname, sizeof(lval->sym->rname),
+ "%s%s_PARM_%d", port->fun_prefix, currFunc->name, pNum);
+ strncpyz (lval->name, lval->sym->rname, sizeof(lval->name));
/* if declared in external storage */
if (SPEC_SCLS (lval->etype) == S_XDATA)
if (!lval->sym->isref)
{
lval->sym->allocreq = 0;
- werror (W_NO_REFERENCE, currFunc->name,
- "function argument", lval->sym->name);
+ werror (W_NO_REFERENCE,
+ currFunc ? currFunc->name : "(unknown)",
+ "function argument", lval->sym->name);
}
/* move the rname if any to the name for both val & sym */
if (lval->sym->rname[0])
{
char buffer[SDCC_NAME_MAX];
- strcpy (buffer, lval->sym->rname);
+ strncpyz (buffer, lval->sym->rname, sizeof(buffer));
lval->sym = copySymbol (lval->sym);
- strcpy (lval->sym->rname, buffer);
- strcpy (lval->name, strcpy (lval->sym->name, lval->sym->rname));
+ 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));
addSym (SymbolTab, lval->sym, lval->sym->name,
lval->sym->level, lval->sym->block, 1);
lval->sym->_isparm = 1;
- addSet (&operKeyReset, lval->sym);
+ if (!isinSet (operKeyReset, lval->sym)) {
+ addSet(&operKeyReset, lval->sym);
+ }
}
}
{
/* generate an unique name */
- sprintf (sym->rname, "%s%s_%s_%d_%d",
- port->fun_prefix,
- currFunc->name, sym->name, sym->level, sym->block);
+ SNPRINTF (sym->rname, sizeof(sym->rname),
+ "%s%s_%s_%d_%d",
+ port->fun_prefix,
+ currFunc->name, sym->name, sym->level, sym->block);
sym->islocal = 1;
sym->localof = currFunc;
if (SPEC_SCLS (sym->etype) == S_SFR ||
SPEC_SCLS (sym->etype) == S_SBIT)
{
-
- /* if both absolute address & initial */
- /* value specified then error */
- if (IS_ABSOLUTE (sym->etype) && sym->ival)
- {
- werror (E_SFR_INIT, sym->name);
- sym->ival = NULL;
- }
-
SPEC_OCLS (sym->etype) =
(SPEC_SCLS (sym->etype) == S_SFR ? sfr : sfrbit);
will remove and put into the 'data' segment if required after
overlay analysis has been done */
if (options.model == MODEL_SMALL) {
- SPEC_OCLS (sym->etype) =
- (options.noOverlay ? port->mem.default_local_map
- : overlay);
+ SPEC_OCLS (sym->etype) =
+ (options.noOverlay ? port->mem.default_local_map
+ : overlay);
} else {
- SPEC_OCLS (sym->etype) = port->mem.default_local_map;
+ SPEC_OCLS (sym->etype) = port->mem.default_local_map;
}
allocIntoSeg (sym);
}
}
/* if not used give a warning */
if (!sym->isref && !IS_STATIC (sym->etype))
- werror (W_NO_REFERENCE, currFunc->name,
+ werror (W_NO_REFERENCE,
+ currFunc ? currFunc->name : "(unknown)",
"local variable", sym->name);
/* now delete it from the symbol table */
deleteSym (SymbolTab, sym, sym->name);
allocIntoSeg (sym);
}
- setToNull ((void **) &overlay->syms);
+ setToNull ((void *) &overlay->syms);
}
addSet (&oset, sym);
}
- setToNull ((void **) &overlay->syms);
+ setToNull ((void *) &overlay->syms);
addSet (&ovrSetSets, oset);
}
/* then args processing */
if (funcInChain (csym->type))
{
-#if 1 // jwk: TODO should have been done already in addDecl() (oclass????)
processFuncArgs (csym);
-#endif
+
/* 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 */
xsPtr += size;
}
- /* if the debug option is set then output the
- symbols to the map file */
- if (options.debug)
- {
- for (sym = setFirstItem (istack->syms); sym;
- sym = setNextItem (istack->syms))
- cdbSymbol (sym, cdbFile, FALSE, FALSE);
-
- for (sym = setFirstItem (xstack->syms); sym;
- sym = setNextItem (xstack->syms))
- cdbSymbol (sym, cdbFile, FALSE, FALSE);
- }
}
/*-----------------------------------------------------------------*/
if (!sym->allocreq && sym->reqv)
{
int i;
+
sym = OP_SYMBOL (sym->reqv);
fprintf (of, "registers ");
for (i = 0; i < 4 && sym->regs[i]; i++)
void
doOverlays (eBBlock ** ebbs, int count)
{
+ if (!overlay) {
+ return;
+ }
+
/* check if the parameters and local variables
of this function can be put in the overlay segment
This check is essentially to see if the function
void
printAllocInfo (symbol * func, FILE * of)
{
+ if (!func)
+ return;
+
if (!of)
of = stdout;
-
+
/* must be called after register allocation is complete */
fprintf (of, ";------------------------------------------------------------\n");
fprintf (of, ";Allocation info for local variables in function '%s'\n", func->name);