Commit Graph

663 Commits

Author SHA1 Message Date
Alessandro Di Federico 143c315196 Merge revng-c into revng 2024-11-21 10:50:55 +01:00
Ivan Krysak 64446d0453 Adopt name builder across the model users 2024-11-06 19:18:53 +02:00
Ivan Krysak 672ee5df50 Replace std::string_view with llvm::StringRef 2024-11-06 15:43:13 +02:00
Ivan Krysak a67ba96644 Adopt name builder across the model users 2024-11-06 15:43:13 +02:00
Ivan Krysak c101770c72 ModelTypeTests: pass the binary to the verifier 2024-11-06 15:42:44 +02:00
Alessandro Di Federico 4e670ac8e6 Either link revngcSupport or revngSupport 2024-11-04 15:09:56 +01:00
Lauri Vasama 2d2fe890fb Add Clift expression operations 2024-10-31 08:41:25 +01:00
Lauri Vasama e1b55fd5c3 Add custom assembly format for Clift FunctionOp 2024-10-31 08:41:25 +01:00
Lauri Vasama 2350f91c48 Use symbol attribute for GlobalVariableOp 2024-10-31 08:41:25 +01:00
Lauri Vasama c29a71a0d9 Add colon in clift.undef assembly format 2024-10-31 08:41:25 +01:00
Giacomo Vercesi 3fc9bbf8fc Uniform GzipStream
Uniform the functions/classes in GzipStream with the ones in ZstdStream.
2024-10-30 21:57:55 +01:00
Ivan Krysak 1a35cbcb77 Introduce PTMLCTypeBuilder 2024-10-15 10:45:13 +03:00
Ivan Krysak 8288bd68d2 PTMLCBuilder: rename into ptml::CBuilder 2024-10-15 09:13:28 +02:00
Alessandro Di Federico a0c670652c Improve usages of Expected<T> 2024-10-10 14:50:26 +02:00
Ivan Krysak 724f8bfb59 ABI: streamline terminology
"packed" is used instead of "unnaturally aligned".
2024-10-08 13:53:53 +02:00
Ivan Krysak 3f803ccc5c ABI-tests: add potential padding support 2024-10-08 13:53:53 +02:00
Ivan Krysak 6063015975 ABI-tests: support return-value-less SPTAR 2024-10-08 13:53:53 +02:00
Ivan Krysak 561f94115a ABI: make pointer to copy testing stricter 2024-10-08 13:53:52 +02:00
Giacomo Vercesi 212cfdc613 mlir_lit_tests: generate proper tar file
Using an empty file as a tar file is not 100% compliant. Use an actual
`tar` invocation to generate the file.
2024-10-01 20:34:38 +02:00
Giacomo Vercesi 993f66d59c revng cli: drop revng- prefix from libexec
Drop using the `revng-` prefix from all executables under
`libexec/revng/`. Now any executable found under there that is
executable and without extension will be considered a `revng`
subcommand, following the usual command-line rules.
2024-10-01 13:38:14 +02:00
Alessandro Di Federico 33cae7de12 Pipeline: reduce usage of Context 2024-09-27 12:07:18 +02:00
Alessandro Di Federico fbf79b5d1b Make Pipe::checkPrecondition optional 2024-09-27 12:07:18 +02:00
Alessandro Di Federico bc064244d6 s/deserialize/fromString/g 2024-09-27 12:07:17 +02:00
Alessandro Di Federico c1cbb4e9a0 Initialize pointers to nullptr 2024-09-27 12:07:17 +02:00
Alessandro Di Federico 2cdedc71f4 s/serialize/toString/
We keep serialize for method dealing with streams.
If it returns a `std::string`, let's use `toString`.
2024-09-27 12:07:17 +02:00
Alessandro Di Federico c8d4381297 s/Context &Ctx/Context &Context/g 2024-09-27 12:07:17 +02:00
Alessandro Di Federico 9bdce8e5c4 s/ExecutionContext &Ctx/ExecutionContext &EC/g 2024-09-27 12:07:17 +02:00
Alessandro Di Federico 12a0a89e15 Ensure every pipe commits what it should
This commit is the final step in ensuring all the pipes commit what they
should. It also asserts this actually happens, enabling us to easily
catch future problems.
2024-09-27 12:07:16 +02:00
Alessandro Di Federico 850276f5c8 Minor changes 2024-09-27 12:07:16 +02:00
Alessandro Di Federico ca99bbbb66 Adopt toString() 2024-09-26 17:51:08 +02:00
Andrea Gussoni 5849deee50 Remove CycleEquivalenceInfo 2024-09-20 21:06:46 +02:00
Andrea Gussoni 70734496f3 GenericGraph: remove Undirected
Remove the `Undirected` `GraphTraits`
2024-09-20 16:08:50 +02:00
Andrea Gussoni 76cb852c28 Implement GenericRegionInfo
We implement the `GenericRegionInfo` analysis.

The analysis accepts a template parameter which enables to run it on
every graph which exposes `llvm::GraphTraits`.
The `GenericRegionPass` is responsible for instantiating and running the
analysis on a `llvm::Function`.

The `GenericRegionInfo` analysis uses, and takes insipiration from the
`GenericCycleInfo` LLVM analysis.

The analysis exposes a tree of well nested `GenericRegion`s, which are
constructed starting from the well nested tree of `GenericCycle`s.
In addition, we perform the election of the `Head` of each
`GenericRegion`, and the election of the retreating edges.
2024-09-19 18:11:19 +02:00
Lauri Vasama 35759476b6 Add Clift LIT/FileCheck tests
Some C++ unit tests were also converted into more easily maintainable
LIT/FileCheck tests.
2024-09-04 10:58:02 +02:00
Lauri Vasama c821fd0455 Remove Clift FunctionArgumentAttr
The FunctionArgumentAttr was removed in order to better conform to the
builtin FunctionOpInterface. The FunctionOpInterface exposes the
argument and result types as array attributes of mlir::Type, and this
was difficult when each argument was wrapped in a FunctionArgumentAttr.

Debug names of the function types arguments from the model is currently
lost in the conversion to MLIR, but when the conversion for functions
themselves is implemented, the names can be added to the function
operations as argument attributes.
2024-09-04 10:58:02 +02:00
Lauri Vasama 8f98664fc0 Add verification of Clift module level operations 2024-09-04 10:58:02 +02:00
Lauri Vasama aceef4e6cc Overhaul Clift statement operations 2024-09-04 10:58:02 +02:00
Lauri Vasama d02c543f6c Remove redundant using directive 2024-09-04 10:58:02 +02:00
Lauri Vasama 4a88a8798e Overhaul clift::ModuleOp verify and re-enable test
Re-enabled (a fixed version) of the class type recursion unit test that
was previous disabled to work around a parsing issue. Added another unit
test for indirectly recursive class types and another for recursion via
indirection.
2024-09-04 10:58:02 +02:00
Lauri Vasama 0775ad4bd1 Fix Clift model import LIT tests 2024-09-04 10:58:02 +02:00
Ivan Krysak 953bc49369 ABI-tests: fix a broken comparison operator 2024-08-16 16:33:39 +02:00
Andrea Gussoni eeca8f781c GenericGraph: introduce Undirected
Introduce the `Undirected` GraphTraits, which treats a `MutableEdgeNode`
`GenericGraph` as an undirected graph.

The trait uses the newly introduced `UndirectedChildIterator`, which is
a special custom iterator to get successors and predecessors
concatenated together.

Add some unit tests for `UndirectedChildIterator`.
2024-08-12 12:32:45 +02:00
Andrea Gussoni 5f7a67c8af CycleEquivalence: implement analysis
We introduce the `CycleEquivalence` analysis.

This is an analysis which implements the _Cycle Equivalence_ computation
algorithm, and provides as result the _cycle equivalence classes_
Specifically, we introduce:
- The `CycleEquivalenceClass`, which is the unitary element computed by
  the analysis.
- The `CycleEquivalenceAnalysis`, which contains the algorithm to
  compute the cycle equivalence.
- The `CycleEquivalencePass`, a `FunctionPass` that can be used to
  perform the analysis on a `llvm::Function`.

The algorithm is composed by various stages:
- We construct a new `GenericGraph` object, replicating the input CFG,
  with the addition of the `exit`->`entry` edge.
- Taking advantage of `llvm::GraphTraits<Undirected<>>`, we can now
  implement the algorithm working on an undirected version of the input.
- We perform the `CycleEquivalence` computation, returning a
  `llvm::SmallVector` of `CycleEquivalenceClass` objects.

In addition to using the `llvm::GraphTraits<Undirected<>>` traits to
walk on the equivalent undirected graph, we also need to:
- Perform a preliminary DFS, in order to:
  - Assign the DFS number to each node in the graph.
  - Compute the spanning tree, and use this information to distinguish
    tree edges and back edges when running the algorithm.

The internal graph used by the analysis also normalizes the graph in
order to have a sinle exit node (called sink), which is a requirement
for the `CycleEquivalence` algorithm.

We also implement the `llvm::DOTGraphTraits` for the
`CycleEquivalenceAnalysis<llvm::Function *>` specialization. In this
way, we can have a graphical representation of the undirected graph used
internally in the `CycleEquivalenceAnalysis` core implementation.

We add some `FileCheck` tests on some well-known graph topologies.
2024-08-12 12:30:54 +02:00
Alessandro Di Federico f87ba8a0d3 Introduce TypeShrinking tests 2024-07-10 16:19:27 +02:00
Ivan Krysak 0542be1b23 Add an array emission test 2024-06-27 11:07:02 +02:00
Ivan Krysak 94a0ad6b93 Adopt reworked model::Type 2024-06-27 11:07:01 +02:00
Ivan Krysak 3705906074 Model: rename Type into TypeDefinition 2024-06-27 11:07:01 +02:00
Ivan Krysak 5f570b99fa Fix a boost exception not found compilation error 2024-06-27 11:06:11 +02:00
Ivan Krysak 4a2db0ba4f UpcastablePointer: streamline empty behavior 2024-06-27 11:05:52 +02:00
Ivan Krysak 3eb4445c29 RegisterStateDeduction: fix heap-buffer-overflow 2024-06-27 11:05:52 +02:00