[fpc-devel] Is there a way to make Register Allocation inside of Interrupt Service Routines more efficient when using inline-assembler?

Florian Klämpfl florian at freepascal.org
Wed Aug 24 10:09:44 CEST 2016


Am 13.08.2016 um 18:57 schrieb Michael Ring:
> Hi!
> 
> I am trying to bring interrupt handling routine size down (and speed up) for mipsel-embedded target.
> 
> I need to use inline assembler routines like this one
> 
> procedure TSystemCore.setCoreTimerComp(value : longWord); assembler; nostackframe;
> asm
>   mtc0 $a1,$11,0
> end ['a1'];
> 
> inside of the interrupt handler, but as soon as I include the call to this procedure the number of
> registers that get saved explodes. When I only need to modify some peripheral I usually get away
> with only $v0 and $v1 registers getting saved, but with asm routine included all registers get saved.
> 
> Same is true if I put the asm block directly inside of the interrupt handler.
> 
> As you can see I have added the used registers list for this procedure so my expectation was that
> only the register declared does get added to the list of used registers.
> 
> Is this a bug on mips platform or is there in general no way to define the list of used registers
> for an assembler routine so that register allocation works more efficient?
> 
> Or is there another way for me to trick freepascal in not saving all registers?
> 

Did you read the suggestion from Michael Schnell? Does the MIPS you use have a shadow register set?




More information about the fpc-devel mailing list