Optimizer compile time constants problem

  • 1
  • 2
  • Page 1 of 2
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Optimizer compile time constants problem

 · 
Posted: 08.06.2014 - 23:55  ·  #1
Is it me missing something obvious or OptimiserRev and OptimiserBuild always show zero?
Code
  WriteLn(Serout, 'OptimiserRev   = ' + IntToStr(OptimiserRev));
  WriteLn(Serout, 'OptimiserBuild = ' + IntToStr(OptimiserBuild));

F9, Ctrl+F9, and Ctrl+Shift+F9 give me the same result.

btw. CompilerBuild and all other compile time constants give correct result.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: Optimizer compile time constants problem

 · 
Posted: 09.06.2014 - 10:34  ·  #2
Hi Avra.

Do you see the optimiser screen flash up when you run any of your options?

The values are substituted by the optimiser when it is run. If it is not run, the values are zero.

I believe that fields are also zeroed if the optimiser is run in smartlinker mode only, but I am not 100% sure about that. Perhaps Rolf can confirm?
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: Optimizer compile time constants problem

 · 
Posted: 09.06.2014 - 10:55  ·  #3
Quote by Merlin

Do you see the optimiser screen flash up when you run any of your options?

Yes, from the flash up screen I could see that optimizer has saved about 26%.
AvrCo v5.04.73
Gunter
Administrator
Avatar
Gender:
Location: Frankfurt Main / Germany
Posts: 1697
Registered: 02 / 2003
Subject:

Re: Optimizer compile time constants problem

 · 
Posted: 09.06.2014 - 11:25  ·  #4
Hi Avra and Merlin,

seems not to be a bug: my AVRco shows
OPTIMISERREV .EQU 0302h ; const
OPTIMISERBUILD .EQU 0B00h ; const
in 5.04.72 and in 5.04.73

Gunter
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: Optimizer compile time constants problem

 · 
Posted: 09.06.2014 - 11:31  ·  #5
Hi Avra.

I also have v5.04.73.

I tried compiling a demo and looking at the ASM files. These constants are set correctly. To confirm, if you look at the ASM file, are the variables set? If so, then I guess it must be a compiler issue. If not, if you can send me your project via pm I'll compile here and see what is going on.

btw.

Have you enough frame space? More efficient on frame is
Code

  Write(Serout, 'OptimiserRev   = ');
  WriteLn(SerOut IntToStr(OptimiserRev)); 
  Write(Serout, 'OptimiserBuild = ');
  WriteLn(SerOut, IntToStr(OptimiserBuild));
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: Optimizer compile time constants problem

 · 
Posted: 09.06.2014 - 12:28  ·  #6
Quote by Merlin
if you look at the ASM file, are the variables set?


This is from my ASM file:
Code
COMPILERREV             .EQU    1F8h            ; const 
COMPILERBUILD_Y         .EQU    00Eh            ; const 
COMPILERBUILD_M         .EQU    006h            ; const 
COMPILERBUILD_D         .EQU    001h            ; const 
COMPILEYEAR             .EQU    00Eh            ; const 
COMPILEMONTH            .EQU    006h            ; const 
COMPILEDAY              .EQU    009h            ; const 
COMPILEHOUR             .EQU    00Bh            ; const 
COMPILEMINUTE           .EQU    023h            ; const 
PROJECTBUILD            .EQU    02Fh            ; const 
OPTIMISERREV            .EQU      0302h         ; const
OPTIMISERBUILD          .EQU      0B00h         ; const

The only odd thing is a little different number format.

This is from serial simulator output:
Code
43 6F 6D 70 69 6C 65 72 52 65 76 20 20 20 20 3D
C o m p i l e r R e v =
20 35 30 34 0D 0A 43 6F 6D 70 69 6C 65 72 42 75
5 0 4 . . C o m p i l e r B u
69 6C 64 20 20 3D 20 30 31 2E 30 36 2E 32 30 31
i l d = 0 1 . 0 6 . 2 0 1
34 0D 0A 43 6F 6D 70 69 6C 65 54 69 6D 65 20 20
4 . . C o m p i l e T i m e
20 20 3D 20 30 39 2E 30 36 2E 32 30 31 34 20 31
= 0 9 . 0 6 . 2 0 1 4 1
31 3A 33 35 0D 0A 50 72 6F 6A 65 63 74 42 75 69
1 : 3 5 . . P r o j e c t B u i
6C 64 20 20 20 3D 20 34 37 0D 0A 4F 70 74 69 6D
l d = 4 7 . . O p t i m
69 73 65 72 52 65 76 20 20 20 3D 20 30 0D 0A 4F
i s e r R e v = 0 . . O
70 74 69 6D 69 73 65 72 42 75 69 6C 64 20 3D 20
p t i m i s e r B u i l d =
30 0D 0A 54 45 45 45 45 45 45 45 45 45 53 54 21
0 . . T E E E E E E E E E S T !


I have prepared the simplest project and I will send it to you and Rolf.

UPDATE:
Simple project sent to PM.

Quote
Have you enough frame space? More efficient on frame is...

That's the first thing I try. Sim shows that limit was never reached, and I have just tested your example with an empty project and stack and frame at 100, and the problem is still the same.
Attachments
Optimizer compile time constants problem
Filename: system administration controls.png
Filesize: 33.3 KB
Title:
Download counter: 88
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: Optimizer compile time constants problem

 · 
Posted: 09.06.2014 - 13:00  ·  #7
Hi Avra.

Thanks for the sources. I can see what the problem is, but it is an issue with the compiler, not the optimiser. I have contacted you and Rolf via pm to explain the issue. Hopefully Rolf can resolve it for you.
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Optimizer compile time constants problem

 · 
Posted: 09.06.2014 - 14:53  ·  #8
Avra, Merlin,

sorry, there is no way to replace these zeros at compile time, because the
compiler doesn't know anything abot the Optimiser. See my pm.

rolf
  • 1
  • 2
  • Page 1 of 2
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 16 · Cache Hits: 15   127   142 · Page-Gen-Time: 0.071003s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI