OpenASIP  2.0
Public Member Functions | List of all members
RLBUPriorityCriticalPath Class Reference

#include <ReadyMoveNodeGroupList.hh>

Inheritance diagram for RLBUPriorityCriticalPath:
Inheritance graph
Collaboration diagram for RLBUPriorityCriticalPath:
Collaboration graph

Public Member Functions

bool operator() (MoveNodeGroup &a, MoveNodeGroup &b)
 

Detailed Description

A function object for prioritizing the ready list according to the move's distance from farthest source node. Futher away from source the better.

Definition at line 87 of file ReadyMoveNodeGroupList.hh.

Member Function Documentation

◆ operator()()

bool RLBUPriorityCriticalPath::operator() ( MoveNodeGroup a,
MoveNodeGroup b 
)
inline

Compares two nodes according to their priority in the ready list.

Parameters
aNode a.
bNode b.
Returns
True if b should be scheduled before a (b greater than a).

Definition at line 97 of file ReadyMoveNodeGroupList.hh.

97  {
98 
99  if (b.isScheduled()) {
100  // keep scheduled MoveNodeSets on a top of a queue
101  // so they will be poped out
102  return true;
103  }
104  if (a.isScheduled()) {
105  // keep scheduled MoveNodeSets on a top of a queue
106  // so they will be poped out
107  return false;
108  }
109  if (a.node(0).move().isControlFlowMove()) {
110  // Push control flow move to beginning of the ready list
111  return false;
112  }
113  if (b.node(0).move().isControlFlowMove()) {
114  // Push control flow move to beginning of the ready list
115  return true;
116  }
117 #if 0
118  // also prioritize moves which write the jump guard.
119  if (a.writesJumpGuard()) {
120  return false;
121  }
122 
123  // also prioritize moves which write the jump guard.
124  if (b.writesJumpGuard()) {
125  return true;
126  }
127 #endif
128  // Compute distances only once, it is expensive operation on graph
129  int aSourceDistance = a.maxSourceDistance();
130  int bSourceDistance = b.maxSourceDistance();
131  if (bSourceDistance == aSourceDistance) {
132  int aSinkDistance = a.maxSinkDistance();
133  int bSinkDistance = b.maxSinkDistance();
134  if (bSinkDistance == aSinkDistance) {
135  return b.node(0).nodeID() < a.node(0).nodeID();
136  }
137  // the lower the sink distance, the higher the priority
138  // this priority is better for loop scheduling, to make
139  // true tails get scheudled first.
140  return bSinkDistance < aSinkDistance;
141 
142  }
143  // the higher the source distance, the higher the priority
144  return bSourceDistance > aSourceDistance;
145  }

References TTAProgram::Move::isControlFlowMove(), MoveNodeGroup::isScheduled(), MoveNodeGroup::maxSinkDistance(), MoveNodeGroup::maxSourceDistance(), MoveNode::move(), MoveNodeGroup::node(), GraphNode::nodeID(), and MoveNodeGroup::writesJumpGuard().

Here is the call graph for this function:

The documentation for this class was generated from the following file:
MoveNodeGroup::node
MoveNode & node(int index) const
Definition: MoveNodeGroup.cc:152
GraphNode::nodeID
int nodeID() const
MoveNodeGroup::maxSinkDistance
int maxSinkDistance() const
Definition: MoveNodeGroup.cc:209
TTAProgram::Move::isControlFlowMove
bool isControlFlowMove() const
Definition: Move.cc:233
MoveNodeGroup::maxSourceDistance
int maxSourceDistance() const
Definition: MoveNodeGroup.cc:230
MoveNodeGroup::writesJumpGuard
bool writesJumpGuard() const
Definition: MoveNodeGroup.cc:260
MoveNode::move
TTAProgram::Move & move()
MoveNodeGroup::isScheduled
bool isScheduled() const
Definition: MoveNodeGroup.cc:164