EarlyFunctionAnalysis now takes a `const TupleTree<model::Binary> &`
as part of `Analyzer` constructor, `finalizeModel` method excepted,
since it needs to write into the model.
EarlyFunctionAnalysis now can be invoked to schedule a full
ABI analysis over the collected functions via `--detect-abi`
option, or it can limit itself to simply recover the CFG and
serialize it onto the LLVM IR via `--collect-cfg` option.
The control-flow graph and all its hierarchy components
have been moved from `model` to `efa`. The CFG is now
serialized onto the LLVM IR module as a metadata.
The results of the model are loaded into the EarlyFunctionAnalysis
cache, and only those functions which are not in the model have
an EarlyFunctionAnalysis scheduled. The model is updated appropriately.
Take advantage of directly iterating over the call-sites of a
function and perform the cross-call site merge, instead of
iterating over all the functions for each function.
The collection of the function entry-points has now been separated
from EarlyFunctionAnalysis into two distinct passes: the first one,
which collects functions which are in call-sites of a direct call,
and the second one which collects code pointers in `.rodata` (e.g.,
function pointers, vtables; jump-tables are possibly skipped).
FunctionIsolation used to expect the model to adhere too much to what
is on the IR. We relax some assumptions, particularly: 1) if there is
a leftover direct boundary, `IndirectBoundary` is set to it regardless;
2) in `handleDirectBoundary`, the actual successors of a block should
include all those in the model, however, we permit extra successors,
if they exist.
This commit relaxes some assertions related to DLA, that were too strict
for general type systems not generated by DLA, and fixes the scoring of
the best access to select ModelGEPs.
* RemoveExtractValues transforms every `extractvalue` instruction
into an opaque call. This prevents the optimization pipeline from
moving around and optimizing `extractvalue`s, since they have a
particular meaning in our IR
* RestoreExtractValues transforms such opaque calls back to regular
`extractvalue`s at the end of the pipeline
Missing `#include "revng/Pipeline/Loader.h"` causes compilation error
when calling `Loader.registerLLVMPass<LLVMPass>(Name);`.
This is a problem since whoever includes `RegisterLLVMPass.h` should
include `Loader.h` **before** `RegisterLLVMPass.h` to compile without
errors. This is subject to breakage if `Loader.h` ever changes name and
`clang-format` starts reordering the include **after**
`RegisterLLVMPass.h`.
This commit inlcudes `Loader.h` directly in `RegisterLLVMPass.h` to fix
the root cause.
This commit adds two method for OpaqueFunctionsPool that use
a pointer to `llvm::Type` (or a class derived from `llvm::Type`) as key.
Both methods are used to initialize the pool with pre-existing functions
inside an `llvm::Module` that match a specific `FunctionTags::Tag`:
- `initializeFromReturnType` uses the return `llvm::Type` of the
function as key in the pool
- `initializeFromNthArgType` takes an additional argument which is an
index N, and uses the return `llvm::Type` of the N-th argument as a
key in the pool
These methods are useful for avoiding unnecessary proliferation of
opaque functions in an `llvm::Module`, re-using the existing ones
instead if they are already present.