---

Implementing semantic register aliasing for nasm

I've read on twitter from @16kbps "why doesn't asm have local aliases for registers". And I thought - "well, how hard can it be?".

Turns out the first quick hack is about an hour hard.

The result is this patch below to nasm (latest git version from https://repo.or.cz/w/nasm.git, that allows you to do stuff like:

%rdefine foobar_test ax
        mov foobar_test, 1
#        mov foobar2_test, 2
%rdefine foobar2_test ax
#        mov foobar_test, 3
        mov foobar2_test, 4

The resulting assembly is:

        mov ax, 1
        mov ax, 4

Uncommenting either of the two commented lines will cause the compile error, which is a nice side effect.

TODO: make it clear out on branch/call.

Files in 2019-11-26-Implementing-semantic-register-aliasing-for-nasm:


../
0001-Implement-rdefine-which-aims-to-help-with-..> 01-Jul-2024 21:41                2777
HEADER.txt                                         01-Jul-2024 21:41                 876

(c) Andrew Yourtchenko