> FWIW, I think you're right. I think that CW *is* using up too much stack
space
> for temporaries. It could easily use one temporary for all of the results
from
> floor(). Instead, it's creating a new temporary for each result.
>
> I played around with a lot of different ways of jiggering the compiler to
be
> more space efficient. I tried putting braces around all of the
expressions, I
> tried inline functions, I tried all the different optimization levels I
could
> think of, etc. None of those worked, but I finally found something that
did --
> create your own temporary and use that. Here's my result. It uses 24 bytes
of
> stack space instead of 64. I think it could get away with 16, but I'm
happy with
> what we've got.

CodeWarrior's code generator on the 68K is a little primitive sometimes.
<GRIN>  It shared this problem with the x86 code generator.  As of CW Pro 5,
stack space wasn't reused.  I worked on the problem some before I left, as
it really just ends up being a simple register coloring problem, at least to
get 90% of the possible benefit for stack space sharing.

I don't know anything about the 68K compiler included with Pro 6, so I can't
say if the compiler guys fixed this problem or not.

The generated code is still correct, but CW just isn't being optimal for
devices with limited stack space (like the Palm).



-- 
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