OpenASIP  2.0
Public Types | Public Member Functions | Private Attributes | List of all members
ProgramDependenceEdge Class Reference

#include <ProgramDependenceEdge.hh>

Inheritance diagram for ProgramDependenceEdge:
Inheritance graph
Collaboration diagram for ProgramDependenceEdge:
Collaboration graph

Public Types

enum  EdgeType { PDG_EDGE_CONTROL, PDG_EDGE_DATA, PDG_EDGE_LOOP_CLOSE, PDG_EDGE_CONTROL_ARTIFICIAL }
 

Public Member Functions

 ProgramDependenceEdge (ControlDependenceEdge &cEdge)
 
 ProgramDependenceEdge (DataDependenceEdge &cEdge)
 
 ProgramDependenceEdge (EdgeType type=PDG_EDGE_CONTROL_ARTIFICIAL)
 
virtual ~ProgramDependenceEdge ()
 
bool isControlDependence () const
 
bool isDataDependence () const
 
bool isArtificialControlDependence () const
 
bool isLoopCloseEdge () const
 
ControlDependenceEdgecontrolDependenceEdge ()
 
DataDependenceEdgedataDependenceEdge ()
 
TCEString toString () const
 
TCEString dotString () const
 
void setFixed ()
 
bool fixed ()
 
- Public Member Functions inherited from GraphEdge
 GraphEdge ()
 
 GraphEdge (const GraphEdge &edge)
 
virtual GraphEdgeclone () const
 
virtual ~GraphEdge ()
 
virtual int edgeID () const
 
virtual bool isBackEdge () const
 
int weight () const
 
void setWeight (int w)
 

Private Attributes

ControlDependenceEdgecEdge_
 
DataDependenceEdgedEdge_
 
EdgeType type_
 
bool fixed_
 Set to fixed if edge is not to be moved any more while serializing. More...
 

Detailed Description

Definition at line 41 of file ProgramDependenceEdge.hh.

Member Enumeration Documentation

◆ EdgeType

Enumerator
PDG_EDGE_CONTROL 
PDG_EDGE_DATA 

Indicates Control Dependence Edge from CDG.

PDG_EDGE_LOOP_CLOSE 

Indicates Data Dependence Edge from DDG.

PDG_EDGE_CONTROL_ARTIFICIAL 

Loop close edge from close node to loop entry.

Indicates artificial control edge for serialization

Definition at line 43 of file ProgramDependenceEdge.hh.

43  {
44  PDG_EDGE_CONTROL, /// Indicates Control Dependence Edge from CDG
45  PDG_EDGE_DATA, /// Indicates Data Dependence Edge from DDG
46  PDG_EDGE_LOOP_CLOSE, /// Loop close edge from close node to loop entry
47  PDG_EDGE_CONTROL_ARTIFICIAL /// Indicates artificial control edge for
48  /// serialization
49  };

Constructor & Destructor Documentation

◆ ProgramDependenceEdge() [1/3]

ProgramDependenceEdge::ProgramDependenceEdge ( ControlDependenceEdge cEdge)

Constructor, makes new Program Dependence Edge with reference to original Control Dependence Edge in CDG.

Parameters
cEdgeControl Dependence Edge

Definition at line 50 of file ProgramDependenceEdge.cc.

52  : cEdge_(&cEdge), dEdge_(NULL), type_(PDG_EDGE_CONTROL), fixed_(false) {
53  if (cEdge.isLoopCloseEdge()) {
55  } else {
57  }
58 }

References ControlDependenceEdge::isLoopCloseEdge(), PDG_EDGE_CONTROL, PDG_EDGE_LOOP_CLOSE, and type_.

Here is the call graph for this function:

◆ ProgramDependenceEdge() [2/3]

ProgramDependenceEdge::ProgramDependenceEdge ( DataDependenceEdge dEdge)

Constructor, makes new Program Dependence Edge with reference to original Data Dependence Edge in DDG.

Parameters
dEdgeData Dependence Edge

Definition at line 65 of file ProgramDependenceEdge.cc.

67  : cEdge_(NULL), dEdge_(&dEdge), type_(PDG_EDGE_DATA), fixed_(false) {
68 }

◆ ProgramDependenceEdge() [3/3]

ProgramDependenceEdge::ProgramDependenceEdge ( EdgeType  type = PDG_EDGE_CONTROL_ARTIFICIAL)

Constructor, makes new Program Dependence Edge without reference to original Control Dependence Edge in CDG. It is artificial edge.

Definition at line 41 of file ProgramDependenceEdge.cc.

42  : cEdge_(NULL), dEdge_(NULL), type_(type), fixed_(false) {
43 }

◆ ~ProgramDependenceEdge()

ProgramDependenceEdge::~ProgramDependenceEdge ( )
virtual

Empty destructor.

Definition at line 73 of file ProgramDependenceEdge.cc.

73  {
74 }

Member Function Documentation

◆ controlDependenceEdge()

ControlDependenceEdge & ProgramDependenceEdge::controlDependenceEdge ( )

Returns reference to control dependence edge of CDG.

Returns
control dependence edge of underlying CDG

Definition at line 166 of file ProgramDependenceEdge.cc.

166  {
167  if (cEdge_ != NULL) {
168  return *cEdge_;
169  } else {
170  throw InvalidData(__FILE__, __LINE__, __func__,
171  "Not a control dependence edge!");
172  }
173 }

References __func__, and cEdge_.

Referenced by ProgramDependenceGraph::processPredicate().

◆ dataDependenceEdge()

DataDependenceEdge & ProgramDependenceEdge::dataDependenceEdge ( )

Returns reference to data dependence edge of CDG.

Returns
data dependence edge of underlying DDG

Definition at line 179 of file ProgramDependenceEdge.cc.

179  {
180  return *dEdge_;
181 }

References dEdge_.

Referenced by ProgramDependenceGraph::moveDDGedges().

◆ dotString()

TCEString ProgramDependenceEdge::dotString ( ) const
virtual

Returns the edge description as a string in .dot format.

Returns
string describing the edge payload in .dot format

Reimplemented from GraphEdge.

Definition at line 101 of file ProgramDependenceEdge.cc.

101  {
103  return TCEString("label=\"") + toString() + "\",color=green";
104  }
105  if (isLoopCloseEdge()) {
106  return TCEString("label=\"") + toString() + "\",color=cyan";
107  }
108 
109  if (isControlDependence()) {
110  if (cEdge_->isTrueEdge()) {
111  return TCEString("label=\"") + toString() + "\",color=blue";
112  }
113  if (cEdge_->isFalseEdge()) {
114  return TCEString("label=\"") + toString() + "\",color=red";
115  }
116  return TCEString("label=\"") + toString() + "\"";
117  }
118  return TCEString("label=\"") + toString() + "\",style=dashed";
119 }

References cEdge_, isArtificialControlDependence(), isControlDependence(), ControlDependenceEdge::isFalseEdge(), isLoopCloseEdge(), ControlDependenceEdge::isTrueEdge(), and toString().

Here is the call graph for this function:

◆ fixed()

bool ProgramDependenceEdge::fixed ( )
inline

Definition at line 66 of file ProgramDependenceEdge.hh.

66 { return fixed_; }

References fixed_.

◆ isArtificialControlDependence()

bool ProgramDependenceEdge::isArtificialControlDependence ( ) const

Tests if edge is artificial control dependence type. Artificial edges are added during PDG synchronization.

Returns
true if edge is artificial control dependence

Definition at line 147 of file ProgramDependenceEdge.cc.

147  {
149 }

References PDG_EDGE_CONTROL_ARTIFICIAL, and type_.

Referenced by dotString(), isControlDependence(), ProgramDependenceGraph::processPredicate(), and toString().

◆ isControlDependence()

bool ProgramDependenceEdge::isControlDependence ( ) const

Tests if edge is control dependence type.

Returns
true if edge is control dependence

Definition at line 126 of file ProgramDependenceEdge.cc.

126  {
128  return true;
129  }
130  return type_ == PDG_EDGE_CONTROL && cEdge_ != NULL ;
131 }

References cEdge_, isArtificialControlDependence(), PDG_EDGE_CONTROL, and type_.

Referenced by dotString(), and toString().

Here is the call graph for this function:

◆ isDataDependence()

bool ProgramDependenceEdge::isDataDependence ( ) const

Tests if edge is data dependence type.

Returns
true if edge is data dependence

Definition at line 137 of file ProgramDependenceEdge.cc.

137  {
138  return type_ == PDG_EDGE_DATA && dEdge_ != NULL;
139 }

References dEdge_, PDG_EDGE_DATA, and type_.

Referenced by ProgramDependenceGraph::removeGuardedJump(), and toString().

◆ isLoopCloseEdge()

bool ProgramDependenceEdge::isLoopCloseEdge ( ) const

Tests if edge is loop close edge from artificial close node to loop entry node

Returns
true if edge is loop close edge

Definition at line 157 of file ProgramDependenceEdge.cc.

157  {
158  return type_ == PDG_EDGE_LOOP_CLOSE;
159 }

References PDG_EDGE_LOOP_CLOSE, and type_.

Referenced by dotString(), and toString().

◆ setFixed()

void ProgramDependenceEdge::setFixed ( )
inline

Definition at line 65 of file ProgramDependenceEdge.hh.

65 { fixed_ = true; }

References fixed_.

◆ toString()

TCEString ProgramDependenceEdge::toString ( ) const
virtual

Returns the edge description as a string.

Returns
string describing the edge payload

Reimplemented from GraphEdge.

Definition at line 81 of file ProgramDependenceEdge.cc.

81  {
83  return "PDG_ARTIFICIAL";
84  }
85  if (isLoopCloseEdge()) {
86  return "LoopClose";
87  }
88  if (isDataDependence()) {
89  return dEdge_->toString();
90  }
91  if (isControlDependence()) {
92  return cEdge_->toString();
93  }
94  return "Error!";
95 }

References cEdge_, dEdge_, isArtificialControlDependence(), isControlDependence(), isDataDependence(), isLoopCloseEdge(), ControlDependenceEdge::toString(), and DataDependenceEdge::toString().

Referenced by dotString().

Here is the call graph for this function:

Member Data Documentation

◆ cEdge_

ControlDependenceEdge* ProgramDependenceEdge::cEdge_
private

◆ dEdge_

DataDependenceEdge* ProgramDependenceEdge::dEdge_
private

Definition at line 69 of file ProgramDependenceEdge.hh.

Referenced by dataDependenceEdge(), isDataDependence(), and toString().

◆ fixed_

bool ProgramDependenceEdge::fixed_
private

Set to fixed if edge is not to be moved any more while serializing.

Definition at line 72 of file ProgramDependenceEdge.hh.

Referenced by fixed(), and setFixed().

◆ type_

EdgeType ProgramDependenceEdge::type_
private

The documentation for this class was generated from the following files:
ProgramDependenceEdge::PDG_EDGE_LOOP_CLOSE
@ PDG_EDGE_LOOP_CLOSE
Indicates Data Dependence Edge from DDG.
Definition: ProgramDependenceEdge.hh:46
ProgramDependenceEdge::isDataDependence
bool isDataDependence() const
Definition: ProgramDependenceEdge.cc:137
ControlDependenceEdge::isTrueEdge
bool isTrueEdge() const
Definition: ControlDependenceEdge.hh:61
ProgramDependenceEdge::type_
EdgeType type_
Definition: ProgramDependenceEdge.hh:70
ProgramDependenceEdge::PDG_EDGE_CONTROL
@ PDG_EDGE_CONTROL
Definition: ProgramDependenceEdge.hh:44
ProgramDependenceEdge::isLoopCloseEdge
bool isLoopCloseEdge() const
Definition: ProgramDependenceEdge.cc:157
ControlDependenceEdge::toString
TCEString toString() const
Definition: ControlDependenceEdge.cc:44
ProgramDependenceEdge::isArtificialControlDependence
bool isArtificialControlDependence() const
Definition: ProgramDependenceEdge.cc:147
InvalidData
Definition: Exception.hh:149
ProgramDependenceEdge::PDG_EDGE_CONTROL_ARTIFICIAL
@ PDG_EDGE_CONTROL_ARTIFICIAL
Loop close edge from close node to loop entry.
Definition: ProgramDependenceEdge.hh:47
ProgramDependenceEdge::toString
TCEString toString() const
Definition: ProgramDependenceEdge.cc:81
__func__
#define __func__
Definition: Application.hh:67
ProgramDependenceEdge::dEdge_
DataDependenceEdge * dEdge_
Definition: ProgramDependenceEdge.hh:69
DataDependenceEdge::toString
TCEString toString() const
Definition: DataDependenceEdge.cc:201
ProgramDependenceEdge::isControlDependence
bool isControlDependence() const
Definition: ProgramDependenceEdge.cc:126
ControlDependenceEdge::isFalseEdge
bool isFalseEdge() const
Definition: ControlDependenceEdge.hh:62
ProgramDependenceEdge::cEdge_
ControlDependenceEdge * cEdge_
Definition: ProgramDependenceEdge.hh:68
TCEString
Definition: TCEString.hh:53
ProgramDependenceEdge::PDG_EDGE_DATA
@ PDG_EDGE_DATA
Indicates Control Dependence Edge from CDG.
Definition: ProgramDependenceEdge.hh:45
ControlDependenceEdge::isLoopCloseEdge
bool isLoopCloseEdge() const
Definition: ControlDependenceEdge.hh:63
ProgramDependenceEdge::fixed_
bool fixed_
Set to fixed if edge is not to be moved any more while serializing.
Definition: ProgramDependenceEdge.hh:72