|
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 () |
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_ |
| NodeIndex | externalMemoryNode_ |
| 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 44 of file PointsToGraph.hpp.
|
private |
Definition at line 109 of file PointsToGraph.hpp.
|
private |
Definition at line 102 of file PointsToGraph.hpp.
|
private |
Definition at line 110 of file PointsToGraph.hpp.
|
private |
Definition at line 112 of file PointsToGraph.hpp.
|
private |
Definition at line 103 of file PointsToGraph.hpp.
Definition at line 113 of file PointsToGraph.hpp.
|
private |
Definition at line 127 of file PointsToGraph.hpp.
|
private |
Definition at line 128 of file PointsToGraph.hpp.
|
private |
Definition at line 115 of file PointsToGraph.hpp.
|
private |
Definition at line 104 of file PointsToGraph.hpp.
|
private |
Definition at line 116 of file PointsToGraph.hpp.
|
private |
Definition at line 118 of file PointsToGraph.hpp.
|
private |
Definition at line 105 of file PointsToGraph.hpp.
|
private |
Definition at line 119 of file PointsToGraph.hpp.
|
private |
Definition at line 121 of file PointsToGraph.hpp.
|
private |
Definition at line 106 of file PointsToGraph.hpp.
|
private |
Definition at line 122 of file PointsToGraph.hpp.
| using jlm::llvm::aa::PointsToGraph::NodeIndex = uint32_t |
Definition at line 47 of file PointsToGraph.hpp.
|
private |
Definition at line 124 of file PointsToGraph.hpp.
|
private |
Definition at line 107 of file PointsToGraph.hpp.
|
private |
Definition at line 125 of file PointsToGraph.hpp.
|
strong |
| Enumerator | |
|---|---|
| RegisterNode | |
| AllocaNode | |
| DeltaNode | |
| ImportNode | |
| LambdaNode | |
| MallocNode | |
| ExternalNode | |
| COUNT | |
Definition at line 49 of file PointsToGraph.hpp.
|
private |
Definition at line 16 of file PointsToGraph.cpp.
|
delete |
|
delete |
|
private |
Definition at line 471 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 67 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 98 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 112 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 150 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 162 of file PointsToGraph.cpp.
| PointsToGraph::NodeIndex jlm::llvm::aa::PointsToGraph::addNodeForRegisters | ( | ) |
Creates a new PointsToGraph node of kind RegisterNode.
Definition at line 192 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 224 of file PointsToGraph.cpp.
|
noexcept |
Definition at line 25 of file PointsToGraph.cpp.
|
inlinestatic |
Definition at line 783 of file PointsToGraph.hpp.
|
noexcept |
Definition at line 31 of file PointsToGraph.cpp.
|
static |
Shorthand for dumping the given pointsToGraph as a string in the GraphViz dot format.
Definition at line 544 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 491 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 576 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 591 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 518 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 544 of file PointsToGraph.hpp.
|
noexcept |
Definition at line 55 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 606 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 621 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 636 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 266 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 349 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 361 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 373 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 385 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 397 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 409 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 420 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 281 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 292 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 303 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 314 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 326 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 337 of file PointsToGraph.hpp.
|
noexcept |
Definition at line 37 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 456 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 444 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 483 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 432 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 321 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 532 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 470 of file PointsToGraph.hpp.
|
noexcept |
Definition at line 43 of file PointsToGraph.cpp.
|
noexcept |
Definition at line 49 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 202 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 213 of file PointsToGraph.cpp.
|
inlinenoexcept |
Definition at line 193 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 202 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 243 of file PointsToGraph.cpp.
|
inlinenoexcept |
Definition at line 554 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 211 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 220 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 229 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 247 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 257 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 267 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 564 of file PointsToGraph.hpp.
|
inlinenoexcept |
Definition at line 238 of file PointsToGraph.hpp.
|
delete |
|
delete |
|
noexcept |
Definition at line 61 of file PointsToGraph.cpp.
|
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 497 of file PointsToGraph.hpp.
|
private |
Definition at line 805 of file PointsToGraph.hpp.
|
private |
Definition at line 806 of file PointsToGraph.hpp.
|
private |
Definition at line 821 of file PointsToGraph.hpp.
|
private |
Definition at line 812 of file PointsToGraph.hpp.
|
private |
Definition at line 807 of file PointsToGraph.hpp.
|
private |
Definition at line 808 of file PointsToGraph.hpp.
|
private |
Definition at line 809 of file PointsToGraph.hpp.
|
private |
Definition at line 798 of file PointsToGraph.hpp.
|
private |
Definition at line 800 of file PointsToGraph.hpp.
|
private |
Definition at line 802 of file PointsToGraph.hpp.
|
private |
Definition at line 823 of file PointsToGraph.hpp.
|
private |
Definition at line 816 of file PointsToGraph.hpp.
|
private |
Definition at line 819 of file PointsToGraph.hpp.