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

#include <SimpleBrokerDirector.hh>

Inheritance diagram for SimpleBrokerDirector:
Inheritance graph
Collaboration diagram for SimpleBrokerDirector:
Collaboration graph

Classes

struct  OriginalResources
 

Public Member Functions

 SimpleBrokerDirector (const TTAMachine::Machine &machine, AssignmentPlan &plan, unsigned int initiationInterval_)
 
virtual ~SimpleBrokerDirector ()
 
virtual bool canAssign (int cycle, MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
 
virtual bool canTransportImmediate (const MoveNode &node, const TTAMachine::Bus *preAssignedBus) const
 
virtual void assign (int cycle, MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) override
 
virtual void unassign (MoveNode &node) override
 
virtual int earliestCycle (MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
 
virtual int earliestCycle (int cycle, MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
 
virtual int latestCycle (MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
 
virtual int latestCycle (int cycle, MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
 
virtual bool hasGuard (const MoveNode &node) const
 
virtual TTAProgram::Instructioninstruction (int cycle) const override
 
virtual bool supportsExternalAssignments () const override
 
virtual int largestCycle () const override
 
virtual int smallestCycle () const override
 
virtual void loseInstructionOwnership (int cycle)
 
virtual std::shared_ptr< TTAProgram::TerminalImmediateimmediateValue (const MoveNode &)
 
virtual int immediateWriteCycle (const MoveNode &) const
 
virtual bool isTemplateAvailable (int, std::shared_ptr< TTAProgram::Immediate >) const
 
void setMaxCycle (unsigned int cycle)
 
void clearOldResources ()
 
void clear ()
 
void setDDG (const DataDependenceGraph *ddg)
 
void setCFG (const ControlFlowGraph *cfg)
 
void setBBN (const BasicBlockNode *bbn)
 
- Public Member Functions inherited from BrokerDirector
 BrokerDirector (const TTAMachine::Machine &machine, AssignmentPlan &plan)
 
virtual ~BrokerDirector ()
 
- Public Member Functions inherited from ResourceManager
 ResourceManager (const TTAMachine::Machine &machine)
 
virtual ~ResourceManager ()
 
const TTAMachine::Machinemachine () const
 

Private Member Functions

IUBrokerimmediateUnitBroker () const
 
ITemplateBrokerinstructionTemplateBroker () const
 
BusBrokerbusBroker () const
 
ExecutionPipelineBrokerexecutionPipelineBroker () const
 
unsigned int instructionIndex (unsigned int maxCycle) const
 

Private Attributes

std::map< const MoveNode *, OriginalResources *, MoveNode::ComparatororigResMap_
 
int knownMaxCycle_
 
int knownMinCycle_
 
unsigned int initiationInterval_
 
int schedulingWindow_
 the number of instructions to look back in the schedule for a free slot More...
 
std::map< int, int > moveCounts_
 
int busCount_
 

Additional Inherited Members

- Protected Attributes inherited from BrokerDirector
AssignmentPlanplan_
 Assignment plan. More...
 

Detailed Description

A simple broker director.

Definition at line 67 of file SimpleBrokerDirector.hh.

Constructor & Destructor Documentation

◆ SimpleBrokerDirector()

SimpleBrokerDirector::SimpleBrokerDirector ( const TTAMachine::Machine machine,
AssignmentPlan plan,
unsigned int  ii 
)

Constructor.

Parameters
machineTarget machine.
planResource assignment plan.
iiInitiation interval.

Definition at line 79 of file SimpleBrokerDirector.cc.

82  :
83  BrokerDirector(machine, plan),
86  knownMaxCycle_ = -1;
87  knownMinCycle_ = INT_MAX;
88 
89  if (Application::cmdLineOptions() != NULL) {
91  dynamic_cast<SchedulerCmdLineOptions*>(
93  schedulingWindow_ = options->schedulingWindowSize();
94  }
95 }

References Application::cmdLineOptions(), knownMaxCycle_, knownMinCycle_, options, and schedulingWindow_.

Here is the call graph for this function:

◆ ~SimpleBrokerDirector()

SimpleBrokerDirector::~SimpleBrokerDirector ( )
virtual

Destructor.

Definition at line 100 of file SimpleBrokerDirector.cc.

100  {
102 }

References MapTools::deleteAllValues(), and origResMap_.

Here is the call graph for this function:

Member Function Documentation

◆ assign()

void SimpleBrokerDirector::assign ( int  cycle,
MoveNode node,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
int  immWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1 
)
overridevirtual

Assign all resources needed by a given node starting from given cycle, and place the node in that cycle.

The manager keeps any pre-existing assignment and verifies that assigned resource is available. For all unassigned parts of the node, the resource manager looks for and then assigns the necessary resources. If the node is not fully assigned after the invocation of this operation, it means the assignment attempt failed.

Parameters
cycleCycle.
nodeNode.
Exceptions
InvalidDataexception if given node is already placed in a cycle different from given cycle.

Implements ResourceManager.

Definition at line 236 of file SimpleBrokerDirector.cc.

242  {
243  if (cycle < 0) {
244  throw InvalidData(__FILE__, __LINE__, __func__,
245  "Negative cycles not supported by RM");
246  }
247  if (cycle == INT_MAX) {
248  throw InvalidData(__FILE__, __LINE__, __func__,
249  "INT_MAX cycle not supported by RM");
250  }
251 
252  if (node.isPlaced() && node.cycle() != cycle) {
253  string msg =
254  "Node is already placed in a cycle different from given cycle.";
255  throw InvalidData(__FILE__, __LINE__, __func__, msg);
256  }
257 
258  if (node.isMove()) {
259  OriginalResources* oldRes = new OriginalResources(
260  node.move().source().copy(),
261  node.move().destination().copy(),
262  &node.move().bus(),
263  NULL,
264  false);
265  if (node.move().isUnconditional()) {
266  oldRes->isGuarded_ = false;
267  } else {
268  oldRes->isGuarded_ = true;
269  oldRes->guard_ = node.move().guard().copy();
270  }
271  origResMap_.insert(
272  std::pair<const MoveNode*, OriginalResources*>(&node, oldRes));
273  }
274 
275  bool success = plan_->tryCachedAssignment(
276  node, cycle, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
277 
278  plan_->setRequest(cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
279  assert( cycle != -1 );
280 
281  while (!success) {
283  if (&plan_->currentBroker() == &plan_->firstBroker()) {
284  string msg = "No resource assignment found for ";
285  msg += node.toString() + "!\n" ;
286  msg += "Instruction at cycle " + Conversion::toString(cycle);
287  msg += " is: ";
289  throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
290  } else {
291  plan_->backtrack();
292  }
293 
294  } else {
296  if (&plan_->currentBroker() == &plan_->lastBroker()) {
297  success = true;
298  } else {
299  plan_->advance();
300  }
301  }
302  }
303  if (knownMaxCycle_ < cycle) {
304  knownMaxCycle_ = cycle;
305  }
306  int guardSlack = std::max(0, node.guardLatency() -1);
307  if (knownMinCycle_ > cycle - guardSlack) {
308  knownMinCycle_ = std::max(cycle - guardSlack,0);
309 #ifdef DEBUG_RM
310  std::cerr << "Set known min cycle to" << knownMinCycle_ << std::endl;
311 #endif
312  assert(knownMinCycle_ >= 0);
313  }
314  if (node.isMove()) {
315  int iwc = immediateWriteCycle(node);
316  if (node.isSourceImmediateRegister() &&
317  knownMinCycle_ > iwc && iwc >= 0) {
318  knownMinCycle_ = iwc;
319 #ifdef DEBUG_RM
320  std::cerr << "Set known min cycle(2) to" << knownMinCycle_ << std::endl;
321 #endif
322  assert(knownMinCycle_ >= 0);
323  }
324  moveCounts_[instructionIndex(cycle)]++;
325  }
326 }

References __func__, AssignmentPlan::advance(), assert, AssignmentPlan::backtrack(), TTAProgram::Move::bus(), TTAProgram::MoveGuard::copy(), TTAProgram::Terminal::copy(), AssignmentPlan::currentBroker(), MoveNode::cycle(), TTAProgram::Move::destination(), POMDisassembler::disassemble(), AssignmentPlan::firstBroker(), TTAProgram::Move::guard(), SimpleBrokerDirector::OriginalResources::guard_, MoveNode::guardLatency(), immediateWriteCycle(), instruction(), instructionIndex(), SimpleBrokerDirector::OriginalResources::isGuarded_, MoveNode::isMove(), MoveNode::isPlaced(), MoveNode::isSourceImmediateRegister(), AssignmentPlan::isTestedAssignmentPossible(), TTAProgram::Move::isUnconditional(), knownMaxCycle_, knownMinCycle_, AssignmentPlan::lastBroker(), MoveNode::move(), moveCounts_, origResMap_, BrokerDirector::plan_, AssignmentPlan::setRequest(), TTAProgram::Move::source(), Conversion::toString(), MoveNode::toString(), AssignmentPlan::tryCachedAssignment(), and AssignmentPlan::tryNextAssignment().

Referenced by SimpleResourceManager::assign().

Here is the call graph for this function:

◆ busBroker()

BusBroker & SimpleBrokerDirector::busBroker ( ) const
private

Return the bus broker.

Returns
The bus broker.
Exceptions
InstanceNotFoundIf bus broker is not found.

Definition at line 737 of file SimpleBrokerDirector.cc.

737  {
738  ResourceBroker* broker = NULL;
739  for (int i = 0; i < plan_->brokerCount(); i++) {
740  broker = &plan_->broker(i);
741  if (broker->isBusBroker()) {
742  return dynamic_cast<BusBroker&>(*broker);
743  }
744  }
745  string msg = "Bus broker not found.";
746  throw InstanceNotFound(__FILE__, __LINE__, __func__, msg);
747 }

References __func__, AssignmentPlan::broker(), AssignmentPlan::brokerCount(), ResourceBroker::isBusBroker(), and BrokerDirector::plan_.

Referenced by canTransportImmediate(), hasGuard(), setBBN(), and setCFG().

Here is the call graph for this function:

◆ canAssign()

bool SimpleBrokerDirector::canAssign ( int  cycle,
MoveNode node,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
int  immWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1 
) const
overridevirtual

Return true if given node can be assigned without resource conflicts in given cycle.

For those parts of the node that have been already assigned to a resource, the manager simply keeps the assignment and verifies that the resource is available. For those parts that are not yet assigned, the resource manager looks for any compatible resource that could be assigned.

Parameters
cycleCycle.
nodeNode.
Returns
True if given node can be assigned without resource conflicts in given cycle, false otherwise.

Implements ResourceManager.

Definition at line 120 of file SimpleBrokerDirector.cc.

127  {
128 
129 #ifdef DEBUG_RM
130  std::cerr << "testing canassign, cycle: " << cycle <<
131  " node: " << node.toString() << std::endl;
132 #endif
133 
134  if (initiationInterval_ != 0 && cycle >= (int)(initiationInterval_ * 2)) {
135  return false;
136  }
137 
138  if (node.isScheduled()) {
139  debugLogRM("isScheduled == true");
140  return false;
141  }
142 
143  // fast way to reject some cases. Makes scheduling faster
144  // for bus-limited machines.
145  std::map<int,int>::const_iterator i = moveCounts_.find(cycle);
146  if (i != moveCounts_.end() && i->second >= busCount_) {
147  debugLogRM("instruction full!");
148  return false;
149  }
150 
151  OriginalResources* oldRes = NULL;
152  if (node.isMove()) {
153  // Store original resources of node
154  oldRes = new OriginalResources(
155  node.move().source().copy(),
156  node.move().destination().copy(),
157  &node.move().bus(),
158  NULL,
159  false);
160  if (node.move().isUnconditional()) {
161  oldRes->isGuarded_ = false;
162  } else {
163  oldRes->isGuarded_ = true;
164  oldRes->guard_ = node.move().guard().copy();
165  }
166  }
167  int placedInCycle = -1;
168  if (node.isPlaced()) {
169  placedInCycle = node.cycle();
170  }
171  plan_->setRequest(
172  cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
173 
174  bool success = false;
175  while (!success) {
176 #ifdef DEBUG_RM
178  << "current broker: "
179  << typeid(plan_->currentBroker()).name()
180  << std::endl;
181 #endif
183  if (&plan_->currentBroker() == &plan_->firstBroker()) {
185  debugLogRM("no assignment found");
186  success = false; // no assignment found
187  break;
188  } else {
189  debugLogRM("backtracking");
190  plan_->backtrack();
191  }
192  } else if (&plan_->currentBroker() == &plan_->lastBroker()) {
194  success = true;
195  } else {
197  plan_->advance();
198  }
199  }
200  if (node.isMove()) {
201  // restore original resources of node
202  node.move().setSource(oldRes->src_);
203  oldRes->src_ = NULL;
204 
205  node.move().setDestination(oldRes->dst_);
206  oldRes->dst_ = NULL;
207  node.move().setBus(*oldRes->bus_);
208  if (oldRes->isGuarded_) {
209  node.move().setGuard(oldRes->guard_);
210  oldRes->guard_ = NULL;
211  }
212  delete oldRes;
213  }
214  if (placedInCycle != -1) {
215  node.setCycle(placedInCycle);
216  }
217  return success;
218 }

References AssignmentPlan::advance(), AssignmentPlan::backtrack(), TTAProgram::Move::bus(), SimpleBrokerDirector::OriginalResources::bus_, busCount_, TTAProgram::MoveGuard::copy(), TTAProgram::Terminal::copy(), AssignmentPlan::currentBroker(), MoveNode::cycle(), debugLogRM, TTAProgram::Move::destination(), SimpleBrokerDirector::OriginalResources::dst_, AssignmentPlan::firstBroker(), TTAProgram::Move::guard(), SimpleBrokerDirector::OriginalResources::guard_, initiationInterval_, SimpleBrokerDirector::OriginalResources::isGuarded_, MoveNode::isMove(), MoveNode::isPlaced(), MoveNode::isScheduled(), AssignmentPlan::isTestedAssignmentPossible(), TTAProgram::Move::isUnconditional(), AssignmentPlan::lastBroker(), Application::logStream(), MoveNode::move(), moveCounts_, BrokerDirector::plan_, AssignmentPlan::resetAssignments(), TTAProgram::Move::setBus(), MoveNode::setCycle(), TTAProgram::Move::setDestination(), TTAProgram::Move::setGuard(), AssignmentPlan::setRequest(), TTAProgram::Move::setSource(), TTAProgram::Move::source(), SimpleBrokerDirector::OriginalResources::src_, MoveNode::toString(), and AssignmentPlan::tryNextAssignment().

Referenced by SimpleResourceManager::canAssign(), earliestCycle(), and latestCycle().

Here is the call graph for this function:

◆ canTransportImmediate()

bool SimpleBrokerDirector::canTransportImmediate ( const MoveNode node,
const TTAMachine::Bus preAssignedBus 
) const
virtual

Return true if immediate in given node can be transported by some bus in the machine.

Parameters
nodeNode that contains immediate read.
Returns
True if immediate in given node can be transported by some bus in the machine.
Exceptions
ModuleRunTimeErrorIf required resource brokers are not found in assignment plan.

Definition at line 680 of file SimpleBrokerDirector.cc.

681  {
682  try {
683  BusBroker& broker = busBroker();
684  return broker.canTransportImmediate(node, preAssignedBus);
685  } catch (const InstanceNotFound& e) {
686  throw ModuleRunTimeError(
687  __FILE__, __LINE__, __func__, e.errorMessage());
688  }
689 }

References __func__, busBroker(), BusBroker::canTransportImmediate(), and Exception::errorMessage().

Referenced by SimpleResourceManager::canTransportImmediate().

Here is the call graph for this function:

◆ clear()

void SimpleBrokerDirector::clear ( )

Clears the bookkeeping so that the same RM can be reused for different BB.

After this call the state of the RM should be identical to a new RM.

Definition at line 944 of file SimpleBrokerDirector.cc.

944  {
945  knownMaxCycle_ = -1;
946  knownMinCycle_ = INT_MAX;
947  moveCounts_.clear();
948  plan_->clear();
949 }

References AssignmentPlan::clear(), knownMaxCycle_, knownMinCycle_, moveCounts_, and BrokerDirector::plan_.

Referenced by SimpleResourceManager::clear().

Here is the call graph for this function:

◆ clearOldResources()

void SimpleBrokerDirector::clearOldResources ( )

Clears bookkeeping which is needed for unassigning previously assigned moves. After this call these cannot be unassigned, but new moves which are assigned after this call can still be unassigned.

Definition at line 913 of file SimpleBrokerDirector.cc.

References ITemplateBroker::clearOldResources(), IUBroker::clearOldResources(), AssocTools::deleteAllValues(), immediateUnitBroker(), instructionTemplateBroker(), and origResMap_.

Referenced by SimpleResourceManager::clear(), and SimpleResourceManager::clearOldResources().

Here is the call graph for this function:

◆ earliestCycle() [1/2]

int SimpleBrokerDirector::earliestCycle ( int  cycle,
MoveNode node,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
int  immWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1 
) const
overridevirtual

Return the earliest cycle starting from the given cycle in which required resources can be assigned to given node.

If the node is partially assigned, the manager keeps existing assignments. This means that a client can apply arbitrary constraints to resource allocation.

Parameters
cycleCycle to start from.
nodeMoveNode.
busif not null, bus that has to be used.
srcFUif not null, srcFu that has to be used.
dstFUif not null, dstFU that has to be used.
immWriteCycleif not -1 and src is imm, write cycle of limm.
Returns
The earliest cycle starting from the given cycle in which required resources can be assigned to given node. Returns -1 if assignment is not possible starting from given cycle.

Implements ResourceManager.

Definition at line 487 of file SimpleBrokerDirector.cc.

493  {
494 
495  // limit the scheduling window.
496  // makes code for minimal.adf schedule in reasonable time
497  if (cycle < knownMaxCycle_ - schedulingWindow_) {
499  }
500  // TODO: is there need for similar test for knownMinCycle as well?
501 
502  int minCycle = executionPipelineBroker().earliestCycle(
503  cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
504 
505  if (minCycle == -1) {
506  // No assignment possible
507  debugLogRM("No assignment possible from executionPipelineBroker");
508  return -1;
509  }
510 
511  minCycle = std::max(minCycle, cycle);
512  int lastCycleToTest;
513  if (initiationInterval_ != 0) {
514  lastCycleToTest = cycle + initiationInterval_ - 2;
515  } else {
516  lastCycleToTest = largestCycle();
517  }
518 
519  while (!canAssign(minCycle, node, bus, srcFU, dstFU, immWriteCycle, immu,
520  immRegIndex)) {
521  if (minCycle > lastCycleToTest + 1) {
522  // Even on empty instruction it is not possible to assign
523  debugLogRM(
524  "A problem with ADF, cannot schedule even on "
525  "an empty instruction.");
526  return -1;
527  }
528  // find next cycle where exec pipeline could be free,
529  // do not test every cycle with canassign.
531  minCycle + 1, node, bus, srcFU, dstFU, immWriteCycle, immu,
532  immRegIndex);
533  if (minCycle == -1) {
534  debugLogRM("No assignment possible due to executionPipelineBroker.");
535  return -1;
536  }
537  }
538  return minCycle;
539 }

References canAssign(), debugLogRM, ExecutionPipelineBroker::earliestCycle(), executionPipelineBroker(), initiationInterval_, knownMaxCycle_, largestCycle(), and schedulingWindow_.

Here is the call graph for this function:

◆ earliestCycle() [2/2]

int SimpleBrokerDirector::earliestCycle ( MoveNode move,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
int  immWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1 
) const
overridevirtual

Return the earliest cycle in the scope where all required resources can be assigned to the given node.

If the node is partially assigned, the manager keeps existing assignments. This means that a client can apply arbitrary constraints to resource allocation.

Parameters
moveThe move.
busif not null, bus that has to be used.
srcFUif not null, srcFu that has to be used.
dstFUif not null, dstFU that has to be used.
immWriteCycleif not -1 and src is imm, write cycle of limm.
Returns
The earliest cycle in the scope where all required resources can be assigned to the given node. Returns -1 if assignment is not possible starting from given cycle.

Implements ResourceManager.

Definition at line 457 of file SimpleBrokerDirector.cc.

463  {
464  return earliestCycle(
465  0, move, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
466 }

Referenced by SimpleResourceManager::earliestCycle().

◆ executionPipelineBroker()

ExecutionPipelineBroker & SimpleBrokerDirector::executionPipelineBroker ( ) const
private

Return the execution pipeline broker.

Returns
The execution pipeline broker.
Exceptions
InstanceNotFoundIf execution pipeline broker is not found.

Definition at line 756 of file SimpleBrokerDirector.cc.

757 {
758  ResourceBroker* broker = NULL;
759  for (int i = 0; i < plan_->brokerCount(); i++) {
760  broker = &plan_->broker(i);
761  if (broker->isExecutionPipelineBroker()) {
762  return dynamic_cast<ExecutionPipelineBroker&>(*broker);
763  }
764  }
765  string msg = "Execution Pipeline broker not found.";
766  throw InstanceNotFound(__FILE__, __LINE__, __func__, msg);
767 }

References __func__, AssignmentPlan::broker(), AssignmentPlan::brokerCount(), ResourceBroker::isExecutionPipelineBroker(), and BrokerDirector::plan_.

Referenced by earliestCycle(), largestCycle(), latestCycle(), setDDG(), and setMaxCycle().

Here is the call graph for this function:

◆ hasGuard()

bool SimpleBrokerDirector::hasGuard ( const MoveNode node) const
virtual

Tests if any of a buses of machine supports guard needed by a node. Should always return true! Otherwise, scheduler generated code for different machine.

Parameters
nodeMoveNode to test
Returns
true if any of buses supports guard needed by node, or if move is not conditional.

Definition at line 811 of file SimpleBrokerDirector.cc.

811  {
812  Move& move = const_cast<MoveNode&>(node).move();
813  if (move.isUnconditional()) {
814  return true;
815  }
816  return busBroker().hasGuard(node);
817 }

References busBroker(), BusBroker::hasGuard(), and TTAProgram::Move::isUnconditional().

Referenced by SimpleResourceManager::hasGuard().

Here is the call graph for this function:

◆ immediateUnitBroker()

IUBroker & SimpleBrokerDirector::immediateUnitBroker ( ) const
private

Return the immediate unit broker.

Returns
The immediate unit broker.
Exceptions
InstanceNotFoundIf immediate unit broker is not found.

Definition at line 698 of file SimpleBrokerDirector.cc.

698  {
699  ResourceBroker* broker = NULL;
700  for (int i = 0; i < plan_->brokerCount(); i++) {
701  broker = &plan_->broker(i);
702  if (broker->isIUBroker()) {
703  return dynamic_cast<IUBroker&>(*broker);
704  }
705  }
706  string msg = "Immediate unit broker not found.";
707  throw InstanceNotFound(__FILE__, __LINE__, __func__, msg);
708 }

References __func__, AssignmentPlan::broker(), AssignmentPlan::brokerCount(), ResourceBroker::isIUBroker(), and BrokerDirector::plan_.

Referenced by clearOldResources(), immediateValue(), and immediateWriteCycle().

Here is the call graph for this function:

◆ immediateValue()

std::shared_ptr< TTAProgram::TerminalImmediate > SimpleBrokerDirector::immediateValue ( const MoveNode node)
virtual

Finds the original terminal with value of immediate.

Parameters
nodenode with immediate register source
Returns
terminal with immediate value

Definition at line 883 of file SimpleBrokerDirector.cc.

883  {
884  return immediateUnitBroker().immediateValue(node);
885 }

References immediateUnitBroker(), and IUBroker::immediateValue().

Referenced by SimpleResourceManager::immediateValue().

Here is the call graph for this function:

◆ immediateWriteCycle()

int SimpleBrokerDirector::immediateWriteCycle ( const MoveNode node) const
virtual

Finds cycle in which the immediate that is read by node is written.

Parameters
nodewith source immediate register
Returns
cycle in which immediate is written to register

Definition at line 894 of file SimpleBrokerDirector.cc.

894  {
896 }

References immediateUnitBroker(), and IUBroker::immediateWriteCycle().

Referenced by assign(), SimpleResourceManager::immediateWriteCycle(), and unassign().

Here is the call graph for this function:

◆ instruction()

TTAProgram::Instruction * SimpleBrokerDirector::instruction ( int  cycle) const
overridevirtual

Returns a copy of instruction that holds a moves for given cycle and has correct template set.

Parameters
cycleCycle for which to get instruction
Returns
the Instruction with moves and template assigned
Note
This method should be called when whole scope is scheduled

Implements ResourceManager.

Definition at line 827 of file SimpleBrokerDirector.cc.

827  {
828  return instructionTemplateBroker().instruction(cycle);
829 }

References ITemplateBroker::instruction(), and instructionTemplateBroker().

Referenced by assign(), SimpleResourceManager::instruction(), and unassign().

Here is the call graph for this function:

◆ instructionIndex()

unsigned int SimpleBrokerDirector::instructionIndex ( unsigned int  cycle) const
private

Return the instruction index corresponding to cycle.

If modulo scheduling is not used (ie. initiation interval is 0), then index is equal to cycle.

Parameters
cycleCycle to get instruction index.
Returns
Return the instruction index for cycle.

Definition at line 929 of file SimpleBrokerDirector.cc.

929  {
930 
931  if (initiationInterval_ != 0) {
932  return cycle % initiationInterval_;
933  } else {
934  return cycle;
935  }
936 }

References initiationInterval_.

Referenced by assign(), and unassign().

◆ instructionTemplateBroker()

ITemplateBroker & SimpleBrokerDirector::instructionTemplateBroker ( ) const
private

Return the instruction template broker.

Returns
The instruction template broker.
Exceptions
InstanceNotFoundIf instruction template broker is not found.

Definition at line 717 of file SimpleBrokerDirector.cc.

717  {
718 
719  ResourceBroker* broker = NULL;
720  for (int i = 0; i < plan_->brokerCount(); i++) {
721  broker = &plan_->broker(i);
722  if (broker->isITemplateBroker()) {
723  return dynamic_cast<ITemplateBroker&>(*broker);
724  }
725  }
726  string msg = "Instruction template broker not found.";
727  throw InstanceNotFound(__FILE__, __LINE__, __func__, msg);
728 }

References __func__, AssignmentPlan::broker(), AssignmentPlan::brokerCount(), ResourceBroker::isITemplateBroker(), and BrokerDirector::plan_.

Referenced by clearOldResources(), instruction(), isTemplateAvailable(), and loseInstructionOwnership().

Here is the call graph for this function:

◆ isTemplateAvailable()

bool SimpleBrokerDirector::isTemplateAvailable ( int  defCycle,
std::shared_ptr< TTAProgram::Immediate immediate 
) const
virtual

Definition at line 899 of file SimpleBrokerDirector.cc.

901  {
902 
904  defCycle, immediate);
905 }

References instructionTemplateBroker(), and ITemplateBroker::isTemplateAvailable().

Referenced by SimpleResourceManager::isTemplateAvailable().

Here is the call graph for this function:

◆ largestCycle()

int SimpleBrokerDirector::largestCycle ( ) const
overridevirtual

Returns largest cycle known to be used by any of the resources.

Returns
Largest cycle resource manager assigned any resource to.

Implements ResourceManager.

Definition at line 848 of file SimpleBrokerDirector.cc.

848  {
849  return std::max(knownMaxCycle_,
850  executionPipelineBroker().highestKnownCycle());
851 }

References executionPipelineBroker(), and knownMaxCycle_.

Referenced by earliestCycle(), and SimpleResourceManager::largestCycle().

Here is the call graph for this function:

◆ latestCycle() [1/2]

int SimpleBrokerDirector::latestCycle ( int  cycle,
MoveNode node,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
int  immWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1 
) const
overridevirtual

Return the latest cycle starting from the given cycle in which required resources can be assigned to given node.

If the node is partially assigned, the manager keeps existing assignments. This means that a client can apply arbitrary constraints to resource allocation.

Parameters
cycleCycle to start from.
nodeNode.
busif not null, bus that has to be used.
srcFUif not null, srcFu that has to be used.
dstFUif not null, dstFU that has to be used.
immWriteCycleif not -1 and src is imm, write cycle of limm.
Returns
The latest cycle starting from the given cycle in which required resources can be assigned to given node. In case assignment is not possible for given arguments returns -1. Returns INT_MAX if there is no upper boundary for assignment.

Implements ResourceManager.

Definition at line 591 of file SimpleBrokerDirector.cc.

597  {
598 
599 #ifdef DEBUG_RM
600  std::cerr << "\t\t\t\tLatest cycle called with cycle: " << cycle << std::endl;
601 #endif
602  int maxCycle = executionPipelineBroker().latestCycle(
603  cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
604 #ifdef DEBUG_RM
605  std::cerr << "\t\t\t\t\tmaxCycle from exec pipeline: " << maxCycle << std::endl;
606 #endif
607  if (maxCycle == -1) {
608  // Assignment not possible at all
609  return maxCycle;
610  }
611  if (maxCycle == INT_MAX || maxCycle == INT_MAX - 1) {
612  if (cycle == INT_MAX) {
613  // There is no upper limit for assignment and it was not set
614  // either
615  return cycle;
616  }
617  }
618  if (maxCycle > cycle) {
619  maxCycle = cycle;
620  }
621  int lastCycleToTest = -1;
622  lastCycleToTest =
623  std::max(knownMaxCycle_,
624  executionPipelineBroker().highestKnownCycle());
625  if (lastCycleToTest == 0) {
626  lastCycleToTest = cycle;
627  }
628 #ifdef DEBUG_RM
629  std::cerr << "\t\t\t\t\tLast cycle to test: " << lastCycleToTest << std::endl;
630 #endif
631  // Define earliest cycle where to finish testing. If the move can not
632  // be scheduled after this cycle, it can not be scheduled at all.
633 
634  int knownMinCycle = knownMinCycle_ == INT_MAX ? cycle :
635  std::min(cycle,knownMinCycle_);
636  int earliestCycleLimit =
637  (knownMinCycle > executionPipelineBroker().longestLatency() + 1) ?
638  knownMinCycle - executionPipelineBroker().longestLatency() : 0;
639 
640 #ifdef DEBUG_RM
641  std::cerr << "\tknown min cycle: " << knownMinCycle << std::endl;
642  std::cerr << "\t\t\t\t\tEarlist limit: " << earliestCycleLimit << std::endl;
643 #endif
644 
645  if (maxCycle <= lastCycleToTest) {
646  for (int i = maxCycle; i >= earliestCycleLimit; i--) {
647  if (canAssign(i, node, bus, srcFU, dstFU, immWriteCycle, immu,
648  immRegIndex)) {
649  return i;
650  }
651  }
652  } else {
653  if (maxCycle > lastCycleToTest) {
654  if (canAssign(maxCycle, node, bus, srcFU, dstFU, immWriteCycle,
655  immu, immRegIndex)) {
656  return maxCycle;
657  }
658  }
659  for (int i = lastCycleToTest; i >= earliestCycleLimit; i--) {
660  if (canAssign(i, node, bus, srcFU, dstFU, immWriteCycle, immu,
661  immRegIndex)) {
662  return i;
663  }
664  }
665  }
666  return -1;
667 }

References canAssign(), executionPipelineBroker(), knownMaxCycle_, knownMinCycle_, ExecutionPipelineBroker::latestCycle(), and ExecutionPipelineBroker::longestLatency().

Here is the call graph for this function:

◆ latestCycle() [2/2]

int SimpleBrokerDirector::latestCycle ( MoveNode node,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
int  immWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1 
) const
overridevirtual

Return the latest cycle in the scope where all required resources can be assigned to the given node.

If the node is partially assigned, the manager keeps existing assignments. This means that a client can apply arbitrary constraints to resource allocation.

Parameters
nodeNode.
busif not null, bus that has to be used.
srcFUif not null, srcFu that has to be used.
dstFUif not null, dstFU that has to be used.
immWriteCycleif not -1 and src is imm, write cycle of limm.
Returns
The latest cycle in the scope where all required resources can be assigned to the given node. In case assignment is not possible for given arguments returns -1. Returns INT_MAX if there is no upper boundary for assignment.

Implements ResourceManager.

Definition at line 560 of file SimpleBrokerDirector.cc.

566  {
567  return latestCycle(
568  INT_MAX, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
569 }

Referenced by SimpleResourceManager::latestCycle().

◆ loseInstructionOwnership()

void SimpleBrokerDirector::loseInstructionOwnership ( int  cycle)
virtual

Transfer the instruction ownership away from this object.

If this method is called, resource manager does not delete it's instructions when it it destroyed.

Definition at line 872 of file SimpleBrokerDirector.cc.

872  {
874 }

References instructionTemplateBroker(), and ITemplateBroker::loseInstructionOwnership().

Referenced by SimpleResourceManager::loseInstructionOwnership().

Here is the call graph for this function:

◆ setBBN()

void SimpleBrokerDirector::setBBN ( const BasicBlockNode bbn)

Definition at line 962 of file SimpleBrokerDirector.cc.

962  {
963  busBroker().setBBN(bbn);
964 }

References busBroker(), and BusBroker::setBBN().

Referenced by SimpleResourceManager::setBBN().

Here is the call graph for this function:

◆ setCFG()

void SimpleBrokerDirector::setCFG ( const ControlFlowGraph cfg)

Definition at line 957 of file SimpleBrokerDirector.cc.

957  {
958  busBroker().setCFG(cfg);
959 }

References busBroker(), and BusBroker::setCFG().

Referenced by SimpleResourceManager::setCFG().

Here is the call graph for this function:

◆ setDDG()

void SimpleBrokerDirector::setDDG ( const DataDependenceGraph ddg)

Definition at line 952 of file SimpleBrokerDirector.cc.

952  {
954 }

References executionPipelineBroker(), and ExecutionPipelineBroker::setDDG().

Referenced by SimpleResourceManager::setDDG().

Here is the call graph for this function:

◆ setMaxCycle()

void SimpleBrokerDirector::setMaxCycle ( unsigned int  cycle)

Definition at line 967 of file SimpleBrokerDirector.cc.

967  {
969 }

References executionPipelineBroker(), and ExecutionPipelineBroker::setMaxCycle().

Referenced by SimpleResourceManager::setMaxCycle().

Here is the call graph for this function:

◆ smallestCycle()

int SimpleBrokerDirector::smallestCycle ( ) const
overridevirtual

Returns smallest cycle known to be used by any of the resources.

Returns
Smallest cycle resource manager assigned any resource to.

Implements ResourceManager.

Definition at line 859 of file SimpleBrokerDirector.cc.

859  {
860  // No need to check the execution pipeline resource here
861  // since there are no negative pipelines
862  return knownMinCycle_;
863 }

References knownMinCycle_.

Referenced by SimpleResourceManager::smallestCycle().

◆ supportsExternalAssignments()

bool SimpleBrokerDirector::supportsExternalAssignments ( ) const
overridevirtual

Defines if Broker Director implementation supports node with resources pre assigned by clients.

Returns
For SimpleBrokerDirector allways false.

Implements ResourceManager.

Definition at line 838 of file SimpleBrokerDirector.cc.

838  {
839  return false;
840 }

Referenced by SimpleResourceManager::supportsExternalAssignments().

◆ unassign()

void SimpleBrokerDirector::unassign ( MoveNode node)
overridevirtual

Free all resource assignments of the given node.

If the node is only partially assigned, the resource manager ignores those parts of the node that are already unassigned.

Parameters
nodeNode to unassign.
Exceptions
InvalidDataIf the given node is not placed in any cycle. Assigned but not placed nodes are not considered by the resource manager.

Implements ResourceManager.

Definition at line 340 of file SimpleBrokerDirector.cc.

340  {
341 
342  if (!node.isPlaced()) {
343  string msg = "Node " + node.toString();
344  msg += " is not placed in any cycle.";
345  throw InvalidData(__FILE__, __LINE__, __func__, msg);
346  }
347 
348  int nodeCycle = node.cycle();
349 
350  bool minCycleImmSrc = false;
351  if (node.isMove()) {
352  if (node.isSourceImmediateRegister() &&
354  minCycleImmSrc = true;
355  }
356  }
357 
358  moveCounts_[instructionIndex(nodeCycle)]--;
359 
360  plan_->clearCache();
361  plan_->resetAssignments(node);
362 
363  if (node.isMove()) {
364  if (!MapTools::containsKey(origResMap_, &node)) {
365  abortWithError("Original resources lost!");
366  }
367  OriginalResources* oldRes = MapTools::valueForKey<OriginalResources*>(
368  origResMap_, &node);
369 
370  // restore original resources of node
371  if (!node.move().source().isGPR()) {
372  node.move().setSource(oldRes->src_);
373  } else {
374  delete oldRes->src_;
375  }
376  oldRes->src_ = NULL;
377  if (!node.move().destination().isGPR()) {
378  node.move().setDestination(oldRes->dst_);
379  } else {
380  delete oldRes->dst_;
381  }
382  oldRes->dst_ = NULL;
383  node.move().setBus(*oldRes->bus_);
384  if (oldRes->isGuarded_) {
385  node.move().setGuard(oldRes->guard_);
386  oldRes->guard_ = NULL;
387  }
388  delete oldRes;
389  origResMap_.erase(&node);
390  }
391  // if unassigned move was known to be in highest cycle assigned so far
392  // tries to decrease highest cycle checking for assigned moves and
393  // immediates
394  int cycleCounter = nodeCycle;
395  if (cycleCounter == knownMaxCycle_) {
396  while(cycleCounter >= knownMinCycle_) {
397  // this may memory leak
398  Instruction* tempIns = instruction(cycleCounter);
399  if (tempIns->moveCount() == 0 && tempIns->immediateCount() == 0) {
400  knownMaxCycle_--;
401  cycleCounter--;
402  } else {
403  break;
404  }
405  }
407  knownMinCycle_ = INT_MAX;
408  knownMaxCycle_ = -1;
409  }
410  }
411  // if unassigned move was known to be in smallest cycle assigned so far
412  // tries to increase smallest cycle checking for assigned moves and
413  // immediates
414  int guardSlack = std::max(0, node.guardLatency() -1);
415  cycleCounter = knownMinCycle_;
416  if (cycleCounter == nodeCycle - guardSlack || minCycleImmSrc) {
417  while(cycleCounter <= knownMaxCycle_) {
418  // this may memory leak
419  Instruction* tempIns = instruction(cycleCounter);
420  if (tempIns->moveCount() == 0 && tempIns->immediateCount() == 0) {
421  knownMinCycle_++;
422  cycleCounter++;
423  } else {
424  for (int i = 0; i < tempIns->moveCount(); i++) {
425  int guardSlack = std::max(0, tempIns->move(i).guardLatency() -1);
426  if (cycleCounter - guardSlack < knownMinCycle_) {
427  knownMinCycle_ = cycleCounter - guardSlack;
428 #ifdef DEBUG_RM
429  std::cerr << "Set known min cycle(3) to" << knownMinCycle_ << std::endl;
430 #endif
431  }
432  }
433  break;
434  }
435  }
436  }
437 }

References __func__, abortWithError, SimpleBrokerDirector::OriginalResources::bus_, AssignmentPlan::clearCache(), MapTools::containsKey(), MoveNode::cycle(), TTAProgram::Move::destination(), SimpleBrokerDirector::OriginalResources::dst_, SimpleBrokerDirector::OriginalResources::guard_, TTAProgram::Move::guardLatency(), MoveNode::guardLatency(), TTAProgram::Instruction::immediateCount(), immediateWriteCycle(), instruction(), instructionIndex(), TTAProgram::Terminal::isGPR(), SimpleBrokerDirector::OriginalResources::isGuarded_, MoveNode::isMove(), MoveNode::isPlaced(), MoveNode::isSourceImmediateRegister(), knownMaxCycle_, knownMinCycle_, TTAProgram::Instruction::move(), MoveNode::move(), TTAProgram::Instruction::moveCount(), moveCounts_, origResMap_, BrokerDirector::plan_, AssignmentPlan::resetAssignments(), TTAProgram::Move::setBus(), TTAProgram::Move::setDestination(), TTAProgram::Move::setGuard(), TTAProgram::Move::setSource(), TTAProgram::Move::source(), SimpleBrokerDirector::OriginalResources::src_, and MoveNode::toString().

Referenced by SimpleResourceManager::unassign().

Here is the call graph for this function:

Member Data Documentation

◆ busCount_

int SimpleBrokerDirector::busCount_
private

Definition at line 181 of file SimpleBrokerDirector.hh.

Referenced by canAssign().

◆ initiationInterval_

unsigned int SimpleBrokerDirector::initiationInterval_
private

Definition at line 173 of file SimpleBrokerDirector.hh.

Referenced by canAssign(), earliestCycle(), and instructionIndex().

◆ knownMaxCycle_

int SimpleBrokerDirector::knownMaxCycle_
private

◆ knownMinCycle_

int SimpleBrokerDirector::knownMinCycle_
private

◆ moveCounts_

std::map<int,int> SimpleBrokerDirector::moveCounts_
private

Definition at line 180 of file SimpleBrokerDirector.hh.

Referenced by assign(), canAssign(), clear(), and unassign().

◆ origResMap_

std::map<const MoveNode*, OriginalResources*, MoveNode::Comparator> SimpleBrokerDirector::origResMap_
private

◆ schedulingWindow_

int SimpleBrokerDirector::schedulingWindow_
private

the number of instructions to look back in the schedule for a free slot

Definition at line 177 of file SimpleBrokerDirector.hh.

Referenced by earliestCycle(), and SimpleBrokerDirector().


The documentation for this class was generated from the following files:
ITemplateBroker::isTemplateAvailable
virtual bool isTemplateAvailable(int, std::shared_ptr< TTAProgram::Immediate >) const
Definition: ITemplateBroker.cc:948
IUBroker::clearOldResources
void clearOldResources()
Definition: IUBroker.cc:598
ExecutionPipelineBroker::latestCycle
virtual int latestCycle(int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: ExecutionPipelineBroker.cc:193
AssignmentPlan::tryCachedAssignment
bool tryCachedAssignment(MoveNode &node, int cycle, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex)
Definition: AssignmentPlan.cc:310
SimpleBrokerDirector::busBroker
BusBroker & busBroker() const
Definition: SimpleBrokerDirector.cc:737
SimpleBrokerDirector::latestCycle
virtual int latestCycle(MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
Definition: SimpleBrokerDirector.cc:560
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
TTAProgram::Instruction::move
Move & move(int i) const
Definition: Instruction.cc:193
TTAProgram::Move::guardLatency
int guardLatency() const
Definition: Move.cc:503
SimpleBrokerDirector::initiationInterval_
unsigned int initiationInterval_
Definition: SimpleBrokerDirector.hh:173
TTAProgram::Instruction
Definition: Instruction.hh:57
TTAProgram::Move::isUnconditional
bool isUnconditional() const
Definition: Move.cc:154
SimpleBrokerDirector::canAssign
virtual bool canAssign(int cycle, MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
Definition: SimpleBrokerDirector.cc:120
TTAProgram::Move::destination
Terminal & destination() const
Definition: Move.cc:323
BrokerDirector::plan_
AssignmentPlan * plan_
Assignment plan.
Definition: BrokerDirector.hh:49
ResourceBroker
Definition: ResourceBroker.hh:61
MapTools::deleteAllValues
static void deleteAllValues(MapType &aMap)
BrokerDirector::BrokerDirector
BrokerDirector(const TTAMachine::Machine &machine, AssignmentPlan &plan)
Definition: BrokerDirector.cc:41
TTAProgram::Move::bus
const TTAMachine::Bus & bus() const
Definition: Move.cc:373
TTAProgram::Move::setGuard
void setGuard(MoveGuard *guard)
Definition: Move.cc:360
MoveNode
Definition: MoveNode.hh:65
ITemplateBroker
Definition: ITemplateBroker.hh:65
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
TTAMachine::Machine::Navigator::count
int count() const
AssignmentPlan::setRequest
void setRequest(int cycle, MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex)
Definition: AssignmentPlan.cc:81
SimpleBrokerDirector::schedulingWindow_
int schedulingWindow_
the number of instructions to look back in the schedule for a free slot
Definition: SimpleBrokerDirector.hh:177
SchedulerCmdLineOptions
Definition: SchedulerCmdLineOptions.hh:45
Conversion::toString
static std::string toString(const T &source)
BusBroker::hasGuard
virtual bool hasGuard(const MoveNode &node) const
Definition: BusBroker.cc:868
SimpleBrokerDirector::instructionTemplateBroker
ITemplateBroker & instructionTemplateBroker() const
Definition: SimpleBrokerDirector.cc:717
AssignmentPlan::lastBroker
ResourceBroker & lastBroker()
Definition: AssignmentPlan.cc:164
SimpleBrokerDirector::busCount_
int busCount_
Definition: SimpleBrokerDirector.hh:181
MoveNode::isSourceImmediateRegister
bool isSourceImmediateRegister() const
Definition: MoveNode.cc:223
debugLogRM
#define debugLogRM(__X)
Definition: ResourceManager.hh:123
MoveNode::isPlaced
bool isPlaced() const
Definition: MoveNode.cc:352
assert
#define assert(condition)
Definition: Application.hh:86
ExecutionPipelineBroker::setMaxCycle
virtual void setMaxCycle(unsigned int maxCycle) override
Definition: ExecutionPipelineBroker.cc:74
BusBroker
Definition: BusBroker.hh:60
ITemplateBroker::loseInstructionOwnership
virtual void loseInstructionOwnership(int cycle)
Definition: ITemplateBroker.cc:908
MoveNode::isMove
bool isMove() const
TTAProgram::Move::setDestination
void setDestination(Terminal *dst)
Definition: Move.cc:333
AssignmentPlan::isTestedAssignmentPossible
bool isTestedAssignmentPossible()
Definition: AssignmentPlan.cc:263
AssignmentPlan::firstBroker
ResourceBroker & firstBroker()
Definition: AssignmentPlan.cc:130
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
SimpleBrokerDirector::moveCounts_
std::map< int, int > moveCounts_
Definition: SimpleBrokerDirector.hh:180
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
MoveNode::guardLatency
int guardLatency() const
Definition: MoveNode.cc:779
ExecutionPipelineBroker::longestLatency
virtual int longestLatency() const
Definition: ExecutionPipelineBroker.hh:88
InvalidData
Definition: Exception.hh:149
SimpleBrokerDirector::earliestCycle
virtual int earliestCycle(MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
Definition: SimpleBrokerDirector.cc:457
BusBroker::setBBN
void setBBN(const BasicBlockNode *bbn)
Definition: BusBroker.hh:136
SimpleBrokerDirector::largestCycle
virtual int largestCycle() const override
Definition: SimpleBrokerDirector.cc:848
SimpleBrokerDirector::executionPipelineBroker
ExecutionPipelineBroker & executionPipelineBroker() const
Definition: SimpleBrokerDirector.cc:756
TTAProgram::Move::guard
MoveGuard & guard() const
Definition: Move.cc:345
Application::cmdLineOptions
static CmdLineOptions * cmdLineOptions()
Definition: Application.cc:397
__func__
#define __func__
Definition: Application.hh:67
AssignmentPlan::currentBroker
ResourceBroker & currentBroker()
Definition: AssignmentPlan.cc:179
AssignmentPlan::clearCache
void clearCache()
Definition: AssignmentPlan.cc:464
TTAProgram::Terminal::isGPR
virtual bool isGPR() const
Definition: Terminal.cc:107
AssignmentPlan::backtrack
void backtrack()
Definition: AssignmentPlan.cc:211
ResourceBroker::isITemplateBroker
virtual bool isITemplateBroker() const
Definition: ResourceBroker.cc:308
TTAProgram::Move
Definition: Move.hh:55
ModuleRunTimeError
Definition: Exception.hh:1043
AssignmentPlan::resetAssignments
void resetAssignments()
Definition: AssignmentPlan.cc:384
SimpleBrokerDirector::instructionIndex
unsigned int instructionIndex(unsigned int maxCycle) const
Definition: SimpleBrokerDirector.cc:929
AssignmentPlan::broker
ResourceBroker & broker(int index) const
Definition: AssignmentPlan.cc:436
AssignmentPlan::advance
void advance()
Definition: AssignmentPlan.cc:191
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
SimpleBrokerDirector::immediateWriteCycle
virtual int immediateWriteCycle(const MoveNode &) const
Definition: SimpleBrokerDirector.cc:894
ResourceBroker::isExecutionPipelineBroker
virtual bool isExecutionPipelineBroker() const
Definition: ResourceBroker.cc:318
SimpleBrokerDirector::immediateUnitBroker
IUBroker & immediateUnitBroker() const
Definition: SimpleBrokerDirector.cc:698
options
static MachInfoCmdLineOptions options
Definition: MachInfo.cc:46
ResourceBroker::isIUBroker
virtual bool isIUBroker() const
Definition: ResourceBroker.cc:313
MoveNode::move
TTAProgram::Move & move()
MoveNode::setCycle
void setCycle(const int newcycle)
Definition: MoveNode.cc:503
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
POMDisassembler::disassemble
static std::string disassemble(const TTAProgram::Move &move)
Definition: POMDisassembler.cc:629
AssignmentPlan::tryNextAssignment
void tryNextAssignment()
Definition: AssignmentPlan.cc:237
ResourceManager::machine
const TTAMachine::Machine & machine() const
Definition: ResourceManager.cc:56
ITemplateBroker::instruction
virtual TTAProgram::Instruction * instruction(int cycle)
Definition: ITemplateBroker.cc:693
SimpleBrokerDirector::instruction
virtual TTAProgram::Instruction * instruction(int cycle) const override
Definition: SimpleBrokerDirector.cc:827
BusBroker::canTransportImmediate
virtual bool canTransportImmediate(const MoveNode &node, const TTAMachine::Bus *preAssigndBus) const
Definition: BusBroker.cc:756
TTAProgram::Instruction::immediateCount
int immediateCount() const
Definition: Instruction.cc:267
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
TTAProgram::Terminal::copy
virtual Terminal * copy() const =0
AssignmentPlan::brokerCount
int brokerCount() const
Definition: AssignmentPlan.cc:424
IUBroker::immediateValue
virtual std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue(const MoveNode &node) const
Definition: IUBroker.cc:555
MoveNode::isScheduled
bool isScheduled() const
Definition: MoveNode.cc:409
BusBroker::setCFG
void setCFG(const ControlFlowGraph *cfg)
Definition: BusBroker.hh:135
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
ExecutionPipelineBroker::setDDG
void setDDG(const DataDependenceGraph *ddg)
Definition: ExecutionPipelineBroker.cc:806
ExecutionPipelineBroker::earliestCycle
virtual int earliestCycle(int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: ExecutionPipelineBroker.cc:137
TTAProgram::MoveGuard::copy
MoveGuard * copy() const
Definition: MoveGuard.cc:96
AssignmentPlan::clear
void clear()
Definition: AssignmentPlan.cc:446
SimpleBrokerDirector::origResMap_
std::map< const MoveNode *, OriginalResources *, MoveNode::Comparator > origResMap_
Definition: SimpleBrokerDirector.hh:170
ITemplateBroker::clearOldResources
void clearOldResources()
Definition: ITemplateBroker.cc:966
SimpleBrokerDirector::knownMinCycle_
int knownMinCycle_
Definition: SimpleBrokerDirector.hh:172
TTAProgram::Move::setBus
void setBus(const TTAMachine::Bus &bus)
Definition: Move.cc:383
AssocTools::deleteAllValues
static void deleteAllValues(ContainerType &aMap)
SimpleBrokerDirector::knownMaxCycle_
int knownMaxCycle_
Definition: SimpleBrokerDirector.hh:171
ExecutionPipelineBroker
Definition: ExecutionPipelineBroker.hh:53
IUBroker::immediateWriteCycle
virtual int immediateWriteCycle(const MoveNode &node) const
Definition: IUBroker.cc:578
TTAProgram::Instruction::moveCount
int moveCount() const
Definition: Instruction.cc:176
IUBroker
Definition: IUBroker.hh:57
ResourceBroker::isBusBroker
virtual bool isBusBroker() const
Definition: ResourceBroker.cc:303
InstanceNotFound
Definition: Exception.hh:304
TTAProgram::Move::setSource
void setSource(Terminal *src)
Definition: Move.cc:312