Commit Graph

443 Commits

Author SHA1 Message Date
Giacomo Vercesi 3e3779498e Implement python interface for revng
Add a python interface (`revng.profile`) for interacting with the rev.ng
infrastructure as a whole; either through the CLI (`CLIProject`) or the
GraphQL API (`DaemonProject`).
2025-05-07 10:48:51 +02:00
Giacomo Vercesi de997ca2e4 python TTG: add mixins infrastructure
Add the infrastructure code needed to allow to add mixins to Tuple-Tree
Generated classes in python.
2025-05-07 10:48:50 +02:00
Giacomo Vercesi d63bba17c6 Implement LLMRenameAnalysis
Implement an analysis in revng which allows renaming the variables of a
C function via an LLM.
2025-05-06 09:59:46 +02:00
Andrea Gussoni 928edb0015 Pipeline: introduce materializetrivialgoto 2025-04-30 16:10:54 +02:00
Khaled Ismaeel 531d9b866c Remove the now-redundant HEADERS list 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 53a5ff07cf Remove embedded TUPLE-TREE-YAML 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 63469c9cd6 Use unified YAML schemas in the build process
In this commit we instruct the build system to use the unified schema
files  instead of collecting the `TUPLE-TREE-YAML` comments.

The fixes to C++ files are necessary because they depend on the order
of the fields in the schema, which was changed.
2025-04-30 15:08:45 +02:00
Giacomo Vercesi 0ac78dddba Fix codespell errors
Fix erros detected by the new version of `codespell`.
2025-04-24 13:22:14 +02:00
Pietro Fezzardi 5ca182578b Add InstCombineNoArraysPass
This pass wraps LLVM's vanilla InstCombine, to hijack one of its
options. The goal of this hijack is to prevent InstCombine from
splitting and replacing accesses to arrays with GEPs and smaller
accesses.
2025-04-22 17:23:37 +02:00
Pietro Fezzardi ef2c3a7626 Add SROANoArraysPass
This pass wraps LLVM's vanilla SROA, to hijack one of its options.
The goal of this hijack is to prevent SROA from splitting and replacing
memory accesses to arrays with GEPs and smaller accesses.
2025-04-22 17:19:56 +02:00
Ivan Krysak 79964eac74 Avoid ' misuse in error messages and comments 2025-04-17 16:41:21 +02:00
Ivan Krysak 76ed261375 Use revng_undefined_ instead of init_
Current `init_` prefix used to set the default values of SCVs
is very common in typical code, hence it would cause a lot of
collisions.
2025-04-17 11:19:17 +03:00
Ivan Krysak 0c99d5d5fb IDBImporter: omit unnecessary typedefs 2025-04-17 11:19:17 +03:00
Ivan Krysak b72bcd7dd2 Introduce a basic problem name reporting system 2025-04-17 11:19:17 +03:00
Ivan Krysak aa15d8ca21 Standardize abort-like function usage 2025-04-17 11:19:17 +03:00
Ivan Krysak 4cde1f614c support.h: mark unknown_pc as noreturn 2025-04-17 11:19:17 +03:00
Ivan Krysak e579da5f9d early-linked.c: use an uglier name for ignore 2025-04-17 11:19:17 +03:00
Ivan Krysak 47a1869695 tests: ensure architecture is always available 2025-04-17 11:19:17 +03:00
Ivan Krysak 1383b0a40a Importers: replace .s in section names 2025-04-17 11:19:17 +03:00
Ivan Krysak 433af9ef6e Adopt the new name deduplication pass 2025-04-17 11:19:17 +03:00
Ivan Krysak dce5c1a02c NamingConfiguration: pull more prefixes inside
Unify additional values that used to be hardcoded in the old backend
under the same naming configuration root.
2025-04-17 11:19:17 +03:00
Ivan Krysak f070f1f1e1 Model: sunset double name system 2025-04-17 11:19:17 +03:00
Ivan Krysak 25790b5a78 NameBuilder: change automatic segment name
Use index within the binary instead of address in order to make these
shorter.
2025-04-15 16:35:42 +03:00
Ivan Krysak 50bbcaba1c Sunset name collision tests
Because of the switch to pre-model deduplication, no collisions are
possible, as such, it doesn't make much sense to keep these.
2025-04-15 16:35:42 +03:00
Giacomo Vercesi e634861c1a Implement SyncingManager
Implement the SyncingManager class which wraps the Manager and implements
save syncing features, which comprise autosave and saving via
synchronizers.
2025-04-03 15:59:18 +02:00
Andrea Gussoni bb4bdec403 Pipeline: introduce dagify and decidewithgotos
The `prepare-for-clift` artifact now encompasses the run of `dagify` and
`decidewithgotos` (`select-scope` + `ids`).
2025-04-02 16:47:14 +02:00
Giacomo Vercesi 42f8321f59 Fix S3 storage test
Fix the storage test by converting it from bash to python and also
testing all the occasions where a save should be triggered.
2025-03-28 14:23:10 +01:00
Alessandro Di Federico c5b9728289 LocalVariableBuilder: add pointer size assumption
This commit further centralizes the creation of allocas + ptrtoint.  The
creation of these pair of instructions is problematic when the size of a
pointer in the input and target architecture differ.

In fact, in such cases, LLVM turns trunc into masking the integer to
suppresse the high bits. This results in problematic code.

This commit introduces an assumption that ensures LLVM does not do that.
2025-03-17 08:51:29 +01:00
Giacomo Vercesi 140735a913 tuple-tree-generate-typescript: drop --prettier
The `prettier` binary is now assumed to be installed as part of the
system. No need to manually install it and use the `--prettier`
command-line option.
2025-03-13 14:06:02 +01:00
Ivan Krysak 45e01ae0d2 Introduce a pipe for embedding statement comments 2025-02-13 13:09:50 +02:00
Ivan Krysak a93ffd3760 Rename UnusedStackArgumentBytes
Old name was `StackBytesAllocatedForRegisterArguments`.
2025-02-12 16:43:19 +02:00
Pietro Fezzardi 5dc4d86f81 Pipeline: squash late-optimize into segregate
Passes without an artifact and a single successor are pointless anyway.
You can't get their output with revng artifact but you need to save
them on disk.
2025-01-29 23:55:49 +01:00
Pietro Fezzardi 1f0c8e1ae5 Pipeline: remove import-clift-types Pipe
At the moment this pipe is broken, because it claims to be producing
artifacts with function rank, while it only produces types.

This pipe should be extended and turned into a pipe that generates
the whole Clift module including functions from LLVM IR, and not just
types.

We should add an input LLVMContainer, and the run() method should first
import types, and then create the functions and their bodies.

For the time being the Pipe is removed from the pipeline.
2025-01-29 23:55:49 +01:00
Pietro Fezzardi 9e0f015eb8 Drop old conversion from LLVM to MLIR
The previous conversion from LLVM to MLIR was translating plain LLVM IR
to LLVM MLIR Dialect, as a preliminary step for further conversion from
LLVM MLIR Dialect to Clift.
This is not how things are expected to work anymore, so the old code is
now dead and can be removed.
2025-01-29 23:55:49 +01:00
Pietro Fezzardi 6e17dbed58 Tests: test the prepare-for-clift artifact
This is the initial part of the clift-based decomilation pipeline.
2025-01-29 23:55:49 +01:00
Pietro Fezzardi 186798c2aa Add initial part of clift-based decompilation 2025-01-29 23:55:49 +01:00
Pietro Fezzardi 7be6491258 Pipeline: avoid duplicate SingleTargetFilename 2025-01-29 23:55:49 +01:00
Pietro Fezzardi 391f5c780f SwitchToStatements: use LocalVariableBuilder 2025-01-29 23:55:49 +01:00
Pietro Fezzardi 59a1434fab Segregate: add template for legacy local variables
Introduce LegacySegregateStackAccessesPipe

This commit restructures the SegregateStackAccesses pass and
SegregateStackAccessesPipe so that they can have 2 modes of operations:
1. Legacy, with the same behavior as the old version, injecting local
   variables as custom llvm::Functions representing opcodes, such as
   LocalVariable, AddressOf, StackFrameAllocator, and CallStackArguments
   allocator.
2. Non-legacy, that is meant to operate with the new LocalVariableHelper
   to inject local variables as regular alloca instructions, with
   additional metadata to discriminate among them.

This commit renames the old SegregateStackAccessesPipe to
LegacySegregateStackAccessesPipe.
It then re-uses the old SegregateStackAccessesPipe name for a new pipe,
meant to work in non-legacy mode.

The pipeline definition YAML file is updated to keep using the legacy
version for now.

For now the implementation is still the same.
2025-01-29 15:17:15 +01:00
Pietro Fezzardi f4c79e0579 Pipeline: fix typo 2025-01-29 15:17:15 +01:00
Pietro Fezzardi 30558bcc29 Add -fno-strict-overflow to compile-flags.cfg
This prevents recompilation of decompiled C code to cause UB on
overflows, because all integer and pointer overflows now wrap.
2025-01-29 15:17:15 +01:00
Alessandro Di Federico b576fd1988 CollectFunctions tests: ignore loaded addresses
The tests was testing if a function whose entry address is the target of
load was identified as a function or not (it shouldn't).

This test was passing accidentally. This has not been supported since
the introduction of `RootAnalyzer`.  In order to support this again, we
need to resurrect `processLoadsAndStores`.
2025-01-28 12:19:16 +01:00
Lauri Vasama 1195617e5b Add revng_register_library, use for MLIR libs 2025-01-02 11:25:32 +02:00
Alessandro Di Federico 276a4aa974 Generate model docs 2024-12-11 16:15:10 +01:00
Alessandro Di Federico ade0603d3f Add docs for artifacts and analyses 2024-12-11 16:15:10 +01:00
Alessandro Di Federico 832840c307 Importers: ignore unmapped code
This commit ensures that parts of the model that must point to code
(specifically `Binary::EntryPoint`, `Binary::ExtraCodeAddresses` and
`Function::Entry`) actually point to a segment mapped as +x.
2024-11-28 15:22:10 +01:00
Alessandro Di Federico 686083bdab Remove mentions to revng-c 2024-11-21 15:54:23 +01:00
Alessandro Di Federico 143c315196 Merge revng-c into revng 2024-11-21 10:50:55 +01:00
Giacomo Vercesi 7a01742421 mass-testing: show smallest binaries
Show on the overview page of mass-testing the smallest binary for OOMs
and timeouts, as these are probably show an early sign of some broken
aspect of the pipeline.
2024-11-13 09:28:12 +01:00
Alessandro Di Federico efcea8ae48 importBinary: fix error handling 2024-11-12 18:05:48 +01:00