Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > Re: Merit of ca...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 4968 of 5166
Post > Topic >>

Re: Merit of callee-saved register

by Robert Redelmeier <redelm@[EMAIL PROTECTED] > Apr 22, 2008 at 12:45 PM

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
 




 3 Posts in Topic:
Merit of callee-saved register
Tim Frink <plfriko@[EM  2008-04-22 09:51:18 
Re: Merit of callee-saved register
Robert Redelmeier <red  2008-04-22 12:45:32 
Re: Merit of callee-saved register
"robertwessel2@[EMAI  2008-04-22 14:38:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 6:00:54 CDT 2008.