Separate `ModelToHeader.cpp` into 3 different files:
1. DependencyGraph, used to calculate the precedence between
type declarations
2. ModelTypeNames, that holds all the naming logic, whose
primitives are accessible from other modules through a
public header
3. ModelToHeader, that now contains only the logic to print
out declarations and definitions
Also add a compilation test for the headers generated by this pass.
Before decompiling, we want to get rid of all unused stuff from the
IR. To do this, we have to:
1. Modify `FilterForDecompilation` so that it removes the body of
all non-isolated functions
2. Add `strip-dead-prototypes` to the preparation pipeline, so that
also the declarations of non-isolated functions that are not
directly called inside an isolated function are stripped from
the LLVM module. In this way, we can safely execute `HelpersToHeader`
Run `matchWhile()` before `matchDoWhile()` in BeautifyGHAST.cpp.
Since `while` nodes cannot be transformed into `doWhile`s nor
vice-versa, this has the effect of giving priority to `while` loops
over `do-while`s in cases where you could emit both.
We should never be changing the nature of a `while` node into a
`doWhile` and vice-versa: we only upgrade standard nodes in
either a `while` or a `doWhile`.
This commit adds a bunch of type names and macro names to the set of
reserved keywords that cannot be used for names in the revng Model.
These are the names defined in the stdint.h standard C header, that is
included automatically by the decompiler in decompiled code.
We need to reserve these names otherwise it would be possible to add
things to the revng Model with names that clash with the names defined
in stdint.h, which would in turn break recompilation of decompiled code
because of conflicting definitions.
This commit imports all the revng pipes (and other support utilities) to
be used with `revng-pipeline`. In particular, the pipes necessary for
binary translations have been introduced.
This commit switches from `deduplicateNames`, which changed certain
`CustomName` values, to `promoteOriginalName`, which updates empty
`CustomName` using non-ambiguous versions of `OriginalName`.
The goal of `OriginalName` is to keep track of the original name of a
symbol upon import.
In future, this will also be used to promote it to `CustomName`.