mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
078cc1222a
We introduce the `InlineDispatcherSwitch` beautify pass. Its goal is to try and inline the body of some of the `case`s of a exit dispatcher, in place of the `SetNode` corresponding to that `case`, if this doesn't introduce duplication in the code (i.e., a single `SetNode` for that specific case value is present). Additionally, if the inlining procedure is able to completely remove the necessity of an exit dispatcher altogether, the pass removes it. The pass is able to handle chains of weaved dispatcher `switch`es referring to the same original dispatcher `switch`, by handling the inline operation and the possible simplification level-wise. The inlining procedure, cannot take place if a `SetNode` is contained in the body of the case we are trying to inline, since this can possibly break the semantics of the state variable of a loop, by placing a `SetNode` in a more internal loop.