|
Jlm
|
#include <PointsToGraph.hpp>
Classes | |
| struct | NodeData |
Public Types | |
| enum class | NodeKind : uint8_t { RegisterNode = 0 , AllocaNode , DeltaNode , ImportNode , LambdaNode , MallocNode , ExternalNode , COUNT } |
| using | NodeIndex = uint32_t |
Static Public Member Functions | |
| static void | dumpGraph (util::graph::Writer &graphWriter, const PointsToGraph &pointsToGraph) |
| static std::string | dumpDot (const PointsToGraph &pointsToGraph) |
| static std::unique_ptr< PointsToGraph > | create () |
Static Public Attributes | |
| static constexpr NodeIndex | externalMemoryNode = 0 |
Private Member Functions | |
| PointsToGraph () | |
| NodeIndex | addNode (NodeKind kind, bool externallyAvailable, bool isConstant, std::optional< size_t > memorySize, const void *object) |
Private Attributes | |
| std::vector< NodeData > | nodeData_ |
| std::vector< util::HashSet< NodeIndex > > | nodeExplicitTargets_ |
| std::vector< const void * > | nodeObjects_ |
| AllocaNodeMap | allocaMap_ |
| DeltaNodeMap | deltaMap_ |
| ImportNodeMap | importMap_ |
| LambdaNodeMap | lambdaMap_ |
| MallocNodeMap | mallocMap_ |
| RegisterNodeMap | registerMap_ |
| std::vector< NodeIndex > | registerNodes_ |
| std::vector< NodeIndex > | externallyAvailableNodes_ |
| size_t | numNodesTargetingAllExternallyAvailable_ = 0 |
The PointsToGraph is a graph where nodes represent virtual registers or locations in memory. An edge, e.g., X -> Y, represents the possibility of node X containing a pointer to memory represented by node Y.
An edge X -> Y can be represented in two ways:
Definition at line 46 of file PointsToGraph.hpp.
|
private |
Definition at line 114 of file PointsToGraph.hpp.
|
private |
Definition at line 107 of file PointsToGraph.hpp.
|
private |
Definition at line 115 of file PointsToGraph.hpp.
|
private |
Definition at line 117 of file PointsToGraph.hpp.
|
private |
Definition at line 108 of file PointsToGraph.hpp.
Definition at line 118 of file PointsToGraph.hpp.
|
private |
Definition at line 132 of file PointsToGraph.hpp.
|
private |
Definition at line 133 of file PointsToGraph.hpp.
|
private |
Definition at line 120 of file PointsToGraph.hpp.
|
private |
Definition at line 109 of file PointsToGraph.hpp.
|
private |
Definition at line 121 of file PointsToGraph.hpp.
|
private |
Definition at line 123 of file PointsToGraph.hpp.
|
private |
Definition at line 110 of file PointsToGraph.hpp.
|
private |
Definition at line 124 of file PointsToGraph.hpp.
|
private |
Definition at line 126 of file PointsToGraph.hpp.
|
private |
Definition at line 111 of file PointsToGraph.hpp.
|
private |
Definition at line 127 of file PointsToGraph.hpp.
| using jlm::llvm::aa::PointsToGraph::NodeIndex = uint32_t |
Definition at line 49 of file PointsToGraph.hpp.
|
private |
Definition at line 129 of file PointsToGraph.hpp.
|
private |
Definition at line 112 of file PointsToGraph.hpp.
|
private |
Definition at line 130 of file PointsToGraph.hpp.
|
strong |
| Enumerator | |
|---|---|
| RegisterNode | |
| AllocaNode | |
| DeltaNode | |
| ImportNode | |
| LambdaNode | |
| MallocNode | |
| ExternalNode | |
| COUNT | |
Definition at line 54 of file PointsToGraph.hpp.
|
private |
Definition at line 17 of file PointsToGraph.cpp.
|
delete |
|
delete |
|
private |
Definition at line 474 of file PointsToGraph.cpp.
| PointsToGraph::NodeIndex jlm::llvm::aa::PointsToGraph::addNodeForAlloca | ( | const rvsdg::SimpleNode & | allocaNode, |
| bool | externallyAvailable | ||
| ) |
Creates a new PointsToGraph node mapped to the given allocaNode, which must have the llvm::AllocaOperation.
| allocaNode | the alloca node. Must not already be mapped to any other node. |
| externallyAvailable | if the created node should be flagged as externally available. |
Definition at line 70 of file PointsToGraph.cpp.
| PointsToGraph::NodeIndex jlm::llvm::aa::PointsToGraph::addNodeForDelta | ( | const rvsdg::DeltaNode & | deltaNode, |
| bool | externallyAvailable | ||
| ) |
Creates a new PointsToGraph node of DeltaNode kind, mapped to the given deltaNode.
| deltaNode | the node. |
| externallyAvailable | if the created node should be flagged as externally available. |
Definition at line 101 of file PointsToGraph.cpp.
| PointsToGraph::NodeIndex jlm::llvm::aa::PointsToGraph::addNodeForImport | ( | const rvsdg::GraphImport & | argument, |
| bool | externallyAvailable | ||
| ) |
Creates a new PointsToGraph node of ImportNode kind, mapped to the given argument.
| argument | the graph import argument. Must not already be mapped to any other node. |
| externallyAvailable | if the created node should be flagged as externally available. |
Definition at line 115 of file PointsToGraph.cpp.
| PointsToGraph::NodeIndex jlm::llvm::aa::PointsToGraph::addNodeForLambda | ( | const rvsdg::LambdaNode & | lambdaNode, |
| bool | externallyAvailable | ||
| ) |
Creates a new PointsToGraph node of LambdaNode kind, mapped to the given lambdaNode.
| lambdaNode | the lambda node. Must not already be mapped to any other node. |
| externallyAvailable | if the created node should be flagged as externally available. |
Definition at line 153 of file PointsToGraph.cpp.
| PointsToGraph::NodeIndex jlm::llvm::aa::PointsToGraph::addNodeForMalloc | ( | const rvsdg::SimpleNode & | mallocNode, |
| bool | externallyAvailable | ||
| ) |
Creates a new PointsToGraph node mapped to the given mallocNode, which must have the llvm::MallocOperation.
| mallocNode | the malloc node. Must not already be mapped to any other node. |
| externallyAvailable | if the created node should be flagged as externally available. |
Definition at line 165 of file PointsToGraph.cpp.
| PointsToGraph::NodeIndex jlm::llvm::aa::PointsToGraph::addNodeForRegisters | ( | ) |
Creates a new PointsToGraph node of kind RegisterNode.
Definition at line 195 of file PointsToGraph.cpp.
Adds the given target to source's set of targets. If source is marked as targeting all externally available nodes, and the target is marked as externally available, this is a no-op.
Neither the target nor the source can be the external node. That node can only be a target / targeted via flags.
| source | the source node. Can not be the external node. |
| target | the target node. Must be a memory node, and not the external node. |
Definition at line 227 of file PointsToGraph.cpp.
|
noexcept |
Definition at line 28 of file PointsToGraph.cpp.
|
inlinestatic |
Definition at line 802 of file PointsToGraph.hpp.
|
noexcept |
Definition at line 34 of file PointsToGraph.cpp.
|
static |
Shorthand for dumping the given pointsToGraph as a string in the GraphViz dot format.
Definition at line 547 of file PointsToGraph.cpp.
|
static |
Writes the given pointsToGraph to the given graphWriter. Each node is associated with the rvsdg object(s) it represents through attribute(s).
Definition at line 494 of file PointsToGraph.cpp.
|
inline |
Gets the rvsdg::SimpleNode mapped to the PointsToGraph node with the given index.
| index | the PointsToGraph node. |
| std::logic_error | if the given node is not of the AllocaNode kind. |
Definition at line 595 of file PointsToGraph.hpp.
|
inline |
Gets the rvsdg::DeltaNode mapped to the PointsToGraph node with the given index.
| index | the PointsToGraph node. |
| std::logic_error | if the given node is not of the DeltaNode kind. |
Definition at line 610 of file PointsToGraph.hpp.
|
inline |
Gets the set of memory nodes that are targeted explicitly by the node with the given index. When a node X explicitly targets a node Y, it means that the value(s) represented by X may contain a pointer to memory represented by Y. Node Y must be a memory node. Explicit targets is one way of representing pointer-pointee relations, the other being implicit targets using flags.
| index | the index of the PointsToGraph node X. |
Definition at line 537 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 563 of file PointsToGraph.hpp.
|
noexcept |
Definition at line 58 of file PointsToGraph.cpp.
|
inline |
Gets the rvsdg::GraphImport mapped to the PointsToGraph node with the given index.
| index | the PointsToGraph node. |
| std::logic_error | if the given node is not of the ImportNode kind. |
Definition at line 625 of file PointsToGraph.hpp.
|
inline |
Gets the rvsdg::LambdaNode mapped to the PointsToGraph node with the given index.
| index | the PointsToGraph node. |
| std::logic_error | if the given node is not of the LambdaNode kind. |
Definition at line 640 of file PointsToGraph.hpp.
|
inline |
Gets the rvsdg::SimpleNode mapped to the PointsToGraph node with the given index.
| index | the PointsToGraph node. |
| std::logic_error | if the given node is not of the MallocNode kind. |
Definition at line 655 of file PointsToGraph.hpp.
| std::string jlm::llvm::aa::PointsToGraph::getNodeDebugString | ( | NodeIndex | index, |
| char | separator = ' ' |
||
| ) | const |
Produces a debug string for the given node, containing the index, flags, size, constness and info about the underlying object. Does not include explicit targets.
| index | the index of the node to create a debug string for |
| separator | the char to put between parts of the debug string |
Definition at line 269 of file PointsToGraph.cpp.
|
inline |
Retrieves the index of the PointsToGraph node mapped to the given rvsdg::SimpleNode.
| node | the node being looked up, which must contain an AllocaOperation. |
node, always of AllocaNode kind. | std::out_of_range | if the alloca node is not mapped to a PointsToGraph node. |
Definition at line 354 of file PointsToGraph.hpp.
|
inline |
Retrieves the index of the PointsToGraph node mapped to the given rvsdg::DeltaNode.
| node | the delta node being looked up. |
node, always of DeltaNode kind. | std::out_of_range | if the delta node is not mapped to a PointsToGraph node. |
Definition at line 366 of file PointsToGraph.hpp.
|
inline |
Retrieves the index of the PointsToGraph node mapped to the given rvsdg::GraphImport.
| argument | the import being looked up. |
argument, always of ImportNode kind. | std::out_of_range | if the argument is not mapped to a PointsToGraph node. |
Definition at line 378 of file PointsToGraph.hpp.
|
inline |
Retrieves the index of the PointsToGraph node mapped to the given rvsdg::LambdaNode.
| node | the lambda node being looked up. |
node, always of LambdaNode kind. | std::out_of_range | if the lambda node is not mapped to a PointsToGraph node. |
Definition at line 390 of file PointsToGraph.hpp.
|
inline |
Retrieves the index of the PointsToGraph node mapped to the given rvsdg::SimpleNode.
| node | the node being looked up, which must contain a MallocOperation. |
node, always of MallocNode kind. | std::out_of_range | if the malloc node is not mapped to a PointsToGraph node. |
Definition at line 402 of file PointsToGraph.hpp.
|
inline |
Retrieves the index of the PointsToGraph node mapped to the given output.
| output | the RVSDG output being looked up. |
output, always of RegisterNode kind. | std::out_of_range | if the output is not mapped to a PointsToGraph node. |
Definition at line 414 of file PointsToGraph.hpp.
Gets the NodeKind of the node with the given index.
| index | the index of the node in question. |
Definition at line 439 of file PointsToGraph.hpp.
|
inline |
Checks whether a PointsToGraph AllocaNode has been created for the given RVSDG SimpleNode. The SimpleNode must correspond to an AllocaOperation.
| node | the RVSDG node to look up. |
Definition at line 286 of file PointsToGraph.hpp.
|
inline |
Checks whether a PointsToGraph DeltaNode is mapped to the given rvsdg::DeltaNode.
| node | the RVSDG delta node to look up. |
Definition at line 297 of file PointsToGraph.hpp.
|
inline |
Checks whether a PointsToGraph ImportNode is mapped to the given rvsdg::GraphImport.
| argument | the RVSDG import to look up. |
Definition at line 308 of file PointsToGraph.hpp.
|
inline |
Checks whether a PointsToGraph LambdaNode is mapped to the given rvsdg::LambdaNode.
| node | the RVSDG lambda node to look up. |
Definition at line 319 of file PointsToGraph.hpp.
|
inline |
Checks whether a PointsToGraph MallocNode is mapped to the given rvsdg::SimpleNode. The simple node must correspond to a MallocOperation.
| node | the RVSDG node to look up. |
Definition at line 331 of file PointsToGraph.hpp.
|
inline |
Checks whether a PointsToGraph RegisterNode has been created for the given rvsdg::Output.
| output | the RVSDG output to look up. |
Definition at line 342 of file PointsToGraph.hpp.
|
noexcept |
Definition at line 40 of file PointsToGraph.cpp.
|
inline |
Checks the the PointsToGraph node with the given index is flagged as externally available. Only memory nodes can have this flag.
| index | the index of the PointsToGraph node. |
Definition at line 475 of file PointsToGraph.hpp.
|
inline |
Checks if the PointsToGraph node with the given index is a memory node. This means all nodes that are not of the RegisterNode kind.
| index | the index of the node in question. |
Definition at line 463 of file PointsToGraph.hpp.
|
inlinenoexcept |
Checks if the memory represented by the given node is representing constant memory. Constant memory means the value stored in the memory never changes during execution.
| index | the index of the PointsToGraph node |
Definition at line 502 of file PointsToGraph.hpp.
|
inline |
Checks if the PointsToGraph node with the given index is of the RegisterNode kind.
| index | the index of the node in question. |
Definition at line 451 of file PointsToGraph.hpp.
| bool jlm::llvm::aa::PointsToGraph::isSupergraphOf | ( | const PointsToGraph & | subgraph | ) | const |
Checks if this PointsToGraph is a supergraph of subgraph. Every node in the subgraph needs to have corresponding nodes in the supergraph. Any flags present in the subgraph must also be present in the supergraph. All pointer-pointee relations in the subgraph must be represented in the supergraph, either as explicit or implicit targets.
| subgraph | the graph to compare against |
Definition at line 324 of file PointsToGraph.cpp.
Checks if the node with index source targets the node with index target, either explicitly or implicitly.
| source | the pointing node. |
| target | the node that is possibly a pointee. |
source targets target, otherwise false. Definition at line 551 of file PointsToGraph.hpp.
|
inline |
Checks if the PointsToGraph node with the given index is flagged as targeting all externally available memory. If it is, it implicitly targets every PointsToGraph node flagged as externally available.
| index | the index of the PointsToGraph node. |
Definition at line 489 of file PointsToGraph.hpp.
|
noexcept |
Definition at line 46 of file PointsToGraph.cpp.
|
noexcept |
Definition at line 52 of file PointsToGraph.cpp.
| void jlm::llvm::aa::PointsToGraph::mapRegisterToNode | ( | const rvsdg::Output & | output, |
| NodeIndex | nodeIndex | ||
| ) |
Maps the given output to the PointsToGraph node with the given nodeIndex. The PointsToGraph node must be of the RegisterNode kind.
| output | the RVSDG output that is mapped |
| nodeIndex | the index of the PointsToGraph node it is mapped to |
Definition at line 205 of file PointsToGraph.cpp.
| void jlm::llvm::aa::PointsToGraph::markAsTargetsAllExternallyAvailable | ( | NodeIndex | index | ) |
Marks the given node as targeting every node that is externally available. Note that this method will not go over other targets and remove doubled up pointees.
| index | the index of the PointsToGraph node that should be marked |
Definition at line 216 of file PointsToGraph.cpp.
|
inlinenoexcept |
Definition at line 198 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 207 of file PointsToGraph.hpp.
|
noexcept |
Gets the total number of edges in the PointsToGraph.
This can be counted in two different ways:
In both cases, register nodes are only counted once, even if multiple registers map to them.
Definition at line 246 of file PointsToGraph.cpp.
|
inlinenoexcept |
Definition at line 573 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 216 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 225 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 234 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 252 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 262 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 272 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 583 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 243 of file PointsToGraph.hpp.
|
delete |
|
delete |
|
noexcept |
Definition at line 64 of file PointsToGraph.cpp.
|
inlinenoexcept |
Retrieves the index of the PointsToGraph node mapped to the given output, if such a node exists. Otherwise nullopt is returned.
Definition at line 425 of file PointsToGraph.hpp.
|
inlinenoexcept |
Gets the size of the memory location represented by the node with the given index. The node can also represent many locations, as long as they all have the same size. If the memory locations have varying or unknown size, nullopt is returned.
| index | the index of the PointsToGraph node |
Definition at line 516 of file PointsToGraph.hpp.
|
private |
Definition at line 824 of file PointsToGraph.hpp.
|
private |
Definition at line 825 of file PointsToGraph.hpp.
|
private |
Definition at line 837 of file PointsToGraph.hpp.
|
staticconstexpr |
Definition at line 52 of file PointsToGraph.hpp.
|
private |
Definition at line 826 of file PointsToGraph.hpp.
|
private |
Definition at line 827 of file PointsToGraph.hpp.
|
private |
Definition at line 828 of file PointsToGraph.hpp.
|
private |
Definition at line 817 of file PointsToGraph.hpp.
|
private |
Definition at line 819 of file PointsToGraph.hpp.
|
private |
Definition at line 821 of file PointsToGraph.hpp.
|
private |
Definition at line 839 of file PointsToGraph.hpp.
|
private |
Definition at line 832 of file PointsToGraph.hpp.
|
private |
Definition at line 835 of file PointsToGraph.hpp.