Registers used by compiler

Walter Bright bright at Data-IO.COM
Thu Jul 20 05:26:16 AEST 1989


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.



More information about the Comp.lang.c mailing list