CGRAOmp  0.1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
llvm::CGRADFG Class Reference

A graph class for CGRA kernel DFG derived from llvm::DirectedGraph. More...

#include <CGRADataFlowGraph.hpp>

Inheritance diagram for llvm::CGRADFG:

Public Types

using NodeType = DFGNode
 
using EdgeType = DFGEdge
 
using EdgeInfoType = std::pair< NodeType *, EdgeListTy >
 

Public Member Functions

 CGRADFG ()=delete
 
 CGRADFG (Function *F, Loop *L)
 Constructor. More...
 
 CGRADFG (const CGRADFG &G)=delete
 
 CGRADFG (CGRADFG &&G)
 move constructor More...
 
 CGRADFG (NodeType &N)
 constructor with an initial node More...
 
 ~CGRADFG ()
 Destructor. More...
 
NodeTypegetRoot () const
 Get the virtual route node object. More...
 
NodeTypeaddNode (NodeType &N)
 add a new node to the graph More...
 
bool connect (NodeType &Src, NodeType &Dst, EdgeType &E)
 connect two nodes with an edge More...
 
bool findIncomingEdgesToNode (const NodeType &N, SmallVectorImpl< EdgeInfoType > &EL, bool ignore_vroot=false) const
 find in-coming edges and get the list of them Unlike the same name method in llvm::DirectedGraph, this keeps source nodes of the egdges. If you want to ignore the virtual root, set ignore vroot to be true More...
 
bool hasExtraInfo () const
 
string convertToReadableNodeName (const string dot_string) const
 convert "Node_" + pointer style node name to more plain name More...
 
Error saveAsDotGraph (StringRef filepath)
 save the graph as DOT file More...
 
Error saveExtraInfo (StringRef filepath)
 
void setName (const string graph_name)
 Set the Name object. More...
 
string getName () const
 Get the Name object. More...
 
void makeSequentialNodeID ()
 
Function * getFunction ()
 
Loop * getLoop ()
 

Private Member Functions

void createVirtualRoot ()
 

Private Attributes

NodeTypevirtual_root = nullptr
 
string name = ""
 
Function * F
 
Loop * L
 

Detailed Description

A graph class for CGRA kernel DFG derived from llvm::DirectedGraph.

See also
https://llvm.org/doxygen/classllvm_1_1DirectedGraph.html

To handle this graph class by LLVM utilities (such as traversal), it needs an entry node. However, data-flow-graphs have more than one nodes which has no in-coming edge. Therefore, this class has a virtual root node, which is connected to those node and does not correspond to any LLVM IR values. When exporting this graph instance as DOT file, the virtual root and its edges are eliminated.

Member Typedef Documentation

◆ EdgeInfoType

using llvm::CGRADFG::EdgeInfoType = std::pair<NodeType*, EdgeListTy>

◆ EdgeType

◆ NodeType

Constructor & Destructor Documentation

◆ CGRADFG() [1/5]

llvm::CGRADFG::CGRADFG ( )
delete

◆ CGRADFG() [2/5]

llvm::CGRADFG::CGRADFG ( Function *  F,
Loop *  L 
)
inline

Constructor.

Parameters
FFunction includes the kernel of DFG
LLoop corresponding to the kernel of DFG

◆ CGRADFG() [3/5]

llvm::CGRADFG::CGRADFG ( const CGRADFG G)
delete

◆ CGRADFG() [4/5]

llvm::CGRADFG::CGRADFG ( CGRADFG &&  G)
inline

move constructor

◆ CGRADFG() [5/5]

llvm::CGRADFG::CGRADFG ( NodeType N)
inline

constructor with an initial node

◆ ~CGRADFG()

llvm::CGRADFG::~CGRADFG ( )
inline

Destructor.

Member Function Documentation

◆ addNode()

CGRADFG::NodeType * CGRADFG::addNode ( NodeType N)

add a new node to the graph

Parameters
Na DFG node to be added
Returns
NodeType* actually added node If an node same as the passed node N is already added, it returns the pointer of that node. In case of error, it returns nullptr;

◆ connect()

bool CGRADFG::connect ( NodeType Src,
NodeType Dst,
EdgeType E 
)

connect two nodes with an edge

Parameters
Srcsource node
Dstdestination node
Ean edge pointing to the dest. node
Returns
true in the case of no error
Otherwise, false

◆ convertToReadableNodeName()

string llvm::CGRADFG::convertToReadableNodeName ( const string  dot_string) const

convert "Node_" + pointer style node name to more plain name

Parameters
dot_stringcontents of the DOT file
Returns
string converted contents

◆ createVirtualRoot()

void llvm::CGRADFG::createVirtualRoot ( )
inlineprivate

◆ findIncomingEdgesToNode()

bool llvm::CGRADFG::findIncomingEdgesToNode ( const NodeType N,
SmallVectorImpl< EdgeInfoType > &  EL,
bool  ignore_vroot = false 
) const
inline

find in-coming edges and get the list of them Unlike the same name method in llvm::DirectedGraph, this keeps source nodes of the egdges. If you want to ignore the virtual root, set ignore vroot to be true

Parameters
NNode
ELa list of edge infomation (edges + src node)
ignore_vrootwhether the virtual root is ignored or not (Default: false)
Returns
it returns true if any edges are found
Otherwise it returns false

◆ getFunction()

Function* llvm::CGRADFG::getFunction ( )
inline

◆ getLoop()

Loop* llvm::CGRADFG::getLoop ( )
inline

◆ getName()

string llvm::CGRADFG::getName ( ) const
inline

Get the Name object.

Returns
string of the graph name

◆ getRoot()

NodeType& llvm::CGRADFG::getRoot ( ) const
inline

Get the virtual route node object.

Returns
NodeType&: a reference to the virtual root

◆ hasExtraInfo()

bool llvm::CGRADFG::hasExtraInfo ( ) const
inline

◆ makeSequentialNodeID()

void CGRADFG::makeSequentialNodeID ( )

◆ saveAsDotGraph()

Error CGRADFG::saveAsDotGraph ( StringRef  filepath)

save the graph as DOT file

Parameters
filepathfilepath of the save file
Returns
Error in the case of failure in creating a new file (e.g., because the same name file already exists)

If OptDFGPlainNodeName option is enabled, this method calls convertToReadableNodeName. Then, the converted contents is saved as a file.

◆ saveExtraInfo()

Error CGRADFG::saveExtraInfo ( StringRef  filepath)

◆ setName()

void llvm::CGRADFG::setName ( const string  graph_name)
inline

Set the Name object.

Parameters
graph_namename of the graph

Member Data Documentation

◆ F

Function* llvm::CGRADFG::F
private

◆ L

Loop* llvm::CGRADFG::L
private

◆ name

string llvm::CGRADFG::name = ""
private

◆ virtual_root

NodeType* llvm::CGRADFG::virtual_root = nullptr
private

The documentation for this class was generated from the following files: