Commit Graph

3168 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
Ivan Krysak 31068f3d43 Pipeline: introduce an optional model path 2025-05-07 10:48:49 +02:00
Giacomo Vercesi e3074ec29a revng artifact: omit kind
When working with `revng artifact`, omit the kind in both the output of
`--list` and the parameters taken specifying which targets to produce.
2025-05-07 10:48:48 +02:00
Alessandro Di Federico 3db971b8b4 Pipeline: invalidate if *any* input is invalidated
We used to invalidate only if *all* inputs were invalidated.
2025-05-07 08:36:44 +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
Giacomo Vercesi 50caf5ef9e Pipeline: allow analyses to not be available
An analysis can implement the `isAvailable` function which can tell
users if the analysis is available or not to be run.
2025-05-05 17:28:48 +02:00
Giacomo Vercesi fede2f2090 ProgramRunner: allow redirection of streams
Change ProgramRunner's API to allow to optionally provide stdin and
capture stdout/stderr.
2025-05-05 17:28:48 +02:00
Giacomo Vercesi 4e7469c1eb ModelTypeNames: fix context-action
The `data-action-context-location` applies to only the variable portion
of a function argument, not the type and the variable.
2025-05-05 17:28:48 +02:00
Giacomo Vercesi cf08ae41be Drop usage of llvm::ErrorOr<T>
Remove the last two remaining classes in revng which used the
`llvm::ErrorOr` class, replace them with `llvm::Expected`.
2025-05-05 16:02:40 +02:00
Alessandro Di Federico e8947cced0 JTM::purgeTranslation: EliminateUnreachableBlocks 2025-04-30 17:40:55 +02:00
Andrea Gussoni 8b87854a11 IDS: improve goto exit ordering criterion
Perform the IDS operation for the exit nodes corresponding to `goto`
blocks afterwards the other _standard_ exits have been processed.

In addition, order the `GotoBlock`s according to the `post_order` of the
target blocks of the `goto` themselves. This should maximize the
opportunities for later runs of `MaterializeTrivialGoto`.
2025-04-30 16:10:54 +02:00
Andrea Gussoni 5698284bea MTGoTo: introduce the MaterializeTrivialGoto pass
The MaterializeTrivialGoto pass, tries to remove superfluous `goto` from
the `ScopeGraph`, by verifying that the resulting `ScopeGraph` does not
become cyclic or undecided.
In that case, it rolls back the changes.
2025-04-30 16:10:54 +02:00
Andrea Gussoni 307110fcfb ScopeGraph: introduce isScopeGraphDecided helper 2025-04-30 16:10:54 +02:00
Andrea Gussoni 2c19f69a74 ScopeGraph: ScopeGraph manipulation helpers
Introduce some helpers used to manipulate `goto_block` and
`scope_closer` annotations on the `ScopeGraph`.
2025-04-30 16:10:54 +02:00
Andrea Gussoni e093a1c7ed SelectScope: extract reusable helpers
Extract reusable helpers in `ScopeGraphAlgorithms.h`, so they can be
reused.
2025-04-30 16:10:54 +02:00
Andrea Gussoni 8ff68174ea ScopeGraph: use snake_case for Markers 2025-04-30 16:10:54 +02:00
Andrea Gussoni 71988af041 Fix MIT license 2025-04-30 16:10:54 +02:00
Khaled Ismaeel 9d80594ddc Bump model version to v3 2025-04-30 15:08:45 +02:00
Khaled Ismaeel a52f1f17c2 Add automatic migrations in PipelineManager 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 030becfeba Adapt the build to the new schema version field
This is a followup to the commit where we introduced the `version`
field in the schema YAML.
2025-04-30 15:08:45 +02:00
Khaled Ismaeel 531d9b866c Remove the now-redundant HEADERS list 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
Khaled Ismaeel b656ea073a Fix erroneous include 2025-04-28 12:58:27 +02:00
Ivan Krysak 1622bb91a1 Introduce automatic names for dynamic functions 2025-04-24 13:22:14 +02:00
Ivan Krysak 1bce76f511 Bring name mangling out into a support helper 2025-04-24 13:22:14 +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
Pietro Fezzardi 3b10a3c5d9 Move SimplifyCFGWithHoistAndSinkPass to new file
This will be used to collect various customizations of LLVM passes, that
are necessary to enable setting different default options to passes for
insertion in the revng pipeline.
2025-04-22 17:18:26 +02:00
Pietro Fezzardi 0cb3abc9c3 LocalVariableBuilder: make array-typed allocas
This reduces the occasions where some LLVM optimization passes rewrite
the allocas, reducing the chances that the model type metadata is
discarded by LLVM passes that we don't control.
A pass that was doing this was InstCombine.
2025-04-22 15:24:30 +02:00
Ivan Krysak 79964eac74 Avoid ' misuse in error messages and comments 2025-04-17 16:41:21 +02:00
Ivan Krysak 83324fcf07 NameBuilder: improve documentation 2025-04-17 11:19:17 +03:00
Ivan Krysak c8de226f56 DwarfImporter: remove an input-dependent assert
Not checking for primitives there doesn't change anything anyway, as
`purge-invalid-types` model pass will clean anything invalid still
left after the importer.
2025-04-17 11:19:17 +03:00
Ivan Krysak ae3f19664a ModelPasses: introduce fix-model 2025-04-17 11:19:17 +03: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 c6e38cd485 Return to using constant name builders
Because of how name builders used to lazy gather namespaces on the first
requested name, the objects were self mutating. As such only non-const
references could be used to pass them around.

Since that is no longer the case, this restores most of lost const
qualifiers.
2025-04-17 11:19:17 +03:00
Ivan Krysak 61f2c122b1 Canonicalize: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 18829dc7e4 RestructureCFG: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 8a8e0ce4ae PromoteStackPointer: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 2c8e0d68c8 FunctionCallIdentification: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 274e0f298a EFA: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 5d0986c315 FunctionIsolation: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak e1c8c370f7 Lift: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 0af6eaf494 BasicAnalyses: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 514e6c56e0 ProgramCounterHandler: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 48a7822923 FunctionTags: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak dc7d08555e Decompile: verify helper names are consistent 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 154287b5d5 init_local_sp: drop leading _ 2025-04-17 11:19:17 +03:00