Re: register variables in C.

preston@dawn.cs.rice.edu (Preston Briggs)
Fri, 1 May 1992 20:01:20 GMT

          From comp.compilers

Related articles
[4 earlier articles]
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)
Re: register variables in C. cliffc@cs.rice.edu (1992-05-06)
| List of all articles for this month |

Newsgroups: comp.compilers
From: preston@dawn.cs.rice.edu (Preston Briggs)
Keywords: registers, optimize
Organization: Rice University, Houston
References: 92-04-125 92-04-161
Date: Fri, 1 May 1992 20:01:20 GMT

bart@cs.uoregon.edu (Barton Christopher Massey) writes:


>I know of at least one large graphics system which
>must compile efficiently on a number of compilers, including GCC, and thus
>includes in its drawing macros a primitive something like
>
> #define L do{
> #define R }while(0);
> #define HIPRI(X) L L L L L L L L X R R R R R R R R
>
>used like
>
> HIPRI( y = x; )


Looks like it would be ineffective in a reasonable compiler. After all,
the conditionals are all constant and the optimizer could simply fold up
all the code into a single assignment. I guess it depends on when the
priorities are established (i.e., before or after optimization).


It would serve them right if the code wasn't simplified and their
"high-priority" assignment ended up followed by 8 conditional branches!


I don't much like register declarations. The bulk of the register
allocator's task is handling temporaries arising during the evaluation of
expressions and during optimization. None of these temps are visible at
the source level and many, perhaps most, are more important than the
source-level variables.


A more comprehensive approach would take advantage of profiling
information to obtain more accurate priorities for all variables and
temporaries. Of course, there are difficulties that must be overcome
before profile-guided allocation can be practical -- relevance of test
cases to real cases, collection and management of profile info, update of
profile after program editing, ... I'm sure people are working on these
questions.


Preston Briggs
--


Post a followup to this message

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