Does any one else have problems with the higher levels of optimisation available to C51? With common block subroutines switched on, sometimes, just sometimes, C51 will generate completely wrong code. I have noticed that the problems are often associated with pointers that are automatic variables and where there is a variable of the same name in another function. Common block subroutines have a dramatic affect on code size, but I don't use this level of optimisation because it just does not seem to be reliable.
Graham, When I first switched to using LX51 I tried optimisation levels 10 and 11 (with "Favour size" selected) and encountered some problems with previously working code. I didn't bother to investigate, however, because I found that the code size in all three projects tested actually grew by about 0.5% with level 11 as opposed to level 9. Have you found these additional optimisation levels to be of any benefit (when they work)? Stefan
Stefan: how well does each level of optimisation work? I performed an experiment using my current development project and built it with various possible levels of optimisation in order to find out. The project is pretty typical, it has no floating point and has ANSI promotion turned on for about 50% of the code. Linker code packing is enabled.
Optimisation Favour Favour Difference Difference from level 8 Level Speed Size for size Speed Size 8 59288 56882 4.06% 00.0% 00.0% 9 49502 48358 2.31% 16.5% 15.0% 10 49499 48417 2.18% 16.5% 14.9% 11 49499 48417 2.18% 16.5% 14.9%
Graham, "whereas levels 10 and 11 have very little to offer" Indeed, you're seeing a slight increase in code size over level 9 with 'Favour size' as I am. My projects all use a great deal of floating point, I build with linker code packing on and integer promotion off. Perhaps Keil would like to comment on whether there are any specific situations where 10 and 11 make a significant improvement? Stefan