Merit of callee-saved register
- From: Tim Frink <plfriko@xxxxxxxx>
- Date: Tue, 22 Apr 2008 09:51:18 +0000 (UTC)
Hi,
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."
What I don't understand is the term "cheaper". In my opinion cheaper must
mean less code (i.e. less instructions in the code) since when the same
function is invoked multiple times, there are just once the instructions
in this function for saving/restoring while in the case of register
saving/restoring around the each call for each call separate instructions
must be added.
Cheaper cannot mean faster execution because the number of executed
saving/restoring instructions would be the same for both approaches,
right?
Or do you understand this in another way?
Regards,
Tim
.
- Follow-Ups:
- Re: Merit of callee-saved register
- From: robertwessel2@xxxxxxxxx
- Re: Merit of callee-saved register
- From: Robert Redelmeier
- Re: Merit of callee-saved register
- Prev by Date: Re: Newbie Alert !!!
- Next by Date: Re: All is right !
- Previous by thread: Code performance, rdtsc and code alignment
- Next by thread: Re: Merit of callee-saved register
- Index(es):
Relevant Pages
|