Added a pass that removes the `bad_return_pc` check, which is useful
only when we want to preserve semantics, but it is useless and harmful
for decompilation.
Now in the `SCS` identification phase, when creating a SCS, if we
contain a node which is the source of another (sub)SCS, we also include
that SCS in the current SCS (in order to increase the number of nested
subregions).
The exception to this situation is when the source of the
other SCS is the head of the region itself under analysis.
Instead of rebuilding the dominator and postdominator at each iteration
of the inflate procedure, use the utilities introduced in LLVM 7.0 to
keep the data structures updated after each change to the RegionCFG.
Fix for different AST post-processing phases, which didn't take into
consideration the possibility of having an `IfNode` with only between
`then` and `else` branches.
Now, during the simplification of short-circuits the so called
`de-optimization` is also applied to the corresponding `RegionCFGTree`.
This allows us to avoid loss of information during the iterative
refinement phase, which basically divides for ever the existencies of
two nodes that have been cloned starting from a single original one.
We now perform the AST serialization directly on file, without using
stderr. In this way we can follow the evolution of simplifications and
changes to the AST tree.
After short-circuit simplification, we can have that a conditional node
corresponds to more than one `BasicBlockNode`.
This change reflects this fact, and takes care of merging blocks during
short-circuit simplification, and of representing this change in the
serialization.
Improved the `dumpOnDotFile` function to take as a parameter also a
sub-folder name.
Modified the `inflate` function to dump on file the graphs after each
modification.
Now the `isEqual` operator does what we call a `deep` comparison,
meaning for every type of `ASTNode` it recursively check if the
structures of the AST tree originating in that node can be considered
equivalent (e.g., two sequence nodes are considered equal if every node
they contain is in turn equal).
This operator gives more space to the short-circuit simplification,
which relies heavily on the `isEqual` operator.
This change makes `CMakeLists.txt` files less verbose and allows proper
registration of debug `Logger`s from revamb `Support` library,
enabling their use without manually enabling them.
This also means that they can be properly enabled with command line
arguments and that we can remove some hacks in the code that was put in
place to work around this limitation.
Now the `isEqual` operator does what we call a `deep` comparison,
meaning for every type of `ASTNode` it recursively check if the
structures of the AST tree originating in that node can be considered
equivalent (e.g., two sequence nodes are considered equal if every node
they contain is in turn equal).
This operator gives more space to the short-circuit simplification,
which relies heavily on the `isEqual` operator.
First concept of short-circuit simplification.
The `isEqual` operator between ASTNodes is very limited (it does only
check if two nodes originate from the same `BasicBlock` in the original
IR.
Outlined the removal of nodes not reachable from the entry node in an
external function. This is useful to reuse the function not only for the
main graph, but also for the collapsed regions.
In this way we can remove not reachable nodes in the inner regions, such
as dandling `break` and `continue` nodes (found in an endless loop).