Op 04-04-2021 om 13:33 schreef Florian Klämpfl via fpc-pascal:


Am 04.04.2021 um 12:50 schrieb Joost van der Sluis via fpc-pascal 
<fpc-pascal@lists.freepascal.org>:

Isn't it at least a good practice to store self at Y. So we have Z free for 
other calculations and can access members directly using ldd (),y+().

But maybe that's difficult?

Using Y might be indeed difficult as the compiler knows only after register 
allocation that it does not need Y for other purposes. It would basically 
require the ability to redo code generation.

In my head I've been thinking a lot about another register-allocator:

During the code-generation the code-generation only asks the register-allocator 'I need a register now that cas capabilities X,Y and Z). Or: give me the same register as I used last time.

And then, afterwards, once code has been generated for the whole 'block', the register-allocator fills in the registers. And store/restores them when needed. This can be done using an algorithm that uses a tree to 'peel-down' (is this English?) all the solutions. Just like is done with a regular-expression parser.

Just dreaming. I don't have the time to work on it, and I don't even know how it works at the moment. But that would seem to be the ideal solution to me.

Regards,

Joost.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to