Subject: Re: Kernel calls - args in registers
To: None <firstname.lastname@example.org, travis@EvTech.com>
From: Bruce Evans <email@example.com>
Date: 11/20/1996 17:51:32
>I've been looking at this a bit lately, and noticed that, as you
>point out, gcc doesn't use registers on the x86 by default (IMHO it should
>have, at least if you can configure that for free Unixes -- it's not like we
>had a historical baggage commercial compiler to be call-level compatible
Well, gcc didn't officially support passing args in registers until
2.7, and it still doesn't quite work - function calls through a
pointer sometimes clobber one of the args. Example: FreeBSD qsort().
My version of FreeBSD works when compiled with -mrtd (callee pops),
but I gave up on getting -mregparm=N to work when I hit this problem.
-mrtd doesn't make much difference. It gives slightly smaller code and
is a few percent faster on 486's (because `ret N' is just as fast as
`ret') and a few percent slower on Pentiums (because `ret N' is one
nonpairable cylce slower than `ret').
-mregparm=2 gives slightly larger code. I think it won't make much
difference to the speed when it works.