# stage2: implement loading-storing via pointer \(in register\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/c7f774803a3ecbc8d0641adde8ef0528f4a8bb8c)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: c7f774803a3ecbc8d0641adde8ef0528f4a8bb8c

Requested commit: c7f774803a3ecbc8d0641adde8ef0528f4a8bb8c

Commit: c7f774803a3ecbc8d0641adde8ef0528f4a8bb8c

Tree: 2ab32f42f282c04492c4c06611dbac7dada9d577

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
stage2: implement loading-storing via pointer (in register)

* load address (pointer) to a stack variable in a register via
  `lea` instruction
* store value on the stack via a pointer stored in a register via
  `mov [reg], imm` instruction
* the lowerings naturally are handled automatically by Mir -> Isel
  layer
* add initial (without safety) implementation of `.optional_payload`
* add matching stage2 test cases

```

## Parents

- [bc12d50170bdbe8d6c38207baf22b78865b48595](https://git.cafe/gitcafe/zig/commit/bc12d50170bdbe8d6c38207baf22b78865b48595?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/c7f774803a3ecbc8d0641adde8ef0528f4a8bb8c?format=markdown)
