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

Karoly Balogh (Charlie/SGR) charlie at scenergy.dfmk.hu
Sun Aug 21 11:06:33 CEST 2016


Hi,

On Sun, 21 Aug 2016, Michael Ring wrote:

> So unless there is a way to find out which registers get used by a procedure
> the only thing I can do to make interrupt routines as lean as possible is to
> not use procedures in them if possible.

There is a way, of course. Seems like the MIPS CG was never updated to
depend on cgobj.g_save_registers/cgobj.g_restore_registers (or implement
these on its own), which takes into account which registers were used in
the procedure, and only saves those. See g_save/restore_registers
implementation in cgobj.pas for an inspiration how it should be done. The
m68k CG also reimplements these methods with some CPU-specific extensions.

It seems to use the old-style approach of just always saving all volatile
registers, and do everything on its own in g_proc_entry/exit which is the
old way (and also still used in some other CGs).

Not sure why it was never updated tho' for MIPS, I don't know anything
about the MIPS CG, and very little about the architecture itself. But it
sounds like this definitely the improvement you want.

Cheers,
--
Charlie



More information about the fpc-devel mailing list