Usage of global register variables on ix86

Marko Schuetz marko at
Fri Oct 9 18:59:48 AEST 1998

Compiling 0.7.3 using FreeBSD 2.2.7 on a ix86 machine there was an
error compiling label.c. This is due to stdio.h being included before
regs.h and in stdio.h there is an inline function for
__sputc. Including regs.h before stdio.h solves the problem. I did not
think of this obvious solution and instead first posted to the
freebsd-stable mailing list.

The comments in the thread basically say that on the ix86 there is not
much to be gained using global register variables since a) it does not
really have (m)any and b) gcc does such a good job allocating
registers that a better register allocation is very difficult to

Ad a). I looked into regs.h and found that 2 or 3
registers are used, depending on whether pic code is generated or not.

Ad b). The mercury docs claim that there is a great speed improvement
when global register variables can be used. Does this also hold for
the ix86? I do not have the resources to compare this myself (I am
using a 90MHz laptop) but I am sure this has been compared. Can anyone
give me a pointer/the facts?

On the side: has anyone compared the efficiency of using egcs instead of
gcc with mercury?


More information about the users mailing list