822 Commits

Author SHA1 Message Date
Giacomo Vercesi 57d9c3deb8 PipeboxCommon: add Access enum
Add an enum to explicitly specify the `TaskArgumentAccess` of a given
`Pipe`. This is needed because in some cases it's required to manually
specify the `READ` or `WRITE` access.
2025-11-17 10:04:13 +01:00
Giacomo Vercesi 1c07656448 pipebox.py: add initialize function
Add the `initialize` function to `pipebox.py`. This allows passing
command-line arguments to the pipebox.
2025-11-17 10:04:13 +01:00
Giacomo Vercesi 4f93c9e7ad Container: add mime type
Add the `MimeType` field to the C++ classes. Forward it to python via
nanobind.
2025-11-17 10:04:13 +01:00
Giacomo Vercesi 964abca598 pypeline: allow multiple root nodes
Change the `Pipeline` class and `pypeline_parser.py` to allow multiple
root nodes to be specified when creating a `Pipeline` object.
2025-11-17 10:04:12 +01:00
Giacomo Vercesi 32fd86d33a Pipe: drop name argument in constructor
Having a pipe's name different from its class name is useless, drop the
feature entirely.
2025-11-17 10:04:12 +01:00
Lauri Vasama fbc1563b43 Add loop detection pass 2025-11-12 15:28:54 +02:00
Lauri Vasama b24f61db40 Improve legalization
Legalization now emits fewer casts depending on context.
2025-11-12 15:28:54 +02:00
Lauri Vasama 359af98ab8 Emit spaces before casts in C 2025-11-12 15:28:54 +02:00
Lauri Vasama 71b3fa2dae Convert Clift C++ unit tests to LIT 2025-11-12 15:28:54 +02:00
Tommaso Fontana 229d12e538 Pypeline: add tests for the new daemon 2025-11-11 17:15:28 +01:00
Tommaso Fontana b38832e251 Pypeline: move epoch to storage_provider
Move the epoch inside the storage_provider, this allows us to make the
storage_provider_factory to return an async context manager.
This way we can simplify the locking for the daemon, but forces the
CLI project commands to deal with async code.
2025-11-11 17:15:28 +01:00
Tommaso Fontana 036411b441 Pypeline: add pipebox initialize and -- args
The pipebox now has to have an initialize function that is called with
all arguments passed to the CLI after --.
2025-11-11 17:15:28 +01:00
Tommaso Fontana a7f77b1704 Pypeline: propagate invalidated artifacts objects
Changed the API of storage_provider to treturn the invalidated object
ids and propagated this info to the CLI and daemon.
2025-11-11 17:15:28 +01:00
Tommaso Fontana 639593164a Pypeline: add autocomplete and refactor CLI
Now pype has an `autocomplete` command usable to enable autocompletion
and revng2 now is based on `pype`, modifying its defalults and
injecting new commands.
2025-11-11 17:15:27 +01:00
Tommaso Fontana 2daa9f938e Pypeline: add mime_type and model_name to Model
Now the model has a mime_type that we expect to return to the UI, and
model_name so the name of the model on disk can be impl-specific.
Moreover, now Model and Container use the same logic to detect if
a mimetype is textual.
2025-11-11 17:15:27 +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
Lauri Vasama 3e0aaaf867 Add new RecursiveCoroutine unit test 2025-10-31 17:23:52 +01:00
Alessandro Di Federico dfbe005307 ReadFields: switch to vectors 2025-10-29 15:10:18 +01:00
Ivan Krysak 2ba5ca3e3d Suppress selected IRBuilder checks 2025-10-21 19:17:37 +03:00
Ivan Krysak 3561c2b907 Adopt IRBuilder wrapper 2025-10-21 19:17:01 +03:00
Lauri Vasama 7980e57fb5 Add Clift C legalization pass 2025-10-21 09:15:40 +02:00
Lauri Vasama 02d3c82887 Add support for Clift for-loop initializers 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
Lauri Vasama 3d9df0f50d Add then marker for Clift if-statement assembly 2025-10-21 09:15:40 +02:00
Lauri Vasama 7da5792f0a Add Clift label and jump operation interfaces 2025-10-21 09:15:40 +02:00
Lauri Vasama 143fce8f62 Fix switch statement C emission
No newline was previously emitted before the first case:
```
switch (C) {case 1: {
  } break;
}
```
2025-10-21 09:15:40 +02:00
Giacomo Vercesi b622fe8f19 Implement FileProvider interface
Implement the `FileProvider` interface, this allows pipes to request
files given a `FileRequest` (hash and optional size/name).
2025-10-16 17:48:45 +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
Giacomo Vercesi 0f7dc7047d pypeline.Container: fix signature of (de)serialize
Change the signature of `Container.serialize` and
`Container.deserialize` to use `Buffer` instead of `bytes`, as this
makes the functions compatible with the `revng::pypeline::Buffer`
classes.
2025-10-16 16:08:05 +02:00
Giacomo Vercesi ca0f312b1e Pipebox: remove const from ArrayRef
Remove the `const` from `ArrayRef<const char>` as the `ArrayRef` already
implies the underlying type will be accessed only in `const`.
2025-10-16 16:07:09 +02:00
Giacomo Vercesi d08c490993 pypeline::Model: expose children function
Expose the `revng::pypeline::Model.children` function to python, as it
was not previously exposed.
2025-10-16 12:51:55 +02:00
Giacomo Vercesi f165f99392 pypeline.Model: make deserialize to static
Change the `Model.deserialize` to a static function, which will return
a new instance of the Model.
2025-10-16 10:30:01 +02:00
Giacomo Vercesi bad8d0f622 Add test for pypeline's StorageProviders
Add a test that checks that the newly implemented invalidation logic
actually works and the objects stored as children or parent objectids
are also dropped when invalidating.
2025-10-15 17:43:09 +02:00
Giacomo Vercesi d92f4cdca3 ObjectID: introduce byte (de)serialization
Add the `to_bytes` and `from_bytes` to `ObjectID`. This allows
serializing an `ObjectID` instance to raw bytes with a specific binary
format.
2025-10-15 11:58:41 +02:00
Giacomo Vercesi 46654c8b26 TupleTree: narrow enums to the smallest uint
When emitting `EnumDefinition`s in C++, use the smallest uint type as
the base class.
2025-10-15 11:58:40 +02: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
Lauri Vasama 22d6f70ee2 Clift directory structure overhaul 2025-10-13 15:08:20 +02:00
Lauri Vasama 3c191122dc Rename Clift to CliftDialect, CliftOps to Clift 2025-10-13 15:08:20 +02:00
Ivan Krysak 5717d835f8 Add missing llvm::Error checks 2025-10-13 10:26:37 +03:00
Ivan Krysak e6d30936f3 Avoid llvm::ExitOnError in non-tool binaries 2025-10-08 12:22:34 +03:00
Ivan Krysak d1fbf2eee6 Model: Drop ToolHelpers.h 2025-10-08 12:22:34 +03:00
Giacomo Vercesi 6d1fbdca97 Implement infrastructure for PipeRuns
Add the needed infrastructures that allow ephemeral classes (`PipeRun`s)
to be wrapped as a regular pypeline `Pipe` class. These automatically
have their dependencies tracked and propagated to the pypeline.
2025-10-03 17:40:45 +02:00
Lauri Vasama 110fb23d58 Improve Clift backend string literal test 2025-09-29 18:05:55 +03:00
Lauri Vasama 18773ba22c Add Clift declaration attribute support 2025-09-29 18:05:55 +03:00
Lauri Vasama cd48916c8d Convert Clift backend tests to use clift-opt 2025-09-29 18:05:55 +03:00
Lauri Vasama a50138998d Model agnostic Clift backend using CTokenEmitter 2025-09-29 18:05:55 +03:00
Lauri Vasama 9eb6b5d6df Remove Clift backend stack frame inlining 2025-09-29 18:05:55 +03:00
Lauri Vasama 16a5ee0a56 Disable elaborated type specifier emission 2025-09-29 18:05:55 +03:00