13#ifndef LLVM_ANALYSIS_DDG_H 
   14#define LLVM_ANALYSIS_DDG_H 
   66    DGNode::operator=(std::move(
N));
 
 
 
  119    InstList = std::move(
N.InstList);
 
 
  125    assert(!InstList.empty() && 
"Instruction List is empty.");
 
 
  130        static_cast<const SimpleDDGNode *
>(
this)->getInstructions());
 
 
  147    setKind((InstList.size() == 0 && 
Input.size() == 1)
 
  148                ? NodeKind::SingleInstruction
 
  149                : NodeKind::MultiInstruction);
 
  152  void appendInstructions(
const SimpleDDGNode &
Input) {
 
  153    appendInstructions(
Input.getInstructions());
 
  157  SmallVector<Instruction *, 2> InstList;
 
 
  181    NodeList = std::move(
N.NodeList);
 
 
  187    assert(!NodeList.empty() && 
"Node list is empty.");
 
 
 
  269    assert(
Root && 
"Root node is not available yet. Graph construction may " 
  270                   "still be in progress\n");
 
 
  284                                  const NodeType &Dst) 
const;
 
 
  327  bool addNode(NodeType &
N);
 
  334  PiBlockMapType PiBlockMap;
 
 
  351    assert(RN && 
"Failed to allocate memory for DDG root node.");
 
 
  357    assert(SN && 
"Failed to allocate memory for simple DDG node.");
 
 
  363    assert(Pi && 
"Failed to allocate memory for pi-block node.");
 
 
  369    assert(
E && 
"Failed to allocate memory for edge");
 
  370    Graph.connect(Src, Tgt, *
E);
 
 
  375    assert(
E && 
"Failed to allocate memory for edge");
 
  376    Graph.connect(Src, Tgt, *
E);
 
 
  381    assert(
E && 
"Failed to allocate memory for edge");
 
  383    Graph.connect(Src, Tgt, *
E);
 
 
  389    assert(PiNode && 
"Expected a pi-block node.");
 
  390    return PiNode->getNodes();
 
 
  395  bool areNodesMergeable(
const DDGNode &Src, 
const DDGNode &Tgt) 
const final;
 
  397  bool shouldSimplify() 
const final;
 
  398  bool shouldCreatePiBlocks() 
const final;
 
 
  414  using Result = std::unique_ptr<DataDependenceGraph>;
 
 
  440template <
typename NodeType>
 
  442    const NodeType &Src, 
const NodeType &Dst, 
DependenceList &Deps)
 const {
 
  443  assert(Deps.
empty() && 
"Expected empty output list at the start.");
 
  448    return I->mayReadOrWriteMemory();
 
  450  Src.collectInstructions(isMemoryAccess, SrcIList);
 
  451  Dst.collectInstructions(isMemoryAccess, DstIList);
 
  453  for (
auto *SrcI : SrcIList)
 
  454    for (
auto *DstI : DstIList)
 
  459  return !Deps.
empty();
 
 
  462template <
typename NodeType>
 
  465                                                   const NodeType &Dst)
 const {
 
  475    if (Str.back() == 
'\n')
 
 
  491    return &
P->getTargetNode();
 
 
 
  531    return &
P->getTargetNode();
 
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
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.
 
SmallVector< Instruction *, 2 > InstructionListType
 
This file defines the interface and a base class implementation for a directed graph.
 
This header provides classes for managing per-loop analyses.
 
This abstract builder class defines a set of high-level steps for creating DDG-like graphs.
 
SmallVectorImpl< BasicBlock * > BasicBlockListType
 
AbstractDependenceGraphBuilder(DataDependenceGraph &G, DependenceInfo &D, const BasicBlockListType &BBs)
 
SmallVector< NodeType *, 4 > NodeListType
 
DataDependenceGraph & Graph
 
DDGAnalysisPrinterPass(raw_ostream &OS)
 
Analysis pass that builds the DDG for a loop.
 
LLVM_ABI Result run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR)
DDG as a loop pass.
 
std::unique_ptr< DataDependenceGraph > Result
 
DDGNode & createPiBlock(const NodeListType &L) final
Create a pi-block node in the graph representing a group of nodes in an SCC of the graph.
 
DDGNode & createFineGrainedNode(Instruction &I) final
Create an atomic node in the graph given a single instruction.
 
DDGBuilder(DataDependenceGraph &G, DependenceInfo &D, const BasicBlockListType &BBs)
 
DDGEdge & createMemoryEdge(DDGNode &Src, DDGNode &Tgt) final
Create a memory dependence edge going from Src to Tgt.
 
DDGEdge & createRootedEdge(DDGNode &Src, DDGNode &Tgt) final
Create a rooted edge going from Src to Tgt .
 
DDGNode & createRootNode() final
Create the root node of the graph.
 
const NodeListType & getNodesInPiBlock(const DDGNode &N) final
Given a pi-block node, return a vector of all the nodes contained within it.
 
DDGEdge & createDefUseEdge(DDGNode &Src, DDGNode &Tgt) final
Create a def-use edge going from Src to Tgt.
 
Data Dependency Graph Edge.
 
DDGEdge & operator=(DDGEdge &&E)
 
bool isDefUse() const
Return true if this is a def-use edge, and false otherwise.
 
bool isRooted() const
Return true if this is an edge stemming from the root node, and false otherwise.
 
EdgeKind getKind() const
Get the edge kind.
 
EdgeKind
The kind of edge in the DDG.
 
bool isMemoryDependence() const
Return true if this is a memory dependence edge, and false otherwise.
 
DDGEdge(const DDGEdge &E)
 
DDGEdge(DDGNode &N, EdgeKind K)
 
DDGEdge(DDGNode &N)=delete
 
DDGEdge & operator=(const DDGEdge &E)=default
 
Data Dependence Graph Node The graph can represent the following types of nodes:
 
DDGNode & operator=(DDGNode &&N)
 
DDGNode & operator=(const DDGNode &N)=default
 
DDGNode(const DDGNode &N)=default
 
SmallVectorImpl< Instruction * > InstructionListType
 
NodeKind getKind() const
Getter for the kind of this node.
 
DDGNode(const NodeKind K)
 
void setKind(NodeKind K)
Setter for the kind of this node.
 
Represent an edge in the directed graph.
 
DGEdge< DDGNode, DDGEdge > & operator=(const DGEdge< DDGNode, DDGEdge > &E)
 
Represent a node in the directed graph.
 
typename EdgeListTy::const_iterator const_iterator
 
typename EdgeListTy::iterator iterator
 
DataDependenceGraph(DataDependenceGraph &&G)
 
DataDependenceGraph(const DataDependenceGraph &G)=delete
 
DataDependenceGraph()=delete
 
Encapsulate some common data and functionality needed for different variations of data dependence gra...
 
std::string getDependenceString(const NodeType &Src, const NodeType &Dst) const
Return a string representing the type of dependence that the dependence analysis identified between t...
 
NodeType & getRoot() const
Return the root node of the graph.
 
DependenceGraphInfo()=delete
 
DependenceGraphInfo(DependenceGraphInfo &&G)
 
StringRef getName() const
Return the label that is used to name this graph.
 
SmallVector< std::unique_ptr< Dependence >, 1 > DependenceList
 
DependenceGraphInfo(const DependenceGraphInfo &G)=delete
 
DependenceGraphInfo(const std::string &N, const DependenceInfo &DepInfo)
 
virtual ~DependenceGraphInfo()=default
 
bool getDependencies(const NodeType &Src, const NodeType &Dst, DependenceList &Deps) const
Collect all the data dependency infos coming from any pair of memory accesses from Src to Dst,...
 
DependenceInfo - This class is the main dependence-analysis driver.
 
const_iterator begin() const
 
const_iterator end() const
 
typename NodeListTy::iterator iterator
 
typename NodeListTy::const_iterator const_iterator
 
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
 
Represents a single loop in the control flow graph.
 
Subclass of DDGNode representing a pi-block.
 
PiBlockDDGNode & operator=(PiBlockDDGNode &&N)
 
const PiNodeList & getNodes() const
Get the list of nodes in this pi-block.
 
static bool classof(const DDGNode *N)
Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
 
PiBlockDDGNode & operator=(const PiBlockDDGNode &N)=default
 
SmallVector< DDGNode *, 4 > PiNodeList
 
A set of analyses that are preserved following a run of a transformation pass.
 
Subclass of DDGNode representing the root node of the graph.
 
static bool classof(const DDGNode *N)
Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
 
RootDDGNode(const RootDDGNode &N)=delete
 
static bool classof(const RootDDGNode *N)
 
~RootDDGNode() override=default
 
RootDDGNode(RootDDGNode &&N)
 
Subclass of DDGNode representing single or multi-instruction nodes.
 
Instruction * getFirstInstruction() const
Get the first/last instruction in the node.
 
SimpleDDGNode & operator=(const SimpleDDGNode &N)=default
 
const InstructionListType & getInstructions() const
Get the list of instructions in this node.
 
SimpleDDGNode & operator=(SimpleDDGNode &&N)
 
static bool classof(const DDGNode *N)
Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
 
static bool classof(const SimpleDDGNode *N)
 
InstructionListType & getInstructions()
 
Instruction * getLastInstruction() const
 
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
 
void push_back(const T &Elt)
 
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
 
StringRef - Represent a constant reference to a string, i.e.
 
An efficient, type-erasing, non-owning reference to a callable.
 
This class implements an extremely fast bulk output stream that can only output to a stream.
 
A raw_ostream that writes to an std::string.
 
This is an optimization pass for GlobalISel generic memory operations.
 
DGEdge< DDGNode, DDGEdge > DDGEdgeBase
 
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
 
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
 
void interleaveComma(const Container &c, StreamT &os, UnaryFunctor each_fn)
 
DirectedGraph< DDGNode, DDGEdge > DDGBase
 
AnalysisManager< Loop, LoopStandardAnalysisResults & > LoopAnalysisManager
The loop analysis manager.
 
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
 
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
 
DGNode< DDGNode, DDGEdge > DDGNodeBase
 
DependenceGraphInfo< DDGNode > DDGInfo
 
Implement std::hash so that hash_code can be used in STL containers.
 
Determine the kind of a node from its type.
 
A CRTP mix-in that provides informational APIs needed for analysis passes.
 
A special type used by analysis passes to provide an address that identifies that particular analysis...
 
DDGNode::iterator ChildEdgeIteratorType
 
mapped_iterator< DDGNode::iterator, decltype(&DDGGetTargetNode)> ChildIteratorType
 
static DDGNode * DDGGetTargetNode(DGEdge< DDGNode, DDGEdge > *P)
 
static ChildIteratorType child_end(NodeRef N)
 
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
 
static ChildEdgeIteratorType child_edge_end(NodeRef N)
 
static ChildIteratorType child_begin(NodeRef N)
 
static NodeRef getEntryNode(NodeRef N)
 
static nodes_iterator nodes_end(DataDependenceGraph *DG)
 
DataDependenceGraph::iterator nodes_iterator
 
static nodes_iterator nodes_begin(DataDependenceGraph *DG)
 
static NodeRef getEntryNode(DataDependenceGraph *DG)
 
static ChildIteratorType child_end(NodeRef N)
 
static const DDGNode * DDGGetTargetNode(const DGEdge< DDGNode, DDGEdge > *P)
 
DDGNode::const_iterator ChildEdgeIteratorType
 
static ChildEdgeIteratorType child_edge_end(NodeRef N)
 
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
 
mapped_iterator< DDGNode::const_iterator, decltype(&DDGGetTargetNode)> ChildIteratorType
 
static NodeRef getEntryNode(NodeRef N)
 
static ChildIteratorType child_begin(NodeRef N)
 
static nodes_iterator nodes_begin(const DataDependenceGraph *DG)
 
DataDependenceGraph::const_iterator nodes_iterator
 
static NodeRef getEntryNode(const DataDependenceGraph *DG)
 
static nodes_iterator nodes_end(const DataDependenceGraph *DG)
 
typename DataDependenceGraph *::UnknownGraphTypeError NodeRef
 
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
 
A CRTP mix-in to automatically provide informational APIs needed for passes.