OpenASIP  2.0
ITemplateBroker.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2011 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file ITemplateBroker.cc
26  *
27  * Implementation of ITemplateBroker class.
28  *
29  * @author Ari Metsähalme 2006 (ari.metsahalme-no.spam-tut.fi)
30  * @author Vladimir Guzma 2007 (vladimir.guzma-no.spam-tut.fi)
31  * @note rating: red
32  */
33 
34 #include "CompilerWarnings.hh"
35 IGNORE_CLANG_WARNING("-Wunused-local-typedef")
36 #include <boost/lexical_cast.hpp>
38 
39 #include "ITemplateBroker.hh"
40 #include "ITemplateResource.hh"
41 #include "Machine.hh"
42 #include "MachineInfo.hh"
43 #include "InstructionTemplate.hh"
45 #include "ResourceMapper.hh"
46 #include "Move.hh"
47 #include "Instruction.hh"
48 #include "MapTools.hh"
49 #include "NullInstruction.hh"
50 #include "POMDisassembler.hh"
51 #include "MoveNode.hh"
53 #include "MathTools.hh"
54 #include "TerminalRegister.hh"
55 #include "Immediate.hh"
56 #include "SimpleResourceManager.hh"
57 #include "TemplateSlot.hh"
58 #include "BusBroker.hh"
59 #include "ControlUnit.hh"
60 
61 using std::string;
62 using namespace TTAMachine;
63 using namespace TTAProgram;
64 
65 /**
66  * Constructor.
67  */
69  std::string name, BusBroker& busBroker, unsigned int initiationInterval) :
70  ResourceBroker(name, initiationInterval),
71  rm_(NULL), busBroker_(busBroker) {
72 }
73 
74 /**
75  * Constructor.
76  */
78  std::string name,
79  BusBroker& busBroker,
81  unsigned int initiationInterval) :
82  ResourceBroker(name, initiationInterval),
83  rm_(rm), busBroker_(busBroker) {
84 }
85 
86 /**
87  * Destructor.
88  */
90  for (std::map<int, TTAProgram::Instruction*>::iterator i =
91  instructions_.begin(); i != instructions_.end(); i++) {
92  std::map<int, bool>::iterator j = instructionsNotOwned_.find(i->first);
93  // not found = >owns, deletes.
94  if (j == instructionsNotOwned_.end() || j->second == false) {
95  delete i->second;
96  }
97  }
98 
99 }
100 
101 /**
102  * Return true if there's an instruction template available to be used
103  * on the given cycle for the given move.
104  *
105  * If the given node contains a long immediate register read, the
106  * instruction template must be able to encode required bits for it.
107  *
108  * @param cycle Cycle where instruction template is used.
109  * @param node Node which contains long immediate register read.
110  * @return True if there's an instruction template available to be used
111  * on the given cycle, and the template is able to encode bits for long
112  * immediate that is read in given node.
113  */
114 bool
116  int cycle,
117  const MoveNode& node,
118  const TTAMachine::Bus* bus,
119  const TTAMachine::FunctionUnit* srcFU,
120  const TTAMachine::FunctionUnit* dstFU,
121  int immWriteCycle,
122  const TTAMachine::ImmediateUnit* immu,
123  int immRegIndex) const {
124  cycle = instructionIndex(cycle);
125  int resultCount = allAvailableResources(
126  cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex).
127  count();
128  return resultCount > 0;
129 }
130 
131 
132 /**
133  * Return all resources managed by this broker that can be assigned to
134  * the given node in the given cycle.
135  *
136  * @param cycle Cycle.
137  * @param node Node.
138  * @return All resources managed by this broker that can be assigned to
139  * the given node in the given cycle.
140  * @note This method is called twice, first it check available resources
141  * for immediate write, second call checks resources for MoveNode
142  */
145  int cycle,
146  const MoveNode& node,
147  const TTAMachine::Bus*,
149  const TTAMachine::FunctionUnit*, int,
151  int) const {
152  cycle = instructionIndex(cycle);
153  Moves moves;
154  Immediates immediates;
155  MoveNode& testedNode = const_cast<MoveNode&>(node);
156  if (node.isMove()) {
157  moves.push_back(testedNode.movePtr());
158  } else if (node.isImmediate()) {
159  immediates.push_back(testedNode.immediatePtr());
160  }
161  return findITemplates(cycle, moves, immediates);
162 }
163 
164 
165 /**
166  * Assigns instruction template resource to the parent instruction of
167  * the given node.
168  *
169  * @param cycle Cycle of node.
170  * @param node Node.
171  * @param res Instruction template resource to assign.
172  * @exception WrongSubclass If this broker does not recognise the given
173  * type of resource.
174  * @exception InvalidData If he given resource cannot be assigned to
175  * given node or no corresponding machine part is found.
176  * @note Ownership of a Move in MoveNode will be passed to Instruction
177  * inside the broker.
178  */
179 void
181  int cycle, MoveNode& node, SchedulingResource& res,int, int) {
182 
183  cycle = instructionIndex(cycle);
184 
185  ITemplateResource& templateRes =
186  static_cast<ITemplateResource&>(res);
187  const InstructionTemplate& iTemplate =
188  static_cast<const InstructionTemplate&>(machinePartOf(res));
189  TTAProgram::Instruction* ins = NULL;
190  if (MapTools::containsKey(instructions_, cycle)) {
191  ins = MapTools::valueForKey<TTAProgram::Instruction*>(
192  instructions_, cycle);
193 
194  // In case template was already assigned and it changes
195  if (ins->instructionTemplate().name() != iTemplate.name()) {
196  SchedulingResource& oldRes =
198  ITemplateResource& oldTemplateRes =
199  dynamic_cast<ITemplateResource&>(oldRes);
200  oldTemplateRes.unassign(cycle);
201 
202  // In case the amount of transportable immediate bits decreases
203  // due to ITemplate change, update each immediate bit width to
204  // the new width. If this is not done, negative immediates ends up
205  // to take more bits than they really need in TPEF and later
206  // loading the TPEF fails in TPEFProgramFactory.
207  for (int i = 0; i < ins->immediateCount(); i++) {
208  // Can not change bit width of these.
209  if (ins->immediate(i).value().isInstructionAddress() ||
210  ins->immediate(i).value().isBasicBlockReference() ||
211  ins->immediate(i).value().isCodeSymbolReference()) {
212  continue;
213  }
214  int currentWidth = ins->immediate(i).value().value().width();
215  const ImmediateUnit& destIU =
216  ins->immediate(i).destination().immediateUnit();
217  int newSupportedWidth = iTemplate.supportedWidth(destIU);
218  if (currentWidth > newSupportedWidth) {
219  SimValue sim(
220  (destIU.signExtends() ?
221  ins->immediate(i).value().value().intValue() :
222  ins->immediate(i).value().value().unsignedValue()),
223  newSupportedWidth);
224  TerminalImmediate* ti = new TerminalImmediate(sim);
225  ins->immediate(i).setValue(ti);
226  }
227  }
228 
229  ins->setInstructionTemplate(iTemplate);
230  templateRes.assign(cycle);
231  }
232  } else {
233  ins = new TTAProgram::Instruction(iTemplate);
234  instructions_[cycle] = ins;
235  templateRes.assign(cycle);
236  }
237 
238  Instruction* oldIn = NULL;
239  if (node.isImmediate()) {
240  oldIn = node.immediate().parent();
241  if (oldIn != NULL) {
242  oldIn->removeImmediate(node.immediate());
243  }
244  ins->addImmediate(node.immediatePtr());
245  } else {
246  if (node.move().isInInstruction()) {
247  oldIn = &node.move().parent();
248  oldIn->removeMove(node.move());
249  }
250  ins->addMove(node.movePtr());
251  }
252  oldParentInstruction_.insert(
253  std::pair<const MoveNode*, TTAProgram::Instruction*>
254  (&node, oldIn));
255 
256  // TODO: refactor this away.
257  if (node.isSourceImmediateRegister()) {
258  // Gets data from Immediate Unit broker, indirectly
259 
260  auto immValue = rm_->immediateValue(node);
261  if (immValue) {
262  TerminalImmediate* tempImm =
263  dynamic_cast<TerminalImmediate*>(
264  immValue->copy());
265  int defCycle = instructionIndex(rm_->immediateWriteCycle(node));
266  if (defCycle >= 0) {
267  TerminalRegister* tmpReg =
268  dynamic_cast<TerminalRegister*>(
269  node.move().source().copy());
270  auto imm = std::make_shared<Immediate>(tempImm, tmpReg);
271  if (!isImmediateInTemplate(defCycle,imm)) {
272  assignImmediate(defCycle, imm);
273  immediateCycles_.insert(
274  std::pair<const MoveNode*, int>(&node,defCycle));
275  immediateValues_.insert(
276  std::pair<const MoveNode*,
277  std::shared_ptr<TTAProgram::Immediate> >(
278  &node,imm));
279  } else {
280  abortWithError("Failed to assign immediate write");
281  }
282  }
283  }
284  }
285 }
286 
287 
288 /**
289  * Assigns instruction template resource to the given instruction located
290  * in given cycle.
291  *
292  * @param cycle Cycle where to store immediate write.
293  * @param immediate Immediate to be written in cycle
294  * @exception WrongSubclass If this broker does not recognise the given
295  * type of resource.
296  * @exception InvalidData If he given resource cannot be assigned to
297  * given node or no corresponding machine part is found.
298  */
299 void
301  int cycle, std::shared_ptr<Immediate> immediate) {
302  cycle = instructionIndex(cycle);
303 
304  try {
305  // Find a template for definition cycle
306  Moves moves;
307  Immediates immediates;
308  immediates.push_back(immediate);
309 
311  findITemplates(cycle, moves, immediates);
312  assert(resources.count());
313  ITemplateResource& templateRes =
314  static_cast<ITemplateResource&>(resources.resource(0));
315  const InstructionTemplate& iTemplate =
316  static_cast<const InstructionTemplate&>(
317  machinePartOf(templateRes));
318 
319  // Find instruction, if there is none, create new.
320  TTAProgram::Instruction* ins = NULL;
321  if (MapTools::containsKey(instructions_, cycle)) {
322  ins = MapTools::valueForKey<TTAProgram::Instruction*>(
323  instructions_, cycle);
324  // Remove old template assignment
325  SchedulingResource& oldRes =
327  ITemplateResource& oldTemplateRes =
328  static_cast<ITemplateResource&>(oldRes);
329  oldTemplateRes.unassign(cycle);
330  } else {
331  ins = new TTAProgram::Instruction(iTemplate);
332  instructions_[cycle] = ins;
333  }
334 
335  // Define new immediate, depending on supported bit width of
336  // template for given immediate unit
337  const ImmediateUnit& iu = immediate->destination().immediateUnit();
338  int neededBitWidth = iTemplate.supportedWidth(iu);
339  if (neededBitWidth <= INT_WORD_SIZE &&
340  (!immediate->value().isInstructionAddress() &&
341  !immediate->value().isBasicBlockReference() &&
342  !immediate->value().isCodeSymbolReference())) {
343  // If it is not floating point or instruction address
344  // we recreate SimValue with proper bit width based on destination
345  if (iu.extensionMode() == Machine::ZERO) {
346  SimValue sim(
347  immediate->value().value().unsignedValue(), neededBitWidth);
348  TerminalImmediate* ti = new TerminalImmediate(sim);
349  immediate->setValue(ti);
350  }
351  if (iu.extensionMode() == Machine::SIGN) {
352  SimValue sim(
353  immediate->value().value().intValue(), neededBitWidth);
354  TerminalImmediate* ti = new TerminalImmediate(sim);
355  immediate->setValue(ti);
356  }
357  }
358 
359  templateRes.assign(cycle);
360  ins->setInstructionTemplate(iTemplate);
361  ins->addImmediate(immediate);
362 
363  } catch (const std::bad_cast& e) {
364  string msg = "Resource is not of an instruction template resource.";
365  throw WrongSubclass(__FILE__, __LINE__, __func__, msg);
366  } catch (const KeyNotFound& e) {
367  string msg = "Broker does not contain given resource.";
368  throw InvalidData(__FILE__, __LINE__, __func__, msg);
369  }
370 }
371 
372 /**
373  * Free the instruction template resource used in the parent instruction
374  * of the given node.
375  *
376  * @param node Node.
377  * @note Returns ownership of Move in MoveNode to the original parent
378  * instruction
379  */
380 void
382  // Template not to be unassgined, it is just that there will be space
383  // left in this template for move
384 
385  TTAProgram::Instruction& ins = node.isMove() ? node.move().parent() :
386  *node.immediate().parent();
388  if (node.isMove()) {
389  ins.removeMove(node.move());
390  TTAProgram::Instruction* oldParent =
391  MapTools::valueForKey<TTAProgram::Instruction*>(
392  oldParentInstruction_, &node);
393  if (oldParent != NULL) {
394  oldParent->addMove(node.movePtr());
395  }
396  oldParentInstruction_.erase(&node);
397  } else if (node.isImmediate()) {
398  ins.removeImmediate(node.immediate());
399  TTAProgram::Instruction* oldParent =
400  MapTools::valueForKey<TTAProgram::Instruction*>(
401  oldParentInstruction_, &node);
402  if (oldParent != NULL) {
403  oldParent->addImmediate(node.immediatePtr());
404  }
405  oldParentInstruction_.erase(&node);
406  reselectTemplate(ins, node.cycle());
407  return;
408  }
409  }
410  if (node.isSourceConstant() &&
412  int defCycle = MapTools::valueForKey<int>(immediateCycles_, &node);
413  auto imm =
414  MapTools::valueForKey<std::shared_ptr<TTAProgram::Immediate> >(
415  immediateValues_, &node);
416 
417  if (isImmediateInTemplate(defCycle, imm)) {
418  unassignImmediate(defCycle, imm->destination().immediateUnit());
419  } else {
420  abortWithError("Failed to remove Immediate from instruction");
421  }
422  immediateCycles_.erase(&node);
423  immediateValues_.erase(&node);
424  }
425  reselectTemplate(ins, node.cycle());
426 }
427 
428 /**
429  * Free the Instruction template used at this cycle. Sets new instruction
430  * template that does not use freed immediate slot.
431  *
432  * If this broker is not applicable to the given node, or the node is
433  * not assigned a resource of the managed type, this method does
434  * nothing.
435  *
436  * @param cycle Cycle from where to unassign immediate
437  * @param immediate Immediate to remove from cycle
438  */
439 void
441  int cycle,
442  const ImmediateUnit& immediateUnit) {
443  cycle = instructionIndex(cycle);
444 
445  if (!MapTools::containsKey(instructions_, cycle)) {
446  return;
447  }
448  Instruction* ins =
449  MapTools::valueForKey<Instruction*>(instructions_, cycle);
450  const InstructionTemplate& iTemplate = ins->instructionTemplate();
451  SchedulingResource& res = *resourceOf(iTemplate);
452  ITemplateResource& templateRes = dynamic_cast<ITemplateResource&>(res);
453 
454  templateRes.unassign(cycle);
455  for (int i = 0; i < ins->immediateCount(); i++) {
456  if (ins->immediate(i).destination().immediateUnit().name() ==
457  immediateUnit.name()) {
458  ins->removeImmediate(ins->immediate(i));
459  break;
460  }
461  }
462  reselectTemplate(*ins, cycle);
463 }
464 
465 /**
466  * Reselect the template to be the most optimal (most nop slots etc)
467  * Called always on unassign.
468  */
469 void
471  // set new template that does not use immediate slot just unassigned
472  // moves and immediate will be filled from instruction in given cycle
473  // inside findITTemplates method
474  Moves moves;
475  Immediates immediates;
477  findITemplates(cycle, moves, immediates);
478  assert(resources.count() >0);
479  ITemplateResource& newTemplateRes = static_cast<ITemplateResource&>(
480  resources.resource(0));
481  const InstructionTemplate& newTemplate =
482  dynamic_cast<const InstructionTemplate&>(
483  machinePartOf(newTemplateRes));
484  ins.setInstructionTemplate(newTemplate);
485  newTemplateRes.assign(cycle);
486 }
487 
488 /**
489  * Return the earliest cycle, starting from given cycle, where a
490  * resource of the type managed by this broker can be assigned to the
491  * given node.
492  *
493  * @param cycle Cycle.
494  * @param node Node.
495  * @return The earliest cycle, starting from given cycle, where a
496  * resource of the type managed by this broker can be assigned to the
497  * given node.
498  */
499 int
501  const TTAMachine::Bus*,
503  const TTAMachine::FunctionUnit*, int,
504  const TTAMachine::ImmediateUnit*, int) const {
505  abortWithError("Not implemented.");
506  return -1;
507 }
508 
509 /**
510  * Return the latest cycle, starting from given cycle, where a
511  * resource of the type managed by this broker can be assigned to the
512  * given node.
513  *
514  * @param cycle Cycle.
515  * @param node Node.
516  * @return The latest cycle, starting from given cycle, where a
517  * resource of the type managed by this broker can be assigned to the
518  * given node.
519  */
520 int
522  const TTAMachine::Bus*,
524  const TTAMachine::FunctionUnit*, int,
525  const TTAMachine::ImmediateUnit*, int) const {
526  abortWithError("Not implemented.");
527  return -1;
528 }
529 
530 /**
531  * Return true if the given node is already assigned a resource of the
532  * type managed by this broker, and the assignment appears valid (that
533  * is, the broker has marked that resource as in use in the given
534  * cycle).
535  *
536  * @param cycle Cycle.
537  * @param node Node.
538  * @return True if the given node is already assigned a resource of the
539  * type managed by this broker, and the assignment appears valid (that
540  * is, the broker has marked that resource as in use in the given
541  * cycle).
542  */
543 bool
545  int cycle, const MoveNode& node, const TTAMachine::Bus*) const {
546  if (node.isImmediate()) {
547  return node.immediate().parent() != NULL;
548  }
549  Move& move = const_cast<MoveNode&>(node).move();
550 
551  cycle = instructionIndex(cycle);
552  if (!move.isInInstruction()) {
553  return false;
554  }
555  const InstructionTemplate& iTemplate =
556  move.parent().instructionTemplate();
557 
558  // Cannot be already assigned if template is null.
559  if (&iTemplate != &NullInstructionTemplate::instance()) {
560  // When node is assigned, it's old parent is stored, thus if the
561  // old parent is stored, node was assigned
563  SchedulingResource* res = resourceOf(iTemplate);
564  if ( res != NULL && res->isInUse(cycle)) {
565  return true;
566  }
567  }
568  }
569  return false;
570 }
571 
572 /**
573  * Return true if the given node needs a resource of the type managed
574  * by this broker, false otherwise.
575  *
576  * @param node Node.
577  * @return True if the given node needs a resource of the type managed
578  * by this broker, false otherwise.
579  * @todo reconsider, should be applicable for all the MoveNodes
580  */
581 bool
583  return true;
584 }
585 
586 /**
587  * Build all resource objects of the controlled type required to model
588  * scheduling resources of the given target processor.
589  *
590  * This method cannot set up the resource links (dependent and related
591  * resources) of the constructed resource objects.
592  *
593  * @param target Target machine.
594  */
595 void
597 
600 
601  for (int i = 0; i < templateNavi.count(); i++) {
602  InstructionTemplate* itemplate = templateNavi.item(i);
603  ITemplateResource* itemplateResource =
604  new ITemplateResource(*itemplate, initiationInterval_);
605  ResourceBroker::addResource(*itemplate, itemplateResource);
606  }
607 
608  Machine::BusNavigator busNavi = target.busNavigator();
609 
610  for (int i = 0; i < busNavi.count(); i++) {
611  slots_.push_back(busNavi.item(i));
612  }
613 }
614 
615 /**
616  * Complete resource initialisation by creating the references to
617  * other resources due to a dependency or a relation.
618  *
619  * Use the given resource mapper to lookup dependent and related resources
620  * using machine parts as keys.
621  *
622  * @param mapper Resource mapper.
623  */
624 void
626 
627  setResourceMapper(mapper);
628 
629  for (ResourceMap::iterator resIter = resMap_.begin();
630  resIter != resMap_.end(); resIter++) {
631 
632  const InstructionTemplate* itemplate =
633  dynamic_cast<const InstructionTemplate*>((*resIter).first);
634  if (itemplate == NULL){
635  throw InvalidData(
636  __FILE__, __LINE__, __func__,
637  "Broker does not have necessary Template registered!");
638  }
639 
640  SchedulingResource* templateResource = (*resIter).second;
641 
642  for (unsigned int i = 0; i < slots_.size(); i++) {
643  if (itemplate->usesSlot(slots_[i]->name())) {
644  try {
645  SchedulingResource& depSlot =
646  mapper.resourceOf(*slots_[i]);
647  templateResource->addToDependentGroup(0, depSlot);
648  } catch (const KeyNotFound& e) {
649  std::string msg = "ITemplateBroker: finding ";
650  msg += " resource for Slot ";
651  msg += " failed with error: ";
652  msg += e.errorMessageStack();
653  throw KeyNotFound(
654  __FILE__, __LINE__, __func__, msg);
655  }
656 
657  ImmediateUnit* iu =
658  itemplate->destinationOfSlot(slots_[i]->name());
659  try {
660  SchedulingResource& depIU = mapper.resourceOf(*iu);
661  templateResource->addToDependentGroup(1, depIU);
662  } catch (const KeyNotFound& e) {
663  std::string msg = "ITemplateBroker: finding ";
664  msg += " resource for IU ";
665  msg += " failed with error: ";
666  msg += e.errorMessageStack();
667  throw KeyNotFound(
668  __FILE__, __LINE__, __func__, msg);
669  }
670  }
671  }
672  }
673 }
674 
675 /**
676  * Return true always.
677  *
678  * @return True always.
679  */
680 bool
682  return true;
683 }
684 
685 /**
686  * Returns an instruction at a given cycle.
687  *
688  * @param cycle Cycle for which to return instruction
689  * @return an instruction object for given cycle,
690  * empty instruction if there is no record.
691  */
694  cycle = instructionIndex(cycle);
695  if (!MapTools::containsKey(instructions_, cycle)) {
696  Moves moves;
697  Immediates immediates;
698  SchedulingResourceSet defaultTemplates = findITemplates(
699  cycle, moves, immediates);
700  if (defaultTemplates.count() == 0) {
701  throw InvalidData(
702  __FILE__, __LINE__, __func__,
703  "No Instruction Template available!");
704  }
705  SchedulingResource& iTemp = defaultTemplates.resource(0);
706  const MachinePart& mp = machinePartOf(iTemp);
707  const InstructionTemplate& iTemplate =
708  dynamic_cast<const InstructionTemplate&>(mp);
709  ITemplateResource& templateRes =
710  dynamic_cast<ITemplateResource&>(iTemp);
711  templateRes.assign(cycle);
712  TTAProgram::Instruction* ins = NULL;
713  ins = new TTAProgram::Instruction(iTemplate);
714  instructions_[cycle] = ins;
715  ins->setInstructionTemplate(iTemplate);
716  return ins;
717  }
718  Instruction* ins =
719  MapTools::valueForKey<TTAProgram::Instruction*>(
720  instructions_, cycle);
721  return ins;
722 }
723 
724 /**
725  * Helper function, finds all templates that are applicable
726  * for current status of instruction and new node that needs
727  * to be added
728  *
729  * @param moves A set of moves which has to fit into template
730  * @param immediates A set of immediates which has to fit into template
731  * @return A set of instruction templates that supports current instruction
732  * plus new instruction
733  * @note The test for Moves is done by checking if a bus Move uses
734  * is not allocated by template for immediate move. Immediate slots
735  * are not relevant here.
736  */
739  int cycle,
740  Moves& moves,
741  Immediates& immediates) const {
742 
743  cycle = instructionIndex(cycle);
744  SchedulingResourceSet result;
745  Instruction* ins = NULL;
746  // Read in content of instruction if there is something already
747  // stored in given cycle
748  if (MapTools::containsKey(instructions_, cycle)) {
749  ins = MapTools::valueForKey<TTAProgram::Instruction*>(
750  instructions_, cycle);
751  for (int i = 0; i < ins->moveCount(); i++) {
752  moves.push_back(ins->movePtr(i));
753  }
754  for (int i = 0; i < ins->immediateCount(); i++) {
755  immediates.push_back(ins->immediatePtr(i));
756  }
757  }
758 
759  for (ResourceMap::const_iterator resIter = resMap_.begin();
760  resIter != resMap_.end(); resIter++) {
761  bool addResult = true;
762  // bus resources (slots) are in dependent group 0
763  // immediate resources are in group 1
764  // trying to find template that has exactly same number or
765  // higher number of immediate writes as instruction
766  if ((*resIter).second->dependentResourceGroupCount() > 1 &&
767  immediates.size() > static_cast<unsigned int>(
768  (*resIter).second->dependentResourceCount(1))) {
769  continue;
770  }
771 
772  const InstructionTemplate& iTemplate =
773  dynamic_cast<const InstructionTemplate&>(*(*resIter).first);
774 
775  // For each of already assigned immediate writes, template
776  // has to have destination unit
777  std::vector<const TTAMachine::ImmediateUnit*> unitWriten;
778  for (unsigned int i = 0; i < immediates.size(); i++) {
779  const ImmediateUnit& unit =
780  immediates[i]->destination().immediateUnit();
781  if (ContainerTools::containsValue(unitWriten, &unit)) {
782  addResult = false;
783  break;
784  }
785  // immediate and immediate units has correct width, this checks
786  // if template can transport such a number of bits into the unit
787  // it is possible to have template which transport less bits
788  if (!iTemplate.isOneOfDestinations(unit)) {
789  addResult = false;
790  break;
791  }
792  // FIXME: hack to check if terminal is floating point value
793  if (immediates[i]->value().value().width() > INT_WORD_SIZE &&
794  (immediates[i]->value().value().width() >
795  iTemplate.supportedWidth(unit))) {
796  addResult = false;
797  break;
798  }
799  // FIXME: instruction addresses hold reference to instruction
800  // reference which computes the SimValue depending on target
801  // instruction's address. So it is not possible to modify the
802  // bit width of such SimValue
803  if (immediates[i]->value().isInstructionAddress() &&
804  !immediates[i]->value().isBasicBlockReference() &&
805  !immediates[i]->value().isCodeSymbolReference()) {
806 
807  const AddressSpace& as =
809  int requiredBitWidth = unit.extensionMode() == Machine::SIGN ?
812  if (requiredBitWidth > iTemplate.supportedWidth(unit)) {
813  addResult = false;
814  break;
815  }
816  }
817  // Ignore instruction addresses, based on destination mode
818  // tests required bits of correct representation of SimValue
819  if (!immediates[i]->value().isInstructionAddress() &&
820  !immediates[i]->value().isBasicBlockReference() &&
821  !immediates[i]->value().isCodeSymbolReference() &&
822  unit.extensionMode() == Machine::ZERO &&
824  immediates[i]->value().value().unsignedValue()) >
825  iTemplate.supportedWidth(unit)) {
826  addResult = false;
827  break;
828  }
829  if (!immediates[i]->value().isInstructionAddress() &&
830  !immediates[i]->value().isBasicBlockReference() &&
831  !immediates[i]->value().isCodeSymbolReference() &&
832  unit.extensionMode() == Machine::SIGN &&
834  immediates[i]->value().value().intValue()) >
835  iTemplate.supportedWidth(unit)) {
836  addResult = false;
837  break;
838  }
839 
840  if (immediates[i]->value().isCodeSymbolReference() &&
841  immediates[i]->value().toString() == "_end") {
842 
843  AddressSpace* dataAS;
844  try {
845  dataAS =
847  } catch (Exception&) {
848  assert(false && "No default data address space");
849  }
850 
851  int requiredBitWidth = unit.extensionMode() == Machine::SIGN ?
853  MathTools::requiredBits(dataAS->end());
854 
855  if (requiredBitWidth > iTemplate.supportedWidth(unit)) {
856  addResult = false;
857  break;
858  }
859 
860  } else if (immediates[i]->value().isBasicBlockReference() ||
861  immediates[i]->value().isCodeSymbolReference()) {
862 
863  const AddressSpace& as
864  = *rm_->machine().controlUnit()->addressSpace();
865  int requiredBitWidth = unit.extensionMode() == Machine::SIGN ?
868 
869  if (requiredBitWidth > iTemplate.supportedWidth(unit)) {
870  addResult = false;
871  break;
872  }
873 
874  }
875 
876  unitWriten.push_back(&unit);
877  }
878  // For each of moves already assigned template
879  // should not use the bus for immediate transport or as
880  // a fixed NOP slot
881  for (unsigned int i = 0; i < moves.size(); i++) {
882 
883  const bool isNOPSlot = false;
884 
885  SchedulingResource* bus =
886  busBroker_.resourceOf(moves[i]->bus());
887  if ((*resIter).second->hasDependentResource(*bus) ||
888  isNOPSlot) {
889  addResult = false;
890  break;
891  }
892  }
893  if (addResult) {
894  result.insert(*(*resIter).second);
895  }
896  }
897  result.sort();
898  return result;
899 }
900 
901 /**
902  * Transfer the instruction ownership away from this object,
903  *
904  * If this method is called, resource manager does not delete it's
905  * instructions when it it destroyed.
906  */
907 void
909  instructionsNotOwned_[cycle] = true;
910 }
911 
912 /*
913  * Tests if an immediate is already written into instruction template
914  *
915  * @param defCycle cycle which to test
916  * @param imm Immediate to test in defCycle
917  * @return True if immediate is already written in instruction template
918  */
919 bool
921  int defCycle,
922  std::shared_ptr<Immediate> imm) const {
923 
924  if (!MapTools::containsKey(instructions_, defCycle)) {
925  return false;
926  }
927  Instruction* ins = MapTools::valueForKey<TTAProgram::Instruction*>(
928  instructions_, defCycle);
929  for (int i = 0; i < ins->immediateCount(); i++){
930  if (ins->immediate(i).value().value() == imm->value().value() &&
931  ins->immediate(i).destination().equals(imm->destination())){
932  return true;
933  }
934  }
935  return false;
936 }
937 
938 /**
939  * Tests if there is any instruction template available for immediate
940  * in given cycle
941  *
942  * @param defCycle cycle to test
943  * @param immediate Immediate to test
944  * @return True if there is instruction template for given cycle which can
945  * write given immediate
946  */
947 bool
949  int defCycle,
950  std::shared_ptr<Immediate> immediate) const {
951 
952  Immediates immediates;
953  Moves moves;
954  immediates.push_back(immediate);
955  int availableCount =
956  findITemplates(defCycle, moves, immediates).count();
957  return availableCount > 0;
958 }
959 
960 /**
961  * Clears bookkeeping which is needed for unassigning previously assigned
962  * moves. After this call these cannot be unassigned, but new moves which
963  * are assigned after this call can still be unassigned.
964  */
965 void
967  oldParentInstruction_.clear();
968 }
969 
970 /**
971  * Clears all bookkeeping for the broker.
972  *
973  * the RM can then be reused for another basic block.
974  */
975 void
979 
980  for (std::map<int, TTAProgram::Instruction*>::iterator i =
981  instructions_.begin(); i != instructions_.end(); i++) {
982  std::map<int, bool>::iterator j = instructionsNotOwned_.find(i->first);
983  // does not find => owns, delete.
984  if (j == instructionsNotOwned_.end() || j->second == false) {
985  delete i->second;
986  }
987  }
988  instructions_.clear();
989  instructionsNotOwned_.clear();
990  immediateCycles_.clear();
991  immediateValues_.clear();
992 }
ITemplateBroker::instructions_
std::map< int, TTAProgram::Instruction * > instructions_
cycle/instruction
Definition: ITemplateBroker.hh:135
SchedulingResource::addToDependentGroup
virtual void addToDependentGroup(const int group, SchedulingResource &resource)
Definition: SchedulingResource.cc:101
ITemplateBroker::assignImmediate
void assignImmediate(int, std::shared_ptr< TTAProgram::Immediate >)
Definition: ITemplateBroker.cc:300
ITemplateBroker::isTemplateAvailable
virtual bool isTemplateAvailable(int, std::shared_ptr< TTAProgram::Immediate >) const
Definition: ITemplateBroker.cc:948
SimValue::intValue
int intValue() const
Definition: SimValue.cc:895
ITemplateBroker::setupResourceLinks
virtual void setupResourceLinks(const ResourceMapper &mapper) override
Definition: ITemplateBroker.cc:625
TTAProgram
Definition: Estimator.hh:65
SimpleResourceManager::immediateWriteCycle
virtual int immediateWriteCycle(const MoveNode &) const
Definition: SimpleResourceManager.cc:520
TTAProgram::Immediate::value
TerminalImmediate & value() const
Definition: Immediate.cc:103
TTAProgram::Instruction::removeMove
void removeMove(Move &move)
Definition: Instruction.cc:536
TTAProgram::Instruction::addMove
void addMove(std::shared_ptr< Move > move)
Definition: Instruction.cc:147
POP_CLANG_DIAGS
#define POP_CLANG_DIAGS
Definition: CompilerWarnings.hh:96
ITemplateBroker::busBroker_
BusBroker & busBroker_
Definition: ITemplateBroker.hh:153
ResourceBroker::initiationInterval_
unsigned int initiationInterval_
Definition: ResourceBroker.hh:158
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAProgram::Terminal::isInstructionAddress
virtual bool isInstructionAddress() const
Definition: Terminal.cc:87
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
ResourceMapper.hh
ResourceBroker::resMap_
ResourceMap resMap_
Definition: ResourceBroker.hh:165
MoveNode::movePtr
std::shared_ptr< TTAProgram::Move > movePtr()
TTAProgram::Instruction
Definition: Instruction.hh:57
MapTools.hh
TTAMachine::Bus
Definition: Bus.hh:53
ITemplateBroker::isITemplateBroker
virtual bool isITemplateBroker() const override
Definition: ITemplateBroker.cc:681
IGNORE_CLANG_WARNING
#define IGNORE_CLANG_WARNING(X)
Definition: CompilerWarnings.hh:85
SimpleResourceManager::immediateValue
virtual std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue(const MoveNode &)
Definition: SimpleResourceManager.cc:509
ITemplateBroker::oldParentInstruction_
std::map< const MoveNode *, TTAProgram::Instruction *, MoveNode::Comparator > oldParentInstruction_
MoveNode/ original parent instruction.
Definition: ITemplateBroker.hh:138
ITemplateResource::unassign
virtual void unassign(const int cycle, MoveNode &node) override
Definition: ITemplateResource.cc:112
TTAMachine::ImmediateUnit::signExtends
bool signExtends() const
Definition: ImmediateUnit.hh:62
ResourceBroker
Definition: ResourceBroker.hh:61
TTAProgram::Instruction::removeImmediate
void removeImmediate(Immediate &imm)
Definition: Instruction.cc:560
MachineInfo.hh
ITemplateBroker::allAvailableResources
virtual SchedulingResourceSet allAvailableResources(int, const MoveNode &, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcUnit, const TTAMachine::FunctionUnit *dstUnit, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: ITemplateBroker.cc:144
TTAProgram::Terminal::isBasicBlockReference
virtual bool isBasicBlockReference() const
Definition: Terminal.cc:139
MoveNode
Definition: MoveNode.hh:65
ITemplateBroker::ITemplateBroker
ITemplateBroker(std::string, BusBroker &busBroker, unsigned int initiationInterval=0)
Definition: ITemplateBroker.cc:68
MoveNode::isSourceConstant
bool isSourceConstant() const
Definition: MoveNode.cc:238
TTAMachine::FunctionUnit::addressSpace
virtual AddressSpace * addressSpace() const
Definition: FunctionUnit.cc:580
ResourceMapper::resourceOf
SchedulingResource & resourceOf(const TTAMachine::MachinePart &mp, int index=0) const
Definition: ResourceMapper.cc:96
TTAMachine::Machine::Navigator::count
int count() const
ITemplateBroker::assign
virtual void assign(int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex) override
Definition: ITemplateBroker.cc:180
ResourceBroker::addResource
void addResource(const TTAMachine::MachinePart &mp, SchedulingResource *res)
Definition: ResourceBroker.cc:265
ITemplateResource.hh
SimValue
Definition: SimValue.hh:96
TerminalRegister.hh
MoveNode::isSourceImmediateRegister
bool isSourceImmediateRegister() const
Definition: MoveNode.cc:223
POMDisassembler.hh
MachineInfo::defaultDataAddressSpace
static TTAMachine::AddressSpace * defaultDataAddressSpace(const TTAMachine::Machine &mach)
Definition: MachineInfo.cc:176
TTAMachine::InstructionTemplate
Definition: InstructionTemplate.hh:49
SchedulingResourceSet
Definition: SchedulingResource.hh:161
ITemplateBroker::latestCycle
virtual int latestCycle(int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcUnit, const TTAMachine::FunctionUnit *dstUnit, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: ITemplateBroker.cc:521
TTAProgram::Immediate::destination
const Terminal & destination() const
Definition: Immediate.cc:92
assert
#define assert(condition)
Definition: Application.hh:86
ITemplateBroker::findITemplates
SchedulingResourceSet findITemplates(int, Moves &, Immediates &) const
Definition: ITemplateBroker.cc:738
TTAProgram::TerminalImmediate::value
virtual SimValue value() const
Definition: TerminalImmediate.cc:75
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TemplateSlot.hh
BusBroker
Definition: BusBroker.hh:60
ITemplateBroker::loseInstructionOwnership
virtual void loseInstructionOwnership(int cycle)
Definition: ITemplateBroker.cc:908
ResourceBroker::resources
void resources(ResourceSet &contents)
Definition: ResourceBroker.cc:279
MoveNode::isImmediate
bool isImmediate() const
Definition: MoveNode.hh:143
MoveNode::isMove
bool isMove() const
ResourceBroker::setResourceMapper
void setResourceMapper(const ResourceMapper &mapper)
Definition: ResourceBroker.cc:224
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
InvalidData
Definition: Exception.hh:149
Instruction.hh
ITemplateResource::assign
virtual void assign(const int cycle, MoveNode &node) override
Definition: ITemplateResource.cc:87
ITemplateBroker::isApplicable
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *) const override
Definition: ITemplateBroker.cc:582
WrongSubclass
Definition: Exception.hh:336
BusBroker.hh
InstructionTemplate.hh
SchedulingResource
Definition: SchedulingResource.hh:52
TTAProgram::Immediate::parent
Instruction * parent() const
Definition: Immediate.hh:67
NullInstruction.hh
__func__
#define __func__
Definition: Application.hh:67
ResourceBroker::clear
virtual void clear()
Definition: ResourceBroker.cc:365
TTAMachine::MachinePart
Definition: MachinePart.hh:57
Exception::errorMessageStack
std::string errorMessageStack(bool messagesOnly=false) const
Definition: Exception.cc:138
NullInstructionTemplate.hh
ResourceBroker::resourceOf
SchedulingResource * resourceOf(const TTAMachine::MachinePart &mp) const
TTAProgram::Terminal::immediateUnit
virtual const TTAMachine::ImmediateUnit & immediateUnit() const
Definition: Terminal.cc:240
ITemplateBroker::Moves
std::vector< std::shared_ptr< const TTAProgram::Move > > Moves
Definition: ITemplateBroker.hh:123
ITemplateBroker::buildResources
virtual void buildResources(const TTAMachine::Machine &target) override
Definition: ITemplateBroker.cc:596
MathTools::requiredBits
static int requiredBits(unsigned long int number)
TTAMachine::InstructionTemplate::supportedWidth
virtual int supportedWidth() const
Definition: InstructionTemplate.cc:427
ITemplateBroker::reselectTemplate
void reselectTemplate(TTAProgram::Instruction &ins, int cycle)
Definition: ITemplateBroker.cc:470
INT_WORD_SIZE
const Byte INT_WORD_SIZE
Definition: BaseType.hh:154
TTAProgram::Move
Definition: Move.hh:55
SchedulingResource::isInUse
virtual bool isInUse(const int cycle) const =0
Machine.hh
Exception
Definition: Exception.hh:54
ITemplateBroker::isAlreadyAssigned
virtual bool isAlreadyAssigned(int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override
Definition: ITemplateBroker.cc:544
TTAProgram::Move::isInInstruction
bool isInInstruction() const
Definition: Move.cc:144
TTAMachine::InstructionTemplate::isOneOfDestinations
virtual bool isOneOfDestinations(const ImmediateUnit &dstUnit) const
Definition: InstructionTemplate.cc:323
TTAProgram::Instruction::immediatePtr
std::shared_ptr< Immediate > immediatePtr(int i) const
Definition: Instruction.cc:309
TTAProgram::Instruction::immediate
Immediate & immediate(int i) const
Definition: Instruction.cc:285
TTAProgram::Immediate::setValue
void setValue(TerminalImmediate *value)
Definition: Immediate.cc:114
ITemplateBroker::isAnyResourceAvailable
virtual bool isAnyResourceAvailable(int, const MoveNode &, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: ITemplateBroker.cc:115
MoveNode::immediatePtr
std::shared_ptr< TTAProgram::Immediate > immediatePtr()
Definition: MoveNode.cc:846
TTAProgram::Instruction::instructionTemplate
const TTAMachine::InstructionTemplate & instructionTemplate() const
Definition: Instruction.cc:523
SimValue::unsignedValue
unsigned int unsignedValue() const
Definition: SimValue.cc:919
TTAProgram::TerminalImmediate
Definition: TerminalImmediate.hh:44
ITemplateBroker::rm_
SimpleResourceManager * rm_
Definition: ITemplateBroker.hh:152
MoveNode::move
TTAProgram::Move & move()
SimValue::width
int width() const
Definition: SimValue.cc:103
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
TTAProgram::Move::parent
Instruction & parent() const
Definition: Move.cc:115
SchedulingResourceSet::count
int count() const
Definition: SchedulingResource.cc:251
ITemplateBroker::instructionsNotOwned_
std::map< int, bool > instructionsNotOwned_
Definition: ITemplateBroker.hh:148
Immediate.hh
ResourceManager::machine
const TTAMachine::Machine & machine() const
Definition: ResourceManager.cc:56
ITemplateBroker::instruction
virtual TTAProgram::Instruction * instruction(int cycle)
Definition: ITemplateBroker.cc:693
ITemplateBroker.hh
TTAProgram::Instruction::immediateCount
int immediateCount() const
Definition: Instruction.cc:267
ControlUnit.hh
TTAProgram::Instruction::setInstructionTemplate
void setInstructionTemplate(const TTAMachine::InstructionTemplate &insTemp)
Definition: Instruction.cc:488
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
ResourceBroker::instructionIndex
unsigned int instructionIndex(unsigned int) const
Definition: ResourceBroker.cc:249
ResourceMapper
Definition: ResourceMapper.hh:51
TTAProgram::Terminal::copy
virtual Terminal * copy() const =0
ITemplateBroker::clear
void clear() override
Definition: ITemplateBroker.cc:976
SimpleResourceManager.hh
TTAProgram::Terminal::equals
virtual bool equals(const Terminal &other) const =0
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
SimpleResourceManager
Definition: SimpleResourceManager.hh:58
ResourceBroker::machinePartOf
virtual const TTAMachine::MachinePart & machinePartOf(const SchedulingResource &r) const
Definition: ResourceBroker.cc:181
ContainerTools::containsValue
static bool containsValue(const ContainerType &aContainer, const ElementType &aKey)
ITemplateBroker::~ITemplateBroker
virtual ~ITemplateBroker()
Definition: ITemplateBroker.cc:89
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
KeyNotFound
Definition: Exception.hh:285
TTAProgram::Terminal::isCodeSymbolReference
virtual bool isCodeSymbolReference() const
Definition: Terminal.cc:154
ITemplateResource
Definition: ITemplateResource.hh:51
SchedulingResourceSet::resource
SchedulingResource & resource(int index) const
Definition: SchedulingResource.cc:263
ITemplateBroker::clearOldResources
void clearOldResources()
Definition: ITemplateBroker.cc:966
TerminalInstructionAddress.hh
MathTools.hh
ITemplateBroker::unassignImmediate
void unassignImmediate(int, const TTAMachine::ImmediateUnit &)
Definition: ITemplateBroker.cc:440
TTAMachine::ImmediateUnit::extensionMode
virtual Machine::Extension extensionMode() const
Definition: ImmediateUnit.cc:143
TTAProgram::Instruction::movePtr
std::shared_ptr< Move > movePtr(int i) const
Definition: Instruction.cc:216
Move.hh
TTAMachine
Definition: Assembler.hh:48
MoveNode::immediate
TTAProgram::Immediate & immediate()
Definition: MoveNode.cc:838
ITemplateBroker::unassign
virtual void unassign(MoveNode &node) override
Definition: ITemplateBroker.cc:381
MoveNode.hh
ITemplateBroker::immediateCycles_
std::map< const MoveNode *, int, GraphNode::Comparator > immediateCycles_
Record cycle for MoveNodes that needed immediate writes, IU broker restores immediates before the tem...
Definition: ITemplateBroker.hh:144
TTAMachine::Machine::instructionTemplateNavigator
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
Definition: Machine.cc:428
ITemplateBroker::Immediates
std::vector< std::shared_ptr< const TTAProgram::Immediate > > Immediates
Definition: ITemplateBroker.hh:124
ITemplateBroker::earliestCycle
virtual int earliestCycle(int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcUnit, const TTAMachine::FunctionUnit *dstUnit, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: ITemplateBroker.cc:500
SchedulingResourceSet::insert
void insert(SchedulingResource &resource)
Definition: SchedulingResource.cc:236
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
TTAMachine::AddressSpace::end
virtual ULongWord end() const
Definition: AddressSpace.cc:177
SLongWord
long SLongWord
Definition: BaseType.hh:52
MathTools::requiredBitsSigned
static int requiredBitsSigned(SLongWord number)
ITemplateBroker::immediateValues_
std::map< const MoveNode *, std::shared_ptr< TTAProgram::Immediate >, GraphNode::Comparator > immediateValues_
Definition: ITemplateBroker.hh:146
TTAProgram::Instruction::moveCount
int moveCount() const
Definition: Instruction.cc:176
ITemplateBroker::slots_
std::vector< TTAMachine::Bus * > slots_
Move/immediate slots.
Definition: ITemplateBroker.hh:133
TTAMachine::InstructionTemplate::usesSlot
virtual bool usesSlot(const std::string &slotName) const
Definition: InstructionTemplate.cc:265
CompilerWarnings.hh
TTAProgram::TerminalRegister
Definition: TerminalRegister.hh:53
TTAProgram::Instruction::addImmediate
void addImmediate(std::shared_ptr< Immediate > imm)
Definition: Instruction.cc:234
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::InstructionTemplate::destinationOfSlot
virtual ImmediateUnit * destinationOfSlot(const std::string &slotName) const
Definition: InstructionTemplate.cc:346
SchedulingResourceSet::sort
void sort()
Definition: SchedulingResource.cc:328
ITemplateBroker::isImmediateInTemplate
bool isImmediateInTemplate(int, std::shared_ptr< TTAProgram::Immediate >) const
Definition: ITemplateBroker.cc:920
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50