This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: does gcc remember register values through into functions?
On Monday 17 January 2005 07:09, Lin Gu wrote:
> char a;
>
> void f()
> {
> a++;
> }
>
> int main()
> {
> a = 252;
> f();
> }
>
>
> If gcc chooses a register r16 to store a's value,
> can gcc use r16 directly in the compiled code
> of function f, so that it avoids a memory load
> for variable a? This optimization should be valid
> if f is only called in main.
This is a form of interprocedural register allocation. GCC does
not do this.
Gr.
Steven