Commit Graph

2366 Commits

Author SHA1 Message Date
Ivan Krysak 2c9c780a3d PTMLCBuilder: introduce a _SIZE annotation 2024-09-04 13:04:44 +03:00
Ivan Krysak 4a080cae0c PTMLCBuilder: introduce a _START_AT annotation 2024-09-04 13:04:44 +03:00
Ivan Krysak cae04be8fd PTMLCBuilder: clean up annotation method naming 2024-09-04 13:04:44 +03:00
Lauri Vasama ee14ba2366 Add unique_handle to Clift module-level operations 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 43399c0462 Add minimal Clift expression operations 2024-09-04 10:58:02 +02:00
Lauri Vasama 9295451b5a Add Clift loop statement operations 2024-09-04 10:58:02 +02:00
Lauri Vasama e8f558cc55 Add custom parser for SwitchOp 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 c7b6fb529f Overhaul Clift module-level operations 2024-09-04 10:58:02 +02:00
Lauri Vasama 16797c864f Add named Clift region constraints 2024-09-04 10:58:02 +02:00
Lauri Vasama a3f7b879d2 Add Clift operation traits
* Rename CliftTraits.h to CliftOpTraits.h.
* Add NoFallthrough operation trait.
2024-09-04 10:58:02 +02:00
Lauri Vasama 748accaa38 Add Clift operation interfaces 2024-09-04 10:58:02 +02:00
Lauri Vasama 2b83648336 Reorder CliftOps.td includes 2024-09-04 10:58:02 +02:00
Lauri Vasama a758463cfc Create a block in the clift::ModuleOp::build
SymbolTable requires the operation to have exactly one block.
2024-09-04 10:58:02 +02:00
Ivan Krysak 8f41b0017e Model: fix failure to parse void 2024-08-30 14:40:09 +02:00
Alessandro Di Federico d28af50f84 DetectStackSize: handle counted loops 2024-08-23 18:01:47 +02:00
Alessandro Di Federico 7b2f02c519 DisassemblyHelper: default initialize struct 2024-08-23 15:01:29 +02:00
Ivan Krysak df4bf51c75 ABI: improve the type filtering helper
It now supports specifying a list of types to ignore.
2024-08-16 16:33:39 +02:00
Alessandro Di Federico cba1d6fa51 PDBImporter: fix .pdb path lookup 2024-08-16 13:01:57 +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 c32a4776ab GenericGraph: edge traits for llvm::Inverse 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 024c9abda2 Step: fix use-after-free 2024-08-07 16:07:59 +02:00
Alessandro Di Federico 744184c90c Do not use CallBase::getCalledFunction
Use our wrapper, which does not return nullptr if the `FunctionType`s do
not match.
2024-08-07 16:07:59 +02:00
Alessandro Di Federico 80237078e4 setMetaAddressMetadata: use MDString 2024-08-07 16:07:59 +02:00
Alessandro Di Federico 09bc315448 Pipeline: improve invalidation logging 2024-08-07 16:07:59 +02:00
Alessandro Di Federico 0cb3eedd37 Do not use CallBase::getCalledFunction
Use our wrapper, which does not return nullptr if the `FunctionType`s do
not match.
2024-08-07 15:40:56 +02:00
Alessandro Di Federico 15d72e580d MetaAddress::address*: simply ignore Type 2024-08-05 17:41:41 +02:00
Alessandro Di Federico 7b00473859 PDBImporter: rework .pdb search 2024-08-05 17:41:34 +02:00
Alessandro Di Federico 06023b4555 BitLivenessWrapperPass::dump 2024-07-10 16:19:26 +02:00
Alessandro Di Federico 7ddae47040 Minor changes 2024-07-10 15:34:19 +02:00
Alessandro Di Federico 3c839cb821 Pipe::mutableContainers: use running containers 2024-07-09 08:58:51 +02:00
Alessandro Di Federico 966caa4137 revng artifact: fix handling of target arguments
This commit adds to `revng artifact` help the part of the command line
accepting a list of targets.
Also, it fixes the parsing of targets.
2024-07-09 08:58:51 +02:00
Pietro Fezzardi 521baf38e8 PTML: honor GeneratePlainC 2024-06-27 17:30:56 -04:00
Pietro Fezzardi d72139357f Add DecompileToDirectoryPipe
This pipe decompiles all the C code in a single directory, packaged up
as a .tar.gz file.
2024-06-27 17:26:18 -04:00
Pietro Fezzardi 8a95a0b9c9 HelpersToHeader: enable printing plain C 2024-06-27 17:14:28 -04:00
Pietro Fezzardi 2b9bcc0260 Backend: enable decompiling as plain C 2024-06-27 17:14:28 -04:00
Ivan Krysak 5ed120cdc9 ImplicitModelCastPass: extend logging 2024-06-27 11:07:02 +02:00
Ivan Krysak 185fc68097 PTML: fix the direct array data usage 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 c2b4fb70bb Model: rename TypePath to DefinitionReference 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 b900e36a68 CommonTypeMethods: introduce isAggregate 2024-06-27 11:05:52 +02:00
Ivan Krysak 0aa2ae7f08 Pipes: introduce a primitive rank 2024-06-27 11:05:52 +02:00
Ivan Krysak cd2fdafc45 TupleTree: never assign root directly
This prevented expected cache invalidation when a new root was
assigned.
2024-06-27 11:05:52 +02:00
Ivan Krysak b72e2fd87b Model: allow omission of void size 2024-06-27 11:05:52 +02:00
Ivan Krysak 9a3086694b UpcastablePointer: do not crash on empty print 2024-06-27 11:05:52 +02:00
Ivan Krysak fbe1416aa2 ConstexprString: add operator* 2024-06-27 11:05:52 +02:00
Ivan Krysak 4a2db0ba4f UpcastablePointer: streamline empty behavior 2024-06-27 11:05:52 +02:00