closed

Loginbox

Please enter your username and password into the following fields to log in.


  • Username:
  • Password:
  •  
  • Auto log in on every visit.


  •  

New Optimiser Feature



Merlin online
Schreiberling
Avatar
Gender: male
Location: UNITED KINGDOM 
Age:
Posts: 819
Registered: 03 / 2005
Private message
Subject: New Optimiser Feature  -  Posted: 22.01.2018 - 20:05   -  
For those of you writing interrupt procedures the latest optimiser will check register save and restore. Not only will it remove saves you don't need, but it will also add in any that you missed.

With thanks to Miparo who suggested and tested this latest feature.
Merlin.

:magic:

Software is a black art.
This post has been edited 1-times. Last edit: 22.01.2018 - 20:06 by Merlin.
go down go up
Avra hidden
Schreiberling
Avatar
Gender: male
Location: SERBIA  Belgrade, Serbia
Age: 47
Posts: 613
Registered: 07 / 2002
Homepage Private message
Subject: Re: New Optimiser Feature  -  Posted: 31.01.2018 - 14:37   -  
Nice touch. Thank you!
go down go up
Lschreyer offline
Benutzer
Avatar
Gender: n/a
Location: n/a 
Age:
Posts: 356
Registered: 02 / 2007
Private message
Subject: Re: New Optimiser Feature  -  Posted: 06.03.2018 - 18:52   -  
I am not sure if this is correct, I tested it with an old project and looked in the .asm file.

Code

Interrupt PortF_INT0;
begin
 PUSHALLREGS;
 toggle(led1);
  HandleEncoderInt_new;
  HandleEncoderInt;
  POPALLREGS;
end;


Gives this:(At the end of all register saving code there is still a call to SYSTEM.PUSHALLREGS, is that ok? It seems as it does it twice now..

Code

testproj.INTERRUPT_TCD1_INTOVF:
                        PUSH      _ACCGLO
                        PUSH      _ACCGHI
                        PUSH      _ACCHLO
                        PUSH      _ACCHHI
                        PUSH      $_SAVERET
                        PUSH      $_SAVERET1
                        PUSH      $_SAVERET2
                        PUSH      FLAGS
                        PUSH      FLAGS2
                        PUSH      _SYSTFLAGS
                        PUSH      _BEEPTIMER
                        PUSH      R11
                        PUSH      R12
                        PUSH      R13
                        PUSH      R14
                        PUSH      R15
                        PUSH      _ACCB
                        PUSH      _ACCA
                        PUSH      _ACCALO
                        PUSH      _ACCAHI
                        PUSH      _ACCDLO
                        PUSH      _ACCDHI
                        PUSH      _ACCELO
                        PUSH      _ACCEHI
                        PUSH      _ACCFLO
                        PUSH      _ACCFHI
                        PUSH      _ACCBLO
                        PUSH      _ACCBHI
                        PUSH      _FRAMEPTR
                        PUSH      _FPTRHI
                        PUSH      _ACCCLO
                        PUSH      _ACCCHI
                        IN        _ACCBHI, SREG
                        PUSH      _ACCBHI
                        .RETURNS   -1
                        .BLOCK    1915
                        .LINE     1916
                        LDS       _ACCA, testproj.ENABLE_OFFLINE_DRIVE
                        TST       _ACCA
                        .BRANCH   3, testproj._L1934
                        BREQ      testproj._L1934
                        .BLOCK    1916
                        .LINE     1917
                         CALL      SYSTEM.PUSHALLREGS

                        .LINE     1919
go down go up
Merlin online
Schreiberling
Avatar
Gender: male
Location: UNITED KINGDOM 
Age:
Posts: 819
Registered: 03 / 2005
Private message
Subject: Re: New Optimiser Feature  -  Posted: 06.03.2018 - 21:13   -  
You are right. I cater for the case when PushAllRegs is in the system area (where it normally is) but not where it is handled manually in user code like this. If you send me the asm and dsm files via pm I will look into it.
Merlin.

:magic:

Software is a black art.
This post has been edited 1-times. Last edit: 06.03.2018 - 21:14 by Merlin.
go down go up
Lschreyer offline
Benutzer
Avatar
Gender: n/a
Location: n/a 
Age:
Posts: 356
Registered: 02 / 2007
Private message
Subject: Re: New Optimiser Feature  -  Posted: 07.03.2018 - 08:41   -  
Maybe I miss something here. As I understood the manual I need to add pusallregs/popallregs if I need the registers saved in the int service routine.
Therefore I added that to my int routines. Is there a better way to do it?
go down go up
Merlin online
Schreiberling
Avatar
Gender: male
Location: UNITED KINGDOM 
Age:
Posts: 819
Registered: 03 / 2005
Private message
Subject: Re: New Optimiser Feature  -  Posted: 07.03.2018 - 09:34   -  
If you are using the optimiser, you don't need to do anything. The optimiser will add the registers saves and restores for you, and only for the registers you are actually using. Also I can't see enough code to tell, but depending on what switches you are using the system might be doing the same as well, meaning you are potentially saving the registers 3 times! (Although that is not strictly true, because if the system does it I remove duplicates). So no, you don't need to add these calls, and unless you use special directives like {$NOREGSAVE} you don't need to do it even if you are not using the optimiser.

You used to need to do it a long time ago but that has not been the case for some years.
Merlin.

:magic:

Software is a black art.
go down go up
 


Registered users in this topic
Currently no registered users in this section

Delete cookies of this forum  •  FAQ / Help  •  Team page  •  Imprint   |  Local time: 20.08.2018 - 12:26