mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
6175c43b0c
Sometimes QEMU will emit code that reads a local temporary *before* it is assigned in the `TranslationBlock`. This usually happens when lifting non-code, but it's still a problem since it leads to phis around the dispatcher, which we don't want. For example, consider the following x86-64 code: ``` 0000000140002000 <.text>: 140002000: f0 lock 140002001: 38 00 cmpb %al, (%rax) ``` It leads to: ``` [libtcg] Translation starting from 0x140002000:Generic64 [libtcg] ---- 0000000040002000 [libtcg] mov_i64 loc2,rax [libtcg] mov_i64 loc1,rax [libtcg] mov_i64 cc_src,loc1 [libtcg] mov_i64 loc8,loc0 [libtcg] sub_i64 cc_dst,loc0,loc1 [libtcg] discard cc_src2 [libtcg] discard cc_op ``` Note how `loc0` is read before being initialized. Currently we zero-initialize all the temporaries. It would be in princple possible to detect those that need the initialization, which would also enable us to emit a warning.