OpenASIP
2.0
|
#include <BasicBlockScheduler.hh>
Static Public Member Functions | |
static MoveNode * | findTrigger (const ProgramOperation &po, const TTAMachine::Machine &mach) |
Static Public Member Functions inherited from BasicBlockPass | |
static void | copyRMToBB (SimpleResourceManager &rm, TTAProgram::BasicBlock &bb, const TTAMachine::Machine &targetMachine, TTAProgram::InstructionReferenceManager &irm, int lastCycle=-1) |
Static Protected Member Functions | |
static MoveNode * | findTriggerFromUnit (const ProgramOperation &po, const TTAMachine::Unit &unit) |
Protected Attributes | |
const TTAMachine::Machine * | targetMachine_ |
The target machine we are scheduling the program against. More... | |
DataDependenceGraph * | ddg_ |
DDG of the currently scheduled BB. More... | |
SimpleResourceManager * | rm_ |
Resource Manager of the currently scheduled BB. More... | |
std::map< const MoveNode *, DataDependenceGraph::NodeSet > | scheduledTempMoves_ |
Stores the MoveNodes that were scheduled as temp moves during scheduling of the operand move. More... | |
SoftwareBypasser * | softwareBypasser_ |
The software bypasser to use to bypass registers when possible. More... | |
RegisterRenamer * | renamer_ |
int | minCycle_ |
The earliest cycle to schedule moves in. Used to leave room for sched_yield() by the sched_yield() emitter. More... | |
MoveNodeSelector * | selector_ |
boost::timer | schedulingTime_ |
Time for getting the scheduling time for current basic block. More... | |
int | bypassedCount_ |
int | deadResults_ |
LLVMTCECmdLineOptions * | options_ |
MoveNode * | jumpNode_ |
int | tripCount_ |
A class that implements the functionality of a basic block scheduler.
Schedules the program one basic block at a time. Does not fill delay slots if they couldn't be filled with the basic block's contents itself (no instruction importing).
Definition at line 66 of file BasicBlockScheduler.hh.
BasicBlockScheduler::BasicBlockScheduler | ( | InterPassData & | data, |
SoftwareBypasser * | bypasser = NULL , |
||
RegisterRenamer * | renamer = NULL |
||
) |
Constructs the basic block scheduler.
data | Interpass data |
bypasser | Helper module implementing software bypassing |
delaySlotFiller | Helper module implementing jump delay slot filling |
Definition at line 85 of file BasicBlockScheduler.cc.
References Application::cmdLineOptions(), and options_.
|
virtual |
Definition at line 95 of file BasicBlockScheduler.cc.
|
inline |
Definition at line 86 of file BasicBlockPass.hh.
|
protected |
Prints DDG to a dot file before and after scheudling
ddg | to print |
name | operation name for ddg |
final | specify if ddg is after scheduling |
resetCounter | |
format | format of the file |
Definition at line 1633 of file BasicBlockScheduler.cc.
References DataDependenceGraph::criticalPathGraph(), ddg_, DataDependenceGraph::DUMP_DOT, BoostGraph< GraphNode, GraphEdge >::name(), GraphBase< GraphNode, GraphEdge >::writeToDotFile(), and DataDependenceGraph::writeToXMLFile().
Referenced by BUBasicBlockScheduler::handleDDG(), handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), handleLoopDDG(), and scheduleOperation().
|
static |
Definition at line 2094 of file BasicBlockScheduler.cc.
References TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), findTriggerFromUnit(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::Machine::Navigator< ComponentType >::item(), Operation::name(), ProgramOperation::operation(), and ProgramOperation::triggeringMove().
Referenced by BFOptimization::getSisterTrigger(), BF2Scheduler::mustBeTrigger(), and BUBasicBlockScheduler::scheduleOperandWrites().
|
staticprotected |
Definition at line 2130 of file BasicBlockScheduler.cc.
References MoveNodeSet::at(), ProgramOperation::inputNode(), TTAMachine::HWOperation::io(), TTAMachine::FUPort::isTriggering(), Operation::name(), TTAMachine::FunctionUnit::operation(), ProgramOperation::operation(), TTAMachine::FunctionUnit::port(), and TTAMachine::Unit::portCount().
Referenced by findTrigger().
|
protected |
Returns the operand which is triggering in all FU's which support the operation. If operation not found, is not gcu or multiple FU's have different triggers, returns 0
Definition at line 1684 of file BasicBlockScheduler.cc.
References TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::FUPort::isTriggering(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, Operation::name(), Operation::numberOfInputs(), TTAMachine::FunctionUnit::operation(), and TTAMachine::HWOperation::port().
Referenced by BUBasicBlockScheduler::tryToSwitchInputs(), and tryToSwitchInputs().
|
overridevirtual |
Schedules a piece of code in a DDG
ddg | The ddg containing the code |
rm | Resource manager that is to be used. |
targetMachine | The target machine. |
Exception | several TCE exceptions can be thrown in case of a scheduling error. |
Reimplemented from DDGPass.
Reimplemented in BUBasicBlockScheduler.
Definition at line 109 of file BasicBlockScheduler.cc.
References __func__, SoftwareBypasser::bypassNode(), CriticalPathBBMoveNodeSelector::candidates(), SoftwareBypasser::clearCaches(), ddg_, ddgSnapshot(), TTAProgram::Move::destination(), DataDependenceGraph::DUMP_DOT, DataDependenceGraph::DUMP_XML, LLVMTCECmdLineOptions::dumpDDGsDot(), LLVMTCECmdLineOptions::dumpDDGsXML(), TTAProgram::Terminal::equals(), RegisterRenamer::initialize(), MoveNode::isMove(), MoveNode::isOperationMove(), TTAProgram::Terminal::isRA(), MoveNodeGroup::isScheduled(), SimpleResourceManager::largestCycle(), minCycle_, MoveNode::move(), MoveNodeGroup::node(), BoostGraph< GraphNode, GraphEdge >::node(), MoveNodeGroup::nodeCount(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), notifyScheduled(), options_, SoftwareBypasser::removeBypass(), SoftwareBypasser::removeDeadResults(), renamer_, rm_, DataDependenceGraph::scheduledNodeCount(), scheduledTempMoves_, scheduleMove(), scheduleOperation(), scheduleRRMove(), schedulingTime_, selector_, RegisterRenamer::setSelector(), SoftwareBypasser::setSelector(), softwareBypasser_, TTAProgram::Move::source(), targetMachine_, MoveNode::toString(), tripCount_, unscheduleAllNodes(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
|
overridevirtual |
Schedules loop in a DDG
ddg | The ddg containing the loop |
rm | Resource manager that is to be used. |
targetMachine | The target machine. |
Exception | several TCE exceptions can be thrown in case of a scheduling error. |
Reimplemented from DDGPass.
Reimplemented in BUBasicBlockScheduler.
Definition at line 254 of file BasicBlockScheduler.cc.
References abortWithError, MoveNodeGroup::addNode(), CriticalPathBBMoveNodeSelector::candidates(), SoftwareBypasser::clearCaches(), ddg_, ddgSnapshot(), debugLog, TTAProgram::Move::destination(), DataDependenceGraph::DUMP_DOT, DataDependenceGraph::DUMP_XML, LLVMTCECmdLineOptions::dumpDDGsDot(), LLVMTCECmdLineOptions::dumpDDGsXML(), RegisterRenamer::initialize(), SimpleResourceManager::initiationInterval(), TTAProgram::Move::isControlFlowMove(), MoveNode::isMove(), MoveNode::isOperationMove(), TTAProgram::Terminal::isRA(), MoveNodeGroup::isScheduled(), jumpNode_, DataDependenceGraph::largestCycle(), Application::logStream(), minCycle_, MoveNode::move(), MoveNodeGroup::node(), BoostGraph< GraphNode, GraphEdge >::node(), MoveNodeGroup::nodeCount(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), notifyScheduled(), options_, renamer_, rm_, DataDependenceGraph::scheduledNodeCount(), scheduledTempMoves_, scheduleMove(), scheduleOperation(), scheduleRRMove(), schedulingTime_, RegisterRenamer::setSelector(), SoftwareBypasser::setSelector(), softwareBypasser_, targetMachine_, Conversion::toString(), tripCount_, unscheduleAllNodes(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
|
protected |
Checks if the result moves that were removed might remove some resource bottleneck of already scheduled moves.
This situation happens at least when a result move used the last RF write port for a cycle and limited the earliest cycle of a previously scheduled move. Thus, after the last use of that result was scheduled and bypassed, the RF write port is freed as the result move becomes unnecessary, thus the move that was scheduled before could be scheduled earlier. Same thing can happen for bus (move slot) contrained moves and also moves that were restricted by a WaR edge due to the result move, etc.
Definition at line 1807 of file BasicBlockScheduler.cc.
References assert, MoveNode::cycle(), ddg_, TTAProgram::Move::destination(), SimpleResourceManager::instruction(), TTAProgram::Terminal::isGPR(), MoveNode::isScheduled(), Application::logStream(), MoveNode::move(), DataDependenceGraph::movesAtCycle(), TTAProgram::Terminal::registerFile(), rm_, scheduleMove(), TTAProgram::Move::toString(), TTAProgram::Instruction::toString(), MoveNode::toString(), and unschedule().
Referenced by scheduleOperation().
|
virtual |
Optional longer description of the pass.
This description can include usage instructions, details of choice of algorithmic details, etc.
Reimplemented from SchedulerPass.
Reimplemented in BUBasicBlockScheduler.
Definition at line 1587 of file BasicBlockScheduler.cc.
|
protected |
Notifies to the selector that given nodes and their temp reg copies are scheduled .
nodes | nodes which are scheduled. |
selector | selector which to notify. |
Definition at line 1602 of file BasicBlockScheduler.cc.
References MoveNodeGroup::node(), MoveNodeGroup::nodeCount(), MoveNodeSelector::notifyScheduled(), and scheduledTempMoves_.
Referenced by handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), and handleLoopDDG().
|
virtual |
Definition at line 1908 of file BasicBlockScheduler.cc.
References Application::verboseLevel().
|
protected |
Schedules the (possible) temporary register copy moves (due to missing connectivity) preceeding the given input move.
The function recursively goes through all the temporary moves added to the given input move.
operandMove | A temp move whose predecessor has to be scheduled. |
operandWrite | The original move of which temp moves to schedule. |
Definition at line 1344 of file BasicBlockScheduler.cc.
References TTAProgram::ProgramAnnotation::ANN_CONNECTIVITY_MOVE, assert, MoveNode::cycle(), ddg_, DataDependenceEdge::DEP_RAW, TTAProgram::Move::destination(), DataDependenceEdge::EDGE_REGISTER, TTAProgram::AnnotatedInstructionElement::hasAnnotations(), TTAProgram::Terminal::index(), BoostGraph< GraphNode, GraphEdge >::inEdges(), MoveNode::isScheduled(), DataDependenceGraph::lastScheduledRegisterRead(), MoveNode::move(), TTAProgram::Terminal::registerFile(), scheduledTempMoves_, scheduleMove(), and BoostGraph< GraphNode, GraphEdge >::tailNode().
Referenced by scheduleOperandWrites().
|
protected |
Schedules a single move to the earliest possible cycle, taking in account the DDG, resource constraints, and latencies in producing source values.
This method assumes the move is possible to schedule with regards to connectivity and resources. Short immediates are converted to long immediates when needed.
move | The move to schedule. |
earliestCycle | The earliest cycle to try. |
allowPredicationAndRenaming | Whether allowed to remove guard from the move being scheduled. Checks again side-effects are still made, this can be done only to operand moves and triggers without mem write or side-effects. |
Definition at line 950 of file BasicBlockScheduler.cc.
References __func__, MoveNodeSet::addMoveNode(), Operation::affectsCount(), TTAProgram::ProgramAnnotation::ANN_REQUIRES_LIMM, TTAProgram::ProgramAnnotation::ANN_STACKFRAME_PROCEDURE_RETURN, assert, SimpleResourceManager::assign(), SimpleResourceManager::canTransportImmediate(), TTAMachine::Machine::controlUnit(), MoveNode::cycle(), ddg_, TTAMachine::ControlUnit::delaySlots(), TTAProgram::Move::destination(), MoveNode::destinationOperation(), SimpleResourceManager::earliestCycle(), DataDependenceGraph::earliestCycle(), MoveNode::earliestResultReadCycle(), Exception::errorMessageStack(), DataDependenceGraph::findLimitingAntidependenceSource(), DataDependenceGraph::findLoopLimitAndIndex(), MoveNode::guardLatency(), TTAProgram::AnnotatedInstructionElement::hasAnnotations(), Operation::hasSideEffects(), SimpleResourceManager::initiationInterval(), TTAProgram::Move::isControlFlowMove(), MoveNode::isDestinationOperation(), TTAProgram::Terminal::isGPR(), TTAProgram::Move::isReturn(), MoveNode::isScheduled(), MoveNode::isSourceConstant(), MoveNode::isSourceOperation(), TTAProgram::Move::isUnconditional(), jumpNode_, SimpleResourceManager::largestCycle(), DataDependenceGraph::largestCycle(), DataDependenceGraph::latestCycle(), minCycle_, MoveNode::move(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), ProgramOperation::operation(), DataDependenceGraph::removeIncomingGuardEdges(), RegisterRenamer::renameDestinationRegister(), renamer_, RegisterRenamer::renameSourceRegister(), rm_, DataDependenceGraph::scheduledNodeCount(), TTAProgram::AnnotatedInstructionElement::setAnnotation(), TTAProgram::Move::setGuard(), TTAProgram::Move::setSource(), TTAProgram::Move::source(), MoveNode::sourceOperation(), targetMachine_, Conversion::toString(), MoveNode::toString(), tripCount_, tryToOptimizeWaw(), unschedule(), unscheduleAllNodes(), DataDependenceGraph::unscheduledMoves(), SimValue::unsignedValue(), TTAProgram::TerminalImmediate::value(), SimValue::width(), Operation::writesMemory(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
Referenced by handleDDG(), handleLoopDDG(), handleRemovedResultMoves(), scheduleInputOperandTempMoves(), scheduleOperandWrites(), scheduleResultReads(), scheduleResultReadTempMoves(), scheduleRRMove(), scheduleRRTempMoves(), and tryToOptimizeWaw().
|
protected |
Schedules operand moves of an operation execution.
Assumes the given MoveNodeGroup contains all moves in the operation execution. Also assumes that all inputs to the MoveNodeGroup have been scheduled. Exception to this are the possible temporary register copies inserted before the operand move due to missing connectivity. If found, the temp moves are scheduled atomically with the operand move. Assumes top-down scheduling.
cycle | Earliest cycle for starting scheduling of operands. This parameter is modified to the highest cycle one should try next in case scheduling starting from the given cycle failed. |
moves | Moves of the operation execution. |
Definition at line 633 of file BasicBlockScheduler.cc.
References __func__, assert, MoveNode::cycle(), ddg_, TTAProgram::Move::destination(), SimpleResourceManager::earliestCycle(), DataDependenceGraph::earliestCycle(), SimpleResourceManager::initiationInterval(), MoveNode::isDestinationOperation(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), TTAProgram::Terminal::isTriggering(), MoveNode::move(), MoveNodeGroup::node(), MoveNodeGroup::nodeCount(), rm_, scheduleInputOperandTempMoves(), scheduleMove(), Conversion::toString(), MoveNodeGroup::toString(), MoveNode::toString(), unschedule(), unscheduleAllNodes(), unscheduleInputOperandTempMoves(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
Referenced by scheduleOperation().
|
protected |
Schedules moves in a single operation execution.
Assumes the given MoveNodeGroup contains all moves in the operation execution. Also assumes that all inputs to the MoveNodeGroup have been scheduled.
moves | Moves of the operation execution. |
Definition at line 401 of file BasicBlockScheduler.cc.
References __func__, RegisterCopyAdder::addMinimumRegisterCopies(), MoveNodeSet::addMoveNode(), SoftwareBypasser::bypass(), RegisterCopyAdder::AddedRegisterCopies::count_, ddg_, ddgSnapshot(), MoveNode::destinationOperation(), DataDependenceGraph::DUMP_DOT, DataDependenceGraph::DUMP_XML, LLVMTCECmdLineOptions::dumpDDGsDot(), Exception::errorMessageStack(), handleRemovedResultMoves(), SimpleResourceManager::initiationInterval(), SchedulerPass::interPassData(), MoveNode::isDestinationOperation(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), SimpleResourceManager::largestCycle(), Application::logStream(), BoostGraph< GraphNode, GraphEdge >::name(), MoveNodeGroup::node(), MoveNodeGroup::nodeCount(), RegisterCopyAdder::operandsScheduled(), options_, SoftwareBypasser::removeBypass(), SoftwareBypasser::removeDeadResults(), RegisterCopyAdder::resultsScheduled(), rm_, DataDependenceGraph::sanityCheck(), scheduleOperandWrites(), scheduleResultReads(), selector_, DataDependenceGraph::setCycleGrouping(), softwareBypasser_, MoveNode::sourceOperation(), targetMachine_, Conversion::toString(), MoveNodeGroup::toString(), tryToSwitchInputs(), unschedule(), unscheduleAllNodes(), unscheduleInputOperandTempMoves(), unscheduleResultReadTempMoves(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
Referenced by handleDDG(), and handleLoopDDG().
|
protected |
Schedules the result read moves of an operation execution.
Assumes the given MoveNodeGroup contains all moves in the operation execution. Also assumes that all operand moves have been scheduled.
moves | Moves of the operation execution. |
Definition at line 847 of file BasicBlockScheduler.cc.
References __func__, MoveNode::cycle(), ddg_, TTAProgram::Move::destination(), TTAProgram::Terminal::index(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), DataDependenceGraph::lastScheduledRegisterRead(), MoveNode::move(), MoveNodeGroup::node(), MoveNodeGroup::nodeCount(), TTAProgram::Terminal::registerFile(), scheduleMove(), scheduleResultReadTempMoves(), succeedingTempMove(), and MoveNode::toString().
Referenced by scheduleOperation().
|
protected |
Schedules the (possible) temporary register copy moves (due to missing connectivity) succeeding the given result read move.
The function recursively goes through all the temporary moves added to the given input move.
resultMove | A temp move whose successor has to be scheduled. |
resultRead | The original move of which temp moves to schedule. |
lastUse | Recursive function parameter, it should be set as 0 for the first function call. |
Definition at line 1442 of file BasicBlockScheduler.cc.
References assert, MoveNode::cycle(), ddg_, TTAProgram::Move::destination(), TTAProgram::Terminal::index(), MoveNode::isScheduled(), DataDependenceGraph::lastScheduledRegisterRead(), MoveNode::move(), TTAProgram::Terminal::registerFile(), scheduledTempMoves_, scheduleMove(), and succeedingTempMove().
Referenced by scheduleResultReads(), and scheduleRRTempMoves().
|
protected |
Schedules moves in a single operation execution.
Assumes the given MoveNodeGroup contains all moves in the operation execution. Also assumes that all inputs to the MoveNodeGroup have been scheduled.
moveNode | R-R Move to schedule. |
Definition at line 902 of file BasicBlockScheduler.cc.
References RegisterCopyAdder::addRegisterCopiesToRRMove(), RegisterCopyAdder::AddedRegisterCopies::count_, ddg_, SchedulerPass::interPassData(), BoostGraph< GraphNode, GraphEdge >::name(), rm_, DataDependenceGraph::sanityCheck(), scheduleMove(), scheduleRRTempMoves(), selector_, DataDependenceGraph::setCycleGrouping(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
Referenced by handleDDG(), and handleLoopDDG().
|
protected |
Schedules the (possible) temporary register copy moves (due to missing connectivity) succeeding the given RR move.
The function recursively goes through all the temporary moves added to the given RR move.
regToRegMove | A temp move whose successor has to be scheduled. |
firstMove | The original move of which temp moves to schedule. |
lastUse | Recursive function parameter, it should be set as 0 for the first function call. |
Definition at line 1297 of file BasicBlockScheduler.cc.
References assert, MoveNode::cycle(), ddg_, TTAProgram::Move::destination(), TTAProgram::Terminal::index(), MoveNode::isScheduled(), DataDependenceGraph::lastScheduledRegisterRead(), MoveNode::move(), TTAProgram::Terminal::registerFile(), scheduledTempMoves_, scheduleMove(), scheduleResultReadTempMoves(), and succeedingTempMove().
Referenced by scheduleRRMove().
|
virtual |
A short description of the pass, usually the optimization name, such as "basic block scheduler".
Implements SchedulerPass.
Reimplemented in BUBasicBlockScheduler.
Definition at line 1574 of file BasicBlockScheduler.cc.
Finds the temp move succeeding the given movenode.
If it does not have one , returns null.
current | MoveNode whose tempmoves we are searching |
Definition at line 1410 of file BasicBlockScheduler.cc.
References TTAProgram::ProgramAnnotation::ANN_CONNECTIVITY_MOVE, assert, ddg_, TTAProgram::AnnotatedInstructionElement::hasAnnotations(), MoveNode::isScheduled(), MoveNode::move(), and BoostGraph< GraphNode, GraphEdge >::successors().
Referenced by BUBasicBlockScheduler::bypassNode(), scheduleResultReads(), BUBasicBlockScheduler::scheduleResultReads(), BUBasicBlockScheduler::scheduleResultReadTempMoves(), scheduleResultReadTempMoves(), scheduleRRTempMoves(), and BUBasicBlockScheduler::scheduleRRTempMoves().
|
protected |
Definition at line 2021 of file BasicBlockScheduler.cc.
References assert, SimpleResourceManager::assign(), MoveNode::cycle(), ddg_, MoveNode::isDestinationOperation(), TTAProgram::Move::isTriggering(), SimpleResourceManager::latestCycle(), DataDependenceGraph::latestCycle(), MoveNode::move(), MoveNodeGroup::node(), MoveNodeGroup::nodeCount(), rm_, and SimpleResourceManager::unassign().
|
protected |
Tries to get rid of WaW dependence from unconditional to conditional.
if the conditional move's result is overwritten by the cond for all users, make the unconditional move conditional, with opposite guard.
Definition at line 1920 of file BasicBlockScheduler.cc.
References assert, BoostGraph< GraphNode, GraphEdge >::connectNodes(), DataDependenceGraph::copyDepsOver(), DataDependenceGraph::copyIncomingGuardEdges(), DataDependenceGraph::copyOutgoingGuardWarEdges(), TTAProgram::CodeGenerator::createInverseGuard(), MoveNode::cycle(), ddg_, DataDependenceEdge::DEP_WAW, DataDependenceEdge::dependenceType(), DataDependenceGraph::earliestCycle(), DataDependenceEdge::EDGE_REGISTER, DataDependenceEdge::edgeReason(), DataDependenceGraph::exclusingGuards(), TTAProgram::Move::guard(), DataDependenceGraph::guardDefMoves(), MoveNode::guardLatency(), BoostGraph< GraphNode, GraphEdge >::inEdges(), MoveNode::isScheduled(), TTAProgram::Move::isUnconditional(), MoveNode::move(), DataDependenceGraph::regRawSuccessors(), BoostGraph< GraphNode, GraphEdge >::removeEdge(), DataDependenceGraph::removeIncomingGuardEdges(), DataDependenceGraph::removeOutgoingGuardWarEdges(), scheduleMove(), TTAProgram::Move::setGuard(), BoostGraph< GraphNode, GraphEdge >::tailNode(), DataDependenceEdge::tailPseudo(), targetMachine_, and unschedule().
Referenced by scheduleMove().
|
protected |
If the operation is commutative, tries to change the operands so that the scheduler can schedule it better.
If the operation is not commutative, does nothing.
Which is better depends lots on the code being compiled and architecture which we are compiling for.
Current implementation tries to make constants triggers, and if there are no constant inputs, try to also change inputs so that last ready operand becomes trigger if it's near, but first ready operand becomes trigger if it's further (allows better bypassing of other operands) This seems to work in practice
po | programoperation whose inputs to switch |
Definition at line 1734 of file BasicBlockScheduler.cc.
References Operation::canSwap(), ddg_, TTAProgram::Move::destination(), DataDependenceGraph::earliestCycle(), getTriggerOperand(), SimpleResourceManager::initiationInterval(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), MoveNode::isSourceConstant(), MoveNode::move(), Operation::numberOfInputs(), ProgramOperation::operation(), TTAProgram::Terminal::operationIndex(), rm_, ProgramOperation::switchInputs(), and targetMachine_.
Referenced by scheduleOperation().
|
protected |
Unschedules the given move.
Also restores a possible short immediate source in case it was converted to a long immediate register read during scheduling.
moveNode | Move to unschedule. |
Definition at line 1488 of file BasicBlockScheduler.cc.
References __func__, TTAProgram::ProgramAnnotation::ANN_REQUIRES_LIMM, TTAProgram::AnnotatedInstructionElement::hasAnnotations(), MoveNode::isPlaced(), MoveNode::isScheduled(), MoveNode::move(), TTAProgram::AnnotatedInstructionElement::removeAnnotations(), rm_, MoveNode::toString(), and SimpleResourceManager::unassign().
Referenced by BUBasicBlockScheduler::bypassNode(), handleRemovedResultMoves(), scheduleMove(), scheduleOperandWrites(), BUBasicBlockScheduler::scheduleOperandWrites(), scheduleOperation(), BUBasicBlockScheduler::scheduleOperation(), BUBasicBlockScheduler::scheduleResultReads(), BUBasicBlockScheduler::tryToOptimizeWaw(), tryToOptimizeWaw(), BUBasicBlockScheduler::undoBypass(), unscheduleAllNodes(), BUBasicBlockScheduler::unscheduleAllNodes(), unscheduleInputOperandTempMoves(), and unscheduleResultReadTempMoves().
|
protected |
Calls unschedule() for all ddg nodes, which are scheduled.
Definition at line 1511 of file BasicBlockScheduler.cc.
References SoftwareBypasser::clearCaches(), ddg_, SoftwareBypasser::removeBypass(), rm_, DataDependenceGraph::scheduledMoves(), softwareBypasser_, and unschedule().
Referenced by handleDDG(), handleLoopDDG(), scheduleMove(), scheduleOperandWrites(), and scheduleOperation().
|
protected |
Unschedules the (possible) temporary register copy moves (due to missing connectivity) preceeding the given move.
operandMove | The move of which temp moves to unschedule. |
Definition at line 1532 of file BasicBlockScheduler.cc.
References MapTools::containsKey(), scheduledTempMoves_, and unschedule().
Referenced by scheduleOperandWrites(), BUBasicBlockScheduler::scheduleOperandWrites(), scheduleOperation(), and BUBasicBlockScheduler::scheduleOperation().
|
protected |
Unschedules the (possible) temporary register copy moves (due to missing connectivity) succeeding the given result read move.
resultMove | The move of which temp moves to unschedule. |
Definition at line 1553 of file BasicBlockScheduler.cc.
References MapTools::containsKey(), scheduledTempMoves_, and unschedule().
Referenced by scheduleOperation(), and BUBasicBlockScheduler::scheduleOperation().
|
protected |
Definition at line 170 of file BasicBlockScheduler.hh.
|
protected |
DDG of the currently scheduled BB.
Definition at line 152 of file BasicBlockScheduler.hh.
Referenced by BUBasicBlockScheduler::bypassNode(), BUBasicBlockScheduler::clearRemovedNodes(), ddgSnapshot(), BUBasicBlockScheduler::finalizeSchedule(), BUBasicBlockScheduler::findBypassDestinations(), BUBasicBlockScheduler::handleDDG(), handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), handleLoopDDG(), handleRemovedResultMoves(), BUBasicBlockScheduler::precedingTempMove(), scheduleInputOperandTempMoves(), BUBasicBlockScheduler::scheduleInputOperandTempMoves(), scheduleMove(), BUBasicBlockScheduler::scheduleMove(), BUBasicBlockScheduler::scheduleOperand(), scheduleOperandWrites(), BUBasicBlockScheduler::scheduleOperandWrites(), scheduleOperation(), BUBasicBlockScheduler::scheduleOperation(), scheduleResultReads(), BUBasicBlockScheduler::scheduleResultReads(), BUBasicBlockScheduler::scheduleResultReadTempMoves(), scheduleResultReadTempMoves(), scheduleRRMove(), BUBasicBlockScheduler::scheduleRRMove(), scheduleRRTempMoves(), BUBasicBlockScheduler::scheduleRRTempMoves(), succeedingTempMove(), tryToDelayOperands(), BUBasicBlockScheduler::tryToOptimizeWaw(), tryToOptimizeWaw(), BUBasicBlockScheduler::tryToSwitchInputs(), tryToSwitchInputs(), BUBasicBlockScheduler::undoBypass(), unscheduleAllNodes(), and BUBasicBlockScheduler::unscheduleAllNodes().
|
protected |
Definition at line 171 of file BasicBlockScheduler.hh.
|
protected |
Definition at line 175 of file BasicBlockScheduler.hh.
Referenced by handleLoopDDG(), and scheduleMove().
|
protected |
The earliest cycle to schedule moves in. Used to leave room for sched_yield() by the sched_yield() emitter.
Definition at line 165 of file BasicBlockScheduler.hh.
Referenced by handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), handleLoopDDG(), and scheduleMove().
|
protected |
Definition at line 173 of file BasicBlockScheduler.hh.
Referenced by BasicBlockScheduler(), BUBasicBlockScheduler::BUBasicBlockScheduler(), BUBasicBlockScheduler::handleDDG(), handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), handleLoopDDG(), and scheduleOperation().
|
protected |
Definition at line 161 of file BasicBlockScheduler.hh.
Referenced by BUBasicBlockScheduler::handleDDG(), handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), handleLoopDDG(), scheduleMove(), and BUBasicBlockScheduler::scheduleMove().
|
protected |
Resource Manager of the currently scheduled BB.
Definition at line 154 of file BasicBlockScheduler.hh.
Referenced by BUBasicBlockScheduler::bypassNode(), BUBasicBlockScheduler::findBypassDestinations(), BUBasicBlockScheduler::handleDDG(), handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), handleLoopDDG(), handleRemovedResultMoves(), scheduleMove(), BUBasicBlockScheduler::scheduleMove(), scheduleOperandWrites(), BUBasicBlockScheduler::scheduleOperandWrites(), scheduleOperation(), BUBasicBlockScheduler::scheduleOperation(), scheduleRRMove(), BUBasicBlockScheduler::scheduleRRMove(), tryToDelayOperands(), BUBasicBlockScheduler::tryToSwitchInputs(), tryToSwitchInputs(), unschedule(), and unscheduleAllNodes().
|
protected |
Stores the MoveNodes that were scheduled as temp moves during scheduling of the operand move.
Definition at line 157 of file BasicBlockScheduler.hh.
Referenced by BUBasicBlockScheduler::finalizeSchedule(), handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), handleLoopDDG(), notifyScheduled(), scheduleInputOperandTempMoves(), BUBasicBlockScheduler::scheduleInputOperandTempMoves(), BUBasicBlockScheduler::scheduleResultReadTempMoves(), scheduleResultReadTempMoves(), scheduleRRTempMoves(), BUBasicBlockScheduler::scheduleRRTempMoves(), unscheduleInputOperandTempMoves(), and unscheduleResultReadTempMoves().
|
protected |
Time for getting the scheduling time for current basic block.
Definition at line 169 of file BasicBlockScheduler.hh.
Referenced by handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), and handleLoopDDG().
|
protected |
Definition at line 167 of file BasicBlockScheduler.hh.
Referenced by BUBasicBlockScheduler::handleDDG(), handleDDG(), scheduleOperation(), BUBasicBlockScheduler::scheduleOperation(), BUBasicBlockScheduler::scheduleResultReadTempMoves(), scheduleRRMove(), BUBasicBlockScheduler::scheduleRRMove(), and BUBasicBlockScheduler::scheduleRRTempMoves().
|
protected |
The software bypasser to use to bypass registers when possible.
Definition at line 159 of file BasicBlockScheduler.hh.
Referenced by handleDDG(), handleLoopDDG(), scheduleOperation(), and unscheduleAllNodes().
|
protected |
The target machine we are scheduling the program against.
Definition at line 150 of file BasicBlockScheduler.hh.
Referenced by BUBasicBlockScheduler::handleDDG(), handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), handleLoopDDG(), scheduleMove(), BUBasicBlockScheduler::scheduleMove(), BUBasicBlockScheduler::scheduleOperandWrites(), scheduleOperation(), BUBasicBlockScheduler::scheduleOperation(), BUBasicBlockScheduler::tryToOptimizeWaw(), tryToOptimizeWaw(), BUBasicBlockScheduler::tryToSwitchInputs(), and tryToSwitchInputs().
|
protected |
Definition at line 177 of file BasicBlockScheduler.hh.
Referenced by handleDDG(), BUBasicBlockScheduler::handleLoopDDG(), handleLoopDDG(), and scheduleMove().