Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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.


List of 68 messages in thread
TopicAuthorDate
Speed Recommendation            01/01/70 00:00      
   Time for processing            01/01/70 00:00      
   Get a 1X Chip            01/01/70 00:00      
      another 485 issue            01/01/70 00:00      
         slightly less            01/01/70 00:00      
            who gives a hoot            01/01/70 00:00      
               maybe yes, maybe not...            01/01/70 00:00      
   Choose the appropriate tool!            01/01/70 00:00      
      Don't have much of a choice!            01/01/70 00:00      
         drop the "coding standards"            01/01/70 00:00      
         Yikes.            01/01/70 00:00      
            down memory lane            01/01/70 00:00      
               a possible compromise...            01/01/70 00:00      
                  Well...            01/01/70 00:00      
               The other end of the spectrum ...            01/01/70 00:00      
                  afer quite a few iterations....            01/01/70 00:00      
                     The guide to writing unmaintainable code says:            01/01/70 00:00      
         That's the kind of nonsense...            01/01/70 00:00      
   put some load on the hardware            01/01/70 00:00      
      Jan, oh Jan            01/01/70 00:00      
      9-bit - more work for the hardware!            01/01/70 00:00      
         true, but...            01/01/70 00:00      
            It is...            01/01/70 00:00      
               calculate the ISR after making the ISR skip            01/01/70 00:00      
   Optimizing C            01/01/70 00:00      
      just one example            01/01/70 00:00      
         The advantage is...            01/01/70 00:00      
            If the thinking had preceded the coding ...            01/01/70 00:00      
               you miss the point            01/01/70 00:00      
                  then what's the chance of having him to C-craft?            01/01/70 00:00      
                     zero            01/01/70 00:00      
                     Job security, of course.            01/01/70 00:00      
      Examples are not equivalent            01/01/70 00:00      
         Wasn\'t saying that they were.            01/01/70 00:00      
            I just tried SDCC...            01/01/70 00:00      
               Hm, can you post the assembly output ?            01/01/70 00:00      
                  Keil does this            01/01/70 00:00      
                     Interesting.            01/01/70 00:00      
                     Optimizing and Keil/SDCC/Raisonance            01/01/70 00:00      
                        Retort            01/01/70 00:00      
                           Register Banks...            01/01/70 00:00      
                              benchmarks            01/01/70 00:00      
                              tools differ            01/01/70 00:00      
                              Clarification            01/01/70 00:00      
                                 comments            01/01/70 00:00      
                                    not to write things twice            01/01/70 00:00      
                                       no need            01/01/70 00:00      
                                          And how does this produce two incarnations?            01/01/70 00:00      
                                             like this            01/01/70 00:00      
                                                hehe            01/01/70 00:00      
                                                   this is no better confusion-wise            01/01/70 00:00      
                                                      what is "efficient"            01/01/70 00:00      
                                                         ok is \'safe\' better?            01/01/70 00:00      
                                                            How to convey our ideas to the mcu?            01/01/70 00:00      
                                                               Carefull now, you could end with Prolog :)            01/01/70 00:00      
                                                                  my kids            01/01/70 00:00      
                                                            Huge code != huge time            01/01/70 00:00      
                                                               This comes under the heading of "famous last words            01/01/70 00:00      
                        the question I always raise on this            01/01/70 00:00      
                           Here's Why...            01/01/70 00:00      
                  SDCC            01/01/70 00:00      
                     Thanks. Also interesting.            01/01/70 00:00      
                     SDCC peephole optimiser conflict            01/01/70 00:00      
                  Raisonance            01/01/70 00:00      
   help me ,I NEED SOME HELP ON MY PROJECT            01/01/70 00:00      
      that is NOT 'help'            01/01/70 00:00      
      Well that is not the way to get it!            01/01/70 00:00      
      start a new thread!            01/01/70 00:00      

Back to Subject List