Re: register variables in C.

metaware!miker@uunet.UU.NET (Mike Ross)
Fri, 1 May 1992 15:36:26 GMT

          From comp.compilers

Related articles
[3 earlier articles]
Re: register variables in C. dd@mips.com (1992-04-23)
Re: register variables in C. dave.howell@ColumbiaSC.NCR.COM (Dave Howell) (1992-04-24)
Re: register variables in C. bart@cs.uoregon.edu (1992-04-29)
Re: register variables in C. jeff@dsp.sps.mot.com (1992-04-30)
Re: register variables in C. Brian.Scearce@Eng.Sun.COM (1992-04-30)
Re: register variables in C. pardo@cs.washington.edu (1992-05-01)
Re: register variables in C. metaware!miker@uunet.UU.NET (1992-05-01)
Re: register variables in C. preston@dawn.cs.rice.edu (1992-05-01)
Re: register variables in C. bliss@sp64.csrd.uiuc.edu (1992-05-01)
Re: register variables in C. ressler@cs.cornell.edu (1992-05-02)
Re: register variables in C. stephen@estragon.uchicago.edu (1992-05-04)
Re: register variables in C. macrakis@osf.org (1992-05-04)
Re: register variables in C. gnb@bby.oz.au (1992-05-04)
[1 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: metaware!miker@uunet.UU.NET (Mike Ross)
Keywords: registers, optimize
Organization: Metaware Incorporated, Santa Cruz, CA
References: 92-04-125 92-04-161
Date: Fri, 1 May 1992 15:36:26 GMT

What John suggests, using a weighting factor that prejudices register
allocation in favor of variables declared as register, is precisely what I
did in writing Apollo's register allocator. The pragma idea isn't really
helpful, unless you want your compiler to do register allocation twice,
once honoring your register variable, and once doing its own thing, and
warning you when your choice appears suboptimal. But then you may as well
let the compiler just do it. Register declaration is fine for PCC and
other slightly brain dead optimizers, but even then, if the code is
actively modified, or ported to various architectures, it will take more
programming discipline and profiling than most of us are willing to exert
to keep the register declarations accurate.


As a side note, I eventually disabled the honoring of register variables
in Apollo's compiler, because I found that with strength reduction and
some other new optimizations, the weighting screwed up the code for
ESPRESSO and some other benchmarks. (Note that I now have no association
with HP/Apollo, and my remarks should not be construed to have any bearing
on their present software products).


In short, if you don't like the code your compiler generates, beat on your
vendor. Send him a snippet that shows the inefficient code, and a
suggestion for what you think it should be. It may not be possible for
them to do it, given the constraints of optimizers dealing in general
cases, but most of the time you'll likely find your vendor appreciative
and responsive.
Mike Ross
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.