Tim Frink <plfriko@[EMAIL PROTECTED]
> wrote in part:
> I've a general question about calling conventions and the
> use of registers across calls. In a book I found this:
> "For a variable whose range of appearance spans many
> procedure calls, the use of a callee-saved register is
> advantageous, because saving and restoring once at the
> procedure entry and exit respectively are cheaper than
> saving and restoring around each call."
I'm a native english speaker and I don't understand either.
Cheaper can mean shorter or quicker (cheaper on cycles)
which are often the same for once-thru code.
To me, register preservation is a matter of conventions
without any ideal answer: only the caller knows which regs
need saving, and only the callee knows which registers will
be trampled. Often, no regs need saving.
In x86, the arch is allegedly short of registers so the
usual presumption is all will get trampled. This leads to
caller-save conventions. But note that ESP and EBP usually
are callee-save . Since procedures have non-zero overhead,
they should be reserved for "significant" code that makes
the trampling more likely.
-- Robert


|