Commit Graph

1544 Commits

Author SHA1 Message Date
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 101cac84ea FileContainer: use TemporaryFile
Ditch the manual management of the temporary file owned by
`FileContainer` and instead rely on the functionality offered by
`TemporaryFile`.
2025-05-05 16:02:40 +02:00
Giacomo Vercesi ec3231d7e6 TemporaryFile: fix move assignment
Fix the move assignment operator of `TemporaryFile`, which would behave
incorrectly if the object was moved into itself.
2025-05-05 16:02:40 +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
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 10055101c5 ScopeGraph: detail namespace to avoid clash
Define the `getScopeGraphSuccessors` and `getScopeGraphPredecessors`
in the `detail` namespace in order to avoid clashes.
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 383af5b6b0 Add the version field to schemas YAML
Here we start restructuring the the schemas YAML such that it
contains a top-level `version` field. In this commit we only modify
the YAML, the build system changes will come later, to avoid
enormous commits.
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
Khaled Ismaeel f384b10435 Check schemas into the codebase
These schema files are currently generated at build time by
collecting various TUPLE-TREE-YAML comments using the
`extract_yaml.py` script. In this commit we move them to the codebase
but we don't use them yet, this will be done at a later commit for
the sake of readability.
2025-04-30 15:08:40 +02:00
Giacomo Vercesi 9ff471409e Remove some asserts from YAMLTraits
More soft-fails instead.
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 33197fb937 LocalVariables: fix VariableTypeMDName string
Before this commit it was set to "revng.stack_type" for a silly
copy-paste error.
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 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 48a7822923 FunctionTags: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 24b96e4480 IRHelpers: introduce a const callers helper 2025-04-17 11:19:17 +03:00
Ivan Krysak 7b02ab0e44 getJTReasons: Work on const instructions 2025-04-17 11:19:17 +03:00
Ivan Krysak 76a2bffc94 Introduce an IR helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak 6a6b34b831 Introduce a general static registry helper 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
Ivan Krysak 57b5eb7f98 NameBuilder: allow different name checkers 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 93e44460bf ptml::CTypeBuilder: drop getPlainTypeName 2025-04-17 11:19:17 +03:00
Ivan Krysak 7d409ab4a7 KeyedObjectContainer: support llvm::StringRef 2025-04-17 11:19:17 +03:00
Ivan Krysak acb7d595ef Model: introduce a primitive typedef removal pass 2025-04-17 11:19:17 +03:00
Ivan Krysak c9ade8d458 NameBuilder: report reason when renaming something 2025-04-17 11:19:17 +03:00
Ivan Krysak 7b04cb99ae ptml::Annotations: introduce isMacro helper 2025-04-17 11:19:17 +03:00
Ivan Krysak cf78106d54 Model: introduce a 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 af79a289d8 NamingConfiguration: add a new option
It's `ReserveNamesStartingWithUnderscore`.
2025-04-17 11:19:17 +03:00
Ivan Krysak 57ac85d7a0 NameBuilder: introduce warning method 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