From: Takahashi, C. <Chr...@fl...> - 2003-07-29 22:47:22
|
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 |