From: SourceForge.net <no...@so...> - 2007-06-26 18:51:38
|
Bugs item #1743798, was opened at 2007-06-26 22:51 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1743798&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: msc51(8051) target Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Stas Sergeev (stsp) Assigned to: Nobody/Anonymous (nobody) Summary: unnecessary bankswitching Initial Comment: Hi. This is not strictly a bug, but the effect of that pessimization is rather bad. If the interrupt handler is defined to use some regbank other than 0, and it calls some function that is not set to use any particular regbank, then the compiler would save all the regs and switch the bank to 0 before calling the function. I define the inthandler to use the specific regbank exactly to save some stack space and an execution time, but the effect is quite the reverse. Unless I am missing something, if the function is not set to explicitly use some regbank, there is no need to switch the banks before calling it. It looks like sdcc doesn't destinguish between the function that is not set to use a particular regbank and the function that was set to use bank 0, which makes the problem. It always switches to bank 0, but if the function is not explicitly defined to use bank 0, then there is no need to switch at all. Attached is the simple demo program. Looking into its assembly reveals how many unneeded things are done, and how much memory does this consume. It eats about 10 extra bytes with the useless push/pops, which is way too much for those poor MCUs with 128bytes of RAM. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1743798&group_id=599 |