These functions can be used in conjunction to dump the Model on a
file during a gdb session, for example:
```
(gdb) p writeToFile(Model->toString(), "/tmp/model.yaml")
```
Add `MakeModelTypes` and `UpdateFuncPrototypes` to the DLA backend:
* `MakeModelTypes` adds to the model all the types recovered by the DLA
* `UpdateFuncPrototypes` updates function prototypes in the model that
have generic return values or arguments to use the types recovered by
the DLA
* Changes to the `LayoutTypeSystem` graph
Pointers are identified in the TypeSystem graph as leaf nodes which
have a new type of edge (PointerEdge) that connects them to another
node of the graph. The destination of the edge represents the layout of
the pointed type.
* Changes to the Front-end
Pointer edges, and their destination nodes, are created by the DLA
front-end (`DLACreateIntraProceduralTypes`) whenever an access node has
a size that is compatible with the size of a pointer in the current
Architecture.
Successors might then be added to the newly generated node, if any,
by looking up the llvm::Value it is attached to.
* Changes to the Middle-end
Most of the DLA passes should ignore Pointer Edges, so they are modified
accordingly. Most notably, nodes that represent pointed layouts should
never be merged/pruned-off.
* Changes to the Back-end
The `TypeDeclCreationAction` of the decompiler and the `DLAMakeLayouts`
step of the DLA back-end are modified to take into account the new
information about pointers.
⚠️ There is a known issue with this version of the decompiler,
namely the fact that type loops are not detected and can cause the
emitter to enter an infinite loop.
We introduce a new tile, for matching if node with a single and inlined
then/else. In these case, the not inlined successor should be connected
with the tile node.
Handle switch nodes with all but one case edges inlined, by electing the
not inlined edge as the path conducting to the postdominator, and
avoiding parts of the graph disconnecting during the tiling procedure.
ConcreteTupleTreeKeyWrapper::clone() should cleanup the Target object
befor cloning, otherwise the destructor of the inner Pointer object
is never called.
Before this commit, SerializeModelPass and SerializeModelWrapperPass had
hard dependencies on the passes that load the model from LLVM-IR.
This commit makes this dependency optional. When the passes for model
serialization are executed, if they see that nobody requested to load
the model, they will not try to serialize it.
This prevents them from crashing when running in pipelines that only
contain passes that ignore the model.
This is particularly beneficial because `revng opt` automatically adds
`-serialize-model` at the end of each pipeline and, before this commit,
this meant that `revng opt` could not be used for unit-testing simple
llvm passes that do not use the model.
With this commit, `revng opt` can be used for unit-tests, even on LLVM IR
with missing model.
* Introduce some documentation for the model.
* Improve the way enums are serialized/deserialized.
* Mark certain fields of model data structures as optional.
* introduces some error messages during model validation.
Add a step that recognizes if two subtrees of a union node are
topologically equivalent and merges them. This corresponds to removing
duplicate fields in unions.
This deduplication was prevously done while emitting layouts.
A check is inserted into DLAMakeLayouts to assert that, after
constructing unions, no union has only one child, which could be the
case if we didn't deduplicate union fields in the graph.
This commit reserves the "unnamed_" prefix for revng.
The first use of this reserved prefix is in `model::Type`s
`CustomName`s and `model::Identifier`s.
This commit also makes the `verify()` method stricter for
`model::Identifier` so that an `Identifier` whose name starts with the
reserved prefix does fails verification.
This commit changes the `TupleTree::deserialize` method to return an
`llvm::ErrorOr<TupleTree>`, enabling users to choose their policies on
error reporting.
callOnPathSteps was using linear scan search in KeyedObjectContainer.
This commit fixes it for using binary search, dramatically improving
performance in workloads that do lots of lookups.