On Feb 23, 2008, at 1:23 PM, Diego Novillo wrote:
On Fri, Feb 22, 2008 at 22:42, Maurizio Vitale
<maurizio.vitale@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Is it safe to assume that GCC saves "callee-owned" registers
around a
function call that gets inlined?
Or does GCC look inside the expansion and determines what needs
to be
saved?
No. Once a function is inlined, the register allocator does not
really know that the inlined body comes from a different function.
For all it knows, the code comes from the same parent function. It's
the same effect as if you had inlined the function in a text editor
and compiled the result (well, except that the inliner keeps enough
debugging information around to inform the debugger about it).
Thanks. This confirms what I suspected, although I've never found it
spelled
out anywhere.
As a followup question (assuming I have a function that destroys all
registers
in ways the compiler cannot know about), is there documentation
(for each platform, although I'm interested in X86_64 only)
on the minimum set of registers that must be left available to GCC?
Putting all general purpose registers in the clobber set fails in
some cases, but
removing registers from the clobber set (and adding explicit saves
around the inlined asm)
until my tests pass doesn't seem very safe.
Thanks again,
Maurizio