HCS08 CW 5.1: Unnecessary saving/restoring of index register to stack

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HCS08 CW 5.1: Unnecessary saving/restoring of index register to stack

2,630 Views
RichardB
Contributor I

We're having a problem with the HCS08 compiler as we migrate from CodeWarrior v3.1 to v5.1. We're seeing some cases where the newer compiler, even for very simple C code, appears to produce assembler that messes about unnecessarily with saving the X register to the stack, and restoring it from the stack when it hasn't actually been changed.

The two examples attached show the sort of thing that we're seeing, compiled using both CW 3.1 and 5.1 with the same compiler options (-Cs08 -Ms -Ot -OiLib -Or -TE1uE).

I'd be very grateful for any advice or suggestions on how to make the newer compiler behave properly in these kind of situations.

Many thanks!

Richard

Labels (1)
Tags (1)
0 Kudos
7 Replies

727 Views
Andrew
Contributor I
I don't know if the problem was the same, but when I updated from CW 3.1 to CW 5.0 the only way to work correctly with my old project, was to create a new project by the wizard adding the source files!
Bye
 
0 Kudos

727 Views
CompilerGuru
NXP Employee
NXP Employee
Hi Andrew,

well, I dont think this is the same issue. As the original problem here is about inefficient code beeing generated, not about a wrong setup.
Andrew, what was your problem then? What was incompatible? Do you have any details?
About the pushes, I did talk with a compiler gui, he looked why more coded was beeing generated, fixed it for future builds. The bad news is that he said there is no simple way in the V5.1 compiler to avoid the unnecessary pushes/reloads.

Daniel
0 Kudos

727 Views
RichardB
Contributor I
Hi Daniel
 
Thanks for the update.  Do you know when we can expect a new release of the compiler with this issue fixed?  Or if there's a way to use the older compiler (from CodeWarrior 3.1, which worked OK) within CodeWarrior 5.1?  Since we're in a bit of a hurry, I guess for now we'll just have to go through the disassembly output from the compiler, look for all the unnecessary pushes/reloads, and re-code these sections manually in assembler.
 
Best regards
 
Richard

Message Edited by RichardB on 2006-09-13 08:38 AM

0 Kudos

727 Views
CompilerGuru
NXP Employee
NXP Employee
No, I dont have any dates for a next release, I'm a bit out of this loop as I'm working on the debugger.
To use the V3.1 compiler, just replacing the prog\chc08.dll fileshould probably work, but I did not test it (I dont see a reason why it would not work, but maybe I miss something)

Are you so tight in your available code space that those additional unnecessary instructions make you app not fit?

Daniel
0 Kudos

727 Views
Andrew
Contributor I
Hello Daniel,
I had problems with initialization of static and local variables. You can find details on the
 
 
discussion.
Bye
0 Kudos

727 Views
CompilerGuru
NXP Employee
NXP Employee
Can you provide some source code which I can compile to check this?
The simplest it to use a preprocessor output.

Daniel
0 Kudos

727 Views
RichardB
Contributor I
Daniel
 
Thanks for your reply.  A simplified version of the relevant section of our source code from which the examples were taken is attached.
 
Best regards
 
Richard
 

Message Edited by RichardB on 2006-09-08 05:36 AM

0 Kudos