OpenASIP  2.0
Classes | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
GraphEdge Class Reference

#include <GraphEdge.hh>

Inheritance diagram for GraphEdge:
Inheritance graph
Collaboration diagram for GraphEdge:
Collaboration graph

Classes

struct  Comparator
 

Public Member Functions

 GraphEdge ()
 
 GraphEdge (const GraphEdge &edge)
 
virtual GraphEdgeclone () const
 
virtual ~GraphEdge ()
 
virtual int edgeID () const
 
virtual TCEString toString () const
 
virtual TCEString dotString () const
 
virtual bool isBackEdge () const
 
int weight () const
 
void setWeight (int w)
 

Private Attributes

int edgeID_
 
int weight_
 

Static Private Attributes

static int edgeCounter_ = 0
 

Detailed Description

Edge of the graph-based program representation. Each edge identifies a relation (dependency, ordering constraint) between two moves of the program.

Edges are pure carriers of information about a node dependency. They do not store head and tail nodes. Edges are independent objects owned by a graph. They do not store a backpointer to their parent graph. All topological information about the graph is stored in ProgramGraph; nothing is distributed across nodes and edges.

Definition at line 52 of file GraphEdge.hh.

Constructor & Destructor Documentation

◆ GraphEdge() [1/2]

GraphEdge::GraphEdge ( )

Definition at line 40 of file GraphEdge.cc.

40 : edgeID_(edgeCounter_++), weight_(-1) {}

◆ GraphEdge() [2/2]

GraphEdge::GraphEdge ( const GraphEdge edge)

Definition at line 42 of file GraphEdge.cc.

42 : edgeID_(edgeCounter_++), weight_(e.weight()) {}

◆ ~GraphEdge()

GraphEdge::~GraphEdge ( )
virtual

Definition at line 38 of file GraphEdge.cc.

38 { }

Member Function Documentation

◆ clone()

GraphEdge * GraphEdge::clone ( ) const
virtual

Clones edge. Needed for dynamic binding, when copying instances through the base class.

Returns
Dynamically allocated copy of the edge.

Reimplemented in OperationDAGEdge.

Definition at line 51 of file GraphEdge.cc.

51  {
52  throw WrongSubclass(
53  __FILE__, __LINE__, __func__,
54  "Cloning must be done in subclass or use copy constructor.");
55  return NULL;
56 }

References __func__.

◆ dotString()

TCEString GraphEdge::dotString ( ) const
virtual

Returns the string that should be placed in the edge's properties section in the GraphViz Dot string.

This can be overridden in the derived class to add different properties (e.g., colors, etc.) to different type of edges. The default implementation only sets the label property.

Returns
String describing the Dot properties of the edge.

Reimplemented in MIDDGEdge, and ProgramDependenceEdge.

Definition at line 81 of file GraphEdge.cc.

81  {
82  return TCEString("label=\"") + toString() + "\"";
83 }

References toString().

Referenced by ResourceConstraintAnalyzer::dumpGraphWithStats().

Here is the call graph for this function:

◆ edgeID()

int GraphEdge::edgeID ( ) const
virtual

Return edge ID as integer.

Returns
The edge ID as integer

Definition at line 92 of file GraphEdge.cc.

92  {
93  return edgeID_;
94 }

References edgeID_.

Referenced by BoostGraph< GraphNode, GraphEdge >::RemovedEdgeDatum::operator<(), and toString().

◆ isBackEdge()

virtual bool GraphEdge::isBackEdge ( ) const
inlinevirtual

Reimplemented in DataDependenceEdge, and ControlFlowEdge.

Definition at line 63 of file GraphEdge.hh.

63  {
64  return false;
65  }

◆ setWeight()

void GraphEdge::setWeight ( int  w)
inline

◆ toString()

TCEString GraphEdge::toString ( ) const
virtual

Return the label of the edge as a string.

Used for printing graph in GraphViz .dot file.

Returns
The edge ID as a string

Reimplemented in MIDDGEdge, ControlFlowEdge, DataDependenceEdge, ProgramDependenceEdge, ControlDependenceEdge, and OperationDAGEdge.

Definition at line 66 of file GraphEdge.cc.

66  {
67  return Conversion::toString(edgeID());
68 }

References edgeID(), and Conversion::toString().

Referenced by dotString().

Here is the call graph for this function:

◆ weight()

int GraphEdge::weight ( ) const
inline

Definition at line 73 of file GraphEdge.hh.

73 { return weight_; }

References weight_.

Referenced by DataDependenceGraph::edgeWeight().

Member Data Documentation

◆ edgeCounter_

int GraphEdge::edgeCounter_ = 0
staticprivate

Definition at line 78 of file GraphEdge.hh.

◆ edgeID_

int GraphEdge::edgeID_
private

Definition at line 76 of file GraphEdge.hh.

Referenced by edgeID(), and GraphEdge::Comparator::operator()().

◆ weight_

int GraphEdge::weight_
private

Definition at line 77 of file GraphEdge.hh.

Referenced by setWeight(), and weight().


The documentation for this class was generated from the following files:
Conversion::toString
static std::string toString(const T &source)
GraphEdge::edgeCounter_
static int edgeCounter_
Definition: GraphEdge.hh:78
WrongSubclass
Definition: Exception.hh:336
GraphEdge::toString
virtual TCEString toString() const
Definition: GraphEdge.cc:66
__func__
#define __func__
Definition: Application.hh:67
GraphEdge::edgeID
virtual int edgeID() const
Definition: GraphEdge.cc:92
GraphEdge::edgeID_
int edgeID_
Definition: GraphEdge.hh:76
GraphEdge::weight_
int weight_
Definition: GraphEdge.hh:77
TCEString
Definition: TCEString.hh:53