Verify that softfloat helper calls become visible after the helper
inlining phase in `DetectABI`.
Merge the previous tests for softfloat and these new ones in a single
file, since they use the same ground truth file.
Add `--detect-abi-after-inline-ir-dir=<dir>` which writes one
`<fn>.ll` file per outlined stub immediately after the helper inlinining
has taken place.
Inline `revng_inline` helper calls into each outlined stub which is
consumed by `analyzeABI`, so the analysis can observe the reads and
writes the helper performs on the floating point registers.
The helper module is linked only once at the beginning of the pass, to
avoid double linking issues.
Split the `InlineHelpers` pass into the three phases:
- `link-helpers-to-inline` links the missing `revng_inline` helper
bodies from the `libtcg-helpers-to-inline-arch` module.
- `inline-helpers` inlines, in every function except those tagged
`Root` or `Helper`, the calls to `revng_inline` helpers whose
critical arguments on the call site are constant.
- `delete-helper-bodies` drops from the module the body of every
`revng_inline` function, leaving only the declaration.
The three passes live in a dedicated `revngInlineHelpers` library
(`lib/InlineHelpers/` + `include/revng/InlineHelpers/`), so that
libraries which do not depend on `revngFunctionIsolation` can use them
without creating cyclic dependencies.
Only the x86 softfloat helpers iterate over the vector-register lanes
with bounded `for` loops (e.g. the packed `helper_*p[sd]` operate on
`XMM/ZMM_D(i)`). `fix-helpers` can only rewrite the per-lane CSV
accesses once those loops are unrolled. This step is not needed on other
archs, so we avoid it to save space on the generated libtcg helpers and
build time.
The previous logic for detection of incompatible PHINodes was broken in
various different ways.
1. `return true` and `return false` were flipped, so it effectively did
the opposite of what it was expected to do
2. `std::numeri_limits<Value *>::max()` yielded 0, breaking the lookup.
This commit fixes the condition for incompatible PHINodes and adds a lot
of logging.
Before this commit, the code never put in the same group two PHINodes if
one of them had a non-phi User. This condition was wrong and was
unnecessarily preventing valig PHINodes to be put in the same group.
This caused the generation of a lot more local variables than necessary.
Before this commit we were replacing all uses of a PHI that were not
used by other PHIs with llvm::UndefValue. That was wrong. The
replacement is valid only if the use is used by a PHINode that is in the
same group. This commit fixes the condition for such a replacement to
take place.
This commit introduces `FixPointerSize`, a pipe changing the
`DataLayout` of module in order to have a pointer size identical to the
one of `targetABI()`.
The pipe also performs safety checks to ensure this does not corrupt
semantics.
Implement compression of objects before they are saved into the storage
provider. Each container type can specify which algorithm to use
(currently `none` or `zstd`) and the compression level.
Change byte containers from being just a `using` of the relative class
(e.g. `BytesContainer`) to a full fledged subclass. This has the
following benefits:
* The template arguments are now laid out in the container class body,
making it more readable.
* The creation of a new class creates a new symbol, improving
debuggability as now the container classes have their own name rather
than the expanded base class template.
Several components in both pipeline YAMLs are slated for removal.
Prepend a legacy prefix to their names, and to the matching c++ code, so
they are clearly distinguished from the new Clift-based pipeline until
they are dropped.
Because of how `StringAttr` comparison works, two attributes with
the same name can be added to one module. Forcing `StringAttr`
recreation from a raw string prevents that.
We used not to put CSVs in `declarations-only`, since `lift` is able to
create them. However, this led to have less CSVs than those we get
post-inlining (some are only used in helpers). This represents a problem
since sometimes we ignore non-existing registers.