Hi all,

I'm trying to optimize some code for PalmOS. It seems that CW7 does not
optimize very well (it is even slower when in "Faster" mode). I do not want
to type assembly code yet because it will not profit for other platforms.

Is there any spec of what it is really able to do ?

Here is an example of some annoying things:
#############
unsigned long a_code;
unsigned some_mask;
unsigned short res;
unsigned code_size;

for(;;)
{
  ... // some code
  res = a_code & (some_mask-1);
  a_code >>= code_size;

  ... // much code
  if(something==some_mask)
  {
    ... // few code
    some_mask <<= 1;
  }
}
#############

in this sample code, "a_code" is not even put in a register (even d0 or d1
which are used dumbly)

I've also a strange thing: some_mask is put in two different memory
variables !!! The 'something==some_mask' tests 8(a7) memory address, and the
'some_mask<<=1' reads again at this address (no register load), put the
result at an other address 20(a7), then at next loop it synchronizes just
before 'a_code & (some_mask-1)' doing some memory to memory move : move.w
20(a7),8(a7) which is a quite long operation.

I can't repeat the case where CW puts some results in memory and never read
it again (obviously i do not ask for this).

Is there any plan for Metrowerks to have some real optimizer ?

Common Sub Expression is not done. Register coloring is neither. It often do
not reuse register loads, and never displace some register load one or two
assembly line before to avoid double memory access.

Compiling in "Smallest code" give me 49.5 Million cycles, "Fastest code"
give me 53 Million cycles.

Is there some compiler that really optimize code for Palm ? I need C++, no
exceptions but virtuals and templates.

Bye,
Armel


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to