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

**URL:** <https://erlangforums.com/t/what-do-z-and-f-registrers-stand-for-how-to-use-them/4469>\
**Category:** Questions / Help\
**Tags:** beam, compiler\
**Created:** [February 9, 2025, 1:22pm UTC](https://erlangforums.com/t/what-do-z-and-f-registrers-stand-for-how-to-use-them/4469 "2025-02-09T13:22:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asd](https://erlangforums.com/letter_avatar_proxy/v4/letter/a/c68b51/32.png) [@Asd](https://erlangforums.com/u/Asd)\
**Post date:** [February 9, 2025, 1:22pm UTC](https://erlangforums.com/t/what-do-z-and-f-registrers-stand-for-how-to-use-them/4469/1 "2025-02-09T13:22:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bjorng](https://erlangforums.com/user_avatar/erlangforums.com/bjorng/32/174_2.png) [@bjorng](https://erlangforums.com/u/bjorng)\
**Post date:** [February 9, 2025, 3:12pm UTC](https://erlangforums.com/t/what-do-z-and-f-registrers-stand-for-how-to-use-them/4469/2 "2025-02-09T15:12:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Asd](https://erlangforums.com/letter_avatar_proxy/v4/letter/a/c68b51/32.png) [@Asd](https://erlangforums.com/u/Asd)\
**Post date:** [February 9, 2025, 4:31pm UTC](https://erlangforums.com/t/what-do-z-and-f-registrers-stand-for-how-to-use-them/4469/3 "2025-02-09T16:31:16Z")

</div>

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