DragonFly commits List (threaded) for 2003-08
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: cvs commit: src/sys/sys cdefs.h
: NOTE: No source files have been modified to make use of the __usereg
: macro yet. This process can be automated, because the maximum number
: of arguments that apply to this macro is 3.
:
: Reviewed by: Matt
:
: Revision Changes Path
: 1.5 +51 -0 src/sys/sys/cdefs.h
Though I will note that use of this macro will be fairly restricted,
at least initially, since it involves an incompatible ABI change for
the functions it is applied to. I don't want people to go __usereg
crazy in the source tree!
It kinda brings me back to my Amiga days where regargs were used
extensively to good effect. For IA32, however, due to the fewer
registers that are available, use of regargs should be restricted to
small 'leaf' functions only... things like bcopy(), and *NOT* things like,
say, tcp_input() :-).
-Matt
Matthew Dillon
<dillon@xxxxxxxxxxxxx>
/*
* TEST.C
*/
#define __usereg __attribute__((regparm(3)))
__usereg int
fubar(int a, int b)
{
return(a + b);
}
int x, y, z;
main()
{
z = fubar(x, y);
}
Outputs the following assembly:
fubar:
pushl %ebp << would be removed by -fomit-frame-pointer
movl %esp,%ebp << would be removed by -fomit-frame-pointer
addl %edx,%eax
leave << would be removed by -fomit-frame-pointer
ret
main:
pushl %ebp
movl %esp,%ebp
subl $8,%esp
movl y,%edx << arguments to function
movl x,%eax
call fubar << function call
movl %eax,z << return value
leave
ret
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]