Cross gcc Mailing List Archive
[Prev][Next][Index][Thread]
Register parameters & m68k-unknown-coff
-
Date: Sun, 26 Jan 1997 16:22:35 +0200 (EET)
-
From: Iso-H <jd@ray.fi>
-
Reply-To: Iso-H <jd@ray.fi>
-
Content-Type: TEXT/PLAIN; charset=US-ASCII
I have problems with mixed register/stack parameter passing.
I am using registers d0 and d1 for passing first and second parameter
and stack for the rest.
To get register parameter passing to work I added these
two macro to file "config/m68k/m68k-coff.h":
#undef TARGET_REGPARM
#define TARGET_REGPARM (1)
#undef FUNCTION_ARG_REGNO_P
#define FUNCTION_ARG_REGNO_P(N) ((N)==0 || (N)==1)
Everything seems to be ok until I used varargs; stack
parameters works (actually everything works just ok,
if I use more than two fixed parameter!) , but register
parameters not.
For example from this C-code:
#include <stdarg.h>
int tmp1, tmp2, tmp3, tmp4;
void func( int p_1, ... )
{
va_list args;
va_start(args, p_1 );
tmp1 = va_arg(args,int);
tmp2 = va_arg(args,int);
tmp3 = va_arg(args,int);
tmp4 = va_arg(args,int);
}
... gcc generates this assembly code:
.globl func
func:
link.w %a6,#0
move.l 8(%a6),tmp1
move.l 12(%a6),tmp2
move.l 16(%a6),tmp3
move.l 20(%a6),tmp4
unlk %a6
rts
Obviously gcc should generate something like this:
.globl func
func:
link.w %a6,#0
move.l %d1,tmp1
move.l 8(%a6),tmp2
move.l 12(%a6),tmp3
move.l 16(%a6),tmp4
unlk %a6
rts
So question is: Do I have to define some other macros
in "m68k-coff.h" also? And what are these macros?
Follow-Ups:
Home |
Subject Index |
Thread Index