diff options
author | Alon Zakai <azakai@google.com> | 2021-08-24 08:25:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-24 15:25:49 +0000 |
commit | a2323f2cfd90089c54100ab98c439b9438cc4dc1 (patch) | |
tree | 61dd41386ca0e17367d7e336ebd546b4282d1318 /src/compiler-support.h | |
parent | 3d88d11176a26b1156b83a71bbc033c71772dabe (diff) | |
download | binaryen-a2323f2cfd90089c54100ab98c439b9438cc4dc1.tar.gz binaryen-a2323f2cfd90089c54100ab98c439b9438cc4dc1.tar.bz2 binaryen-a2323f2cfd90089c54100ab98c439b9438cc4dc1.zip |
Ensure cfg-traversal emits blocks in reverse postorder, refactoring try. NFC (#4101)
Reverse postorder basically just means that a block's immediate dominator
must precede it in the list. That is useful because then algorithms that look at
dominance can simply process the list in order, and the immediate dominator
will have already been seen before each block.
Another way to put it is that in reverse postorder a block's dominators
appear before it in the list, as do all non-loop predecessors. At least in
reducible graphs that is the case, and our IR, like wasm, is reducible.
It is pretty natural to emit reverse postorder on wasm given the
reducibility: simply process the wasm in postorder, and make sure to
create new basic blocks only when reaching their code - that is, do not
create them "ahead of time". We were doing that in a single place, for
try-catch, so this PR refactors that. Specifically it makes us create the
basic blocks for catches right when we reach them, and not earlier.
So the data structure that used to store them becomes a list of things
to connect to them.
This is useful for #4100 , see more details there.
Diffstat (limited to 'src/compiler-support.h')
0 files changed, 0 insertions, 0 deletions