Sometimes I write very short assembly functions like
function SeniorBit(Value: LongWord): Integer;
asm
OR EAX,EAX
JZ @@Done
BSR EAX,EAX
INC EAX
@@Done:
end;
that seems to be the best candidates for inlining:
function SeniorBit(Value: LongWord): Integer; inline;
but Delphi compiler does not allow it. Why?
Updated:
Thanks to ldsandon, there exists a 5.5 year old open report on QC. The report containes some proposals (like extending asm directive) to simplify the asm inlining for the compiler. I would prefer to introduce the "naked" directive on the procedure/function level which says to the compiler that it does not have to create a stack frame for the procedure and optionally what registers (among eax, edx and ecx) should be preserved.
If the general task of efficient inlining procedures with BASM code is difficult (and may be unnessessary) a good idea is to enable inlining for the most important cases (like naked function with explicitely declared register usage).