Commit Graph

6113 Commits

Author SHA1 Message Date
Alessandro Di Federico 7c44328a49 Introduce YAML license notice 2022-06-21 18:19:06 +02:00
Pietro Fezzardi 12efa99680 Merge branch origin/feature/new-test-suite 2022-06-21 15:24:11 +02:00
Alessandro Di Federico 4688e520f6 Merge branch 'feature/new-test-suite' 2022-06-21 15:16:57 +02:00
Alessandro Di Federico 6d3a35cf22 EFA: ignore dynamic functions, if static too 2022-06-21 14:17:57 +02:00
Alessandro Di Federico 9ce2828659 Simplify CMake 2022-06-21 10:35:45 +02:00
Alessandro Di Federico da8cc78d17 Switch to new test suite 2022-06-21 10:35:45 +02:00
Alessandro Di Federico f4684e244d Switch to new testsuite 2022-06-20 19:04:18 +02:00
Massimo Fioravanti 55fb87b268 PipelineC: introduce dead kinds
We need to prevent stub kinds used just to represent dead elements to be
displayed in the GUI and CL.
We do so by introducing a DeadKind which expands their targets to the
empty list.
2022-06-20 19:03:17 +02:00
Alessandro Di Federico 7311b7e2da Merge branch 'feature/yield-cfg-pipeline' 2022-06-17 08:37:36 +02:00
Ivan Krysak ac74ae2fff Add the cfg generation test 2022-06-15 16:04:44 +03:00
Ivan Krysak 71115c8062 Implement SVG control flow exporter 2022-06-15 16:04:44 +03:00
Ivan Krysak eb129428a9 Import edge routing from caliban
(the following is the original commit message)

The last step is pretty simple. All that's left to do is to take the
ordered edge container and to `append` their points to their `Path`
2022-06-15 16:04:44 +03:00
Ivan Krysak 5ff8a00b2e Import edge ordering from caliban
(the following is the original commit message)

Now that the problematic edges are dealt with, all the normal edges
need to also get routed, but first, it's a good idea to order them.
As such, the DAG is consumed to produce the list of all the edges in
the optimal order for them to get routed.
2022-06-15 16:04:44 +03:00
Ivan Krysak 479d0287c7 Import corner routing from caliban
(the following is the original commit message)

Now that every single node has gotten its exact position, the only
thing left to do is to route all the edges between them. First of
all, the special edges (like corners) need to be handled.
2022-06-15 16:04:44 +03:00
Ivan Krysak b69121bc0a Import vertical coordinate position from caliban
(the following is the original commit message)

Now, that it's precisely known how much space is needed between each
pair of the layers, it's possible to set the vertical coordinates for
each of the nodes based on the layer heights (the height of the
longest node within said layer) and the number of horizontal lanes
required after it.
2022-06-15 16:04:44 +03:00
Ivan Krysak acf5858099 Import edge lane selection from caliban
(the following is the original commit message)

Now that the nodes are placed into the grid (at least horizontally),
it's possible to focus on the edges. Since, the information about
the number of edges going from/to each of the layers is known, it's
possible to determine the number of horizontal space needed to placed
those.

In this part of the layouter, the focus is on three different laning
points:
- horizontal lanes between layers.
- entry lanes for each of the nodes.
- exit lanes for each of the nodes.

Indexation is done independently for each of the lane types.
2022-06-15 16:04:44 +03:00
Ivan Krysak 057ac648c3 Import horizontal coordinate position from caliban
(the following is the original commit message)

Since the predetermined order of the nodes for each layer was already
predetermined, what's left is to put their coordinates based on the
size of the nodes and the predefined margins between them.

Except the resulting layouts are extremely left-heavy. As such, it's
important to use the coordinate selection part to push as many nodes
to the right as possible to balance the graph out at least somewhat.
2022-06-15 16:04:44 +03:00
Ivan Krysak 98b098cbce Import graph layout finalization from caliban
(the following is the original commit message)

Since from this point on, no breaking changes will be done to the graph
It's possible to finalize the layout. Meaning that from this point
onwards the logical positions of the nodes remain unchanged.

Having this guarantee we can proceed to calculating their real
positions, starting from the horizontal coordinates.
2022-06-15 16:04:44 +03:00
Ivan Krysak eee95028d0 Import linear segment selection from caliban
(the following is the original commit message)

Now that the layer permutation is finalized, it's possible to select
a couple of node-groups that only depend on a single predecessor and
consider them a single linear segment. This allows to "draw" straight
vertical lines accross the layout for nodes that could benefit from
that.

Such linear segments are also paramount for good looking long edges
(both forwards and backwards facing).

\note: this part of the layouter could still use more work.
If you're looking to rework it, this is the spot.
2022-06-15 16:04:44 +03:00
Ivan Krysak 054f9a2b25 Import topological ordering from caliban
(the following is the original commit message)

To optimize the algorithms coming from now, having a topological
of the nodes of the graph is benefitial. And, considering, no new
nodes will be added to the graph from this point on, we can only
compute it once.

To optimize the ordering even further, augmented graph is used.
On top of the original (and earlier added artifical) edges, the graph
used for obtaining the ordering get a few extra edges added.

`llvm::ReversePostOrderTraversal` is used to convert the graph to the
ordered node list.
2022-06-15 16:04:44 +03:00
Ivan Krysak 678e203164 Import permutation selection from caliban
(the following is the original commit message)

To ensure the optimal layout is choosen, it's important to try out
and compare a few different permutations.

First of all, layers are optimized. Those layers, that only contain
irrelevant artificial nodes are removed and all the others are shifted
in order to maintain simple layer indexing.

Then, using a simple hill climbing the permutation with the lowest
number of edge crossings is selected. After which a technique based
on computing barycenters for nodes and layers is used as a fallback
to ensure even the least optimal layout is still usable.

On top of all that, simple clustering based on the classification
obtained while preparing the graph is used to keep original nodes
somewhat separate from the artificial ones.
2022-06-15 16:04:44 +03:00
Ivan Krysak c45f4d5e73 Import graph preparation from caliban
(the following is the original commit message)

Preparation includes:
- ensuring there are no loops.
- ensuring there are no edges spanning more than a single layer.
- ensuring there are no backwards facing edges that were not split
  into a bunch of parts to simplify laying them out.
- ensuring there are no self loops (they are treated similarly to
  backwards facing edges, which they theoretically are).

Subproducts include:
- `Classifier` allowing to cheaply determine whether a given node is
  adjacent to an artificial edge.
- `Ranks` container allowing to easily determine the layer each of the
  nodes belongs to.
2022-06-15 16:04:44 +03:00
Ivan Krysak 7e538776d4 Outline sugiyama style layouter interface 2022-06-15 16:04:44 +03:00
Ivan Krysak 7591788620 Implement node size calculation 2022-06-15 16:04:44 +03:00
Ivan Krysak 840a34c0a4 Implement CFG extraction 2022-06-15 16:04:44 +03:00
Ivan Krysak 71f2ea6b22 Outline yield::Graph 2022-06-15 16:04:44 +03:00
Ivan Krysak d3afdc47bb Outline yield::cfg::Configuration 2022-06-15 16:04:43 +03:00
Ivan Krysak 5b49873523 Move delay slot control down to basic block level 2022-06-15 16:04:43 +03:00
Ivan Krysak 33c8ce96bd Use labeled block system instead of block strings 2022-06-15 16:04:43 +03:00
Ivan Krysak b19663e439 Implement labeled block detection 2022-06-15 16:03:45 +03:00
Ivan Krysak de9861815a Move fallthrough detection to yield::cfg 2022-06-15 16:02:44 +03:00
Ivan Krysak 80e9243e06 Add a basic CFG pipeline 2022-06-15 15:52:26 +03:00
Ivan Krysak f536ba46f0 Separate process-assembly from yield-assembly 2022-06-15 15:52:25 +03:00
Ivan Krysak 832a8d0baa Use TTG-based assembly to weaken dependency on efa 2022-06-15 15:52:23 +03:00
Ivan Krysak 74764f9729 Switch to TTG-based assembly description 2022-06-15 15:52:00 +03:00
Ivan Krysak f26ee02029 Use tuple tree generator for assembly description 2022-06-15 15:51:23 +03:00
Ivan Krysak 569d677157 Disable default instruction operand symbolization
It was causing issues on some architectures (like i386)
2022-06-15 15:51:23 +03:00
Ivan Krysak 7063bb528c Make CFG verification use GenericGraph exporter 2022-06-15 15:51:22 +03:00
Ivan Krysak 49d0c316a0 Implement GenericGraph-based CFG exporter 2022-06-15 15:51:18 +03:00
Pietro Fezzardi 2bf486779b Merge branch feature/op-precedence 2022-06-15 10:46:41 +02:00
Antonio Frighetto 97e79783ae Backend: handle Parentheses and ModelCast markers
`DecompileFunction` now handles the opaque `parentheses` and
`ModelCast` markers as part of beautifying the decompiled code
with proper parenthesized expressions. Should OPRP not be enabled,
we fallback to the case in which parentheses are always emitted.
2022-06-15 10:28:50 +02:00
Antonio Frighetto cd65fd1554 Introduce OperatorPrecedenceResolutionPass
A simple pass that maps LLVM IR instructions to C operators,
taking into account their precedence and associativity to
emit nice-looking parenthesized expressions.
2022-06-15 10:28:50 +02:00
Antonio Frighetto 4a045cce53 Introduce MakeModelCastPass
A pass that strips the casts off from some instructions, including
`ModelGEP`s, general function calls, return and store ones, and
embeds the cast into new dedicated `ModelCast` function calls.
2022-06-15 10:28:50 +02:00
Ivan Krysak 04efcb8ed8 Drop the revng yield .* tools 2022-06-14 18:55:59 +03:00
Ivan Krysak bc775a91b4 Improve the String wrapper 2022-06-14 18:55:59 +03:00
Pietro Fezzardi 0194bee681 Merge branch feature/dla-push-padding-to-parent 2022-06-14 15:29:16 +02:00
Pietro Fezzardi 8b812680ea DLACollapsSingleChild: push padding to parent 2022-06-14 12:51:48 +02:00
Pietro Fezzardi af760942e7 DLATypeSystem: add API to move edge target 2022-06-14 12:51:48 +02:00
Pietro Fezzardi 89734f6208 DLA: add pointer placeholders to model types
This commit adds placeholder pointer nodes to the DLA graph during
initialization, to point to nodes that represent model types whose size
should not altered during the Middleend.
2022-06-14 12:51:48 +02:00
Pietro Fezzardi ad81bc7020 Enable addtional compilation warnings
These warnings are not enabled by default with -Wall nor with -Wextra.
2022-06-14 12:48:54 +02:00