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

#include <MoveNodeGroup.hh>

Collaboration diagram for MoveNodeGroup:
Collaboration graph

Public Member Functions

 MoveNodeGroup ()
 
 MoveNodeGroup (const DataDependenceGraph &ddg)
 
virtual ~MoveNodeGroup ()
 
void addNode (MoveNode &node)
 
int earliestCycle (bool assumeBypassing=false) const
 
int latestCycle () const
 
int maxSinkDistance () const
 
int maxSourceDistance () const
 
int nodeCount () const
 
MoveNodenode (int index) const
 
bool isPlaced () const
 
bool isScheduled () const
 
std::string toString () const
 
bool isAlive () const
 
void setProgramOperationPtr (ProgramOperationPtr op)
 in case this MNG contains strictly the nodes of a single operation, it can be set and queried with these methods More...
 
bool isOperation () const
 
ProgramOperationPtr programOperationPtr () const
 
bool writesJumpGuard () const
 

Private Attributes

std::vector< MoveNode * > nodes_
 
const DataDependenceGraphddg_
 The data dependence graph the moves in this group belong to (optional). More...
 
ProgramOperationPtr operation_
 in case this MNG contains strictly the nodes of a single operation this can be set to point to it (optional) More...
 

Detailed Description

Class which contains group of moves which are to be scheduled.

Definition at line 48 of file MoveNodeGroup.hh.

Constructor & Destructor Documentation

◆ MoveNodeGroup() [1/2]

MoveNodeGroup::MoveNodeGroup ( )

Constructor.

Definition at line 45 of file MoveNodeGroup.cc.

45  : ddg_(NULL) {
46 }

◆ MoveNodeGroup() [2/2]

MoveNodeGroup::MoveNodeGroup ( const DataDependenceGraph ddg)

Constructor.

Parameters
ddgThe data dependence graph the moves in the group belong to.

Definition at line 53 of file MoveNodeGroup.cc.

53  :
54  ddg_(&ddg) {
55 }

◆ ~MoveNodeGroup()

MoveNodeGroup::~MoveNodeGroup ( )
virtual

Destructor.

Definition at line 61 of file MoveNodeGroup.cc.

61  {
62 }

Member Function Documentation

◆ addNode()

void MoveNodeGroup::addNode ( MoveNode node)

Adds a node to the MoveNodeGroup.

Parameters
nodeThe MoveNode being added to the group.

Definition at line 70 of file MoveNodeGroup.cc.

70  {
71  nodes_.push_back(&node);
72 }

References node(), and nodes_.

Referenced by MoveNodeGroupBuilder::build(), BasicBlockScheduler::handleLoopDDG(), BUMoveNodeSelector::mightBeReady(), and CriticalPathBBMoveNodeSelector::mightBeReady().

Here is the call graph for this function:

◆ earliestCycle()

int MoveNodeGroup::earliestCycle ( bool  assumeBypassing = false) const

Calculates the earliest cycle in which dependences make it possible to try schedule the leader node.

In case the MoveNodeGroup is not (known) to be part of a DDG, or at least one of the predecessors of the MoveNodeGroup are unscheduled, this function returns INT_MAX. If the node is a root node, the function returns 0.

Todo:
What is the "leader node", in general, in an unassigned operation?
Parameters
assumeBypassingIf set to true, assume we can software bypass all inputs from the original source.
Returns
The earliest possible cycle all nodes could be scheduled according to their precedences.

Definition at line 103 of file MoveNodeGroup.cc.

103  {
104 
105  if (ddg_ == NULL)
106  return INT_MAX;
107 
108  int cycle = 0;
109  // check the predecessors of all nodes in the MoveNodeGroup
110  for (std::size_t i = 0; i < nodes_.size(); ++i) {
111  MoveNode& node = *nodes_.at(i);
112  int nodeCycle =
114  node, UINT_MAX, false, false, false, false, false,
115  assumeBypassing);
116 
117  Application::logStream() << "EC " << nodeCycle << " for "
118  << node.toString() << std::endl;
119 
120  // the result read moves have unscheduled predecessors in case
121  // the operand moves are not yet scheduled, ignore that
122  if (nodeCycle == INT_MAX) {
123  if (!node.isSourceOperation()) {
124  return INT_MAX;
125  }
126  } else {
127  cycle = std::max(nodeCycle, cycle);
128  }
129  }
130 
131  return cycle;
132 }

References ddg_, DataDependenceGraph::earliestCycle(), MoveNode::isSourceOperation(), Application::logStream(), node(), nodes_, and MoveNode::toString().

Here is the call graph for this function:

◆ isAlive()

bool MoveNodeGroup::isAlive ( ) const

Returns true if all moves in the move group are alive.

An empty MoveNodeGroup is considered always alive.

Returns
True if scheduled.

Definition at line 190 of file MoveNodeGroup.cc.

190  {
191  if (ddg_ != NULL) {
192  for (std::size_t i = 0; i < nodes_.size(); ++i) {
193  if (!ddg_->hasNode(*nodes_.at(i))) {
194  return false;
195  }
196  }
197  }
198  return true;
199 }

References ddg_, BoostGraph< GraphNode, GraphEdge >::hasNode(), and nodes_.

Referenced by BUMoveNodeSelector::candidates(), and CriticalPathBBMoveNodeSelector::candidates().

Here is the call graph for this function:

◆ isOperation()

bool MoveNodeGroup::isOperation ( ) const
inline

Definition at line 74 of file MoveNodeGroup.hh.

74 { return operation_ != NULL; }

References operation_.

Referenced by LLVMTCEDataDependenceGraphBuilder::buildLocalDDG(), and toString().

◆ isPlaced()

bool MoveNodeGroup::isPlaced ( ) const

Definition at line 173 of file MoveNodeGroup.cc.

173  {
174  for (std::size_t i = 0; i < nodes_.size(); ++i) {
175  if (!nodes_.at(i)->isPlaced())
176  return false;
177  }
178  return true;
179 }

References nodes_.

◆ isScheduled()

bool MoveNodeGroup::isScheduled ( ) const

Returns true if all moves in the move group have been scheduled.

An empty MoveNodeGroup is considered always scheduled.

Returns
True if scheduled.

Definition at line 164 of file MoveNodeGroup.cc.

164  {
165  for (std::size_t i = 0; i < nodes_.size(); ++i) {
166  if (!nodes_.at(i)->isScheduled())
167  return false;
168  }
169  return true;
170 }

References nodes_.

Referenced by BUMoveNodeSelector::candidates(), CriticalPathBBMoveNodeSelector::candidates(), SequentialScheduler::handleBasicBlock(), BUBasicBlockScheduler::handleDDG(), BasicBlockScheduler::handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), BasicBlockScheduler::handleLoopDDG(), RLPriorityCriticalPath::operator()(), RLPriorityNodeId::operator()(), and RLBUPriorityCriticalPath::operator()().

◆ latestCycle()

int MoveNodeGroup::latestCycle ( ) const

Calculates the last cycle in which dependences make it possible to try schedule the leader node.

Returns
The earliest possible cycle

Definition at line 81 of file MoveNodeGroup.cc.

81  {
82  abortWithError("Not yet implemented");
83  return 0;
84 }

References abortWithError.

◆ maxSinkDistance()

int MoveNodeGroup::maxSinkDistance ( ) const

Returns the maximum distance from any movenode in the group to any sink.

Calling this may cause forever loop if the DDG has loops.

Returns
maximum distance from any movenode in the group to any sink.

Definition at line 209 of file MoveNodeGroup.cc.

209  {
210  if (ddg_ == NULL) {
211  return 0;
212  }
213  int maxSD = 0;
214  for (int i = 0; i < nodeCount(); i++) {
215  int sinkDistance = ddg_->maxSinkDistance(node(i));
216  maxSD = std::max (maxSD, sinkDistance);
217  }
218  return maxSD;
219 }

References ddg_, BoostGraph< GraphNode, GraphEdge >::maxSinkDistance(), node(), and nodeCount().

Referenced by RLPriorityCriticalPath::operator()(), and RLBUPriorityCriticalPath::operator()().

Here is the call graph for this function:

◆ maxSourceDistance()

int MoveNodeGroup::maxSourceDistance ( ) const

Returns the maximum distance from any source node to any movenode in the group.

Calling this may cause forever loop if the DDG has loops.

Returns
maximum distance from any source node to any node in the group.

Definition at line 230 of file MoveNodeGroup.cc.

230  {
231  if (ddg_ == NULL) {
232  return 0;
233  }
234  int maxSD = 0;
235  for (int i = 0; i < nodeCount(); i++) {
236  int sourceDistance = ddg_->maxSourceDistance(node(i));
237  maxSD = std::max (maxSD, sourceDistance);
238  }
239  return maxSD;
240 }

References ddg_, BoostGraph< GraphNode, GraphEdge >::maxSourceDistance(), node(), and nodeCount().

Referenced by RLBUPriorityCriticalPath::operator()().

Here is the call graph for this function:

◆ node()

MoveNode & MoveNodeGroup::node ( int  index) const

Returns one MoveNode contained in this group.

Parameters
indexThe index of node which to return
Returns
The node being returned.

Definition at line 152 of file MoveNodeGroup.cc.

152  {
153  return *nodes_.at(index);
154 }

References nodes_.

Referenced by addNode(), LLVMTCEDataDependenceGraphBuilder::buildLocalDDG(), CycleLookBackSoftwareBypasser::bypass(), earliestCycle(), SequentialScheduler::handleBasicBlock(), BUBasicBlockScheduler::handleDDG(), BasicBlockScheduler::handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), BasicBlockScheduler::handleLoopDDG(), BF2Scheduler::handleLoopDDG(), BUMoveNodeSelector::isReadyToBeScheduled(), maxSinkDistance(), maxSourceDistance(), ResourceConstraintAnalyzer::memoryBoundScheduleResourceUsage(), BasicBlockScheduler::notifyScheduled(), RLPriorityCriticalPath::operator()(), RLPriorityNodeId::operator()(), RLBUPriorityCriticalPath::operator()(), CycleLookBackSoftwareBypasser::removeBypass(), CycleLookBackSoftwareBypasser::removeDeadResults(), BF2Scheduler::scheduleDDG(), SequentialScheduler::scheduleOperandWrites(), BasicBlockScheduler::scheduleOperandWrites(), BUBasicBlockScheduler::scheduleOperandWrites(), SequentialScheduler::scheduleOperation(), BasicBlockScheduler::scheduleOperation(), BUBasicBlockScheduler::scheduleOperation(), SequentialScheduler::scheduleResultReads(), BasicBlockScheduler::scheduleResultReads(), BUBasicBlockScheduler::scheduleResultReads(), toString(), BasicBlockScheduler::tryToDelayOperands(), and SequentialMoveNodeSelector::~SequentialMoveNodeSelector().

◆ nodeCount()

int MoveNodeGroup::nodeCount ( ) const

Returns the number of movenodes in the group

Returns
The number of nodes.

Definition at line 140 of file MoveNodeGroup.cc.

140  {
141  return nodes_.size();
142 }

References nodes_.

Referenced by MoveNodeGroupBuilder::build(), LLVMTCEDataDependenceGraphBuilder::buildLocalDDG(), CycleLookBackSoftwareBypasser::bypass(), SoftwareBypasser::bypass(), SequentialScheduler::handleBasicBlock(), BUBasicBlockScheduler::handleDDG(), BasicBlockScheduler::handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), BasicBlockScheduler::handleLoopDDG(), BF2Scheduler::handleLoopDDG(), BUMoveNodeSelector::isReadyToBeScheduled(), maxSinkDistance(), maxSourceDistance(), ResourceConstraintAnalyzer::memoryBoundScheduleResourceUsage(), BUMoveNodeSelector::mightBeReady(), BasicBlockScheduler::notifyScheduled(), CycleLookBackSoftwareBypasser::removeBypass(), SoftwareBypasser::removeBypass(), CycleLookBackSoftwareBypasser::removeDeadResults(), SoftwareBypasser::removeDeadResults(), BF2Scheduler::scheduleDDG(), SequentialScheduler::scheduleOperandWrites(), BasicBlockScheduler::scheduleOperandWrites(), BUBasicBlockScheduler::scheduleOperandWrites(), SequentialScheduler::scheduleOperation(), BasicBlockScheduler::scheduleOperation(), BUBasicBlockScheduler::scheduleOperation(), SequentialScheduler::scheduleResultReads(), BasicBlockScheduler::scheduleResultReads(), BUBasicBlockScheduler::scheduleResultReads(), toString(), BasicBlockScheduler::tryToDelayOperands(), and SequentialMoveNodeSelector::~SequentialMoveNodeSelector().

◆ programOperationPtr()

ProgramOperationPtr MoveNodeGroup::programOperationPtr ( ) const
inline

◆ setProgramOperationPtr()

void MoveNodeGroup::setProgramOperationPtr ( ProgramOperationPtr  op)
inline

in case this MNG contains strictly the nodes of a single operation, it can be set and queried with these methods

Definition at line 73 of file MoveNodeGroup.hh.

73 { operation_ = op; }

References operation_.

Referenced by MoveNodeGroupBuilder::build().

◆ toString()

std::string MoveNodeGroup::toString ( ) const

Returns the disassembly of moves in NodeGroup as a string.

Returns
string with disasembly of NodeGroup moves.

Definition at line 248 of file MoveNodeGroup.cc.

248  {
249  std::string result = "";
250  for (int i = 0; i < nodeCount(); i++) {
251  result += node(i).toString() + " ; ";
252  }
253 
254  if (isOperation()) {
255  result += "[PO: " + programOperationPtr()->toString() + "] ";
256  }
257  return result;
258 }

References isOperation(), node(), nodeCount(), programOperationPtr(), and MoveNode::toString().

Referenced by MoveNodeGroupBuilder::build(), BasicBlockScheduler::scheduleOperandWrites(), SequentialScheduler::scheduleOperation(), BasicBlockScheduler::scheduleOperation(), and BUBasicBlockScheduler::scheduleOperation().

Here is the call graph for this function:

◆ writesJumpGuard()

bool MoveNodeGroup::writesJumpGuard ( ) const

Definition at line 260 of file MoveNodeGroup.cc.

260  {
261  if (ddg_ == nullptr) return false;
262  for (auto n: nodes_) {
263  if (!ddg_->hasNode(*n)) continue;
265  for (auto e: outEdges) {
266  if (e->guardUse() && e->edgeReason() == DataDependenceEdge::EDGE_REGISTER &&
267  !e->isFalseDep() && !e->headPseudo() && !e->tailPseudo()) {
268  MoveNode& head = ddg_->headNode(*e);
269  if (head.isMove() && head.move().isControlFlowMove()) {
270  return true;
271  }
272  }
273  }
274  }
275  return false;
276 }

References ddg_, DataDependenceEdge::EDGE_REGISTER, BoostGraph< GraphNode, GraphEdge >::hasNode(), BoostGraph< GraphNode, GraphEdge >::headNode(), TTAProgram::Move::isControlFlowMove(), MoveNode::isMove(), MoveNode::move(), nodes_, and BoostGraph< GraphNode, GraphEdge >::outEdges().

Referenced by RLBUPriorityCriticalPath::operator()().

Here is the call graph for this function:

Member Data Documentation

◆ ddg_

const DataDependenceGraph* MoveNodeGroup::ddg_
private

The data dependence graph the moves in this group belong to (optional).

Definition at line 82 of file MoveNodeGroup.hh.

Referenced by earliestCycle(), isAlive(), maxSinkDistance(), maxSourceDistance(), and writesJumpGuard().

◆ nodes_

std::vector<MoveNode*> MoveNodeGroup::nodes_
private

◆ operation_

ProgramOperationPtr MoveNodeGroup::operation_
private

in case this MNG contains strictly the nodes of a single operation this can be set to point to it (optional)

Definition at line 85 of file MoveNodeGroup.hh.

Referenced by isOperation(), programOperationPtr(), and setProgramOperationPtr().


The documentation for this class was generated from the following files:
MoveNodeGroup::ddg_
const DataDependenceGraph * ddg_
The data dependence graph the moves in this group belong to (optional).
Definition: MoveNodeGroup.hh:82
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
MoveNodeGroup::node
MoveNode & node(int index) const
Definition: MoveNodeGroup.cc:152
BoostGraph::headNode
virtual Node & headNode(const Edge &edge) const
BoostGraph::maxSourceDistance
int maxSourceDistance(const GraphNode &node) const
MoveNodeGroup::nodes_
std::vector< MoveNode * > nodes_
Definition: MoveNodeGroup.hh:79
MoveNode
Definition: MoveNode.hh:65
DataDependenceEdge::EDGE_REGISTER
@ EDGE_REGISTER
Definition: DataDependenceEdge.hh:53
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
MoveNodeGroup::nodeCount
int nodeCount() const
Definition: MoveNodeGroup.cc:140
MoveNodeGroup::programOperationPtr
ProgramOperationPtr programOperationPtr() const
Definition: MoveNodeGroup.hh:75
MoveNode::isMove
bool isMove() const
MoveNodeGroup::operation_
ProgramOperationPtr operation_
in case this MNG contains strictly the nodes of a single operation this can be set to point to it (op...
Definition: MoveNodeGroup.hh:85
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
TTAProgram::Move::isControlFlowMove
bool isControlFlowMove() const
Definition: Move.cc:233
BoostGraph< MoveNode, DataDependenceEdge >::EdgeSet
std::set< DataDependenceEdge *, typename DataDependenceEdge ::Comparator > EdgeSet
Definition: BoostGraph.hh:87
MoveNodeGroup::isOperation
bool isOperation() const
Definition: MoveNodeGroup.hh:74
BoostGraph::maxSinkDistance
int maxSinkDistance(const GraphNode &node) const
MoveNode::isSourceOperation
bool isSourceOperation() const
Definition: MoveNode.cc:168
BoostGraph::hasNode
bool hasNode(const Node &) const
DataDependenceGraph::earliestCycle
int earliestCycle(const MoveNode &moveNode, unsigned int ii=UINT_MAX, bool ignoreRegWaRs=false, bool ignoreRegWaWs=false, bool ignoreGuards=false, bool ignoreFUDeps=false, bool ignoreSameOperationEdges=false, bool assumeBypassing=false) const
Definition: DataDependenceGraph.cc:388
BoostGraph::outEdges
virtual EdgeSet outEdges(const Node &node) const
MoveNode::move
TTAProgram::Move & move()