Re: CALL_USED_REGISTERS help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Paulo J. Matos" <pocmatos@xxxxxxxxx> writes:

> I am reading the documentation of CALL_USED_REGISTERS and can't help
> but thing there is a typo (even though it is more probable that I am
> not understanding the documentation).
> It says:
> "Like FIXED_REGISTERS but has 1 for each register that is clobbered
> (in general) by function calls as well as for fixed registers. ... If
> a register has 0 in CALL_USED_REGISTERS, the compiler automatically
> saves it on function entry and restores it on function exit, if the
> register is used within the function. "
>
> Is it has a 1, then it means that the register is clobbered. And 0
> means it is not clobbered. But if it is not clobbered, why does the
> compiler need to save it on function entry and restore it on function
> exit?

Look at it from the perspective of the function which wants to use the
register.  If CALL_USED_REGISTERS is 0, the function is not permitted
to change the register.  If the function did change the register, that
would break the assumptions of the function's caller.  Therefore, if
the function wants to use the register, it must save the old value and
restore when it is done.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux