Commit Graph

2366 Commits

Author SHA1 Message Date
Alessandro Di Federico a555b6d50b s/+yaml/+tar+gz/g 2024-02-09 09:04:25 +01:00
Alessandro Di Federico 911ab00107 s/CDecompilation/Decompile/g 2024-02-09 09:03:34 +01:00
Alessandro Di Federico ba94f0ddd4 s/DecompiledToYAML/Decompiled/g 2024-02-09 09:03:34 +01:00
Alessandro Di Federico 2c9d50bdec s/DecompiledYAMLToC/DecompileToSingleFile/g 2024-02-09 09:03:34 +01:00
Pietro Fezzardi fdf1720433 Drop ValueManipulationAnalysis (VMA)
This commit drops ValueManipulationAnalysis, which in its original
design based on MinCut and Karger, was never enabled in the
decompilation pipeline.

Until now, VMA was only used in a severely weakened form in
initModelTypes. That for was so weakened that it barely did anything.

We already have a new design for VMA so that it can work before
DataLayoutAnalysis, and on Clift.
At this point, the old VMA is basically useless anyway, and the very few
occasions where it can do something will simply be solved by the
upcoming work on making some of the remaining casts implicit.

At this point it does not make sense to keep VMA alive anymore.
2024-02-07 00:41:30 +01:00
Andrea Gussoni 4219ce3101 ASTNode: remove unused SequenceNode constructor 2024-02-05 00:51:15 +01:00
Massimo Fioravanti ab856523dd Introduce clift types 2024-02-04 16:49:51 +01:00
Pietro Fezzardi f367eafad2 DLA: store node neighbours in increasing ID order 2024-02-04 16:07:30 +01:00
Ivan Krysak 78510010f8 ABI: rename isIncompatibleWith
The new name is `isPreliminarilyCompatibleWith`.
2024-01-29 11:57:54 +02:00
Ivan Krysak e7c456afd2 ABI: improve register state deduction docs 2024-01-29 11:57:54 +02:00
Ivan Krysak 4cb38a722c ABI: disallow ABI flags to be optional 2024-01-29 11:57:54 +02:00
Ivan Krysak 4093cd30c4 ABI: provide alignment computation for model::Type 2024-01-29 11:57:54 +02:00
Ivan Krysak 386cb26f6d ABI: introduce a new ABI configuration option
It's called `AllowUnnaturallyAlignedTypesInRegisters` and explicitly
allows weirdly aligned structs in registers.
2024-01-29 11:57:54 +02:00
Ivan Krysak 16dc85cb0f ABI: improve unnatural alignment support 2024-01-29 11:57:54 +02:00
Ivan Krysak 54ffd723e6 ABI: decouple alignment from model::VerifyHelper 2024-01-29 11:57:54 +02:00
Ivan Krysak 7fae2e4522 STLExtras: introduce takeAsTuple
It's a useful shorthand for the cases where one only cares about
a constant number of top values in a range (i.e. first three elements of
a vector) and wants them as named variables. It can be used as:
`auto [First, Second, Third] = takeAsTuple<3>(MyVector)`.
2024-01-29 11:57:54 +02:00
Ivan Krysak 3068cd219e compile_time: add a tuple repeat overload
Based on the passed `Callable`, it either behaves as previously,
or returns a `std::tie`'d version of all the values returned by it.
2024-01-29 11:57:54 +02:00
Ivan Krysak a2ef041cb2 Move TypeBucket to the model 2024-01-29 11:57:54 +02:00
Ivan Krysak 77b1acaf00 Prefer uint64_t to size_t wherever relevant 2024-01-29 11:57:54 +02:00
Ivan Krysak f67030214f STLExtras: add to_underlying 2024-01-29 11:57:54 +02:00
Ivan Krysak b25a32de2a Stop using std:: prefix for std::size_t 2024-01-29 11:57:54 +02:00
Ivan Krysak 15be26f9fa Minor Improvements 2024-01-29 11:57:54 +02:00
Giacomo Vercesi 7f8a83c34a ModelToHeader: add DisableTypeInlining option
When running ModelToHeader in HeaderToModel, all types need to be
defined in the header for clang to successfully parse the file. Add an
option to `ModelToHeaderOptions` that forces all types to be printed
regardless of stack or inlining rules.
2024-01-26 19:13:58 +01:00
Giacomo Vercesi 92e90d554c PTML/Constants.h: add editType action 2024-01-26 19:13:58 +01:00
Giacomo Vercesi ed1ad5e040 Add type.h artifact
Add the required container and pipes to produce `type.h`, a type-wise
file that shows the definition of a Model type in plain C.
2024-01-26 19:13:58 +01:00
Giacomo Vercesi fc4c91e333 Introduce PopulateTargetListContainer
This commit adds the `TargetListContainer` container that allows storing
a list of target for a fixed Kind. Moreover the
`PopulateTargetListContainer` pipe has been added that allows adding all
targets to a `TargetListContainer` from a `Kind` via the
`appendAllTargets` method.
2024-01-26 19:13:58 +01:00
Giacomo Vercesi a09a4ab2bf Adapt switch to detail::GenericStringMap
This commit adapts the changes introduced in revng that generalize
`FunctionStringMap`.
2024-01-26 19:13:58 +01:00
Giacomo Vercesi 11938e40da Introduce TypeStringMap
Building upon the previous commit, introduce `TypeStringMap` which is a
container for type-wise strings.
2024-01-26 19:13:58 +01:00
Giacomo Vercesi 5f8143207d Generalize FunctionStringMap
Generalize `FunctionStringMap` into `detail::GenericStringMap`, which
supports any `Depth=1` rank. `FunctionStringMap` remains as an `using`
with `Rank = ranks::Function`.
2024-01-26 19:13:58 +01:00
Giacomo Vercesi ca3fb32aeb Fix Step::invalidationMetadataContains
This commit fixes the `Step::invalidationMetadataContains` function
since it returned an inverted result.
2024-01-26 19:13:58 +01:00
Giacomo Vercesi 6ac7c0c557 Implement container cache pruning
Implement the pruning of container caches (resume directory) when there
is a mismatch between the current revng components' hash and the saved
one. This functionality is activated via `-check-components-version`.
2024-01-26 17:46:21 +01:00
Giacomo Vercesi 06f6137004 ResourceFinder: implement getComponentsHash
Implement the `getComponentsHash` function which returns a hash string
for all the components currently installed in revng.
2024-01-26 17:46:21 +01:00
Giacomo Vercesi 5070fe6aef revng::Path: add newline to dump
The `revng::Path.dump` method was missing a newline, which caused the
output to be harder to read.
2024-01-26 17:46:21 +01:00
Giacomo Vercesi 27b6fa984d STLExtras: fix append
Before this commit, the `append` function did not work with contained
objects which were not default-constructible. This commit fixes this
behavior by using a different choice of iterator wrappers which avoids
the need for the contained object to be default-constructible.
2024-01-26 17:46:21 +01:00
Giacomo Vercesi ca66b4ddfc InitRevng: fix command line parsing
This commit fixes command line parsing of revng through the
REVNG_OPTIONS environment variable. Previously the env was prepended to
the actual command-line variables, now it's appended, allowing to
specify command line arguments that depend on `-load`s.
2024-01-26 17:46:21 +01:00
Giacomo Vercesi af1e927e7e Drop ApplyDiffAnalysis' files
The files `ApplyDiffAnalysis.{cpp,h}` were mis-re-merged in c276a439.
Drop them.
2024-01-26 17:46:21 +01:00
Massimo Fioravanti 2ec4683874 Fix: invalidation map and invalidation cache
The invalidation map passed by callers of pipeline invalidate was
assumed to be always empty. This requirement has been relaxed.

The pipe invalidation cache now checks that what must be removed is
actually present. This is relevant for targets that are killed by later
pipes before the end of the step.
2024-01-02 15:08:26 +01:00
Massimo Fioravanti d7c56bd1f4 Remove redundant model copy 2024-01-02 12:10:21 +01:00
Massimo Fioravanti c276a439b5 Add pipeline invalidation
Replace the stub implementation of invalidation with the proper
implementation. A ReadPathCache is added to each global so that it can
keep tracks of what target are associated to which read paths.
2024-01-02 11:14:56 +01:00
Massimo Fioravanti 643d96698d Preliminaries for pipeline invalidation
Fix various bugs already present in the codebase.
2024-01-02 11:06:48 +01:00
Massimo Fioravanti 86e45461a0 Introduce pipeline execution context 2024-01-02 11:05:50 +01:00
Giacomo Vercesi b6d1f178fd FunctionStringMap: UncompressedSize in index
Add the `UncompressedSize` field in the index file.
2023-12-13 14:45:10 +01:00
Alessandro Di Federico 3d3d3abfc3 Layout: add info about return values
This commit introduces two new methods that describe the return value of
a function:

* `returnMethod`: describes how the return value is passed to the
  caller.
* `returnValueAggregateType`: the type of the aggregate that is being
  returned, in case `returnMethod` is `LocalVariable`.
2023-12-12 12:04:34 +01:00
Alessandro Di Federico d648f9b970 s/Layout::returnsAggregateType/Layout::hasSPTAR/ 2023-12-12 12:04:34 +01:00
Alessandro Di Federico 73a1827c29 Import QualifiedType::stripPointer 2023-12-12 12:04:34 +01:00
Alessandro Di Federico 98f5304c54 InlineHelpers: do not inline recursive functions
Also, turn it into a ModulePass.
2023-12-12 12:04:33 +01:00
Alessandro Di Federico d5ad77d2d9 Adopt model::QualifiedType::stripPointer 2023-12-12 12:04:19 +01:00
Alessandro Di Federico 0e7d3a9a71 Pass PlainMetaAddress by pointer 2023-12-12 10:20:51 +01:00
Alessandro Di Federico e63feda848 Outliner::getCallSiteInfo: drop unused argument 2023-12-12 10:05:30 +01:00
Alessandro Di Federico 28a0fa5b7d DetectABI: run to fixed point and more
This commit switches the approach with which we run the ABI analyses: we
now run them until we reach a fixed point. This enables proper
interprocedural propagation of arguments and return values.

Basically, we now inject reads before call sites, so that, if a function
immediately calls another one, the arguments of the callee are
propagated to the caller.

This commit also updates the logic with which we propagate function
prototypes (and names) to callers. The main advantage of this, is that
function wrappers (in particular, PLT entries) now have the same name as
the function they wrap.
2023-12-12 10:05:22 +01:00