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

Sergei Gorelkin sergei_gorelkin at mail.ru
Sun Aug 21 14:35:46 CEST 2016

21.08.2016 14:32, Michael Ring пишет:
> Was getting high hopes for a moment...
> @Sergej: I just started wondering on usage of fp registers, when I call a routine that uses floating
> point I see that the fp registers are not marked as reserved by the compiler, what do you think?
> The procedure below (test) uses $f0 and $f2 but they are not marked as allocated:
>          # Register at,v0,v1,a0,a1,a2,a3,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,ra allocated
>          jal     P$TEST_$$_TEST
>          nop
>          # Register at,v0,v1,a0,a1,a2,a3,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,ra released
> could this be a bug? (I have also modified tcpuparamanager.get_volatile_registers_fp to return [] so
> i'd expect to see $f0..$f19 pushed to stack but I see nothing)
> Could of course be me causing this bug, but I checked my diff to trunk, I have not knowingly changed
> fp behaviour besides changing get_volatile_registers_fp
It's either a bug or unimplemented feature, not your fault. Currently calls allocate non-integer 
register types only if caller uses registers of that type itself. This is good for calls between 
procedures with same calling convention (i.e. equal sets of volatile registers), but not for calls 
where callee's set of volatile registers is larger than one of caller's.

But probably you can force 'use' of fp registers by adding one of them after 'asm' block.


More information about the fpc-devel mailing list