14#ifndef LLVM_ANALYSIS_DEPENDENCEGRAPHBUILDER_H
15#define LLVM_ANALYSIS_DEPENDENCEGRAPHBUILDER_H
37 using NodeType =
typename GraphType::NodeType;
38 using EdgeType =
typename GraphType::EdgeType;
75 void computeInstructionOrdinals();
79 void createFineGrainedNodes();
83 void createDefUseEdges();
87 void createMemoryDependencyEdges();
91 void createAndConnectRootNode();
98 void createPiBlocks();
110 void sortNodesTopologically();
152 const NodeType &
B)
const = 0;
161 "No ordinal computed for this instruction.");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file defines the DenseMap class.
Generic implementation of equivalence classes through the use Tarjan's efficient union-find algorithm...
This file defines the SmallVector class.
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.
DenseMap< Instruction *, NodeType * > InstToNodeMap
Map types to map instructions to nodes used when populating the graph.
void sortNodesTopologically()
Topologically sort the graph nodes.
SmallVectorImpl< BasicBlock * > BasicBlockListType
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.
DenseMap< NodeType *, size_t > NodeToOrdinalMap
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
EquivalenceClasses< BasicBlock * > ClassesType
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 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.
SmallVector< NodeType *, 4 > NodeListType
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.
DenseMap< Instruction *, size_t > InstToOrdinalMap
Map Types to map instruction/nodes to an ordinal number.
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...
LLVM Basic Block Representation.
DependenceInfo - This class is the main dependence-analysis driver.
EquivalenceClasses - This represents a collection of equivalence classes and supports three efficient...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.