Commit Graph

88 Commits

Author SHA1 Message Date
Alessandro Di Federico 1d91ed9beb tuple_tree_generator: make C++ just a regular backend
The `tuple_tree_generator` component was still heavily treating C++ as a
special citizen.
This commit normalizes the situation.
2022-08-11 16:20:42 +02:00
Massimo Fioravanti 96bd5835d8 revng-pipeline: rework file-to-container syntax 2022-08-10 09:49:24 +02:00
Ivan Krysak b3f9ce7cc2 Use locations in PTML exporter 2022-08-05 21:47:05 +03:00
Ivan Krysak dff7c5f37d Move yield pipes into revngYield 2022-08-05 21:46:28 +03:00
Ivan Krysak 8f4590bf00 Outline the cross-relation interface 2022-08-05 21:42:58 +03:00
Ivan Krysak 65d1a016d4 Standardize concept naming across the codebase 2022-08-05 17:27:56 +03:00
Ivan Krysak 8dce9ef724 Fix the problem with negative node ranks
Having the initial rank threshhold too low caused them to sometimes
loop around and become negative, causing problems later down the line.

This sets the rank of the "entry" node to 4 offsetting the possible
causes of this issue quite a bit.
2022-08-05 17:27:56 +03:00
Ivan Krysak 240f334d78 Fix minor wording issues 2022-08-05 17:27:56 +03:00
Ivan Krysak 4ffadb2144 Fix an iteration invalidation caused issue 2022-08-05 17:27:56 +03:00
Giacomo Vercesi 3e9058393e Rework YieldAssemblyHTML to output PTML 2022-07-28 08:47:34 +02: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 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 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 cf3845b78d Add a way to output assembly as plain text 2022-05-06 18:51:47 +02:00
Ivan Krysak 1adc74e660 Import an assembly to html converter from caliban 2022-05-06 18:51:47 +02:00
Ivan Krysak 6e81dbe06c Add a disassembly helper 2022-05-06 18:51:47 +02:00
Ivan Krysak 36c63c1bb9 Implement the disassembler interface 2022-05-06 18:51:47 +02:00