Commit Graph

7705 Commits

Author SHA1 Message Date
Alessandro Di Federico 27bd08e613 Merge branch 'feature/detect-abi-inline-helpers' 2026-06-19 15:36:17 +02:00
Andrea Gussoni 0ae39d72a2 tests: filecheck IR after detect-abi inlining
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.
2026-06-19 15:35:18 +02:00
Andrea Gussoni 57f7e577fe DetectABI: name outlined stubs after symbols 2026-06-19 15:35:18 +02:00
Andrea Gussoni f6d2a71466 DetectABI: add post-inline IR dump flag
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.
2026-06-19 15:35:18 +02:00
Andrea Gussoni 6a56557177 DetectABI: inline helpers
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.
2026-06-19 15:35:18 +02:00
Andrea Gussoni 06733a9f3a InlineHelpers: split into link / inline / delete
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.
2026-06-19 15:35:18 +02:00
Andrea Gussoni b10024bfc8 InlineHelpers: limit loop-unroll to x86
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.
2026-06-19 15:35:18 +02:00
Giacomo Vercesi 75059cfdff Port last tests to pypeline
Convert the `revng.test-segregate-stack-accesses` and
`revng.test-detect-stack-size` tests so that they use
the new pipeline.
2026-06-19 15:35:18 +02:00
Giacomo Vercesi 4776a24eb8 tests: use revng merge llvm
Change the code of tests to use the `revng merge llvm` where possible.
2026-06-19 15:35:18 +02:00
Giacomo Vercesi 49b2c523ab Add revng merge llvm command
Add the `revng merge llvm` command which allows linking multiple LLVM
IR modules together into a single module.
2026-06-19 15:35:18 +02:00
Giacomo Vercesi 5287e69be0 revng.internal.cli.support: expose std{in,out,err}
Expose redirecting std{in,out,err} to `run`, `try_run` and `popen`.
2026-06-19 15:35:17 +02:00
Giacomo Vercesi 7be14c59b3 pypeline: add segregate-stack-accesses artifact 2026-06-19 15:35:17 +02:00
Pietro Fezzardi 0de0ceaa3e Merge branch 'feature/fix-exit-ssa' 2026-06-19 15:27:57 +02:00
Pietro Fezzardi aa1ea25ca7 ExitSSA: add unit tests 2026-06-19 11:07:44 +02:00
Pietro Fezzardi a7aa3a0e1a ExitSSA: fix detection of incompatible PHINodes
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.
2026-06-19 11:07:44 +02:00
Pietro Fezzardi a7d4a73d2d ExitSSA: don't exclude PHINodes with non-phi Users
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.
2026-06-19 11:07:44 +02:00
Pietro Fezzardi 422319f4d8 ExitSSA: fix insertion of undefs
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.
2026-06-19 11:07:44 +02:00
Alessandro Di Federico c2ce667bd8 Merge branch 'feature/segretate-aggregates-2' 2026-06-19 09:18:32 +02:00
Alessandro Di Federico 12b9a44ace Ban dynamic-size allocas, use ArrayType instead 2026-06-19 09:18:16 +02:00
Alessandro Di Federico 903617e79e IRHelpers: turn some functions into IRBuilder::* 2026-06-19 09:18:16 +02:00
Alessandro Di Federico 63734b7ca0 Canonicalize: ban pointers
In order to ensure there are no `alloca`s containing pointers, we change
the passes that emit them to emit instead integer scalars of the same
type.
2026-06-19 09:18:16 +02:00
Alessandro Di Federico 3e31edf817 Introduce FixPointerSize
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.
2026-06-19 09:18:16 +02:00
Alessandro Di Federico 1ff0eedc5f test-segregate-stack-accesses: test i386 as well 2026-06-19 09:18:15 +02:00
Alessandro Di Federico 64fa538051 Introduce DropRedundantPtrIntCasts 2026-06-19 09:18:15 +02:00
Alessandro Di Federico ffaf735219 sqlite: open read-only when appropriate 2026-06-19 09:18:15 +02:00
Alessandro Di Federico b5e3ccba9e Do not allocate const objects 2026-06-18 16:44:15 +02:00
Alessandro Di Federico a35da01bdd Minor changes 2026-06-18 16:44:15 +02:00
Alessandro Di Federico 1ce725fac6 Merge branch 'feature/hitman-pypeline' 2026-06-18 14:12:09 +02:00
Giacomo Vercesi 4f9e811110 pypeline: implement Pypeline Data Viewer
Implement the Pypeline Data Viewer, an HTTP server that allows browsing
the data stored by PRSS.
2026-06-17 17:48:13 +02:00
Giacomo Vercesi dfb9a36bb2 pypeline: implement compression
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.
2026-06-17 10:06:35 +02:00
Giacomo Vercesi e1b86f757a pypeline: move container from using to subclasses
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.
2026-06-17 10:06:35 +02:00
Giacomo Vercesi b1857d18ee Merge Clift{Function,SingleType}Container
The two containers were identical modulo the `Kind`. Use a base class
and make the two subclasses.
2026-06-17 10:06:35 +02:00
Giacomo Vercesi f0144ac0c9 pypeline: make artifact_categories kebab-case 2026-06-17 09:43:07 +02:00
Giacomo Vercesi d3d73a48c9 PRSS: add envvars for secret parameters
Allow passing command-line options which might contain secrets via an
environment variable instead of directly on the CLI.
2026-06-17 09:43:07 +02:00
Giacomo Vercesi d6e02c1f95 get_middlewares: allow x-project-id
When authentication is enabled the `x-project-id` header needs to be
provided. Add it to the list of allowed CORS headers.
2026-06-17 09:43:07 +02:00
Giacomo Vercesi 882afa192d revng.project: fix compatibility
The use of `"` inside a `f"..."` f-string is not supported in older
python versions.
2026-06-17 09:43:07 +02:00
Pietro Fezzardi 874e423a2a Merge branch 'feature/clift-based-headers-4' 2026-06-16 21:31:33 +02:00
Ivan Krysak ad8be6819c import-from-c: minor wording improvements 2026-06-16 18:43:45 +02:00
Ivan Krysak 24de1435ff import-from-c: add more tests 2026-06-16 18:43:45 +02:00
Ivan Krysak bbb0a00f46 import-from-c: make output easier to debug 2026-06-16 18:43:45 +02:00
Ivan Krysak 2a97323232 import-from-c: fail on unexpected successes 2026-06-16 18:43:45 +02:00
Ivan Krysak 1609bbe745 Restore the separate enum declaration node 2026-06-16 18:43:45 +02:00
Ivan Krysak 42a045a2b5 CliftEmitC: fix the header filtering direction 2026-06-15 17:32:35 +02:00
Ivan Krysak e5113a8c1d ImportFromC: add a logger printing clang inputs 2026-06-15 17:32:33 +02:00
Ivan Krysak 42e9973ab1 ImportFromC: drop a pointless logger
It was only outputting errors that were already printed anyway.
2026-06-15 17:32:30 +02:00
Pietro Fezzardi 6a3ab92a9d Mark to-be-dropped pipeline names as legacy
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.
2026-06-15 17:28:22 +02:00
Ivan Krysak 81aceca45d CliftContainer: use llvm::StringRef overload
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.
2026-06-15 17:28:22 +02:00
Alessandro Di Federico e44c04925e developer-manual/qemu-helpers.md: update 2026-06-15 17:28:22 +02:00
Alessandro Di Federico ffd8710492 isolate: keep CSVs used by helpers
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.
2026-06-15 17:28:22 +02:00
Alessandro Di Federico 1660b44cfe promote-csvs: improve logging 2026-06-15 17:28:22 +02:00