Allocation of PASM registers (in PASM mode)

Allison Randal allison at parrot.org
Sun Jan 11 04:28:10 UTC 2009


Klaas-Jan Stol wrote:
> hi,
> 
> There is one minor detail on register allocation unclear to me, 
> regarding PASM registers (in PASM files).
> When using/specifying PASM registers in PASM code, must these exact 
> registers be used, or should the PASM compiler do the allocation?
> 
> So, when writing:
> 
> new P42, 'Integer'
> set P42, 100
> print P42
> 
> Should P42 be mapped to P0 (i.e. the first available register), or 
> should P42 be used (thus allocating at least 43 (counting from 0) 
> registers).
> It's the difference between full power to the user (s/he might know what 
> s/he's doing), or doing the allocation for the user.
> 
> IMCC was originally written to handle the register allocation, as the 
> default assembler did not handle that (which basically implies that 
> register allocation should not be done in PASM mode). I do  not intend 
> to change the implementation of IMCC (which, AFAIK, does register 
> allocation even in PASM mode), but for PIRC, I can go either way: submit 
> the PASM registers to the register allocator/optimizer, or use the 
> registers as specified by the user.

As far as the user is concerned, they have no guarantee that P42 is 
allocated to any particular register. The only guarantee they have is 
that P42 will hold the value they stored in it for as long as that value 
is used within the program. This allows us to plug in any number of 
allocation schemes behind the scenes.

In PIRC you're free to do whatever you want, but I prefer option B): 
intelligently allocate registers, and don't allocate 1000 registers just 
because someone used P999.

Allison


More information about the parrot-dev mailing list