561 Commits

Author SHA1 Message Date
Giacomo Vercesi e32c92b164 Add pypeline comparison tests
Add a set of tests to the test suite that compare the output of the new
pipeline (via `revng2`) to the output of the old one.
2025-11-18 17:47:54 +01:00
Giacomo Vercesi 57ae281403 verify-abi-test-binaries: remove orc shell
`orc shell` should not be used in the revng codebase in general,
moreover the PATH already contains all the entries needed to invoke the
`llvm-dwarfdump` command.
2025-11-17 10:04:12 +01:00
Alessandro Di Federico 1429b526ab Introduce libtcg
This commit drops libptc in favor of its new form libtcg.

It brings several improvements, among which:

* The QEMU version we work on has been upgraded.
* CPUStateAccessAnalysis has been reimplemented in a way that makes it
  easier to debug and solves some limitations (e.g., tracking leaking
  pointers).
* Identification of pieces of the CPU state that are read by each helper
  and fixing access to the CPU state is now performed at build-time.
* We no longer mmap the code we need to translate, dropping all the
  issues related to code that needed to be mapped where something is
  already present.
* We now have two distinct flavors of helper modules: the full one and
  the "slim" one. The latter contains the definition only of functions
  we intend to inline. It is used in most of the pipeline, a good thing
  since we spend less time optimizing code we don't really care about.
  The full module is only used on the re-compilation branch of the
  pipeline.
* We no longer split the `cpu_loop` function.
* We change MetaAddress to rely on architectures from `model::` as
  opposed to the LLVM ones.
* We no longer attach debug info to LLVM IR containing the original
  assembly.
* We now verify that the lifted code only contains code we expect.
2025-10-31 17:25:03 +01:00
Alessandro Di Federico 90f21a10a8 check-conventions: enable excluding specific files 2025-10-28 09:18:24 +01:00
Alessandro Di Federico 81f063d30c Old backend: suppress -Wshift-count-overflow 2025-10-24 18:21:13 +02:00
Ivan Krysak 8bbbe10396 Ban unwrapped IRBuilder 2025-10-21 19:17:08 +03:00
Lauri Vasama 2b8701bb94 Add Clift optimization pipe 2025-10-21 09:15:40 +02:00
Lauri Vasama bf5adce413 Overhaul Clift loop syntax, add break/continue 2025-10-21 09:15:40 +02:00
Giacomo Vercesi 40da49548b Add Binaries list to the model
Add to the model an entry detailing the list of input binaries under
`Binaries`. This will be referenced by `Segments` when needed.
2025-10-16 17:48:45 +02:00
Giacomo Vercesi e57442fafe Introduce Tar.h
Split off the `GzipTarReader` into `Tar.h`, include a normal
`TarWriter` class which leverages libarchive to generate the tar file.
2025-10-16 16:08:05 +02:00
Ivan Krysak 45cc832602 Docs: do not spell default values
Note that a seemingly random relocation appeared from who knows where,
I wonder what's going on with it.
2025-10-13 18:33:10 +03:00
Ivan Krysak 2d618120e0 TTG: add default: value support
This also unifies `get_default_value` helper across all the target
languages.

Before this, there were two different versions of it for python
and typescript while c++ side didn't have one at all.
2025-10-13 18:33:10 +03:00
Ivan Krysak 23a0a09d21 TTG: add --string-type support to cpp generator
Note that other code-generating TTG-backends (namely python and
typescript) emitting ones already support this. This is just a matter
of extending similar logic to the c++ backend.
2025-10-13 18:33:10 +03:00
Ivan Krysak 859e122081 EFA: make TTG verification more strict
Some stuff that was before implicitly checked during deserialization
now need explicit checks, those are introduced here.

This also fixes test failures related to the changed serialization
format (which fields can or cannot be omitted when they have
the default value).
2025-10-13 18:33:10 +03:00
Ivan Krysak 6c0c758e67 Model: make TTG verification more strict
Some stuff that was before implicitly checked during deserialization
now need explicit checks, those are introduced here.

This also fixes test failures related to the changed serialization
format (which fields can or cannot be omitted when they have
the default value).
2025-10-13 18:33:10 +03:00
Ivan Krysak cc57e57fd1 TTG: remove support for optional: true fields
After this commit, every non-key field is treated as if it was optional
while every key field (plus every auto-generated `Kind` field) - as if
it was required.
2025-10-13 18:33:10 +03:00
Ivan Krysak 10ca432cb2 TTG: simplify reference field usage
This allows to avoid having to specify the `rootType` (stable within
the entire tree) manually each time a reference is introduced.
Thanks to that, a much nicer syntax of:
```yaml
- name: MyTypeField
  reference-to: TypeDefinition
```
can replace the current one:
```yaml
- name: MyTypeField
  reference:
    pointeeType: TypeDefinition
    rootType: Binary
```
2025-10-13 18:33:10 +03:00
Ivan Krysak 480443f358 TTG: drop upcastable: configuration option
Instead, detect whether `UpcastablePointer` wrapping is needed or not
based on the type.
2025-10-13 18:33:10 +03:00
Ivan Krysak 00ea93c99e TTG: move metaschema.yml to share/revng/ 2025-10-13 18:33:10 +03:00
Ivan Krysak e56f543b1a Split module.bc.zstd 2025-10-13 10:26:41 +03:00
Ivan Krysak ed53e759c9 Do not use -Y flag
Yaml model are now the _only_ way to store them, no point in still
specifying the old flag for it.
2025-10-13 10:26:41 +03:00
Lauri Vasama 653d451e6c Remove undef name configuration support
Also adds a model migration removing
Configuration.Naming.UndefinedValuePrefix.
2025-09-29 18:05:55 +03:00
Lauri Vasama 77adbcc5ba Add import-model-names pipe 2025-09-29 18:05:55 +03:00
Andrea Gussoni 855a9309ec MaterializeLoopScopes: drop pass
Drop the `MaterializeLoopScopes` pass after the re-design the loop
matching stage to work entirely on `clift`, without the need to insert a
`scope_closer` edge to guide the emission.

Simultaneously, drop the DAGify `Head` metadata insertion, since it will
not be checked anymore during the `MaterializeLoopScopes` pass.
2025-09-26 10:39:09 +02:00
Giacomo Vercesi 688b9fe111 Introduce compatibility with revng-pypeline
Add the necessary machinery to allow `Pipe`s, `Analysis`es,
`Container`s, `Model` and `ObjectID` to be implemented in C++ and used
by Python.
2025-09-17 14:02:40 +02:00
Giacomo Vercesi 5f5d2da842 check-conventions: check CMakeLists.txt license
The `check-conventions` script inadvertently ignored checking the
license header in `CMakeLists.txt`. Change the script so that those are
checked. Also add the missing headers to the reported files.
2025-09-17 14:02:40 +02:00
Ivan Krysak 8cc4082223 model-from-scratch: fix a broken link 2025-09-12 18:57:48 +03:00
Ivan Krysak 3c8ca061ef model-from-scratch: improve wording 2025-09-12 18:57:31 +03:00
Pietro Fezzardi 37cadeabd4 PTML doc: clarify supported and allowed actions 2025-09-10 18:48:06 +02:00
Pietro Fezzardi 82d0a17fe0 PTML doc: attribute categories are indepenent 2025-09-10 18:48:05 +02:00
Ivan Krysak 707b6247d5 Rename remove-broken-debug-information
The new name is `discard-broken-debug-information`.
2025-09-10 17:44:01 +02:00
Andrea Gussoni 1451721e1f revng-pipelines.yml: add materialize-loop-scopes 2025-09-10 13:36:09 +02:00
Tommaso Fontana 80eb02c207 Pypeline: merge pypeline 2025-09-10 12:05:15 +02:00
Ivan Krysak f03654564e Emit _STARTS_AT on fields with custom names 2025-09-05 10:15:32 +03:00
Ivan Krysak 3eea4c4094 Always emit _SIZE on struct definitions 2025-09-04 16:57:12 +03:00
Ivan Krysak c6a175a1b9 Rename _START_AT -> _STARTS_AT 2025-08-29 14:00:29 +03:00
Ivan Krysak b656381ec5 Update ptml documentation
This also reorders definitions in `revng/Pipes/Ranks.h` to match
the order used by the docs.
2025-07-23 11:38:53 +02:00
Ivan Krysak 461c49df25 Model: bump version to 5 and introduce migration 2025-07-23 11:38:52 +02:00
Ivan Krysak 343ba2ff8a ABI: fix msvc GPR usage for small aggregates 2025-07-23 11:38:51 +02:00
Ivan Krysak 3a7ec51a6c Pipeline: fix emit-recompilable-archive
Because of misplaced `From` value, comment we not adopted by
the recompilable archive, leading to desyncronization between it
and the usual decompilation branch of the pipeline.
2025-07-23 11:38:51 +02:00
Giacomo Vercesi 29d7f2d8a8 artifacts: allow parsing the recompilable archive
Allow the artifacts machinery to parse, via `pycparser`, the
recompilable archive provided by revng via the
`emit-recompilable-archive` artifact.
2025-07-18 09:30:56 +02:00
Giacomo Vercesi 38b50c2977 tupletree: fix Reference class
Fix the `Reference` class, make it work with the new model and allow it
to be dereferences via the `_accessor` attribute.
2025-07-18 09:30:55 +02:00
Giacomo Vercesi 460ffbf965 project: move some methods to Binary
Move some methods from the `Project` class to `model.Binary`.
2025-07-18 09:30:55 +02:00
Alessandro Di Federico 4378576eed Python scripting: get_example_binary{,_path} 2025-07-18 09:29:09 +02:00
Lauri Vasama e9b18d448b Add Clift emit-c pipe and end-to-end tests 2025-07-17 16:45:03 +02:00
Lauri Vasama 28550f2f57 Add explicit pointer size support in old backend
When `Configuration.ExplicitTargetPointerSize` is set, the backend uses
explicit pointer type sizes (e.g. `pointer32_t(T)`).
2025-07-17 16:45:03 +02:00
Lauri Vasama 9d39020034 Add LLVM-to-Clift import pipe 2025-07-17 16:45:03 +02:00
Lauri Vasama 1addc26e58 Add remove-constant-array-returns pass 2025-07-17 16:45:03 +02:00
Lauri Vasama 74588ae684 Rename MLIRFunctionKind to CliftFunction 2025-07-17 16:45:03 +02:00
Giacomo Vercesi 569b9d11b5 end-to-end: add test to check decompile output
Add an end-to-end test that checks that the decompile output is a valid
tar file and it contains all the functions defined in the model.
2025-06-27 17:12:18 +02:00