Related articles |
---|
Is "register" generally ignored? smeyers@aristeia.com (Scott Meyers) (2002-02-28) |
Re: Is "register" generally ignored? {spamtrap}@erewhon.demon.co.uk (Maneki Neko) (2002-03-09) |
Re: Is "register" generally ignored? fjh@cs.mu.OZ.AU (2002-03-09) |
Re: Is "register" generally ignored? rkrayhawk@aol.com (2002-03-09) |
Re: Is "register" generally ignored? bear@sonic.net (Ray Dillinger) (2002-03-21) |
From: | Ray Dillinger <bear@sonic.net> |
Newsgroups: | comp.compilers |
Date: | 21 Mar 2002 22:01:26 -0500 |
Organization: | Compilers Central |
References: | 02-02-067 02-03-014 |
Keywords: | C, optimize |
Posted-Date: | 21 Mar 2002 22:01:26 EST |
Fergus Henderson wrote:
>
> Scott Meyers <smeyers@aristeia.com> writes:
>
> >Is it reasonable to assume that contemporary C and C++
> >compilers will ignore use of "register" when generating optimized code?
>
> Yes.
Although some compilers have a setting or compile flag that will make
them pay attention to the "register" directives.
I have used such options when compiling to C without benefit of the C
stack. Scheme, the language I compiled to C,does not have the same
stack discipline as C, so I was generating explicit stack-handling
code to put stack frames on the heap and link them to the
datastructures used by the garbage collector. From the perspective of
the C compiler, the code that had been produced was just one gigantic
routine with the stack-handling stuff inlined and occasional "gotos"
where the scheme source code was passing control from one routine to
another.
Until I figured out how to get gcc to pay attention to the register
directive, I had to tell it not to optimize at all. Otherwise it was
trying to do graph-coloring on that monstrous routine to figure out
what variables should be enregistered -- a process that could make the
compile take years if the program being compiled was large.
Bear
Return to the
comp.compilers page.
Search the
comp.compilers archives again.