OpenASIP 2.2
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ProgramOperation Class Reference

#include <ProgramOperation.hh>

Collaboration diagram for ProgramOperation:
Collaboration graph

Classes

class  Comparator
 

Public Member Functions

 ProgramOperation (const Operation &operation, const llvm::MachineInstr *instr=NULL)
 
 ProgramOperation ()
 TODO: this better go, just for testing with empty operation...
 
 ~ProgramOperation ()
 
void addNode (MoveNode &node)
 
void addInputNode (MoveNode &node)
 
void addOutputNode (MoveNode &node, int outputIndex)
 
void addOutputNode (MoveNode &node)
 
void addGuardOutputNode (MoveNode &node)
 
int outputIndexFromGuardOfMove (const MoveNode &node) const
 
int outputIndexFromGuard (const TTAMachine::PortGuard &pg) const
 
int outputIndexOfMove (const MoveNode &mn) const
 
const TTAMachine::FunctionUnitscheduledFU () const
 
const TTAMachine::FunctionUnitfuFromOutMove (const MoveNode &outputNode) const
 
const TTAMachine::HWOperationhwopFromOutMove (const MoveNode &outputNode) const
 
void removeOutputNode (MoveNode &node, int outputIndex)
 
void removeOutputNode (MoveNode &node)
 
void removeGuardOutputNode (MoveNode &node)
 
void removeInputNode (MoveNode &node)
 
bool isComplete ()
 
bool isReady ()
 
bool isMultinode ()
 
bool isAssigned ()
 
bool isAnyNodeAssigned ()
 
bool isAnyInputAssigned ()
 
bool isAnyOutputAssigned ()
 
bool areInputsAssigned ()
 
bool areOutputsAssigned ()
 
MoveNodeopcodeSettingNode ()
 
MoveNodeSetinputNode (int in) const
 
MoveNodeSetoutputNode (int out) const
 
bool hasOutputNode (int out) const
 
bool hasInputNode (int in) const
 
const Operationoperation () const
 
void setOperation (const Operation &op)
 
int inputMoveCount () const
 
int outputMoveCount () const
 
bool hasMoveNodeForMove (const TTAProgram::Move &move) const
 
MoveNodemoveNode (const TTAProgram::Move &move) const
 
MoveNodeinputMove (int index) const
 
MoveNodeoutputMove (int index) const
 
MoveNodetriggeringMove () const
 
MoveNodefindTriggerFromUnit (const TTAMachine::Unit &unit) const
 
bool isLegalFU (const TTAMachine::FunctionUnit &fu) const
 
const llvm::MachineInstr * machineInstr () const
 
void switchInputs (int idx1=1, int idx2=2)
 
std::string toString () const
 
unsigned int poId () const
 
bool hasConstantOperand () const
 
bool operator== (const ProgramOperation &po)
 

Static Public Member Functions

static int outputIndexFromGuard (const TTAMachine::PortGuard &pg, const Operation &op)
 

Private Types

typedef std::vector< MoveNode * > MoveVector
 

Private Member Functions

 ProgramOperation (const ProgramOperation &)
 
ProgramOperationoperator= (const ProgramOperation &)
 

Private Attributes

const Operationoperation_
 
std::map< int, MoveNodeSet * > inputMoves_
 
std::map< int, MoveNodeSet * > outputMoves_
 
MoveVector allInputMoves_
 
MoveVector allOutputMoves_
 
unsigned int poId_
 
const llvm::MachineInstr * mInstr_
 

Static Private Attributes

static unsigned int idCounter = 0
 

Detailed Description

Represents a single execution of an operation in a program.

Definition at line 70 of file ProgramOperation.hh.

Member Typedef Documentation

◆ MoveVector

typedef std::vector<MoveNode*> ProgramOperation::MoveVector
private

Definition at line 158 of file ProgramOperation.hh.

Constructor & Destructor Documentation

◆ ProgramOperation() [1/3]

ProgramOperation::ProgramOperation ( const Operation operation,
const llvm::MachineInstr *  instr = NULL 
)

Constructor.

Creates a ProgramOperation from operation

Parameters
operationOperation

Definition at line 67 of file ProgramOperation.cc.

69 :
71}
const Operation & operation() const
static unsigned int idCounter
const Operation * operation_
const llvm::MachineInstr * mInstr_

◆ ProgramOperation() [2/3]

ProgramOperation::ProgramOperation ( )

TODO: this better go, just for testing with empty operation...

Constructor.

Creates a ProgramOperation from NullOperation

Definition at line 79 of file ProgramOperation.cc.

79 :
81 inputMoves_.clear();
82 outputMoves_.clear();
83}
static NullOperation & instance()
std::map< int, MoveNodeSet * > inputMoves_
std::map< int, MoveNodeSet * > outputMoves_

References inputMoves_, and outputMoves_.

◆ ~ProgramOperation()

ProgramOperation::~ProgramOperation ( )

Destructor.

Deletes MoveNodeSets. Does not unregister these program operations from movenodes.

Definition at line 90 of file ProgramOperation.cc.

90 {
91 // If MoveNodes of PO are not destroyed before PO they need to unset
92 // their source or destination operation respectively
93 for (int i = 0; i < inputMoveCount(); i++) {
95 }
96 for (int i = 0; i < outputMoveCount(); i++) {
97 if (&outputMove(i).sourceOperation() == this) {
99 } else {
100 if (&outputMove(i).guardOperation() == this) {
102 }
103 }
104 }
107}
static void deleteAllValues(ContainerType &aMap)
void unsetSourceOperation()
Definition MoveNode.cc:760
void removeDestinationOperation(const ProgramOperation *po)
Definition MoveNode.cc:741
ProgramOperation & sourceOperation() const
Definition MoveNode.cc:453
void unsetGuardOperation()
Definition MoveNode.cc:771
int outputMoveCount() const
int inputMoveCount() const
MoveNode & inputMove(int index) const
MoveNode & outputMove(int index) const

References AssocTools::deleteAllValues(), inputMove(), inputMoveCount(), inputMoves_, outputMove(), outputMoveCount(), outputMoves_, MoveNode::removeDestinationOperation(), MoveNode::sourceOperation(), MoveNode::unsetGuardOperation(), and MoveNode::unsetSourceOperation().

Here is the call graph for this function:

◆ ProgramOperation() [3/3]

ProgramOperation::ProgramOperation ( const ProgramOperation )
private

Member Function Documentation

◆ addGuardOutputNode()

void ProgramOperation::addGuardOutputNode ( MoveNode node)

Add given node to the set of nodes that belong to this program operation.

Add node to nodes of program operation

Parameters
nodeMoveNode to add to operation

Definition at line 201 of file ProgramOperation.cc.

201 {
202
204}
void addOutputNode(MoveNode &node, int outputIndex)
int outputIndexFromGuardOfMove(const MoveNode &node) const

References addOutputNode(), and outputIndexFromGuardOfMove().

Referenced by MoveNodeDuplicator::duplicateMoveNode().

Here is the call graph for this function:

◆ addInputNode()

void ProgramOperation::addInputNode ( MoveNode node)

Add given node to the set of input nodes that belong to this program operation.

Input node is a move that writes an operand of the operation.

Parameters
nodeMoveNode to add to operation

Definition at line 144 of file ProgramOperation.cc.

144 {
145 int inputIndex = node.move().destination().operationIndex();
146 if (MapTools::containsKey(inputMoves_, inputIndex)) {
147 MoveNodeSet* nodeSet =
149 nodeSet->addMoveNode(node);
150 allInputMoves_.push_back(&node);
151 } else {
152 MoveNodeSet* nodeSet = new MoveNodeSet;
153 nodeSet->addMoveNode(node);
154 inputMoves_[inputIndex] = nodeSet;
155 allInputMoves_.push_back(&node);
156 }
157}
static KeyType keyForValue(const MapType &aMap, const ValueType &aValue)
static bool containsKey(const MapType &aMap, const KeyType &aKey)
void addMoveNode(MoveNode &)
TTAProgram::Move & move()
Terminal & destination() const
Definition Move.cc:323
virtual int operationIndex() const
Definition Terminal.cc:364

References MoveNodeSet::addMoveNode(), allInputMoves_, MapTools::containsKey(), TTAProgram::Move::destination(), inputMoves_, MapTools::keyForValue(), MoveNode::move(), and TTAProgram::Terminal::operationIndex().

Referenced by addNode(), MoveNode::copy(), and MoveNodeDuplicator::duplicateMoveNode().

Here is the call graph for this function:

◆ addNode()

void ProgramOperation::addNode ( MoveNode node)

Add given node to the set of nodes that belong to this program operation.

Warning: this should not be used with bypassed moves!

Add node to nodes of program operation

Parameters
nodeMoveNode to add to operation

Definition at line 119 of file ProgramOperation.cc.

119 {
120 if (node.move().source().isFUPort()) {
121 if (node.move().source().hintOperation().name() ==
122 operation().name()) {
123 addOutputNode(node);
124 }
125 } else {
126 if (node.move().destination().isFUPort()) {
127 if (node.move().destination().hintOperation().name() ==
128 operation().name()) {
129 addInputNode(node);
130 }
131 }
132 }
133}
virtual TCEString name() const
Definition Operation.cc:93
void addInputNode(MoveNode &node)
Terminal & source() const
Definition Move.cc:302
virtual Operation & hintOperation() const
Definition Terminal.cc:341
virtual bool isFUPort() const
Definition Terminal.cc:118

References addInputNode(), addOutputNode(), TTAProgram::Move::destination(), TTAProgram::Terminal::hintOperation(), TTAProgram::Terminal::isFUPort(), MoveNode::move(), Operation::name(), operation(), and TTAProgram::Move::source().

Here is the call graph for this function:

◆ addOutputNode() [1/2]

void ProgramOperation::addOutputNode ( MoveNode node)

Add given node to the set of nodes that belong to this program operation.

Add node to nodes of program operation

Parameters
nodeMoveNode to add to operation

Definition at line 188 of file ProgramOperation.cc.

188 {
189
190 int outputIndex = node.move().source().operationIndex();
191 addOutputNode(node, outputIndex);
192}

References addOutputNode(), MoveNode::move(), TTAProgram::Terminal::operationIndex(), and TTAProgram::Move::source().

Here is the call graph for this function:

◆ addOutputNode() [2/2]

void ProgramOperation::addOutputNode ( MoveNode node,
int  outputIndex 
)

Add given node to the set of nodes that belong to this program operation.

Add node to nodes of program operation

Parameters
nodeMoveNode to add to operation
outputIndexoutput index of the operation.

Definition at line 167 of file ProgramOperation.cc.

167 {
168 if (MapTools::containsKey(outputMoves_, outputIndex)) {
169 MoveNodeSet* nodeSet =
171 nodeSet->addMoveNode(node);
172 allOutputMoves_.push_back(&node);
173 } else {
174 MoveNodeSet* nodeSet = new MoveNodeSet;
175 nodeSet->addMoveNode(node);
176 allOutputMoves_.push_back(&node);
177 outputMoves_[outputIndex] = nodeSet;
178 }
179}

References MoveNodeSet::addMoveNode(), allOutputMoves_, MapTools::containsKey(), MapTools::keyForValue(), and outputMoves_.

Referenced by addGuardOutputNode(), addNode(), addOutputNode(), MoveNode::copy(), and MoveNodeDuplicator::duplicateMoveNode().

Here is the call graph for this function:

◆ areInputsAssigned()

bool ProgramOperation::areInputsAssigned ( )

Return true if nodes of this operation have function unit assigned to their source or destination respectively

Returns
True if nodes have source or destination function unit assigned

Definition at line 435 of file ProgramOperation.cc.

435 {
436 for (int i = 0; i < inputMoveCount(); i++ ) {
437 if (!inputMove(i).isAssigned()) {
438 return false;
439 }
440 }
441 return true;
442}
bool isAssigned() const
Definition MoveNode.cc:367

References inputMove(), inputMoveCount(), and MoveNode::isAssigned().

Referenced by CopyingDelaySlotFiller::tryToAssignOtherMovesOfOp().

Here is the call graph for this function:

◆ areOutputsAssigned()

bool ProgramOperation::areOutputsAssigned ( )

Return true if nodes of this operation have function unit assigned to their source or destination respectively

Returns
True if nodes have source or destination function unit assigned

Definition at line 467 of file ProgramOperation.cc.

467 {
468 for (int i = 0; i < outputMoveCount(); i++ ) {
469 if (!outputMove(i).isAssigned()) {
470 return false;
471 }
472 }
473 return true;
474}

References MoveNode::isAssigned(), outputMove(), and outputMoveCount().

Here is the call graph for this function:

◆ findTriggerFromUnit()

MoveNode * ProgramOperation::findTriggerFromUnit ( const TTAMachine::Unit unit) const

Definition at line 677 of file ProgramOperation.cc.

678 {
679 const TTAMachine::FunctionUnit* fu =
680 dynamic_cast<const TTAMachine::FunctionUnit*>(&unit);
681 int ioIndex = -1;
682 assert(fu);
683
684 int portC = fu->portCount();
685 for (int i = 0; i < portC; i++) {
686 auto p = fu->port(i);
687 const TTAMachine::FUPort* port = dynamic_cast<const TTAMachine::FUPort*>(p);
688 if (port != nullptr && port->isTriggering()) {
689 const TTAMachine::HWOperation* hwop =
690 fu->operation(operation().name());
691 ioIndex = hwop->io(*port);
692 auto ngi = inputMoves_.find(ioIndex);
693 if (ngi == inputMoves_.end()) {
694 return NULL;
695 }
696 auto mng = *ngi->second;
697 if (mng.count() < 1)
698 return NULL;
699 return &mng.at(0);
700 }
701 }
702 return NULL;
703}
#define assert(condition)
virtual bool isTriggering() const
Definition FUPort.cc:182
virtual HWOperation * operation(const std::string &name) const
virtual BaseFUPort * port(const std::string &name) const
int io(const FUPort &port) const
virtual int portCount() const
Definition Unit.cc:135

References assert, inputMoves_, TTAMachine::HWOperation::io(), TTAMachine::FUPort::isTriggering(), Operation::name(), operation(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::port(), and TTAMachine::Unit::portCount().

Referenced by ExecutionPipelineResource::resultCausesTriggerBetweenOperandSharing(), and triggeringMove().

Here is the call graph for this function:

◆ fuFromOutMove()

const TTAMachine::FunctionUnit * ProgramOperation::fuFromOutMove ( const MoveNode outputNode) const

Definition at line 844 of file ProgramOperation.cc.

844 {
845 if (outputNode.isAssigned() &&
846 outputNode.isSourceOperation() &&
847 &outputNode.sourceOperation() == this) {
848 return static_cast<const TTAMachine::FunctionUnit*>(
849 outputNode.move().source().port().parentUnit());
850 }
851 if (!outputNode.move().isUnconditional() &&
852 outputNode.isGuardOperation() &&
853 outputNode.guardOperationPtr().get() == this) {
854 const TTAMachine::Guard& guard =
855 outputNode.move().guard().guard();
856 const TTAMachine::PortGuard* pg =
857 dynamic_cast<const TTAMachine::PortGuard*>(&guard);
858 assert(pg); // todo: throw?
859 return static_cast<const TTAMachine::FunctionUnit*>(
860 pg->port()->parentUnit());
861 }
862 return nullptr;
863}
MoveNodeSet & outputNode(int out) const
FunctionUnit * parentUnit() const
Definition BaseFUPort.cc:96
FUPort * port() const

References assert, outputNode(), TTAMachine::BaseFUPort::parentUnit(), and TTAMachine::PortGuard::port().

Referenced by ExecutionPipelineBroker::earliestFromDestination(), OutputFUBroker::isAlreadyAssigned(), ExecutionPipelineBroker::latestFromSource(), ExecutionPipelineResource::latestTriggerWriteCycle(), scheduledFU(), triggeringMove(), and OutputFUBroker::unassign().

Here is the call graph for this function:

◆ hasConstantOperand()

bool ProgramOperation::hasConstantOperand ( ) const

Returns true in case the operation has at least one operand that is a contant/immediate.

Definition at line 831 of file ProgramOperation.cc.

831 {
832 for (MoveVector::const_iterator i = allInputMoves_.begin();
833 i != allInputMoves_.end(); ++i) {
834 MoveNode* mn = *i;
835 if (mn->isSourceConstant())
836 return true;
837 }
838 return false;
839}
bool isSourceConstant() const
Definition MoveNode.cc:238

References allInputMoves_, and MoveNode::isSourceConstant().

Here is the call graph for this function:

◆ hasInputNode()

bool ProgramOperation::hasInputNode ( int  index) const

Return true if program operation has node registered for input identified by index.

Parameters
IndexOperation input to test
Returns
True if the operation input Index has node registered

Definition at line 560 of file ProgramOperation.cc.

560 {
562 return true;
563 } else {
564 return false;
565 }
566}

References MapTools::containsKey(), and inputMoves_.

Here is the call graph for this function:

◆ hasMoveNodeForMove()

bool ProgramOperation::hasMoveNodeForMove ( const TTAProgram::Move move) const

Definition at line 723 of file ProgramOperation.cc.

724 {
725
726 for (std::size_t i = 0; i < allInputMoves_.size(); ++i) {
728 if (&moveNode.move() == &move)
729 return true;
730 }
731 for (std::size_t i = 0; i < allOutputMoves_.size(); ++i) {
733 if (&moveNode.move() == &move)
734 return true;
735 }
736 return false;
737}
MoveNode & moveNode(const TTAProgram::Move &move) const

References allInputMoves_, allOutputMoves_, MoveNode::move(), and moveNode().

Here is the call graph for this function:

◆ hasOutputNode()

bool ProgramOperation::hasOutputNode ( int  index) const

Return true if program operation has node registered for output identified by index.

Parameters
IndexOperation output to test
Returns
True if the operation output Index has node registered

Definition at line 576 of file ProgramOperation.cc.

576 {
578 return true;
579 } else {
580 return false;
581 }
582}

References MapTools::containsKey(), and outputMoves_.

Here is the call graph for this function:

◆ hwopFromOutMove()

const TTAMachine::HWOperation * ProgramOperation::hwopFromOutMove ( const MoveNode outputNode) const

Definition at line 895 of file ProgramOperation.cc.

896 {
897 if (outputNode.isSourceOperation() &&
898 &outputNode.sourceOperation() == this) {
899 return outputNode.move().source().functionUnit().operation(
900 operation().name());
901 } else {
902 const TTAMachine::Guard& guard =
903 outputNode.move().guard().guard();
904 const TTAMachine::PortGuard* pg =
905 dynamic_cast<const TTAMachine::PortGuard*>(&guard);
906 assert(pg); // todo: throw?
907 const TTAMachine::Port* p = pg->port();
908 const TTAMachine::Unit* u = p->parentUnit();
909 const TTAMachine::FunctionUnit* fu =
910 static_cast<const TTAMachine::FunctionUnit*>(u);
911 return fu->operation(operation().name());
912 }
913}
Unit * parentUnit() const

References assert, Operation::name(), operation(), TTAMachine::FunctionUnit::operation(), outputNode(), TTAMachine::Port::parentUnit(), and TTAMachine::PortGuard::port().

Referenced by BF2ScheduleFront::prefResultCycle().

Here is the call graph for this function:

◆ inputMove()

MoveNode & ProgramOperation::inputMove ( int  index) const

Returns the given input move.

Parameters
indexIndex of the move.
Returns
The input move.

Definition at line 621 of file ProgramOperation.cc.

621 {
622 return *allInputMoves_.at(index);
623}

References allInputMoves_.

Referenced by RegisterCopyAdder::addCandidateSetAnnotations(), RegisterCopyAdder::addRegisterCopies(), InputFUBroker::allAvailableResources(), ResourceConstraintAnalyzer::analyzeMoveNode(), annotateAllInputs(), areInputsAssigned(), BFEarlyBypasser::bypassSourceLatestCycle(), DataDependenceGraphBuilder::checkAndCreateMemDep(), ExecutionPipelineResource::checkOperandAllowed(), DataDependenceGraph::dotString(), ExecutionPipelineBroker::earliestFromDestination(), ExecutionPipelineBroker::earliestFromSource(), BF2ScheduleFront::findInducingBypassSourceFromOperation(), MachineConnectivityCheck::findPossibleDestinationPorts(), BF2Scheduler::getDstUnit(), BFOptimization::immCountPreventsScheduling(), RegisterCopyAdder::isAllowedUnit(), isAnyInputAssigned(), isAnyNodeAssigned(), isAssigned(), MoveNode::isLastUnscheduledMoveOfDstOp(), isLegalFU(), ExecutionPipelineBroker::isMoveTrigger(), DataDependenceGraph::latestCycle(), ExecutionPipelineBroker::latestFromDestination(), ExecutionPipelineBroker::latestFromSource(), DataDependenceGraphBuilder::memoryCategory(), CriticalPathBBMoveNodeSelector::mightBeReady(), DataDependenceGraph::moveFUDependenciesToTrigger(), ExecutionPipelineResource::operandAllowedAtCycle(), ExecutionPipelineResource::operandsOverwritten(), BFLateBypassGuard::operator()(), BFPushMoveUp::operator()(), BFPushMoveUp2::operator()(), ResourceConstraintAnalyzer::optimalScheduleResourceUsage(), ExecutionPipelineResource::poConflictsWithInputPort(), BUMoveNodeSelector::queueOperation(), ExecutionPipelineResource::resultCausesTriggerBetweenOperandSharing(), BFOptimization::RFReadPortCountPreventsScheduling(), scheduledFU(), BUBasicBlockScheduler::scheduleOperation(), setOperation(), switchInputs(), ExecutionPipelineResource::triggerTooEarly(), CopyingDelaySlotFiller::tryToAssignOtherMovesOfOp(), PreOptimizer::tryToOptimizeAddressReg(), PreOptimizer::tryToPrecalcConstantAdd(), PreOptimizer::tryToRemoveEq(), PreOptimizer::tryToRemoveGuardInversingOp(), PreOptimizer::tryToRemoveXor(), BasicBlockScheduler::tryToSwitchInputs(), BUBasicBlockScheduler::tryToSwitchInputs(), DataDependenceGraph::writeToXMLFile(), and ~ProgramOperation().

◆ inputMoveCount()

int ProgramOperation::inputMoveCount ( ) const

Count of input moves to this operation.

Returns
The count of input moves.

Definition at line 600 of file ProgramOperation.cc.

600 {
601 return allInputMoves_.size();
602}

References allInputMoves_.

Referenced by RegisterCopyAdder::addCandidateSetAnnotations(), RegisterCopyAdder::addRegisterCopies(), InputFUBroker::allAvailableResources(), ResourceConstraintAnalyzer::analyzeMoveNode(), annotateAllInputs(), areInputsAssigned(), BFEarlyBypasser::bypassSourceLatestCycle(), DataDependenceGraphBuilder::checkAndCreateMemDep(), ExecutionPipelineResource::checkOperandAllowed(), DataDependenceGraph::dotString(), ExecutionPipelineBroker::earliestFromDestination(), ExecutionPipelineBroker::earliestFromSource(), BF2ScheduleFront::findInducingBypassSourceFromOperation(), MachineConnectivityCheck::findPossibleDestinationPorts(), BF2Scheduler::getDstUnit(), BFOptimization::immCountPreventsScheduling(), RegisterCopyAdder::isAllowedUnit(), isAnyInputAssigned(), isAnyNodeAssigned(), isAssigned(), MoveNode::isLastUnscheduledMoveOfDstOp(), isLegalFU(), ExecutionPipelineBroker::isMoveTrigger(), DataDependenceGraph::latestCycle(), ExecutionPipelineBroker::latestFromDestination(), ExecutionPipelineBroker::latestFromSource(), DataDependenceGraphBuilder::memoryCategory(), CriticalPathBBMoveNodeSelector::mightBeReady(), DataDependenceGraph::moveFUDependenciesToTrigger(), ExecutionPipelineResource::operandAllowedAtCycle(), ExecutionPipelineResource::operandsOverwritten(), BFLateBypassGuard::operator()(), BFPushMoveUp::operator()(), BFPushMoveUp2::operator()(), ExecutionPipelineResource::poConflictsWithInputPort(), BUMoveNodeSelector::queueOperation(), ExecutionPipelineResource::resultCausesTriggerBetweenOperandSharing(), BFOptimization::RFReadPortCountPreventsScheduling(), scheduledFU(), SequentialScheduler::scheduleOperandWrites(), BUBasicBlockScheduler::scheduleOperation(), setOperation(), switchInputs(), ExecutionPipelineResource::triggerTooEarly(), CopyingDelaySlotFiller::tryToAssignOtherMovesOfOp(), PreOptimizer::tryToOptimizeAddressReg(), PreOptimizer::tryToPrecalcConstantAdd(), PreOptimizer::tryToRemoveEq(), PreOptimizer::tryToRemoveXor(), BasicBlockScheduler::tryToSwitchInputs(), BUBasicBlockScheduler::tryToSwitchInputs(), DataDependenceGraph::writeToXMLFile(), and ~ProgramOperation().

◆ inputNode()

MoveNodeSet & ProgramOperation::inputNode ( int  index) const

Return the nodes that writes input Index of operation

Parameters
indexIndex of a operation to test
Returns
Set of nodes that writes particular input of operation
Exceptions
OutOfRangeIn case the index is higher then number of operation inputs

Definition at line 513 of file ProgramOperation.cc.

513 {
514 if (index < 1 || index > operation_->numberOfInputs()) {
515 std::string msg = "InputNode index out of range.";
516 throw OutOfRange(__FILE__, __LINE__, __func__, msg);
517 }
518
519 std::map<int, MoveNodeSet*>::const_iterator i = inputMoves_.find(index);
520 if (i != inputMoves_.end()) {
521 return *(i->second);
522 } else {
523 std::string msg = "InputNode index not found.";
524 throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
525 }
526}
#define __func__
virtual int numberOfInputs() const
Definition Operation.cc:192

References __func__, inputMoves_, Operation::numberOfInputs(), and operation_.

Referenced by MemoryAliasAnalyzer::addressOperandMove(), LoopAnalyzer::analyze(), OffsetAliasAnalyzer::analyze(), BF2Scheduler::countLoopInvariantValueUsages(), MemoryAliasAnalyzer::detectConstantScale(), LoopAnalyzer::findEndCond(), MemoryAliasAnalyzer::findIncrement(), LoopAnalyzer::findInitAndUpdate(), DataDependenceGraph::findLoopIndexUpdate(), DataDependenceGraph::findLoopLimitAndIndex(), BasicBlockScheduler::findTriggerFromUnit(), StackAliasAnalyzer::getStackOffset(), OffsetAliasAnalyzer::isAddressTraceable(), ExecutionPipelineResource::nodeOfInputPort(), BF2Scheduler::reservePreallocatedFUs(), scheduledFU(), MemoryAliasAnalyzer::searchLoopIndexBasedIncrement(), and LoopAnalyzer::tryTrackCommonAncestor().

Here is the call graph for this function:

◆ isAnyInputAssigned()

bool ProgramOperation::isAnyInputAssigned ( )

Return true if any node of this operation have function unit assigned to their source or destination respectively

Returns
True if any node has source or destination function unit assigned

Definition at line 419 of file ProgramOperation.cc.

419 {
420 for (int i = 0; i < inputMoveCount(); i++ ) {
421 if (inputMove(i).isAssigned()) {
422 return true;
423 }
424 }
425 return false;
426}

References inputMove(), inputMoveCount(), and MoveNode::isAssigned().

Here is the call graph for this function:

◆ isAnyNodeAssigned()

bool ProgramOperation::isAnyNodeAssigned ( )

Return true if any node of this operation have function unit assigned to their source or destination respectively

Returns
True if any node has source or destination function unit assigned

Definition at line 398 of file ProgramOperation.cc.

398 {
399 for (int i = 0; i < inputMoveCount(); i++ ) {
400 if (inputMove(i).isAssigned()) {
401 return true;
402 }
403 }
404 for (int i = 0; i < outputMoveCount(); i++ ) {
405 if (outputMove(i).isAssigned()) {
406 return true;
407 }
408 }
409 return false;
410}

References inputMove(), inputMoveCount(), MoveNode::isAssigned(), outputMove(), and outputMoveCount().

Referenced by MachineConnectivityCheck::findPossibleDestinationPorts().

Here is the call graph for this function:

◆ isAnyOutputAssigned()

bool ProgramOperation::isAnyOutputAssigned ( )

Return true if any output node of this operation have function unit assigned to their source or destination respectively

Returns
True if any node has source or destination function unit assigned

Definition at line 451 of file ProgramOperation.cc.

451 {
452 for (int i = 0; i < outputMoveCount(); i++ ) {
453 if (outputMove(i).isAssigned()) {
454 return true;
455 }
456 }
457 return false;
458}

References MoveNode::isAssigned(), outputMove(), and outputMoveCount().

Referenced by BUBasicBlockScheduler::scheduleMove().

Here is the call graph for this function:

◆ isAssigned()

bool ProgramOperation::isAssigned ( )

Return true if nodes of this operation have function unit assigned to their source or destination respectively

Returns
True if nodes have source or destination function unit assigned

Definition at line 377 of file ProgramOperation.cc.

377 {
378 for (int i = 0; i < inputMoveCount(); i++ ) {
379 if (!inputMove(i).isAssigned()) {
380 return false;
381 }
382 }
383 for (int i = 0; i < outputMoveCount(); i++ ) {
384 if (!outputMove(i).isAssigned()) {
385 return false;
386 }
387 }
388 return true;
389}

References inputMove(), inputMoveCount(), MoveNode::isAssigned(), outputMove(), and outputMoveCount().

Here is the call graph for this function:

◆ isComplete()

bool ProgramOperation::isComplete ( )

Return true if each input and each output of the operation has a corresponding node reference in this program operation

Returns
True if each input and output of operation has node reference

Definition at line 315 of file ProgramOperation.cc.

315 {
316 if (!isReady()) {
317 return false;
318 }
319 // numbering of output does not start from 1 but input count +1
320 int begin = operation_->numberOfInputs() + 1;
322 for (int i = begin; i <= end; i++) {
324 return false;
325 }
326 }
327 return true;
328}
virtual int numberOfOutputs() const
Definition Operation.cc:202

References MapTools::containsKey(), isReady(), Operation::numberOfInputs(), Operation::numberOfOutputs(), operation_, and outputMoves_.

Here is the call graph for this function:

◆ isLegalFU()

bool ProgramOperation::isLegalFU ( const TTAMachine::FunctionUnit fu) const

Definition at line 915 of file ProgramOperation.cc.

915 {
916
917 if (!fu.hasOperation(operation_->name())) {
918 return false;
919 }
920 for (int i = 0; i < inputMoveCount(); i++) {
921 MoveNode& mn = inputMove(i);
922 TTAProgram::Move& move = mn.move();
923 if (move.hasAnnotation(
925 fu.name())) {
926 return false;
927 }
928 }
929 for (int i = 0; i < outputMoveCount(); i++) {
930 MoveNode& mn = outputMove(i);
931 TTAProgram::Move& move = mn.move();
932 if (move.hasAnnotation(
934 fu.name())) {
935 return false;
936 }
937 }
938 return true;
939}
virtual TCEString name() const
virtual bool hasOperation(const std::string &name) const
bool hasAnnotation(ProgramAnnotation::Id id, const TCEString &data) const
@ ANN_REJECTED_UNIT_SRC
Src. unit rejected.
@ ANN_REJECTED_UNIT_DST
Dst. unit rejected.

References TTAProgram::ProgramAnnotation::ANN_REJECTED_UNIT_DST, TTAProgram::ProgramAnnotation::ANN_REJECTED_UNIT_SRC, TTAProgram::AnnotatedInstructionElement::hasAnnotation(), TTAMachine::FunctionUnit::hasOperation(), inputMove(), inputMoveCount(), MoveNode::move(), TTAMachine::Component::name(), Operation::name(), operation_, outputMove(), and outputMoveCount().

Referenced by FUBroker::findFUOfPO(), and BFLateBypassGuard::operator()().

Here is the call graph for this function:

◆ isMultinode()

bool ProgramOperation::isMultinode ( )

Return true if this program operation has more then one reference for some input or output of the operation.

Returns
True if some of inputs or outputs has more then one reference

Definition at line 352 of file ProgramOperation.cc.

352 {
353 std::map<int,MoveNodeSet*>::iterator moveIt = inputMoves_.begin();
354 while (moveIt != inputMoves_.end()) {
355 if ((*moveIt).second->count() > 1) {
356 return true;
357 }
358 moveIt++;
359 }
360 moveIt = outputMoves_.begin();
361 while (moveIt != outputMoves_.end()) {
362 if ((*moveIt).second->count() > 1) {
363 return true;
364 }
365 moveIt++;
366 }
367 return false;
368}

References inputMoves_, and outputMoves_.

◆ isReady()

bool ProgramOperation::isReady ( )

Return true if each input node has corresponding node reference

Returns
True if each input of operation has corresponding node reference

Definition at line 336 of file ProgramOperation.cc.

336 {
337 for (int i = 1; i <= operation_->numberOfInputs(); i++) {
339 return false;
340 }
341 }
342 return true;
343}

References MapTools::containsKey(), inputMoves_, Operation::numberOfInputs(), and operation_.

Referenced by isComplete().

Here is the call graph for this function:

◆ machineInstr()

const llvm::MachineInstr * ProgramOperation::machineInstr ( ) const
inline

◆ moveNode()

MoveNode & ProgramOperation::moveNode ( const TTAProgram::Move move) const

Definition at line 706 of file ProgramOperation.cc.

706 {
707
708 for (std::size_t i = 0; i < allInputMoves_.size(); ++i) {
710 if (&moveNode.move() == &move)
711 return moveNode;
712 }
713 for (std::size_t i = 0; i < allOutputMoves_.size(); ++i) {
715 if (&moveNode.move() == &move)
716 return moveNode;
717 }
718 throw KeyNotFound(__FILE__, __LINE__, __func__,
719 "No MoveNode for the Move found in the ProgramOperation.");
720}

References __func__, allInputMoves_, allOutputMoves_, MoveNode::move(), and moveNode().

Referenced by hasMoveNodeForMove(), moveNode(), and triggeringMove().

Here is the call graph for this function:

◆ opcodeSettingNode()

MoveNode & ProgramOperation::opcodeSettingNode ( )

Return the MoveNode of program operation that sets the opcode and triggers operation execution.

Such a MoveNode is usually one of input nodes and can not have multiple copies.

Returns
MoveNode that sets opcode and triggers execution
Exceptions
InvalidDataIn case there is no opcode setting node register in operation

Definition at line 487 of file ProgramOperation.cc.

487 {
488 std::map<int,MoveNodeSet*>::iterator moveIt = inputMoves_.begin();
489 while (moveIt != inputMoves_.end()) {
490 if ((*moveIt).second->at(0).move().destination().isOpcodeSetting()) {
491 if ((*moveIt).second->count() > 1) {
492 std::string msg = "ProgramOperation has more then one opcode\
493 setting node.";
494 throw InvalidData(__FILE__, __LINE__, __func__, msg);
495 }
496 return (*moveIt).second->at(0);
497 }
498 moveIt++;
499 }
500 std::string msg = "ProgramOperation is missing opcode setting node.";
501 throw InvalidData(__FILE__, __LINE__, __func__, msg);
502}

References __func__, and inputMoves_.

Referenced by ResourceConstraintAnalyzer::analyzeMoveNode().

◆ operation()

const Operation & ProgramOperation::operation ( ) const

Return the operation from OSAL

Returns
Return the operation object handle from OSAL

Definition at line 590 of file ProgramOperation.cc.

590 {
591 return *operation_;
592}

References operation_.

Referenced by addNode(), MemoryAliasAnalyzer::addressOperandMove(), OutputFUBroker::allAvailableResources(), LoopAnalyzer::analyze(), OffsetAliasAnalyzer::analyze(), ResourceConstraintAnalyzer::analyzeMoveNode(), OutputFUBroker::assign(), BusResource::canAssign(), ExecutionPipelineResource::canAssignDestination(), ExecutionPipelineResource::canAssignSource(), BFOptimization::canBeSpeculated(), PreOptimizer::checkGuardReversalAllowed(), CopyingDelaySlotFiller::collectMoves(), MemoryAliasAnalyzer::compareIndeces(), BF2Scheduler::countLoopInvariantValueUsages(), MemoryAliasAnalyzer::detectConstantScale(), ResourceConstraintAnalyzer::dumpGraphWithStats(), MoveNodeDuplicator::duplicateMove(), ExecutionPipelineBroker::earliestFromDestination(), ExecutionPipelineBroker::earliestFromSource(), MoveNode::earliestResultReadCycle(), LoopAnalyzer::findEndCond(), MemoryAliasAnalyzer::findIncrement(), LoopAnalyzer::findInitAndUpdate(), DataDependenceGraph::findLoopIndexUpdate(), DataDependenceGraph::findLoopLimitAndIndex(), MachineConnectivityCheck::findPossibleDestinationPorts(), MachineConnectivityCheck::findPossibleSourcePorts(), BasicBlockScheduler::findTrigger(), BasicBlockScheduler::findTriggerFromUnit(), findTriggerFromUnit(), MemoryAliasAnalyzer::findTwoPartAddressOperands(), CopyingDelaySlotFiller::getMove(), PreOptimizer::handleCFGDDG(), hwopFromOutMove(), BFOptimization::immCountPreventsScheduling(), OffsetAliasAnalyzer::isAddressTraceable(), ExecutionPipelineBroker::isMoveTrigger(), BF2Scheduler::isTrigger(), DataDependenceGraphBuilder::isTriggering(), ExecutionPipelineBroker::latestFromDestination(), ExecutionPipelineBroker::latestFromSource(), MoveNode::latestTriggerWriteCycle(), ExecutionPipelineResource::latestTriggerWriteCycle(), BF2Scheduler::mustBeTrigger(), ExecutionPipelineResource::nodeOfInputPort(), ExecutionPipelineResource::operandOverwritten(), ExecutionPipelineResource::operandPort(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), ExecutionPipelineResource::operandTooLate(), BFLateBypassGuard::operator()(), BFRemoveLoopChecksAndJump::operator()(), BFShareOperands::operator()(), outputIndexFromGuard(), ExecutionPipelineResource::poConflictsWithInputPort(), RegisterCopyAdder::requiredRegisterCopiesForEachFU(), BF2Scheduler::reservePreallocatedFUs(), ExecutionPipelineResource::resultCausesTriggerBetweenOperandSharing(), ExecutionPipelineResource::resultPort(), ExecutionPipelineResource::resultReadyCycle(), BFOptimization::RFReadPortCountPreventsScheduling(), BUBasicBlockScheduler::scheduleMove(), BasicBlockScheduler::scheduleMove(), MemoryAliasAnalyzer::searchLoopIndexBasedIncrement(), ExecutionPipelineResource::setOperandsUsed(), ExecutionPipelineResource::setResultWriten(), switchInputs(), ExecutionPipelineResource::testTriggerResult(), ExecutionPipelineResource::triggerTooEarly(), PreOptimizer::tryToPrecalcConstantAdd(), PreOptimizer::tryToRemoveEq(), BasicBlockScheduler::tryToSwitchInputs(), BUBasicBlockScheduler::tryToSwitchInputs(), LoopAnalyzer::tryTrackCommonAncestor(), ExecutionPipelineResource::unsetOperandsUsed(), and ExecutionPipelineResource::unsetResultWriten().

◆ operator=()

ProgramOperation & ProgramOperation::operator= ( const ProgramOperation )
private

◆ operator==()

bool ProgramOperation::operator== ( const ProgramOperation po)
inline

Definition at line 147 of file ProgramOperation.hh.

147{ return poId() == po.poId(); }
unsigned int poId() const

References poId().

Here is the call graph for this function:

◆ outputIndexFromGuard() [1/2]

int ProgramOperation::outputIndexFromGuard ( const TTAMachine::PortGuard pg) const

Definition at line 266 of file ProgramOperation.cc.

266 {
267 return outputIndexFromGuard(pg, operation());
268}
int outputIndexFromGuard(const TTAMachine::PortGuard &pg) const

References operation(), and outputIndexFromGuard().

Referenced by BFLateBypassGuard::operator()(), outputIndexFromGuard(), and outputIndexFromGuardOfMove().

Here is the call graph for this function:

◆ outputIndexFromGuard() [2/2]

int ProgramOperation::outputIndexFromGuard ( const TTAMachine::PortGuard pg,
const Operation op 
)
static

Definition at line 271 of file ProgramOperation.cc.

272 {
273
274 const TTAMachine::Port* p = pg.port();
275 const TTAMachine::FUPort* fup = static_cast<const TTAMachine::FUPort*>(p);
276 const TTAMachine::Unit* u = p->parentUnit();
277 const TTAMachine::FunctionUnit* fu =
278 static_cast<const TTAMachine::FunctionUnit*>(u);
279 const TTAMachine::HWOperation* hwop = fu->operation(op.name());
280 return hwop->io(*fup);
281}

References TTAMachine::HWOperation::io(), Operation::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::Port::parentUnit(), and TTAMachine::PortGuard::port().

Here is the call graph for this function:

◆ outputIndexFromGuardOfMove()

int ProgramOperation::outputIndexFromGuardOfMove ( const MoveNode node) const

Definition at line 256 of file ProgramOperation.cc.

256 {
257 assert(!node.move().isUnconditional()); // todo: throw?
258 const TTAMachine::Guard& guard = node.move().guard().guard();
259 const TTAMachine::PortGuard* pg =
260 dynamic_cast<const TTAMachine::PortGuard*>(&guard);
261 assert(pg); // todo: throw?
262 return outputIndexFromGuard(*pg);
263}
const TTAMachine::Guard & guard() const
Definition MoveGuard.cc:86
MoveGuard & guard() const
Definition Move.cc:345
bool isUnconditional() const
Definition Move.cc:154

References assert, TTAProgram::Move::guard(), TTAProgram::MoveGuard::guard(), TTAProgram::Move::isUnconditional(), MoveNode::move(), and outputIndexFromGuard().

Referenced by addGuardOutputNode(), OutputFUBroker::allAvailableResources(), ExecutionPipelineResource::canAssignSource(), ExecutionPipelineBroker::latestFromDestination(), outputIndexOfMove(), removeGuardOutputNode(), and ExecutionPipelineResource::testTriggerResult().

Here is the call graph for this function:

◆ outputIndexOfMove()

int ProgramOperation::outputIndexOfMove ( const MoveNode mn) const

◆ outputMove()

MoveNode & ProgramOperation::outputMove ( int  index) const

Returns the given output move.

Parameters
indexIndex of the move.
Returns
The output move.

Definition at line 632 of file ProgramOperation.cc.

632 {
633 return *allOutputMoves_.at(index);
634}

References allOutputMoves_.

Referenced by RegisterCopyAdder::addCandidateSetAnnotations(), RegisterCopyAdder::addRegisterCopies(), annotateAllOutputs(), areOutputsAssigned(), BFEarlyBypasser::bypassSourceLatestCycle(), DataDependenceGraph::dotString(), DataDependenceGraph::earliestCycle(), ExecutionPipelineBroker::earliestFromDestination(), BF2ScheduleFront::findInducingBypassSourceFromOperation(), MachineConnectivityCheck::findPossibleDestinationPorts(), RegisterCopyAdder::isAllowedUnit(), isAnyNodeAssigned(), isAnyOutputAssigned(), isAssigned(), isLegalFU(), ExecutionPipelineBroker::latestFromDestination(), ExecutionPipelineBroker::latestFromSource(), MoveNode::latestTriggerWriteCycle(), ExecutionPipelineResource::latestTriggerWriteCycle(), CriticalPathBBMoveNodeSelector::mightBeReady(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), BFLateBypassGuard::operator()(), BFPushMoveUp2::operator()(), BFRescheduleResultsClose::operator()(), BF2ScheduleFront::prefResultCycle(), BUMoveNodeSelector::queueOperation(), scheduledFU(), BUBasicBlockScheduler::scheduleMove(), BUBasicBlockScheduler::scheduleOperation(), setOperation(), ExecutionPipelineResource::testTriggerResult(), CopyingDelaySlotFiller::tryToAssignOtherMovesOfOp(), PreOptimizer::tryToOptimizeAddressReg(), PreOptimizer::tryToPrecalcConstantAdd(), PreOptimizer::tryToRemoveGuardInversingOp(), and ~ProgramOperation().

◆ outputMoveCount()

int ProgramOperation::outputMoveCount ( ) const

Count of output moves to this operation.

Returns
The count of output moves.

Definition at line 610 of file ProgramOperation.cc.

610 {
611 return allOutputMoves_.size();
612}

References allOutputMoves_.

Referenced by RegisterCopyAdder::addCandidateSetAnnotations(), RegisterCopyAdder::addRegisterCopies(), annotateAllOutputs(), areOutputsAssigned(), BFEarlyBypasser::bypassSourceLatestCycle(), DataDependenceGraph::dotString(), DataDependenceGraph::earliestCycle(), ExecutionPipelineBroker::earliestFromDestination(), BF2ScheduleFront::findInducingBypassSourceFromOperation(), MachineConnectivityCheck::findPossibleDestinationPorts(), RegisterCopyAdder::isAllowedUnit(), isAnyNodeAssigned(), isAnyOutputAssigned(), isAssigned(), isLegalFU(), ExecutionPipelineBroker::latestFromDestination(), ExecutionPipelineBroker::latestFromSource(), MoveNode::latestTriggerWriteCycle(), ExecutionPipelineResource::latestTriggerWriteCycle(), CriticalPathBBMoveNodeSelector::mightBeReady(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), BFLateBypassGuard::operator()(), BFPushMoveUp2::operator()(), BFRescheduleResultsClose::operator()(), BF2ScheduleFront::prefResultCycle(), BUMoveNodeSelector::queueOperation(), scheduledFU(), BUBasicBlockScheduler::scheduleMove(), BUBasicBlockScheduler::scheduleOperation(), setOperation(), ExecutionPipelineResource::testTriggerResult(), CopyingDelaySlotFiller::tryToAssignOtherMovesOfOp(), PreOptimizer::tryToOptimizeAddressReg(), PreOptimizer::tryToRemoveEq(), PreOptimizer::tryToRemoveXor(), and ~ProgramOperation().

◆ outputNode()

MoveNodeSet & ProgramOperation::outputNode ( int  index) const

Return the nodes that writes output Index of operation

Parameters
indexIndex of a operation to test
Returns
Set of nodes that writes particular output of operation
Exceptions
OutOfRangeIf index is not found

Definition at line 535 of file ProgramOperation.cc.

535 {
536 if (index <= operation_->numberOfInputs() ||
537 index > operation_->numberOfInputs()+
539 std::string msg = "OutputNode index out of range.";
540 throw OutOfRange(__FILE__, __LINE__, __func__, msg);
541 }
542
544 MoveNodeSet* nodeSet =
546 return *nodeSet;
547 } else {
548 std::string msg = "OutputNode index not found.";
549 throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
550 }
551}

References __func__, MapTools::containsKey(), MapTools::keyForValue(), Operation::numberOfInputs(), Operation::numberOfOutputs(), operation_, and outputMoves_.

Referenced by ExecutionPipelineResource::canAssignSource(), fuFromOutMove(), hwopFromOutMove(), and scheduledFU().

Here is the call graph for this function:

◆ poId()

unsigned int ProgramOperation::poId ( ) const

Returns an unique id of this program operation.

These can be used instead of pointers for comparison, and are more deterministic as they are given in order.

Definition at line 765 of file ProgramOperation.cc.

765 {
766 return poId_;
767}

References poId_.

Referenced by StackAliasAnalyzer::analyze(), OffsetAliasAnalyzer::analyze(), DataDependenceGraph::dotString(), MoveNode::dotString(), OffsetAliasAnalyzer::isAddressTraceable(), StackAliasAnalyzer::isAddressTraceable(), ProgramOperation::Comparator::operator()(), operator==(), and toString().

◆ removeGuardOutputNode()

void ProgramOperation::removeGuardOutputNode ( MoveNode node)

Removes output node from set of nodes that belong to this program operation.

Parameters
nodeMoveNode being removed from this program operation

Definition at line 249 of file ProgramOperation.cc.

249 {
250
252}
void removeOutputNode(MoveNode &node, int outputIndex)

References outputIndexFromGuardOfMove(), and removeOutputNode().

Referenced by DataDependenceGraph::guardRestored(), and MoveNode::~MoveNode().

Here is the call graph for this function:

◆ removeInputNode()

void ProgramOperation::removeInputNode ( MoveNode node)

Removes output node from set of nodes that belong to this program operation.

Parameters
nodeMoveNode being removed from this program operation

Definition at line 289 of file ProgramOperation.cc.

289 {
290 int inputIndex = node.move().destination().operationIndex();
291 if (MapTools::containsKey(inputMoves_,inputIndex)) {
292 MoveNodeSet* nodeSet =
294 nodeSet->removeMoveNode(node);
295 for (std::vector<MoveNode*>::iterator i = allInputMoves_.begin();
296 i != allInputMoves_.end(); i++) {
297 if (*i == &node) {
298 allInputMoves_.erase(i);
299 break;
300 }
301 }
302 } else {
304 __FILE__,__LINE__,__func__,"MoveNode not part of PO");
305 }
306}
void removeMoveNode(MoveNode &)

References __func__, allInputMoves_, MapTools::containsKey(), TTAProgram::Move::destination(), inputMoves_, MapTools::keyForValue(), MoveNode::move(), TTAProgram::Terminal::operationIndex(), and MoveNodeSet::removeMoveNode().

Referenced by DataDependenceGraph::removeNode(), and MoveNode::~MoveNode().

Here is the call graph for this function:

◆ removeOutputNode() [1/2]

void ProgramOperation::removeOutputNode ( MoveNode node)

Removes output node from set of nodes that belong to this program operation.

Parameters
nodeMoveNode being removed from this program operation

Definition at line 238 of file ProgramOperation.cc.

238 {
239 int outputIndex = node.move().source().operationIndex();
240 removeOutputNode(node, outputIndex);
241}

References MoveNode::move(), TTAProgram::Terminal::operationIndex(), removeOutputNode(), and TTAProgram::Move::source().

Here is the call graph for this function:

◆ removeOutputNode() [2/2]

void ProgramOperation::removeOutputNode ( MoveNode node,
int  outputIndex 
)

Removes output node from set of nodes that belong to this program operation.

Parameters
nodeMoveNode being removed from this program operation
outputIndexthe output index.

Definition at line 214 of file ProgramOperation.cc.

214 {
215 if (MapTools::containsKey(outputMoves_,outputIndex)) {
216 MoveNodeSet* nodeSet =
218 nodeSet->removeMoveNode(node);
219 for (std::vector<MoveNode*>::iterator i = allOutputMoves_.begin();
220 i != allOutputMoves_.end(); i++) {
221 if (*i == &node) {
222 allOutputMoves_.erase(i);
223 break;
224 }
225 }
226 } else {
228 __FILE__,__LINE__,__func__,"MoveNode not part of PO");
229 }
230}

References __func__, allOutputMoves_, MapTools::containsKey(), MapTools::keyForValue(), outputMoves_, and MoveNodeSet::removeMoveNode().

Referenced by removeGuardOutputNode(), DataDependenceGraph::removeNode(), removeOutputNode(), PreOptimizer::tryToPrecalcConstantAdd(), BFUpdateMoveOnBypass::undoOnlyMe(), DataDependenceGraph::unMergeUser(), and MoveNode::~MoveNode().

Here is the call graph for this function:

◆ scheduledFU()

const TTAMachine::FunctionUnit * ProgramOperation::scheduledFU ( ) const

Definition at line 866 of file ProgramOperation.cc.

866 {
867
868 for (int i = 0; i < inputMoveCount(); i++ ) {
870 if (inputNode.isAssigned()) {
871 return static_cast<const TTAMachine::FunctionUnit*>(
872 inputNode.move().destination().port().parentUnit());
873 }
874 }
875 for (int i = 0; i < outputMoveCount(); i++ ) {
878 if (fu != nullptr) {
879 return fu;
880 }
881 }
882 return nullptr;
883}
MoveNodeSet & inputNode(int in) const
const TTAMachine::FunctionUnit * fuFromOutMove(const MoveNode &outputNode) const

References fuFromOutMove(), inputMove(), inputMoveCount(), inputNode(), outputMove(), outputMoveCount(), and outputNode().

Referenced by MachineConnectivityCheck::busConnectedToAnyFU(), FUBroker::findFUOfPO(), and BFShareOperands::operator()().

Here is the call graph for this function:

◆ setOperation()

void ProgramOperation::setOperation ( const Operation op)

Definition at line 941 of file ProgramOperation.cc.

941 {
942 operation_ = &op;
943 for (int i = 0; i < inputMoveCount(); i++) {
944 MoveNode& mn = inputMove(i);
946 &mn.move().destination());
947 assert(tfp);
948 tfp->setHintOperation(op.name().c_str());
949 }
950
951 for (int i = 0; i < outputMoveCount(); i++) {
952 MoveNode& mn = outputMove(i);
954 &mn.move().source());
955 assert(tfp);
956 tfp->setHintOperation(op.name().c_str());
957 }
958}
void setHintOperation(const char *name)

References assert, TTAProgram::Move::destination(), inputMove(), inputMoveCount(), MoveNode::move(), Operation::name(), operation_, outputMove(), outputMoveCount(), TTAProgram::TerminalFUPort::setHintOperation(), and TTAProgram::Move::source().

Referenced by Peel2BBLoops::appendBB().

Here is the call graph for this function:

◆ switchInputs()

void ProgramOperation::switchInputs ( int  idx1 = 1,
int  idx2 = 2 
)

Switches inputs of 2-operand commutative operations

Definition at line 795 of file ProgramOperation.cc.

795 {
796
797 const Operation& op = operation();
798 assert (op.numberOfInputs() >= 2);
799
800 // switch input nodes.
801 MoveNodeSet tmpSet = *inputMoves_[idx1];
802 *inputMoves_[idx1] = *inputMoves_[idx2];
803 *inputMoves_[idx2] = tmpSet;
804
805 for (int i = 0; i < inputMoveCount(); i++) {
806 MoveNode& node = inputMove(i);
807 TTAProgram::Move& move = node.move();
808 TTAProgram::Terminal& oldDest = move.destination();
809
810 // then update the moves.
811 if (move.destination().operationIndex() == idx1) {
812 move.setDestination(
814 *static_cast<TTAProgram::TerminalFUPort&>(oldDest).
815 hwOperation(), idx2));
816
817 } else if (move.destination().operationIndex() == idx2) {
818 move.setDestination(
820 *static_cast<TTAProgram::TerminalFUPort&>(oldDest).
821 hwOperation(), idx1));
822 }
823 }
824}
void setDestination(Terminal *dst)
Definition Move.cc:333

References assert, TTAProgram::Move::destination(), inputMove(), inputMoveCount(), inputMoves_, MoveNode::move(), Operation::numberOfInputs(), operation(), TTAProgram::Terminal::operationIndex(), and TTAProgram::Move::setDestination().

Referenced by PreOptimizer::inverseGuardsOfHeads(), BasicBlockScheduler::tryToSwitchInputs(), and BUBasicBlockScheduler::tryToSwitchInputs().

Here is the call graph for this function:

◆ toString()

std::string ProgramOperation::toString ( ) const

The moves of the program operation in human readable format.

Returns
The program operation as a string.

Definition at line 746 of file ProgramOperation.cc.

746 {
748 output << " Inputs: ";
749 for (std::size_t i = 0; i < allInputMoves_.size(); ++i) {
750 output += allInputMoves_.at(i)->toString() + " ";
751 }
752 output << " Outputs: ";
753 for (std::size_t i = 0; i < allOutputMoves_.size(); ++i) {
754 output += allOutputMoves_.at(i)->toString() + " ";
755 }
756 return output;
757}
static std::string toString(const T &source)

References allInputMoves_, allOutputMoves_, poId(), and Conversion::toString().

Referenced by RegisterCopyAdder::addMinimumRegisterCopies(), BF2Scheduler::allocateFunctionUnits(), LoopAnalyzer::analyze(), ResourceConstraintAnalyzer::analyzeMoveNode(), BFOptimization::assign(), BFOptimization::assignCopyToPrologEpilog(), ExecutionPipelineResource::assignDestination(), MoveNodeGroupBuilder::build(), BFOptimization::canAssign(), ExecutionPipelineResource::canAssignDestination(), DataDependenceGraphBuilder::checkAndCreateMemDep(), ExecutionPipelineResource::checkOperandAllowed(), ExecutionPipelineResource::operandOverwritten(), ExecutionPipelineResource::operandOverwritten(), ExecutionPipelineResource::operandsOverwritten(), BFLateBypassGuard::operator()(), BF2Scheduler::preAllocateFunctionUnits(), ExecutionPipelineResource::resultAllowedAtCycle(), ExecutionPipelineResource::resultReadyCycle(), BFUnscheduleFromBody::returnOriginal(), BFUnscheduleMove::returnOriginal(), BFShareOperandLate::revert(), ExecutionPipelineResource::triggerTooEarly(), BFLateBypass::undoOnlyMe(), BFUnscheduleFromBody::unscheduleOriginal(), and BFUnscheduleMove::unscheduleOriginal().

Here is the call graph for this function:

◆ triggeringMove()

MoveNode * ProgramOperation::triggeringMove ( ) const

Returns the triggering move of the operation.

Returns
The triggering move. NULL in case the operation is not yet assigned to an FU, or the triggering move has not been assigned yet.

Definition at line 643 of file ProgramOperation.cc.

643 {
644
645 for (std::size_t i = 0; i < allInputMoves_.size(); ++i) {
647 const TTAProgram::Move& move = moveNode.move();
648 TTAProgram::Terminal& dest = move.destination();
649 if (!dest.isFUPort()) {
650 continue;
651 }
652 const TTAMachine::BaseFUPort* fup =
653 static_cast<const TTAMachine::BaseFUPort*>(&dest.port());
654 if (dynamic_cast<const UniversalFUPort*>(fup)) {
655 continue;
656 }
657
658 if (fup->isTriggering()) {
659 return &moveNode;
660 } else {
661 return findTriggerFromUnit(
662 *fup->parentUnit());
663 }
664 }
665
666 for (std::size_t i = 0; i< allOutputMoves_.size(); ++i) {
669 if (fu != nullptr) {
670 return findTriggerFromUnit(*fu);
671 }
672 }
673 return NULL;
674}
MoveNode * findTriggerFromUnit(const TTAMachine::Unit &unit) const
virtual bool isTriggering() const =0
virtual const TTAMachine::Port & port() const
Definition Terminal.cc:378

References allInputMoves_, allOutputMoves_, TTAProgram::Move::destination(), findTriggerFromUnit(), fuFromOutMove(), TTAProgram::Terminal::isFUPort(), TTAMachine::BaseFUPort::isTriggering(), MoveNode::move(), moveNode(), TTAMachine::BaseFUPort::parentUnit(), and TTAProgram::Terminal::port().

Referenced by CopyingDelaySlotFiller::allowedToSpeculate(), ResourceConstraintAnalyzer::analyzeMoveNode(), ExecutionPipelineResource::canAssignSource(), DataDependenceGraph::earliestCycle(), MoveNode::earliestResultReadCycle(), BasicBlockScheduler::findTrigger(), ExecutionPipelineResource::hasConflictingResultsOnCycle(), ExecutionPipelineResource::nextResultCycle(), ExecutionPipelineResource::operandAllowedAtCycle(), ExecutionPipelineResource::operandOverwritten(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), ExecutionPipelineResource::operandTooLate(), BFPushMoveUp2::operator()(), BFShareOperandLate::operator()(), ExecutionPipelineResource::otherTriggerBeforeMyTrigger(), ExecutionPipelineResource::resultCausesTriggerBetweenOperandSharing(), and ExecutionPipelineResource::resultReadyCycle().

Here is the call graph for this function:

Member Data Documentation

◆ allInputMoves_

MoveVector ProgramOperation::allInputMoves_
private

◆ allOutputMoves_

MoveVector ProgramOperation::allOutputMoves_
private

◆ idCounter

unsigned int ProgramOperation::idCounter = 0
staticprivate

Definition at line 174 of file ProgramOperation.hh.

◆ inputMoves_

std::map<int,MoveNodeSet*> ProgramOperation::inputMoves_
private

◆ mInstr_

const llvm::MachineInstr* ProgramOperation::mInstr_
private

Definition at line 176 of file ProgramOperation.hh.

Referenced by machineInstr().

◆ operation_

const Operation* ProgramOperation::operation_
private

◆ outputMoves_

std::map<int,MoveNodeSet*> ProgramOperation::outputMoves_
private

◆ poId_

unsigned int ProgramOperation::poId_
private

Definition at line 173 of file ProgramOperation.hh.

Referenced by poId().


The documentation for this class was generated from the following files: