Re: confusion on caller-saved registers and callee-saved registers

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

 



He Xiao <xiheasas@xxxxxxxxx> writes:

> I am quite confused about how the gcc distinguish them. I know there
> is a macro CALL_USED_REGISTER, where one register should be saved in
> the stack when used in a function if the corresponding value in
> CALL_USED_REGISTER is set to 0. So it becomes reasonable for the
> caller to save the registers if their CALL_USED_REGISTER values are 1.

To be clear, it's the other way around.  If CALL_USED_REGISTER is 1,
then the function is permitted to change the register.  The prologue
should save any registers which are used for which CALL_USED_REGISTER
is 0.

> But I didn't see  GCC generate sw r24, sp, off. Is there something I
> am missing? Or maybe I misunderstand the concept of call-used
> registers.

The function prologue code is responsible for saving registers which
are not called used but which are modified by the function.

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