Commit Graph

3168 Commits

Author SHA1 Message Date
Alessandro Di Federico e1f46264f8 Ensure every pipe commits what it should 2024-09-26 17:51:07 +02:00
Alessandro Di Federico bd08864e49 DwarfReader::readValue: handle DW_EH_PE_omit 2024-09-26 17:44:51 +02:00
Alessandro Di Federico 835a00d80c Minor changes 2024-09-25 10:00:22 +02:00
Andrea Gussoni 5849deee50 Remove CycleEquivalenceInfo 2024-09-20 21:06:46 +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
Ivan Krysak b4a6682a3e OperatorPrecedence: introduce forced parentheses 2024-09-10 11:49:42 +03:00
Ivan Krysak 5666b063cc OperatorPrecedence: handle logical or and and 2024-09-10 11:49:42 +03:00
Ivan Krysak 17cc3e497f OperatorPrecedence: rework precedence encoding 2024-09-10 11:49:42 +03:00
Ivan Krysak d5c7365f4f OperatorPrecedence: switch to cppreference scale 2024-09-05 10:18:55 +03:00
Ivan Krysak a8b5ebdd95 import-from-c: rework testing from the ground up 2024-09-04 16:55:49 +02:00
Pietro Fezzardi 4d845c5cdb HeaderToModel: drop unused Logger 2024-09-04 16:55:49 +02:00
Pietro Fezzardi 4e2617f4c5 HeaderToModel: fix double parsing of enums 2024-09-04 16:55:48 +02:00
Ivan Krysak d36e50e0d1 HeaderToModel: switch to the new annotation system 2024-09-04 16:44:23 +02:00
Ivan Krysak 77c8e4b927 PTML: move annotation data to a new header 2024-09-04 16:43:57 +02:00
Ivan Krysak e67a08ce05 HeaderToModel: greatly improve reported errors 2024-09-04 16:43:40 +02:00
Ivan Krysak cc16b8f3c8 HeaderToModel: improve RFT argument handling 2024-09-04 16:43:23 +02:00
Ivan Krysak 60391c9ab6 HeaderToModel: forbid stack return values in RFTs 2024-09-04 16:43:07 +02:00
Ivan Krysak adb1551283 HeaderToModel: make type ID detection stricter 2024-09-04 16:42:50 +02:00
Ivan Krysak 73a723e9f4 HeaderToModel: rework error reporting 2024-09-04 16:42:29 +02:00
Ivan Krysak 748e4dd560 HeaderToModel: add code annotation support 2024-09-04 13:04:44 +03:00
Ivan Krysak cb82331a17 HeaderToModel: add struct size annotation support 2024-09-04 13:04:44 +03:00
Ivan Krysak e708f3f8fc HeaderToModel: add padding annotation support 2024-09-04 13:04:44 +03:00
Ivan Krysak ee22a5a558 HeaderToModel: clean up type replacement 2024-09-04 13:04:44 +03:00
Ivan Krysak 000d9f26aa HeaderToModel: revamp annotation parsing 2024-09-04 13:04:44 +03:00
Ivan Krysak b297bec1bb HeaderToModel: clean up global strings 2024-09-04 13:04:44 +03:00
Ivan Krysak 7b00b85647 PTMLCBuilder: introduce a code tag annotation 2024-09-04 13:04:44 +03:00
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
Ivan Krysak dc6f2456be Minor improvements 2024-09-04 13:04:44 +03: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 10d878e5ac Add verification of control statement nesting 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 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 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 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
Lauri Vasama f0d707be70 Fix Clift class type field parsing 2024-09-04 10:58:02 +02:00
Alessandro Di Federico 14734eb3f0 ComputeStackAccessesBounds: add logging 2024-08-23 18:02:10 +02:00
Alessandro Di Federico d28af50f84 DetectStackSize: handle counted loops 2024-08-23 18:01:47 +02:00
Alessandro Di Federico b69c5d2b99 ConvertToCABI: ignore DefaultPrototype 2024-08-16 16:33:39 +02:00
Alessandro Di Federico 5c9b6ed9b3 Rename DILogger into Log 2024-08-16 13:27:00 +02:00
Alessandro Di Federico 09e483f96b BinaryImporter: create a Function for EntryPoint 2024-08-16 13:01:59 +02:00
Alessandro Di Federico cba1d6fa51 PDBImporter: fix .pdb path lookup 2024-08-16 13:01:57 +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