OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 

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 };
@ PDG_EDGE_CONTROL_ARTIFICIAL
Loop close edge from close node to loop entry.
@ PDG_EDGE_DATA
Indicates Control Dependence Edge from CDG.
@ PDG_EDGE_LOOP_CLOSE
Indicates Data Dependence Edge from DDG.

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}
bool fixed_
Set to fixed if edge is not to be moved any more while serializing.
ControlDependenceEdge * cEdge_
DataDependenceEdge * dEdge_

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}
#define __func__

References __func__, and cEdge_.

◆ 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(), 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 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}
TCEString toString() const

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: