#include "common.h"
-#define ENABLE_MICHAELH_REGPARM_HACK 0
-
bucket *SymbolTab [256] ; /* the symbol table */
bucket *StructTab [256] ; /* the structure table */
bucket *TypedefTab[256] ; /* the typedef table */
/*-----------------------------------------------------------------*/
/* hashKey - computes the hashkey given a symbol name */
/*-----------------------------------------------------------------*/
-int hashKey (char *s)
+int hashKey (const char *s)
{
unsigned long key = 0;
/*-----------------------------------------------------------------*/
/* findSym - finds a symbol in a table */
/*-----------------------------------------------------------------*/
-void *findSym ( bucket **stab, void *sym, char *sname)
+void *findSym ( bucket **stab, void *sym, const char *sname)
{
bucket *bp ;
/* the storage class to reflect where the var will go */
if ( sym->level && SPEC_SCLS(sym->etype) == S_FIXED) {
if ( options.stackAuto || (currFunc && IS_RENT(currFunc->etype)))
+ {
SPEC_SCLS(sym->etype) = (options.useXstack ?
S_XSTACK : S_STACK ) ;
+ }
else
- SPEC_SCLS(sym->etype) = (options.useXstack ?
- S_XDATA :S_DATA ) ;
+ {
+ /* hack-o-matic! I see no reason why the useXstack option should ever
+ * control this allcoation, but the code was originally that way, and
+ * changing it for non-390 ports breaks the compiler badly.
+ */
+ extern PORT ds390_port;
+ bool useXdata = (port == &ds390_port) ? options.model : options.useXstack;
+ SPEC_SCLS(sym->etype) = (useXdata ?
+ S_XDATA : S_FIXED ) ;
+ }
}
}
not inhibited by command line option or #pragma */
if (!func->hasVargs &&
!options.noregparms &&
+ !IS_RENT(func->etype) &&
(*port->reg_parm)(val->type)) {
-
SPEC_REGPARM(val->etype) = 1;
}
-
-#if ENABLE_MICHAELH_REGPARM_HACK
- /* HACK: pull out later */
- if (
- (
- !strcmp(func->name, "memcpy") ||
- !strcmp(func->name, "strcpy") ||
- !strcmp(func->name, "strcmp") ||
- 0
- ) &&
- port->reg_parm(val->type)) {
- SPEC_REGPARM(val->etype) = 1;
- }
-#endif
if ( IS_AGGREGATE(val->type)) {
/* if this is a structure */
sprintf(val->name,"_%s_PARM_%d",func->name,pNum++);
val->sym = newSymbol(val->name,1);
- SPEC_OCLS(val->etype) = (options.model ? xdata : data);
+ SPEC_OCLS(val->etype) = port->mem.default_local_map;
val->sym->type = copyLinkChain (val->type);
val->sym->etype = getSpec (val->sym->type);
val->sym->_isparm = 1;
int i ;
bucket **table = StructTab;
bucket *chain;
-
+ wassert(of);
+
/* go thru the entire table */
for ( i = 0 ; i < 256; i++ ) {
for ( chain = table[i]; chain ; chain = chain->next ) {
link *floatType;
-#if ENABLE_MICHAELH_REGPARM_HACK
static void _makeRegParam(symbol *sym)
{
value *val ;
val = val->next ;
}
}
-#endif
/*-----------------------------------------------------------------*/
/* initCSupport - create functions for C support routines */
sbwd[bwd]);
__muldiv[muldivmod][bwd][su] = funcOfType(buffer, __multypes[bwd][su], __multypes[bwd][su], 2, options.intlong_rent);
SPEC_NONBANKED(__muldiv[muldivmod][bwd][su]->etype) = 1;
-#if ENABLE_MICHAELH_REGPARM_HACK
- if (bwd < 2)
+ if (bwd < port->muldiv.force_reg_param_below)
_makeRegParam(__muldiv[muldivmod][bwd][su]);
-#endif
}
}
}