TCE
1.20
|
#include <BypassingBUBasicBlockScheduler.hh>
Public Types | |
enum | TempRegCopyLocation { TempRegNotAllowed, TempRegBefore, TempRegAfter } |
Private Member Functions | |
bool | renameSourceIfNotConnected (MoveNode &moveNode, int latestCycle) |
void | finalizeOperation (MoveNodeSelector &selector) |
bool | scheduleOperation (ProgramOperation &po, int &latestCycle, bool allowTempRegCopies) |
bool | scheduleResults (ProgramOperation &po, int latestCycle, bool allowTempRegCopies) |
bool | scheduleMoveUB (MoveNode &mn, int earlistCycle, int latestCycle) |
bool | scheduleMoveBU (MoveNode &mn, int earlistCycle, int latestCycle, TempRegCopyLocation t) |
int | bypassNode (MoveNode &node, int maxHopCount) |
std::pair< MoveNode *, int > | findBypassSource (MoveNode &node, int maxHopCount) |
bool | bypassAndScheduleNode (MoveNode &node, MoveNode *trigger, int latestCycle, bool allowRegCopies) |
bool | bypassAndScheduleOperands (ProgramOperation &po, MoveNode *trigger, int latestCycle, bool allowRegCopies) |
bool | scheduleOperandOrTrigger (MoveNode &operand, MoveNode *trigger, int latestCycle, bool allowRegCopies) |
void | unscheduleResults (ProgramOperation &po) |
void | unscheduleOperands (ProgramOperation &po) |
void | unschedule (MoveNode &mn) |
void | undoBypass (MoveNode &mn) |
void | undoBypassAndUnschedule (MoveNode &mn) |
void | unscheduleOperation (ProgramOperation &po) |
std::pair< int, int > | operandCycleLimits (MoveNode &mn, MoveNode *trigger) |
int | lastOperandCycle (const ProgramOperation &po) |
MoveNode * | createTempRegCopy (MoveNode &mn, bool after) |
void | createAntidepsFromUnscheduledRegCopies (MoveNode ©Node, MoveNode &mn, TTAProgram::Terminal &terminalRegister) |
std::set< TTAMachine::RegisterFile *, TTAMachine::MachinePart::Comparator > | possibleTempRegRFs (const MoveNode &mn, bool tempRegAfter) |
void | clearCaches () |
Private Attributes | |
std::map< MoveNode *, MoveNode *, MoveNode::Comparator > | bypassSources_ |
std::map< MoveNode *, MoveNode *, MoveNode::Comparator > | removedBypassSources_ |
std::set< MoveNode *, MoveNode::Comparator > | removedNodes_ |
std::set< MoveNode *, MoveNode::Comparator > | pendingBypassSources_ |
std::set< MoveNode *, MoveNode::Comparator > | scheduledMoves_ |
std::map< MoveNode *, MoveNode *, MoveNode::Comparator > | regCopiesBefore_ |
std::map< MoveNode *, MoveNode *, MoveNode::Comparator > | regCopiesAfter_ |
bool | killDeadResults_ |
bool | renameRegisters_ |
int | endCycle_ |
A class that implements the functionality of a bottom up 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 74 of file BypassingBUBasicBlockScheduler.hh.
Enumerator | |
---|---|
TempRegNotAllowed | |
TempRegBefore | |
TempRegAfter |
Definition at line 78 of file BypassingBUBasicBlockScheduler.hh.
BypassingBUBasicBlockScheduler::BypassingBUBasicBlockScheduler | ( | InterPassData & | data, |
SoftwareBypasser * | bypasser = NULL , |
||
CopyingDelaySlotFiller * | delaySlotFiller = NULL , |
||
RegisterRenamer * | renamer = NULL |
||
) |
Constructs the basic block scheduler.
data | Interpass data |
bypasser | Helper module implementing software bypassing. Not used. |
delaySlotFiller | Helper module implementing jump delay slot filling |
registerRenamer | Helper module implementing register renaming |
Definition at line 110 of file BypassingBUBasicBlockScheduler.cc.
References Application::cmdLineOptions(), SchedulerCmdLineOptions::killDeadResults(), killDeadResults_, BasicBlockScheduler::options_, SchedulerCmdLineOptions::renameRegisters(), and renameRegisters_.
|
virtual |
|
private |
Tries to schedule an (input) node, bypassing if possible
Definition at line 856 of file BypassingBUBasicBlockScheduler.cc.
References bypassNode(), MoveNode::isSourceOperation(), scheduleOperandOrTrigger(), scheduleOperation(), MoveNode::sourceOperation(), MoveNode::toString(), and undoBypass().
Referenced by bypassAndScheduleOperands(), and scheduleOperation().
|
private |
Schedule all operands of an operation, (but no trigger), trying t bypass them.
Definition at line 914 of file BypassingBUBasicBlockScheduler.cc.
References assert, bypassAndScheduleNode(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), MoveNode::isScheduled(), and undoBypassAndUnschedule().
Referenced by scheduleOperation().
|
private |
Bypasses a node.
maxHopCount | maximum amount or registers to skip while bypassing. 1 == bypass from move which produced the value, 0 == do not bypass. |
Definition at line 761 of file BypassingBUBasicBlockScheduler.cc.
References bypassSources_, BasicBlockScheduler::ddg_, findBypassSource(), DataDependenceGraph::guardsAllowBypass(), killDeadResults_, DataDependenceGraph::mergeAndKeep(), pendingBypassSources_, regCopiesBefore_, and DataDependenceGraph::resultUsed().
Referenced by bypassAndScheduleNode().
|
private |
Cleanups some bookkeeping. This should not be needed
Definition at line 1132 of file BypassingBUBasicBlockScheduler.cc.
References assert, bypassSources_, BasicBlockScheduler::ddg_, pendingBypassSources_, regCopiesAfter_, regCopiesBefore_, removedNodes_, BoostGraph< GraphNode, GraphEdge >::removeNode(), and BoostGraph< GraphNode, GraphEdge >::rootGraph().
Referenced by handleDDG().
|
private |
Creste register antideps from unscheduled temp reg copies to the just created one.
This is needed when temp reg copies are "created on wrong order", for example if some operation is attempted to first schedule some FU, later to some another
Definition at line 1282 of file BypassingBUBasicBlockScheduler.cc.
References DataDependenceGraph::connectOrDeleteEdge(), BasicBlockScheduler::ddg_, DataDependenceEdge::DEP_WAR, DataDependenceEdge::DEP_WAW, DataDependenceEdge::EDGE_REGISTER, regCopiesBefore_, and DisassemblyRegister::registerName().
Referenced by createTempRegCopy().
|
inlinevirtual |
Reimplemented from BasicBlockScheduler.
Definition at line 96 of file BypassingBUBasicBlockScheduler.hh.
References BasicBlockPass::ddgBuilder().
Creates a temp reg copy for given move.
Does not necessarily create all required temp reg copies, so this may be needed to be called recursively to get all required copies.
: Smarted logic to select the register to use
mn | movenode to be splitted |
after | set to true if temp reg is the last of the nodes, false if first |
Definition at line 1213 of file BypassingBUBasicBlockScheduler.cc.
References TTAProgram::AnnotatedInstructionElement::addAnnotation(), DataDependenceGraph::addNode(), TTAProgram::ProgramAnnotation::ANN_CONNECTIVITY_MOVE, TTAProgram::ProgramAnnotation::ANN_STACKFRAME_PROCEDURE_RETURN, TTAProgram::Move::copy(), createAntidepsFromUnscheduledRegCopies(), BasicBlockScheduler::ddg_, TTAMachine::RegisterFile::firstReadPort(), TTAMachine::RegisterFile::firstWritePort(), RegisterCopyAdder::fixDDGEdgesInTempReg(), DataDependenceGraph::getBasicBlockNode(), TTAProgram::Move::isReturn(), MoveNode::move(), possibleTempRegRFs(), TTAProgram::AnnotatedInstructionElement::setAnnotation(), TTAProgram::Move::setDestination(), TTAProgram::Move::setSource(), TTAMachine::BaseRegisterFile::size(), TTAProgram::Move::toString(), and MoveNode::toString().
Referenced by scheduleMoveBU().
|
private |
Definition at line 312 of file BypassingBUBasicBlockScheduler.cc.
References assert, bypassSources_, BasicBlockScheduler::ddg_, BoostGraph< GraphNode, GraphEdge >::dropNode(), MoveNodeSelector::mightBeReady(), MoveNodeSelector::notifyScheduled(), pendingBypassSources_, BoostGraph< GraphNode, GraphEdge >::predecessors(), regCopiesAfter_, regCopiesBefore_, removedNodes_, BoostGraph< GraphNode, GraphEdge >::rootGraph(), and scheduledMoves_.
Referenced by handleDDG(), and scheduleOperation().
|
private |
Finds a source where from to bypass.
Goes ddg backwards and checks for connectivity.
Definition at line 827 of file BypassingBUBasicBlockScheduler.cc.
References MachineConnectivityCheck::canSourceWriteToAnyDestinationPort(), BasicBlockScheduler::ddg_, MachineConnectivityCheck::findPossibleDestinationPorts(), DataDependenceGraph::onlyRegisterRawSource(), and BasicBlockScheduler::targetMachine_.
Referenced by bypassNode().
|
virtual |
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 BasicBlockScheduler.
Definition at line 141 of file BypassingBUBasicBlockScheduler.cc.
References __func__, abortWithError, BUMoveNodeSelector::candidates(), clearCaches(), BasicBlockScheduler::ddg_, BasicBlockScheduler::ddgSnapshot(), debugLog, DataDependenceGraph::DUMP_DOT, DataDependenceGraph::DUMP_XML, LLVMTCECmdLineOptions::dumpDDGsDot(), LLVMTCECmdLineOptions::dumpDDGsXML(), endCycle_, finalizeOperation(), RegisterCopyAdder::findTempRegisters(), RegisterRenamer::initialize(), SchedulerPass::interPassData(), MoveNode::isMove(), MoveNode::isOperationMove(), MoveNodeGroup::isScheduled(), MoveNodeGroup::node(), BoostGraph< GraphNode, GraphEdge >::node(), MoveNodeGroup::nodeCount(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), BasicBlockScheduler::options_, BasicBlockScheduler::renamer_, BasicBlockScheduler::rm_, DataDependenceGraph::scheduledNodeCount(), scheduleMoveBU(), scheduleOperation(), SimpleResourceManager::setMaxCycle(), RegisterRenamer::setSelector(), BasicBlockScheduler::targetMachine_, TempRegBefore, MoveNode::toString(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
|
private |
find the highest cycle some operand of an operation is scheduled.
: move this to ProgramOperation class?
Definition at line 997 of file BypassingBUBasicBlockScheduler.cc.
References MoveNode::cycle(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), and MoveNode::isScheduled().
Referenced by operandCycleLimits().
|
virtual |
Optional longer description of the pass.
This description can include usage instructions, details of choice of algorithmic details, etc.
Reimplemented from BasicBlockScheduler.
Definition at line 305 of file BypassingBUBasicBlockScheduler.cc.
|
private |
Calculates the range where operand can be scheduled, based on results and other operands.
Definition at line 957 of file BypassingBUBasicBlockScheduler.cc.
References assert, MoveNode::cycle(), MoveNode::destinationOperation(), endCycle_, BasicBlockScheduler::findTrigger(), MoveNode::isDestinationOperation(), MoveNode::isScheduled(), lastOperandCycle(), and MoveNode::latestTriggerWriteCycle().
Referenced by scheduleOperandOrTrigger(), and scheduleResults().
|
private |
Find possible temp reg RF's for connectivity of given register.
This only gives the register files that for the "next register in the temp reg chain", not the whole chain
Definition at line 1319 of file BypassingBUBasicBlockScheduler.cc.
References __func__, MachineConnectivityCheck::canAnyPortWriteToDestination(), MachineConnectivityCheck::canSourceWriteToAnyDestinationPort(), InterPassData::datum(), MachineConnectivityCheck::findReadPorts(), MachineConnectivityCheck::findWritePorts(), TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), SchedulerPass::interPassData(), MachineConnectivityCheck::isConnected(), TTAProgram::Move::isUnconditional(), and MoveNode::move().
Referenced by createTempRegCopy().
|
private |
Tries to rename source register of unconnected move to make it connected.
Definition at line 1156 of file BypassingBUBasicBlockScheduler.cc.
References MachineConnectivityCheck::canTransportMove(), BasicBlockScheduler::ddg_, DataDependenceGraph::findLiveRange(), LiveRange::reads, RegisterRenamer::renameLiveRange(), BasicBlockScheduler::renamer_, renameRegisters_, RegisterRenamer::renameSourceRegister(), BasicBlockScheduler::targetMachine_, LiveRange::toString(), MoveNode::toString(), and LiveRange::writes.
Referenced by scheduleMoveBU().
|
private |
Schedule a single move with bottom-up-scheduling.
If the machine does not have sufficient connectivity, tries to rename the source register or add regcopies.
mn | MoveNode to be scheduled |
earliestCycle | earliestCycle allowed. |
latestCycle | latest allowed cycle. Tries to schedule close to this. |
t | whether temp register copies are allowed, and whether they are added after or before this move. |
Definition at line 615 of file BypassingBUBasicBlockScheduler.cc.
References SimpleResourceManager::assign(), MachineConnectivityCheck::canTransportMove(), TTAMachine::Machine::controlUnit(), createTempRegCopy(), BasicBlockScheduler::ddg_, TTAMachine::ControlUnit::delaySlots(), endCycle_, TTAProgram::Move::isControlFlowMove(), MoveNode::isScheduled(), SimpleResourceManager::latestCycle(), DataDependenceGraph::latestCycle(), MoveNode::move(), pendingBypassSources_, regCopiesAfter_, regCopiesBefore_, renameSourceIfNotConnected(), BasicBlockScheduler::rm_, scheduledMoves_, BasicBlockScheduler::targetMachine_, TempRegAfter, TempRegBefore, TempRegNotAllowed, MoveNode::toString(), and unschedule().
Referenced by handleDDG(), scheduleOperandOrTrigger(), scheduleOperation(), and scheduleResults().
|
private |
Schedule a single move with up-down scheduling.
Currently used only for results which also have bypassed read of the result, to get this as close to the bypassed one as possible.
Definition at line 545 of file BypassingBUBasicBlockScheduler.cc.
References SimpleResourceManager::assign(), MachineConnectivityCheck::canTransportMove(), BasicBlockScheduler::ddg_, SimpleResourceManager::earliestCycle(), DataDependenceGraph::earliestCycle(), endCycle_, DataDependenceGraph::latestCycle(), BasicBlockScheduler::rm_, scheduledMoves_, BasicBlockScheduler::targetMachine_, and MoveNode::toString().
Referenced by scheduleResults().
|
private |
Tries to schedue operand or trigger, but not trying to bypass
Definition at line 939 of file BypassingBUBasicBlockScheduler.cc.
References operandCycleLimits(), scheduleMoveBU(), TempRegBefore, and TempRegNotAllowed.
Referenced by bypassAndScheduleNode().
void BypassingBUBasicBlockScheduler::scheduleOperation | ( | MoveNodeGroup & | moves, |
MoveNodeSelector & | selector | ||
) |
Schedules moves in a single operation execution.
Assumes the given MoveNodeGroup contains all moves in the operation execution. Also assumes that all outputs of the MoveNodeGroup have been scheduled.
moves | Moves of the operation execution. |
Definition at line 247 of file BypassingBUBasicBlockScheduler.cc.
References __func__, BasicBlockScheduler::ddg_, MoveNode::destinationOperation(), endCycle_, finalizeOperation(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), MoveNodeGroup::node(), MoveNodeGroup::nodeCount(), MoveNode::sourceOperation(), MoveNodeGroup::toString(), GraphBase< GraphNode, GraphEdge >::writeToDotFile(), and DataDependenceGraph::writeToXMLFile().
Referenced by bypassAndScheduleNode(), and handleDDG().
|
private |
Tries to schedule an operation.
This function is called recursively, when bypassing.
Definition at line 364 of file BypassingBUBasicBlockScheduler.cc.
References __func__, assert, bypassAndScheduleNode(), bypassAndScheduleOperands(), MoveNode::cycle(), BasicBlockScheduler::ddg_, endCycle_, BasicBlockScheduler::findTrigger(), ProgramOperation::isAnyNodeAssigned(), MoveNode::isScheduled(), ProgramOperation::outputMove(), ProgramOperation::outputMoveCount(), scheduleMoveBU(), scheduleResults(), TempRegBefore, TempRegNotAllowed, ProgramOperation::toString(), MoveNode::toString(), unscheduleOperands(), unscheduleResults(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
|
private |
Schedules result writes to an operation.
There result writes may be bypasses.
Definition at line 461 of file BypassingBUBasicBlockScheduler.cc.
References assert, MoveNode::cycle(), BasicBlockScheduler::ddg_, MoveNode::isDestinationOperation(), TTAMachine::HWOperation::latency(), MoveNode::move(), Operation::name(), operandCycleLimits(), TTAMachine::FunctionUnit::operation(), ProgramOperation::operation(), TTAProgram::Terminal::operationIndex(), ProgramOperation::outputMove(), ProgramOperation::outputMoveCount(), TTAMachine::Port::parentUnit(), pendingBypassSources_, TTAProgram::Terminal::port(), scheduleMoveBU(), scheduleMoveUB(), TTAProgram::Move::source(), DataDependenceGraph::successorsReady(), TempRegAfter, TempRegNotAllowed, MoveNode::toString(), and unscheduleResults().
Referenced by scheduleOperation().
|
virtual |
A short description of the pass, usually the optimization name, such as "basic block scheduler".
Reimplemented from BasicBlockScheduler.
Definition at line 292 of file BypassingBUBasicBlockScheduler.cc.
|
private |
undoes a bypass.
Definition at line 1015 of file BypassingBUBasicBlockScheduler.cc.
References assert, bypassSources_, BasicBlockScheduler::ddg_, pendingBypassSources_, regCopiesBefore_, MoveNode::toString(), and DataDependenceGraph::unMerge().
Referenced by bypassAndScheduleNode(), and undoBypassAndUnschedule().
|
private |
Undoes bypass and unschedules a move.
This also recursively unschedules the source operation of the bypass.
Definition at line 1041 of file BypassingBUBasicBlockScheduler.cc.
References MoveNode::isBypass(), MoveNode::sourceOperation(), undoBypass(), unschedule(), and unscheduleOperation().
Referenced by bypassAndScheduleOperands(), and unscheduleOperands().
|
private |
Unschedule a move
Also unschedules the tempregcopies of that move.
Definition at line 1069 of file BypassingBUBasicBlockScheduler.cc.
References MoveNode::isScheduled(), regCopiesAfter_, regCopiesBefore_, BasicBlockScheduler::rm_, scheduledMoves_, MoveNode::toString(), and SimpleResourceManager::unassign().
Referenced by scheduleMoveBU(), undoBypassAndUnschedule(), and unscheduleResults().
|
private |
Unschedules all operands of an operation. Also reverts bypasses and unschedules the bypass sources.
Definition at line 1112 of file BypassingBUBasicBlockScheduler.cc.
References ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), and undoBypassAndUnschedule().
Referenced by scheduleOperation(), and unscheduleOperation().
|
private |
Unschedules an operation (and recursively the bypass sources
Definition at line 1123 of file BypassingBUBasicBlockScheduler.cc.
References unscheduleOperands(), and unscheduleResults().
Referenced by undoBypassAndUnschedule().
|
private |
Unschedule all result moves of an operation.
Definition at line 1097 of file BypassingBUBasicBlockScheduler.cc.
References MoveNode::isScheduled(), ProgramOperation::outputMove(), ProgramOperation::outputMoveCount(), and unschedule().
Referenced by scheduleOperation(), scheduleResults(), and unscheduleOperation().
|
private |
Definition at line 171 of file BypassingBUBasicBlockScheduler.hh.
Referenced by bypassNode(), clearCaches(), finalizeOperation(), and undoBypass().
|
private |
Definition at line 184 of file BypassingBUBasicBlockScheduler.hh.
Referenced by handleDDG(), operandCycleLimits(), scheduleMoveBU(), scheduleMoveUB(), and scheduleOperation().
|
private |
Definition at line 182 of file BypassingBUBasicBlockScheduler.hh.
Referenced by BypassingBUBasicBlockScheduler(), and bypassNode().
|
private |
Definition at line 175 of file BypassingBUBasicBlockScheduler.hh.
Referenced by bypassNode(), clearCaches(), finalizeOperation(), scheduleMoveBU(), scheduleResults(), and undoBypass().
|
private |
Definition at line 179 of file BypassingBUBasicBlockScheduler.hh.
Referenced by clearCaches(), finalizeOperation(), scheduleMoveBU(), and unschedule().
|
private |
Definition at line 178 of file BypassingBUBasicBlockScheduler.hh.
Referenced by bypassNode(), clearCaches(), createAntidepsFromUnscheduledRegCopies(), finalizeOperation(), scheduleMoveBU(), undoBypass(), and unschedule().
|
private |
Definition at line 172 of file BypassingBUBasicBlockScheduler.hh.
|
private |
Definition at line 174 of file BypassingBUBasicBlockScheduler.hh.
Referenced by clearCaches(), and finalizeOperation().
|
private |
Definition at line 183 of file BypassingBUBasicBlockScheduler.hh.
Referenced by BypassingBUBasicBlockScheduler(), and renameSourceIfNotConnected().
|
private |
Definition at line 176 of file BypassingBUBasicBlockScheduler.hh.
Referenced by finalizeOperation(), scheduleMoveBU(), scheduleMoveUB(), and unschedule().