Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Oct 1998 08:31:57 -0700
From:      Mike Smith <mike@smith.net.au>
To:        marko@cs.uni-frankfurt.de
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Global register variables in gcc and stdio.h?!? 
Message-ID:  <199810071531.IAA00355@dingo.cdrom.com>
In-Reply-To: Your message of "Wed, 07 Oct 1998 15:30:38 %2B0200." <199810071330.PAA22126@king.ki.informatik.uni-frankfurt.de> 

index | next in thread | previous in thread | raw e-mail

> An application I want to compile runs much faster if it can use global
> register variables.
> 
> Trying to compile it I get 
> 
> [...]
> gmake[1]: Entering directory `/usr/home/marko/src/mercury-0.7.3.orig/runtime'
> MERCURY_C_INCL_DIR=. ../scripts/mgnuc --grade asm_fast.gc --no-ansi -I../runtime -I../boehm_gc -g   -c label.c -o label.o
> In file included from regs.h:67,
>                  from imp.h:36,
>                  from label.c:19:
> machdeps/i386_regs.h:61: global register variable follows a function definition
> machdeps/i386_regs.h:62: global register variable follows a function definition
> machdeps/i386_regs.h:67: global register variable follows a function definition
> gmake[1]: *** [label.o] Error 1
> gmake[1]: Leaving directory `/usr/home/marko/src/mercury-0.7.3.orig/runtime'
> gmake: *** [runtime] Error 2
> 
> I checked the preprocessor output and found that there is only the 
> function definition for `static __inline int __sputc(int _c, FILE
> *_p)` which is included from stdio.h. Depending on an #ifdef that
> version of __sputc or an alternative as a macro is used.
> 
> I would suggest adding something like
> !defined(__USE_GLOBAL_REGISTER_VARIABLES__) to the condition for using
> the inline function.
>
> Doing that allows at least mercury to compile using global register
> variables. 
> 
> Please comment. 

1)  Any application which depends on global register variables for 
    performance needs to be fixed.  The concept of a "global register 
    variable" on the x86 is a bit of a joke anyway.

2)  Declare your global register variables before including header 
    files.

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810071531.IAA00355>