On 12 Jun 2012, at 18:41, Rainer Stratmann wrote:

> Is it still necessary to fill in the registers at the end of a asm statement?

Yes.

> What happens if there is only the end; statement without the used registers?

Then the compiler will assume that the assembler code can change all 
callee-saved registers for the current target platform, and that it will not 
modify any caller-saved registers. If you don't know what the 
callee/caller-saved registers of all of your current and future supported 
target platforms are (possibly even targets that do not yet exist), or if you 
simply don't want the compiler to needlessly save and restore all callee-saved 
registers even when you don't modify them (it would be rather strange to resort 
to assembler and then force the compiler to generate suboptimal code), then you 
should specify the registers that are overwritten by your assembler code.

And no, the compiler cannot automagically figure this out for you. It does not 
contain an abstract interpretation infrastructure for assembler that can 
determine what registers are changed and not saved/restored by the code, neatly 
sidestepping the halting problem in the process. Anything less would result in 
a lot of work with either only suboptimal or unsafe results.


Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to