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 ( IS_AGGREGATE(val->type)) {
/* if this is a structure */
void mcs51_assignRegisters (eBBlock **ebbs, int count);
+static int regParmFlg = 0; /* determine if we can register a parameter */
+
+static void _mcs51_reset_regparm()
+{
+ regParmFlg = 0;
+}
+
+static int _mcs51_regparm( link *l)
+{
+ /* for this processor it is simple
+ can pass only the first parameter in a register */
+ if (regParmFlg)
+ return 0;
+
+ regParmFlg = 1;
+ return 1;
+}
+
static bool _mcs51_parseOptions(int *pargc, char **argv, int *i)
{
/* TODO: allow port-specific command line options to specify
_mcs51_getRegName ,
_mcs51_keywords,
_mcs51_genAssemblerPreamble,
- _mcs51_genIVT
+ _mcs51_genIVT ,
+ _mcs51_reset_regparm,
+ _mcs51_regparm
};
* will be used.
*/
int (*genIVT)(FILE *of, symbol **intTable, int intCount);
+
+
+ /* parameter passing in register related functions */
+ void (*reset_regparms)(); /* reset the register count */
+ int (*reg_parm)(struct link *); /* will return 1 if can be passed in register */
+
} PORT;
extern PORT *port;
z80_opts.sub = SUB_Z80;
}
+static int regParmFlg = 0; /* determine if we can register a parameter */
+
+static void _z80_reset_regparm()
+{
+ regParmFlg = 0;
+}
+
+static int _z80_reg_parm(link *l)
+{
+ /* for this processor it is simple
+ can pass only the first parameter in a register */
+ if (regParmFlg)
+ return 0;
+
+ regParmFlg = 1;
+ return 1;
+
+}
+
static bool _z80_parseOptions(int *pargc, char **argv, int *i)
{
return FALSE;
_z80_keywords,
0, /* no assembler preamble */
0, /* no local IVT generation code */
+ _z80_reset_regparm,
+ _z80_reg_parm
};