mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
a704926ddc
Through `JumpTargetManager::setCFGForm` the `root` function CFG can be changed so that the `dispatcher` is minimized, i.e., it jumps only to those basic blocks that would be otherwise unreachable. This allows us to perform more accurate and simpler analyses. To bring the function in this state we used to check if there was at least a non-dispatcher predecessor, however this did not work with loops reachable only from the dispatcher, since they had a predecessor, but that didn't mean it was reachable from the entry. This commit fixes the problem by navigating the CFG in reverse-post order, registering all the reachable blocks and then restoring the edge from the dispatcher to those that are not reachable. Additionally: * Basic blocks with no predecessors are now purged before `JumpTargetManager::harvest`. * The `CFGForm` enum is now a namespace.