??? 08/08/05 21:44 Read: times |
#99018 - The Trick is: Responding to: ???'s previous message |
Oleg Sergeev said:
In one of projects we have several (about 20) huge subroutines which destroy contents of most registers. Indeed it is possible to push all needed registers to stack at the start of these subroutines and restore registers before return. During optimization we come to low free program memory and looking at the code found that each block of pushing/popping takes about 50 bytes in sum. So they "eats" about 1kb totally. Thus why the Keil C51 use a complete different approach: All registers are scratchpad or for parameter passing and thus any function can destroy all registers. Its the task of the caller, if he need variables later, he must push it or locate in on the direct RAM. It was also my approach on former assembler days to do many needless PUSH and POP. And I was very surprised after using C, that most times the code was smaller and faster as my assembler. Peter |