Potential optimisation?

Angus Greiswald the fourth ag4 at pucc-h
Thu Jan 24 01:01:13 AEST 1985


> > 2)  In a UNIX C compiler (to the best of my knowledge) two assembly
> > procedures CSV and CRET are used to save and restore the registers in
> > the *called* procedure.  I fail to see why this is desirable.  The
> > *calling* procedure has full knowledge of which registers are being
> > used and can save them itself.  This may not result in savings, but I
> > don't see where it can result in a performance degradation.

>      ... Registers, by definition CANNOT change from original values after
> a subroutine call returns.

Not sure I follow you there.  Which definition are you talking about?

>                         [saving and restoring registers] is nessasary
> considering you can have constructs such as 'register int charlie'.  

If the calling procedure saves all the registers that are being used,
and restores them itself, then the called procedure can do anything it
pleases with the registers, including, of course, use register variables.

--
" ... "

Jeff Lewis                                         vvvvvvvvvvvv
{decvax|ucbvax|allegra|seismo|harpo|teklabs|ihnp4}!pur-ee!lewie
                                                   ^^^^^^^^^^^^



More information about the Comp.lang.c mailing list