What do Z and F registrers stand for? How to use them?

Hi, while reading Erlang compiler code, I found that it performs “pre” pass on SSA which reserves z and f registers. What are these registers used for? What’s their purpose?

UPD: I leaned that f registers are for floats and for operations on floats. But I am still not sure what z registers are for

1 Like

Z registers are pseudo-registers used only briefly during code generation.

Their main purpose is to prevent allocation an X register for an SSA instruction when the corresponding BEAM instruction does not return a value. Allocating an X register that will not actually be used by the BEAM instruction could result in either unsafe code or code with more register shuffling because an X register seems to be occupied while it’s actually free.

I might also have used Z registers to transfer values between two consecutive SSA instructions that are combined into a single BEAM instruction.

2 Likes

Thanks, that’s interesting idea, I will explore more!