Commit Graph

1779 Commits

Author SHA1 Message Date
Ivan Krysak 45ede5fd6b 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-14 18:55:59 +03:00
Ivan Krysak e5f98a0437 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-14 18:55:59 +03:00
Ivan Krysak 64b9101202 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-14 18:55:59 +03:00
Ivan Krysak 1b3ff006e1 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-14 18:55:59 +03:00
Ivan Krysak a63121bd9c 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-14 18:55:59 +03:00
Ivan Krysak e30dce4367 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-14 18:55:59 +03:00
Ivan Krysak 436bfdd697 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-14 18:55:59 +03:00
Ivan Krysak 2d77caa383 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-14 18:55:59 +03:00
Ivan Krysak ad33e581b5 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-14 18:55:59 +03:00
Ivan Krysak 20041374af 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-14 18:55:59 +03:00
Ivan Krysak 4a2898596f 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-14 18:55:59 +03:00
Ivan Krysak fc45885841 Outline sugiyama style layouter interface 2022-06-14 18:55:59 +03:00
Ivan Krysak a6a2b030db Implement node size calculation 2022-06-14 18:55:59 +03:00
Ivan Krysak da4bfb8644 Implement CFG extraction 2022-06-14 18:55:59 +03:00
Ivan Krysak 8136cb611b Make CFG verification use GenericGraph exporter 2022-06-14 18:55:59 +03:00
Ivan Krysak e7a523162a Implement GenericGraph-based CFG exporter 2022-06-14 18:55:59 +03:00
Ivan Krysak 4289c8aa74 Outline yield::Graph 2022-06-14 18:55:59 +03:00
Ivan Krysak d6b3d9f346 Outline yield::cfg::Configuration 2022-06-14 18:55:59 +03:00
Ivan Krysak b59d5c6cfe Move delay slot control down to basic block level 2022-06-14 18:55:59 +03:00
Ivan Krysak 8121eeec8c Use labeled block system instead of block strings 2022-06-14 18:55:59 +03:00
Ivan Krysak 3e62ec6d19 Implement labeled block detection 2022-06-14 18:55:59 +03:00
Ivan Krysak d515ad5c9f Move fallthrough detection to yield::cfg 2022-06-14 18:55:59 +03:00
Ivan Krysak 9af5429b72 Add a basic CFG pipeline 2022-06-14 18:55:59 +03:00
Ivan Krysak 7b4778302f Separate process-assembly from yield-assembly 2022-06-14 18:55:59 +03:00
Ivan Krysak 1eebad74cd Use TTG-based assembly to weaken dependency on efa 2022-06-14 18:55:59 +03:00
Ivan Krysak ed5d28502c Disable default instruction operand symbolization
It was causing issues on some architectures (like i386)
2022-06-14 18:55:59 +03:00
Ivan Krysak 4d09dcc351 Switch to TTG-based assembly description 2022-06-14 18:55:59 +03:00
Ivan Krysak d4585f8ee5 Use tuple tree generator for assembly description 2022-06-14 18:55:59 +03: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
Ivan Krysak 150fab6bbc Fix a minor pipeline::Target construction issue 2022-06-14 12:40:11 +03:00
Ivan Krysak 257bcb9b3c Make MetaAddress constexpr constructible 2022-06-14 12:40:11 +03:00
Ivan Krysak dffe311ad8 Add efa::FunctionEdgeType::needsFallthrough 2022-06-14 12:40:11 +03:00
Giacomo Vercesi 1cc8c2c20c Fix pyYAML type error
Remove code in revng.cli.model_dump and override_by_name that was used
when the model had tags. The code subclassed the default pyYAML loader
to ignore unknown tags to allow reading the model data easily. Since the
model no longer has tags this code is dead and can be removed.
2022-06-13 18:35:37 +02:00
Massimo Fioravanti 22bce466b1 revng-pipeline: support handles multiple branches
This commit introduces the possibility to have multiple pipeline
branches in a single YAML pipeline file.
2022-06-13 18:34:03 +02:00
Massimo Fioravanti f8ad4e634d Replace pipeline -load using LLVM -load mechanism
`revng -load` mechanism did not allow to specify arguments for loaded
libraries, the new LLVM mechanism allow to do so.
2022-06-13 18:30:08 +02:00
Alessandro Di Federico d37c3d3dd8 Fix revng --prefix
When running subcommands from a `revng` script the build directory and
the root directory were being swapped.
2022-05-31 11:30:10 +02:00
Alessandro Di Federico 6b63efa0a9 Merge branch 'feature/pipeline-analysis' 2022-05-25 09:14:53 +02:00
Giacomo Vercesi 2f0519c3c5 GraphQL: Introduce run_all_analyses 2022-05-24 10:56:04 +02:00
Giacomo Vercesi e5704ede11 Make Python API thread-safe and non-blocking
Since PipelineC is not thread-safe, add a lock to all function calls to
it to avoid any thread safety-related issues.

At the same time, use a thread pool to run "expensive" PipelineC
functions in GraphQL (specifically `produce_target` and `run_analysis`)
to avoid problems due to the cooperative nature of Python coroutines.
2022-05-24 10:56:04 +02:00
Alessandro Di Federico 071fe1c0e4 [FIXUP] Support analyses and global in Python 2022-05-24 10:56:04 +02:00
Giacomo Vercesi 7052f2a8a0 Support analyses and globals in Python
This commit adds the newly implemented functionality in PipelineC both
in revng.api and the graphql api, allowing:

* retrieval of global variable names
* unwrapping of a single target
* execution of analyses
2022-05-24 10:56:02 +02:00
Giacomo Vercesi 7c3d9a3fcd Python API: automatically call destructors
Use the owning annotation in PipelineC/Prototypes.h to automatically
destroy resources when they go out of scope on the python side.
2022-05-24 08:59:08 +02:00
Massimo Fioravanti 1508a1bc72 revng-pipeline: support out of line analyses 2022-05-24 08:59:08 +02:00
Massimo Fioravanti e38dfc74cc PipelineC: introduce run_all_analyses 2022-05-24 08:59:08 +02:00
Massimo Fioravanti f0a5ffe3b3 revng-pipeline: globals, extractOne and analyses 2022-05-24 08:58:48 +02:00
Massimo Fioravanti 2c48713af9 Make TupleTreeDiff compatible with regular vectors 2022-05-24 08:50:24 +02:00
Giacomo Vercesi 07c23dda8d revng-deamon: fix GraphQL URL
The page was using the wrong attribute to make the GraphQL calls
relative to the debug page's url.
2022-05-24 08:49:16 +02:00
Alessandro Di Federico 5b39595b77 Minor changes 2022-05-13 15:14:51 +02:00
Alessandro Di Federico e89870d125 Merge branch 'feature/asan-support' 2022-05-13 07:59:49 +02:00