of course, hand-craften assembly is much better.
~d
On Wednesday 30 July 2003 02:47, Takahashi, Chris wrote:
> While looking at asm listings I keep running across instances where GCC
> 'juggles' its general purpose registers around for no apparent(to me)
> reason, creating lots of extra mov instructions and wasted code space.
> Attached is some source which has all the irrelevant (to this issue) code
> removed and its asm list.
>
> A pointer 'err' gets passed to the function through r12 then moved into r7
> (Which I believe to be unnecessary.) Then r12 is used to alter *err.
> Later r12 is used by another bit of code for something unrelated and then
> r7 is then used at the pointer to err. Finally the function returns.
>
> Why cant the first move be avoided and the section of code that uses r12
> for something else use r7 instead? Then at the last use of *err r7 could
> be replaced by r12.
>
> I am compiling with -Os so this probably shouldn't occur.
>
> Thanks for the help.
>
> -Chris Takahashi
--
/*****************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) State Polytechnical Univ.
(_Y_.)' ._ ) `._ `. ``-..-' Radio-Physics Departament
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 5403923, 5585314
*****************************************************************/