Why would the following line in C:
XRAM00 |= 0x01;
compile into this:
mov dptr, #XRAM00 movx a, @dptr mov r7, a mov a, r7 orl a, #1 mov r7, a mov dptr, #XRAM00 mov a, r7 movx @dptr, a
I would have expected this:
mov dptr, #XRAM00 movx a, @dptr orl a, #1 movx @dptr, a
Thanks, Drew. Although I don't LIKE your answer (grumble, grumble), it makes perfect sense. Now, can I convince the optimizer to clean up this mess???
Now, can I convince the optimizer to clean up this mess??? I believe so, but goodby debugging.
I wish Keil would make an optimize selection (number) that would remove the crap (no jmp@ for 'switch' and no infernal r7,a a,r7) without 'merging execution strings'. Of course, a very much better way would be to do that directly in the compiler.
I STILL can not imagine why that has to be done by the optimizer, the compiler would be perfectly capable of doing so.
SO, I repeat my suspicion: many things that could be done in the compiler are done in the optimizer, just to make the optimizer more impressive.
Erik
And it turns out it's a lot easier to generate code that's correct, if inefficient, and then optimize away inefficiency than it is to try to write a code generator that is smarter in the first place. It's a form of modularity; the code generator is responsible for semantics, the optimizer for getting rid of the silliness that occurs when you don't pay global attention to that sort of thing
as to my post above and this
that "it's a lot easier ..." does not, in any way, hinder that what I described could be done by the compiler, maybe do compile - do optimize, instead of "compile to optimal", but that would not make any difference to the user.
Then, of course an optimizer would be needed to optimize after linking (e.g. combine identical execution strings in different modules for those that do not care about debugging).
OK, now my newbie status becomes blatantly apparent: I had the optimization level set to 9 for the PROJECT, but set to 0 for the individual C files. Oops...
This explains why my disassembled file looked less-than-optimized.
I wish Keil would make an optimize selection (number) that would remove the crap (no jmp@ for 'switch' and no infernal r7,a a,r7) without 'merging execution strings'.
What is an 'execution string'?
Maybe "instruction sequence"?
Don't you ever get tired? Get a life!
A hangman's noose, perhaps?
What is an 'execution string'? just one more of the smoked sardines refusal to understand things that are not written in HIS vernacular. I do not know if the phrase 'execution string' is in his beloved C standard, but if sosmeone say 'car' I have no problem thinking 'automobile'.
Maybe "instruction sequence"? yes, that would be another way to say it
A hangman's noose, perhaps? :) :) :)
just one more of the smoked sardines refusal to understand things that are not written in HIS vernacular.
Quite the opposite, actually. I'm trying my best to understand the things you write in your vernacular.
I do not know if the phrase 'execution string' is in his beloved C standard, but if sosmeone say 'car' I have no problem thinking 'automobile'.
No, the 'C' standard says nothing about 'execution strings'. However, this isn't a 'C' issue so I'm unclear why you bring the 'C' standard into the discussion.
It is most commendable that you can translate between english and american, fortunately I am fairly proficient in that area as well. However, I do not speak 'Erik' very fluently so I asked for a translation which will allow me to understand the problem you have with optimisation of switch/case constructs.
There are many advantages of using standard terminology in an engineering environment not least of which is the fact that others will actually understand what you are talking about. You are forever critical of others for using abbreviations that you don't understand, perhaps you could make the effort not to do the same.
Ok, but how about telling us the correct way to say it?
I asked for some clarification of the problem. That seems a pretty reasonable thing to do in a discussion forum.
I asked for a translation which will allow me to understand the problem you have with optimisation of switch/case constructs. do you actually want to help? that is a new one. my 'problem' I just hate inefficiencies, with the "switch/case constructs" is that you can not get it without the debugger killer (I can not tell you what that is till you answer the question below since I am dead tired of your nitpicking.
'execution string' "instruction sequence"? .... Ok, but how about telling us the correct way to say it? if none of the above is 'correct' enough for you, then, instead of bitching, post what is 'correct' enough for you. I have no idea whatsoever what problem (besides a personal one) you have with either of the two expressions above.
if none of the above is 'correct' enough for you, then, instead of bitching, post what is 'correct' enough for you.
I can't post what is correct because I don't know what you are trying to say. That is why I keep asking you to rephrase it in commonly accepted terminology.
This is what you said:
It would appear that your expression 'merging execution strings' is a reference to some method of optimisation. What is it in commonly accepted terminology?
I have no idea whatsoever what problem (besides a personal one) you have with either of the two expressions above.
My problem is that I do not understand what 'merging execution strings' is supposed to mean. That is why I keep asking you to rephrase it in commonly accepted terminology.
If you really cannot see the problem with using incorrect terminology, take a look at this thread for an example of how a whole lot of people's time is wasted dealing with someone who obstinately refuses to use the correct terminology:
http://www.keil.com/forum/docs/thread11754.asp
well, since I know of no terninology that will satisfy you I have to resort to examples. I am kind of uzzled what your problem is, many (e.g. Per) have undeerstood.
if you have a function that ends like that void a (void) { w x y z } and another function that end like this void b (void) { p x y z
the optimixer will, if you are more intersted in optimization than debuggability and select an optimization level reflecting that philosophy merge execution strings like this:
void a (void) { w optimal: x y z } void b (void) { p goto optimal
if x,y,z is too much for a sardines brain I give up, this will be my final att6epmt to make you understand what the common phrase "merging execution strings" mean
I realize a miss above
no, I am not 'uzzled', I am 'puzzled'
this will be my final att6epmt to make you understand what the common phrase "merging execution strings" mean
See my reply to you in this thread:
http://www.keil.com/forum/docs/thread11754.asp#msg57841