[fpc-pascal] Register Allocation on x86_64

Jonas Maebe jonas at freepascal.org
Wed Jan 10 21:43:59 CET 2018

On 10/01/18 17:06, Martok wrote:
>> Afaik there are only two limitations:
>> * routines containing assembly blocks (including pure assembly routines)
>> cannot be inlined> * regular procedures that contain assembly blocks will never use regvars
> Somehow I have a feeling that the fix for one would also fix the other...

They are orthogonal issues.

> I'd add the manual RIP addressing that was mentioned on the bugtracker recently

That's not a limitation. Not supporting absolute addressing on x86-64 
would be a limitation.

> (OT: is -Cg supposed to work on platforms where it is not set by default?).

I think it does, although I don't think it does anything on Win64 (as 
its code is already position-independent by default).

> For the original issue, since manually using assembler blocks makes things
> complicated, is there a way to "strongly suggest" to the compiler that a
> variable should become a regvar if the entire routine is pure Pascal? Something
> like the (purely decorative) {register} comments in
> /packages/pasjpeg/src/jdcolor.pas?

No, and I don't think it would be a good idea to spend time on 
complicating the compiler with such functionality. Over time, such hints 
become more of a burden than a gain (I believe all modern C compilers 
completely ignore such hints).


More information about the fpc-pascal mailing list