Commit Graph

2343 Commits

Author SHA1 Message Date
Ivan Krysak ccb7c41e9e Introduce automatic names for dynamic functions 2025-04-24 12:00:21 +02:00
Ivan Krysak 0836143181 Bring name mangling out into a support helper 2025-04-24 12:00:14 +02:00
Giacomo Vercesi d428eb597d Fix codespell errors
Fix erros detected by the new version of `codespell`.
2025-04-23 14:13:03 +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
Ivan Krysak 645cf7fc2e NameBuilder: sunset deduplication
This reworks NameBuilder to ease the transition to the system where
the model will be guaranteed to never contain any name collisions, both
between user-specified names and the automatic ones.
2025-04-15 16:35:42 +03:00
Ivan Krysak 45cc80cb68 PrimitiveType: introduce isCName helper 2025-04-15 16:35:42 +03:00
Ivan Krysak cbddbaa462 Model: add a way to iterate over all the registers 2025-04-15 16:35:42 +03:00
Ivan Krysak e10199ee1c TypeDefinitionKind: introduce a prefix consumer 2025-04-15 16:35:42 +03:00
Ivan Krysak 795a84dfe6 MetaAddressType: introduce a prefix consumer 2025-04-15 16:35:42 +03:00
Ivan Krysak 2e85653873 MetaAddressType: introduce Count 2025-04-15 16:35:42 +03:00
Ivan Krysak 6ea75f02b3 Model: switch to the new namespace verifier 2025-04-15 16:35:42 +03:00
Ivan Krysak 3ff5b2cd3a Support: introduce unwrapError 2025-04-15 16:35:42 +03:00
Ivan Krysak 6710dacfed Model: give path helpers a home 2025-04-15 16:35:42 +03:00
Ivan Krysak b354f1b75b TupleTree: allow visiting upcastable pointers 2025-04-15 16:35:42 +03:00
Ivan Krysak 6c6cf04d11 STLExtras: rename is_contained_if into any_of
This improves consistency with the names llvm uses.
2025-04-15 16:35:42 +03:00
Ivan Krysak 0bd174c07f STLExtras: fix an ambiguous find_if call 2025-04-15 16:35:42 +03:00
Ivan Krysak 169383daa8 MetaAddress: introduce toIdentifier() method
It's equivalent to the existing `toString()` except for the fact that
it uses an identifier-friendly separator (`_`).
2025-04-15 16:35:42 +03:00
Ivan Krysak 3edb6cbb9b Minor improvements 2025-04-15 16:35:42 +03:00
Alessandro Di Federico c5c657d11b Lift: increase determinism 2025-04-15 15:31:10 +02:00
Giacomo Vercesi e6fcca3dc6 TupleTreeContainer: fix infinite recursion
Fix an infinite recursion caused by renaming the `ContainerBase::load`
function to `ContainerBase::loadImpl`.
2025-04-07 10:35:20 +02:00
Giacomo Vercesi 11f1e532c6 Implement dirty bit on Container
Add a `Dirty` boolean to the `ContainerBase` class. This will be set to
true when the container mutates itself (e.g. remove, mergeBack, clear).
The dirty bit is reset when running `PipelineManager.store`.
2025-04-03 15:59:18 +02:00
Giacomo Vercesi f740badd68 PipelineManager: drop storeContext
The `storeContext` function was a misguided attempt to performance
optimization. Without storing all the containers and the invalidation
metadata the resume directory would be corrupt by just storing the
context.
2025-04-03 15:59:18 +02:00
Andrea Gussoni 40ebac06cc IDS: introduce pass
Introduce the `inline-divergent-scopes` pass. This pass in is charge of
reducing the exit nodes in a `ScopeGraph`, applying the _Inline
Divergent Scopes_ transformation, which is able, in presence of
divergent exits nodes, wrt. to a conditional, to remove the exit node
and to transform the `ScopeGraph` in a form where semantics is
preserved.
2025-04-02 16:47:14 +02:00
Andrea Gussoni 47fac0d948 SelectScope: introduce pass
Introduce the `select-scope` pass. This pass is in charge of enforcing
the relative decidedness property for all the nodes in the `ScopeGraph`,
wrt. to all the conditional nodes. It does this by applying the
relative decidedness definition, electing one scope for each conditional
node in the graph, and by transforming all the edges that would violate
the property into goto edges.
2025-04-02 16:47:14 +02:00
Andrea Gussoni 21be052d6f ScopeGraph: introduce the makeGotoEdge helper
Introduce the `makeGotoEdge` helper to the `ScopeGraphBuilder` class,
that can be used to handle the transformation of a solid edge into a
`goto` edge, taking care of the creation of the `goto` block and the
redirection of the edges.
2025-04-02 16:47:14 +02:00
Andrea Gussoni 1482a5e110 ScopeGraph: improve ScopeGraph .dot name
Include the function name in the filename of the dumped `.dot` of the
`ScopeGraph`.
2025-04-02 16:47:14 +02:00
Andrea Gussoni a7e58b2749 GraphAlgorithms: improve return type
Improve the definition of the return type of `nodesBetween`, obtaining
the type of the elements in the `Set`s by passing through the
`GraphTraits::NodeRef` type, which enables us to handle more generic
situations, where `GraphT` includes a `View` over a graph.
2025-04-02 16:47:14 +02:00