#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 */
DCL_TYPE(ptr) = POINTER ;
break;
case S_CODE:
- DCL_PTR_CONST(ptr) = 1;
+ DCL_PTR_CONST(ptr) = port->mem.code_ro;
DCL_TYPE(ptr) = CPOINTER ;
break;
case S_EEPROM:
SPEC_BLEN(dest) |= SPEC_BLEN(src);
SPEC_BSTR(dest) |= SPEC_BSTR(src);
SPEC_TYPEDEF(dest) |= SPEC_TYPEDEF(src);
+ SPEC_NONBANKED(dest) |= SPEC_NONBANKED(src);
if ( IS_STRUCT(dest) && SPEC_STRUCT(dest) == NULL )
SPEC_STRUCT(dest) = SPEC_STRUCT(src);
/* global variables declared const put into code */
if (sym->level == 0 &&
- SPEC_SCLS(sym->etype) == S_CONSTANT)
+ SPEC_SCLS(sym->etype) == S_CONSTANT) {
SPEC_SCLS(sym->etype) = S_CODE ;
-
+ SPEC_CONST(sym->etype) = 1;
+ }
/* global variable in code space is a constant */
if (sym->level == 0 &&
- SPEC_SCLS(sym->etype) == S_CODE)
+ SPEC_SCLS(sym->etype) == S_CODE &&
+ port->mem.code_ro )
SPEC_CONST(sym->etype) = 1;
if (SPEC_SCLS(sym->etype) == S_CODE &&
sym->ival == NULL &&
!sym->level &&
+ port->mem.code_ro &&
!IS_EXTERN(sym->etype))
werror(E_CODE_NO_INIT,sym->name);
value *val ;
int pNum = 1;
+
/* if this function has variable argument list */
/* then make the function a reentrant one */
if (func->hasVargs)
func->args = NULL ;
return ;
}
-
+
+ /* reset regparm for the port */
+ (*port->reset_regparms)();
/* if any of the arguments is an aggregate */
/* change it to pointer to the same type */
while (val) {
-
/* mark it as a register parameter if
- the function does nit have VA_ARG
- and MAX_REG_PARMS not exceeded &&
+ the function does not have VA_ARG
+ and as port dictates
not inhibited by command line option or #pragma */
- if (pNum <= MAX_REG_PARMS &&
+ if (!func->hasVargs &&
!options.noregparms &&
- !func->hasVargs)
+ (*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 */
link *floatType;
+#if ENABLE_MICHAELH_REGPARM_HACK
+static void _makeRegParam(symbol *sym)
+{
+ value *val ;
+
+ val = sym->args; /* loop thru all the arguments */
+
+ /* reset regparm for the port */
+ (*port->reset_regparms)();
+ while (val) {
+ SPEC_REGPARM(val->etype) = 1;
+ sym->argStack -= getSize(val->type);
+ val = val->next ;
+ }
+}
+#endif
+
/*-----------------------------------------------------------------*/
/* initCSupport - create functions for C support routines */
/*-----------------------------------------------------------------*/
ssu[su],
sbwd[bwd]);
__muldiv[muldivmod][bwd][su] = funcOfType(buffer, __multypes[bwd][su], __multypes[bwd][su], 2, options.intlong_rent);
+#if ENABLE_MICHAELH_REGPARM_HACK
+ if (bwd < 2)
+ _makeRegParam(__muldiv[muldivmod][bwd][su]);
+#endif
}
}
}