??? 02/20/07 22:52 Read: times |
#133372 - Clarification Responding to: ???'s previous message |
Jon Ward said:
I also think you took my post as a personal attack, which it was not. Sorry, I'll try and tone down my "attitude" a bit. Jon Ward said:
I think you may have a different opinion of how register banks were intended to be used than I do.
[snip] On more of a technical note...if you are going to call a function from multiple register banks, make sure that all arguments fit into registers. I don't want to go too far off topic, but you have misunderstood the issue I was complaining about. It's not about passing parameters to functions, but rather consider this example: void Shared() { ... } void main() // using 0 by default. { ... Shared(); ... } void Timer1() interrupt 1 using 1 { ... Shared(); ... }If the code in function "Shared" decides to use absolute register addressing for any reason (and we have seen that *a++ = *b++ uses it), then this is broken. I could use "#pragma NOAREGS" on just the "Shared" function, but doing this is prone to error, because if you miss something (like a secondary called function) then you get no diagnostic, just random register corruption issues at runtime. And before anyone says this usage is unsafe, I do take concurrency issues into account and ensure that function Shared is not called from both places at the same time (code not shown in example). Jon Ward said:
I think that there are lot of people who would disagree with your absolute assessment of the Keil tools. Don't get me wrong, everyone tells me that Keil is the best '51 C compiler, and that may very well be true. But being the best of what's available doesn't mean that Keil is good at generating code in an absolute sense. Anywhere where semi-optimal code is required, I have to check the assembly output and tweak the code to get something reasonable. Often I have to make simple transformations like the one we are discussing. What I find is that I need to program using "assembly in C", using C but make the statements so simple that the translation to assembly is straightforward (and I don't need much from the optimiser). Unfortunately, this reduces productivity, which is one of the key advantages of C vs assembly in the first place. Where non-optimal code is acceptable (and this is more places that you might at first think), Keil is fine. |