14#ifndef LLVM_ANALYSIS_DEPENDENCEGRAPHBUILDER_H
15#define LLVM_ANALYSIS_DEPENDENCEGRAPHBUILDER_H
36 using NodeType =
typename GraphType::NodeType;
37 using EdgeType =
typename GraphType::EdgeType;
151 const NodeType &
B)
const = 0;
160 "No ordinal computed for this instruction.");
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the DenseMap class.
Generic implementation of equivalence classes through the use Tarjan's efficient union-find algorithm...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
This abstract builder class defines a set of high-level steps for creating DDG-like graphs.
void createAndConnectRootNode()
Create a root node and add edges such that each node in the graph is reachable from the root.
void computeInstructionOrdinals()
Compute ordinal numbers for each instruction and store them in a map for future look up.
virtual const NodeListType & getNodesInPiBlock(const NodeType &N)=0
Given a pi-block node, return a vector of all the nodes contained within it.
virtual void destroyEdge(EdgeType &E)
Deallocate memory of edge E.
virtual EdgeType & createMemoryEdge(NodeType &Src, NodeType &Tgt)=0
Create a memory dependence edge going from Src to Tgt.
virtual bool shouldCreatePiBlocks() const
Return true if creation of pi-blocks are supported and desired, and false otherwise.
virtual bool shouldSimplify() const
Return true if graph simplification step is requested, and false otherwise.
void sortNodesTopologically()
Topologically sort the graph nodes.
virtual NodeType & createFineGrainedNode(Instruction &I)=0
Create an atomic node in the graph given a single instruction.
virtual EdgeType & createRootedEdge(NodeType &Src, NodeType &Tgt)=0
Create a rooted edge going from Src to Tgt .
void createFineGrainedNodes()
Create fine grained nodes.
virtual NodeType & createPiBlock(const NodeListType &L)=0
Create a pi-block node in the graph representing a group of nodes in an SCC of the graph.
virtual NodeType & createRootNode()=0
Create the root node of the graph.
InstToOrdinalMap InstOrdinalMap
A mapping from each instruction to an ordinal number.
AbstractDependenceGraphBuilder(GraphType &G, DependenceInfo &D, const BasicBlockListType &BBs)
virtual EdgeType & createDefUseEdge(NodeType &Src, NodeType &Tgt)=0
Create a def-use edge going from Src to Tgt.
virtual ~AbstractDependenceGraphBuilder()=default
void createMemoryDependencyEdges()
Analyze data dependencies that exist between memory loads or stores, in the graph nodes and create ed...
virtual void mergeNodes(NodeType &A, NodeType &B)=0
Append the content of node B into node A and remove B and the edge between A and B from the graph.
DependenceInfo & DI
Dependence information used to create memory dependence edges in the graph.
void simplify()
Go through all the nodes in the graph and collapse any two nodes 'a' and 'b' if all of the following ...
void populate()
The main entry to the graph construction algorithm.
const BasicBlockListType & BBList
The list of basic blocks to consider when building the graph.
InstToNodeMap IMap
A mapping from instructions to the corresponding nodes in the graph.
virtual void destroyNode(NodeType &N)
Deallocate memory of node N.
size_t getOrdinal(Instruction &I)
Given an instruction I return its associated ordinal number.
void createDefUseEdges()
Analyze the def-use chains and create edges from the nodes containing definitions to the nodes contai...
size_t getOrdinal(NodeType &N)
Given a node N return its associated ordinal number.
NodeToOrdinalMap NodeOrdinalMap
A mapping from nodes to an ordinal number.
GraphType & Graph
Reference to the graph that gets built by a concrete implementation of this builder.
virtual bool areNodesMergeable(const NodeType &A, const NodeType &B) const =0
Return true if it's safe to merge the two nodes.
void createPiBlocks()
Apply graph abstraction to groups of nodes that belong to a strongly connected component of the graph...
bool contains(const_arg_type_t< KeyT > Val) const
Return true if the specified key is in the map, false otherwise.
DependenceInfo - This class is the main dependence-analysis driver.
EquivalenceClasses - This represents a collection of equivalence classes and supports three efficient...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
@ BasicBlock
Various leaf nodes.
This is an optimization pass for GlobalISel generic memory operations.