Commit Graph

13 Commits

Author SHA1 Message Date
Andrea Gussoni e2090b8746 GraphAlgorithms: nodesBetween double DFS
We now implement the `nodesBetween` primitive with a double DFS visit.
Specifically, we have:
1) A forward DFS that starts from the `Source`, and stops at `Target`.
2) A backward DFS that starts from the `Target`, and stops at `Source`.
The final result is then the intersection of the nodes found by the two
above DFS visits.

A new `findReachableNodes` primitive is also added to perform a DFS from
a `Source` node, which stops at the `Stop` parameter node, if present.

Added unit tests to improve the coverage.
2023-10-09 10:33:48 +02:00
Andrea Gussoni c8871fc508 GraphAlgorithms: drop old nodesBetween
We now switch to the `llvm::df_iterator` based `nodesBetween`
implementation.

This new implementation makes use of the idiomatic way of extending the
DFS implementation provided by LLVM, instead of rolling our custom
implementation for the `nodesBetween` algorithm.
2023-07-07 15:02:08 +02:00
Andrea Gussoni 1a0c429ef9 GraphAlgorithms: introduce extended DFS algorithms
We improve the `getBackedges` and `nodesBetween` helper functions that
can be used for backedge discovery and computation of all the nodes
reachable on all the paths defined between two nodes in a graph.

We build upon the `llvm::df_iterator` function, by customizing the visit
stack to perform the desired visits.
2023-07-07 15:02:08 +02:00
Andrea Gussoni a613b873e8 GraphAlgorithms: introduce isDAG verifier helper 2023-07-07 13:33:30 +02:00
Ivan Krysak 9f1d9fd5d0 Use Container::contains() where appropriate 2023-07-02 15:06:11 +00:00
Ivan Krysak a123ec2c35 Remove clang-format off around concepts
Now that clang-format no longer breaks anything involving a concept or
a requires clause on sight, these are no longer necessary
2023-07-02 13:20:49 +02:00
Ivan Krysak bc98e0079f Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-02 13:20:49 +02:00
Andrea Gussoni 7a92d70b8c Introduce llvm::dfs usage for graph algorithms
Implement a couple of restructure algorithms in a template manner, so
that they can be used with any data structure implementing
`GraphTraits`.

Test the algorithms using the `GenericGraph` data structure.
2023-04-27 17:28:22 +02:00
Pietro Fezzardi c7105cda4d GraphAlgorithms: generic entry point detection 2022-09-26 10:33:43 +02:00
Alessandro Di Federico 84a4aef1ee nodesBetween: introduce ignore list 2021-04-22 18:05:39 +02:00
Pietro Fezzardi 9869f057b9 Use #pragma once for header include guards 2020-11-13 14:12:18 +01:00
Pietro Fezzardi cd9bc34d9d Enforce new include conventions 2020-11-13 10:00:24 +01:00
Alessandro Di Federico a9de053243 Introduce GraphAlgorithms
A series of algorithms working on `llvm::GraphTraits`.

* `nodesBetween` computes the set of nodes on all the paths from a node
  A to B.
* Factor out code to iterate over infinite loops into
  `exitless_scc_range`.
* Introduce unit tests.
2019-05-22 18:42:32 +02:00