[comp.lang.c] Registers used by compiler

bright@Data-IO.COM (Walter Bright) (07/20/89)

Various methods have appeared to determine the number of registers a
compiler will use to stuff variables in.

None of these will work with my compiler, Zortech. The compiler first
generates code for a function, keeping track of what registers are used
where. Based on this and a map of where variables are used, it then
assigns variables to registers using classic graph-coloring techniques.

Therefore, how many registers are used for variables varies from function
to function, and also varies depending on whether optimization was selected
and what memory model was used.

Modern compilers stuff variables into registers regardless of the use of
the 'register' keyword. That keyword is an anachronism, only useful with
old compilers.

gwyn@smoke.BRL.MIL (Doug Gwyn) (07/21/89)

In article <2064@dataio.Data-IO.COM> bright@dataio.Data-IO.COM (Walter Bright) writes:
>Modern compilers stuff variables into registers regardless of the use of
>the 'register' keyword. That keyword is an anachronism, only useful with
>old compilers.

At one of the X3J11 meetings, "register" was described as serving the
compiler technology of the 1970s, and "noalias" was described as serving
the compiler technology of the 1980s.  I think that's about right.

Roy.Browning@f506.n106.z1.fidonet.org (Roy Browning) (07/25/89)

Walter:

> Modern compilers stuff variables into registers regardless of the use
> of the 'register' keyword. That keyword is an anachronism, only useful
> with old compilers.

     I find myself in disagreement with such an absolute statement!  For
human thought is required to adapt to new or unexpected situations.  The
"register" declaration can be misused but it is a beneficial tool that I
regret not having use of.  When implemented it can offer significant
improvement when code is designed expressly for register variables.


     Should the compiler or the programmer be in ultimate control?,

                              Roy Browning