Integrate results of ABIAnalyses in EarlyFunctionAnalysis
and refine such results by suppressing stack pointer
and callee-saved registers from the analyses.
Architecture-agnostic and ABI-independent data-flow analyses that
traverse the recovered functions in order to detect arguments and
return values registers.
An architecture-agnostic analysis that attempts to detect
boundaries of functions, recover the control-flow graph as
well as function prototypes (arguments and return values)
of the original program. The analysis determines whether
the function jumps to its return address (namely, it is a
regular function), it tracks the evolution of the stack
by determining its height (in order to say if the stack is
left in a correct position upon stackframe destruction),
and it identifies callee-saved registers.
A pass which segregates direct stack accesses from all other
memory accesses through appropriate alias information metadata.
By doing so, we provide a way to say that stack accesses reasonably
do not interfere with any other memory access. This pass also tries
to canonicalize `inttoptr` + `add` instructions into `getelementptr`s
so as to avoid the use of `inttoptr`, which would otherwise inhibit
compiler optimizations.
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")
```
Without this attribute, newer versions of llvm are not able to
remove calls to `ReadOnly` functions whose return value is unused.
This is instead the expected behavior for the functions that are
generated by `revng` with the `ReadOnly` attribute.
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.
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.
This commit introduces the type system of the model along with several
various other improvements to the model and its users.
* Introduce the type system.
* Introduce possibility to tag certain fields in the model as to be
optional during YAML serialization.
* All the `Name` fields have been replaced in favor of `CustomName` plus
a `name` method that will use `CustomName` if available, or an
automatically generated name otherwise.
* Make TupleTreeReferences behavior more robust: now you either need to
have a valid pointer to `Root` and a `Path` or be default constructed
(`nullptr` for `Root` and an empty `Path`). Any other configuration is
invalid.
* The type system introduces `RawFunctionType`: this superseds the
previous way in which we were specifying arguments and return
values. Users of such information have been updated accordingly.
The previous design returned a model::Binary &, which did not allow
users writing the model to properly initialize cross references between
different parts of the model.
With llvm-12 thera are more stringent requirement on the propagation of
DebugLoc on CallInst and InvokeInst.
Various CallInst and InvokeInst created during lifting did not fulfill
these requirements, causing the Module to not verify() with llvm-12.
This commit fixes the problem, properly propagating the debug locations.