Registers and macro expansion: PASM vs PIR

Klaas-Jan Stol parrotcode at gmail.com
Tue Nov 25 17:10:22 UTC 2008


since there is now a clear distinction between PASM and PIR registers,
meaning that they cannot be used together, a new issue is introduced: macro
expansion.

Ideally, we'd have macros that are usable in both PASM mode and PIR mode.
However, when using PASM registers in a macro, the macro becomes unusable in
PIR mode, and vice versa.

I see a few options:
1. Cheat. Allow PASM registers in PIR mode and vice versa, if these are
coming from a macro expansion.
I don't like this option/cheating. It feels dirty :-)

2. Map .macro_local to the Right Thing. (note that .macro_local's are not
yet implemented in IMCC; this would be a future feature). Basically, when
you want to use variables in a macro, you should declare .macro_locals. Then
when expanding the macro, it's expanded to PASM registers in PASM mode, and
PIR registers in PIR mode. Either way, they will be mapped to unique
registers (that's the whole purpose of .macro_locals, to generate unique
variables), but register usage can be optimized with the register optimizer.
I guess .macro_local would be a nice abstraction for this issue (it's my
preference).

3. Leave it as it is. That means that for instance the fp_eq/ne macros must
be duplicated for PIR and PASM mode (as I've done recently). macros will be
PASM or PIR specific.


Comments welcome.
kjs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.parrot.org/pipermail/parrot-dev/attachments/20081125/240d0a9c/attachment.htm 


More information about the parrot-dev mailing list