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

Michael Ring mail at michael-ring.org
Sat Aug 13 18:57:31 CEST 2016


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?

Thank you,

Michael





More information about the fpc-devel mailing list