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

#include <BFOptimization.hh>

Inheritance diagram for BFOptimization:
Inheritance graph
Collaboration diagram for BFOptimization:
Collaboration graph

Public Member Functions

 BFOptimization (BF2Scheduler &sched)
 
virtual bool isFinishFront ()
 
virtual void mightBeReady (MoveNode &mn)
 
- Public Member Functions inherited from Reversible
virtual bool operator() ()=0
 
virtual void undo ()
 
virtual ~Reversible ()
 
void deleteChildren (std::stack< Reversible * > &children)
 
int id ()
 
 Reversible ()
 

Static Public Member Functions

static void clearPrologMoves ()
 
static MoveNodegetSisterTrigger (const MoveNode &mn, const TTAMachine::Machine &mach)
 

Protected Member Functions

DataDependenceGraphddg ()
 
DataDependenceGraphrootDDG ()
 
const DataDependenceGraphddg () const
 
DataDependenceGraphprologDDG ()
 
SimpleResourceManagerrm () const
 
SimpleResourceManagerprologRM () const
 
BUMoveNodeSelectorselector ()
 
const TTAMachine::MachinetargetMachine () const
 
unsigned int ii () const
 
MoveNodeDuplicatorduplicator () const
 
virtual bool assign (int cycle, MoveNode &, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU_=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1, bool ignoreGuardWriteCycle=false)
 
virtual void unassign (MoveNode &mn, bool disposePrologCopy=true)
 
virtual int rmEC (int cycle, MoveNode &mn, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1)
 
virtual int rmLC (int cycle, MoveNode &mn, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1)
 
virtual bool canAssign (int cycle, MoveNode &mn, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1, bool ignoreGWN=false)
 
bool putAlsoToPrologEpilog (int cycle, MoveNode &mn)
 
void setPrologSrcFUAnno (MoveNode &prologMN, MoveNode &loopMN)
 
void setPrologDstFUAnno (MoveNode &prologMN, MoveNode &loopMN)
 
void setJumpGuard (MoveNode &mn)
 
void unsetJumpGuard (MoveNode &mn)
 
bool needJumpGuard (const MoveNode &mn, int cycle)
 
int jumpGuardAvailableCycle (const MoveNode &mn)
 
bool canBeSpeculated (const Operation &op)
 
bool canBeSpeculated (const MoveNode &mn)
 
bool usePrologMove (const MoveNode &mn)
 
bool canBeScheduled (const MoveNode &mn)
 
const TTAMachine::RegisterFileRFReadPortCountPreventsScheduling (const MoveNode &mn)
 
bool immCountPreventsScheduling (const MoveNode &mn)
 
- Protected Member Functions inherited from Reversible
bool runPreChild (Reversible *preChild)
 
bool runPostChild (Reversible *preChild)
 
bool runChild (std::stack< Reversible * > &children, Reversible *child)
 
bool runChild (Reversible *child, bool pre)
 
void undoAndRemovePreChildren ()
 
void undoAndRemovePostChildren ()
 
void undoAndRemoveChildren (std::stack< Reversible * > &children)
 
virtual void undoOnlyMe ()
 

Protected Attributes

BF2Schedulersched_
 
- Protected Attributes inherited from Reversible
std::stack< Reversible * > preChildren_
 
std::stack< Reversible * > postChildren_
 

Static Protected Attributes

static std::map< MoveNode *, MoveNode *, MoveNode::ComparatorprologMoves_
 

Private Member Functions

void unsetJumpGuardIfNeeded (MoveNode &mn, int cycle)
 
void assignCopyToPrologEpilog (int cycle, MoveNode &mn, MoveNode &loopMN, const TTAMachine::Bus *prologBus, int prologImmWriteCycle)
 
void unassignCopyFromPrologEpilog (MoveNode &mh, bool disposePrologCopy=true)
 
std::pair< MoveNode *, bool > createCopyForPrologEpilog (MoveNode &mn)
 
bool addJumpGuardIfNeeded (MoveNode &mn, int cycle, bool ignoreGuardWriteCycle=false)
 
void setPrologFUAnnos (MoveNode &prologMN, MoveNode &loopMN)
 
bool hasAmbiguousResources (MoveNode &mn) const
 
const TTAMachine::FunctionUnitsourceFU (const MoveNode &mn)
 
const TTAMachine::FunctionUnitdestinationFU (const MoveNode &mn)
 
const TTAMachine::FunctionUnitfuOfTerminal (const TTAProgram::Terminal &t)
 
void checkPrologDDG (MoveNode &prologEpilogMN)
 

Detailed Description

Definition at line 73 of file BFOptimization.hh.

Constructor & Destructor Documentation

◆ BFOptimization()

BFOptimization::BFOptimization ( BF2Scheduler sched)
inline

Definition at line 75 of file BFOptimization.hh.

75 : sched_(sched) {
76#ifdef CHECK_DDG_EQUALITY
77 getDDGSnapshot();
78#endif
79}
BF2Scheduler & sched_

Member Function Documentation

◆ addJumpGuardIfNeeded()

bool BFOptimization::addJumpGuardIfNeeded ( MoveNode mn,
int  cycle,
bool  ignoreGuardWriteCycle = false 
)
private

Returns false if needs guard but guard not available yet

Definition at line 889 of file BFOptimization.cc.

890 {
891 if (needJumpGuard(mn, cycle)) {
892 if (jumpGuardAvailableCycle(mn) > cycle && !ignoreGuardWriteCycle) {
893#ifdef DEBUG_LOOP_SCHEDULER
894 std::cerr << "jump guard available at "
896 << " , not in cycle: " << cycle << std::endl;
897#endif
898 return false;
899 }
900 if (!mn.move().isUnconditional()) {
901#ifdef DEBUG_BUBBLEFISH_SCHEDULER
902 std::cerr << "Cannot add guard to already-conditional move "
903 << std::endl;
904#endif
905 return false;
906 }
907 setJumpGuard(mn);
908 }
909 return true;
910}
bool needJumpGuard(const MoveNode &mn, int cycle)
void setJumpGuard(MoveNode &mn)
int jumpGuardAvailableCycle(const MoveNode &mn)
TTAProgram::Move & move()
bool isUnconditional() const
Definition Move.cc:154

References TTAProgram::Move::isUnconditional(), jumpGuardAvailableCycle(), MoveNode::move(), needJumpGuard(), and setJumpGuard().

Referenced by assign().

Here is the call graph for this function:

◆ assign()

bool BFOptimization::assign ( int  cycle,
MoveNode mn,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU_ = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
const TTAMachine::Bus prologBus = nullptr,
int  immWriteCycle = -1,
int  prologImmWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1,
bool  ignoreGuardWriteCycle = false 
)
protectedvirtual

Definition at line 103 of file BFOptimization.cc.

112 {
113
114 bool createdPrologCopy = false;
115#ifdef DEBUG_LOOP_SCHEDULER
116 if (ii() != 0) {
117 std::cerr << "\t\t\t\tAssigning in loop sched: " << mn.toString()
118 << " to cycle: " << cycle << " imm write cycle: "
119 << immWriteCycle << std::endl;
120 }
121#else
122#ifdef DEBUG_BUBBLEFISH_SCHEDULER
123 std::cerr << "\t\t\t\t\tAssigning mn: " << mn.toString()
124 << " imm write cycle: " << immWriteCycle << std::endl;
125#endif
126#endif
127 bool usePrologMN = usePrologMove(mn);
128 MoveNode* prologEpilogMN = NULL;
129 // TODO: why trying to assign all to prolog fails???
130 if (usePrologMN) {
131 auto a = createCopyForPrologEpilog(mn);
132 prologEpilogMN = a.first;
133 createdPrologCopy = a.second;
134 }
135
136 // TODO: assert if too early due the integrated epilog and guard.
137 if (!(addJumpGuardIfNeeded(mn, cycle, ignoreGWC))) {
138 std::cerr << "Adding jump guard failed for node: "
139 << mn.toString() << std::endl;
140 ddg().writeToDotFile("adding_jump_guard_fail.dot");
141 assert(false);
142 }
143
144#ifdef DEBUG_BUBBLEFISH_SCHEDULER
145 if (!rm().canAssign(
146 cycle, mn, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex)) {
147 std::cerr << "cannot assign move in assign: " << mn.toString()
148 << " cycle: " << cycle << std::endl;
149 TTAProgram::Move& m = mn.move();
150 std::cerr << "set bus: " << m.bus().name() << std::endl;
151 if (bus != NULL) {
152 std::cerr << "bus: " << bus->name() << std::endl;
153 }
154 if (srcFU != NULL) {
155 std::cerr << "src FU: " << srcFU->name() << std::endl;
156 }
157 if (dstFU != NULL) {
158 std::cerr << "dst FU: " << dstFU->name() << std::endl;
159 }
160
161 std::cerr << "annotations:" << std::endl;
162 for (int i = 0 ; i < m.annotationCount(); i++) {
163 const TTAProgram::ProgramAnnotation& anno = m.annotation(i);
164 std::cerr << "\thas anno, id: " << anno.id()
165 << " data: " << anno.stringValue() << std::endl;
166 }
167 if (mn.isSourceOperation()) {
168 std::cerr << "Source op: " << mn.sourceOperation().toString()
169 << std::endl;
170 }
171 if (mn.isDestinationOperation()) {
172 std::cerr << "Destination op: "
173 << mn.destinationOperation().toString() << std::endl;
174 }
175 ddg().writeToDotFile("cannot_assign_on_assign.dot");
176 assert(false);
177 }
178#endif
179
180 rm().assign(
181 cycle, mn, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
182#ifdef DEBUG_BUBBLEFISH_SCHEDULER
183 std::cerr << "\t\t\t\t\tAssigned mn: " << mn.toString() << std::endl;
184#endif
185 assert(bus == NULL || bus == &mn.move().bus());
186 if (usePrologMN) {
187 assignCopyToPrologEpilog(cycle, *prologEpilogMN, mn, prologBus,
188 prologImmWriteCycle);
189#ifdef CHECK_PROLOG_DDG
190 checkPrologDDG(*prologEpilogMN);
191#endif
192 }
193 return createdPrologCopy;
194}
#define assert(condition)
bool usePrologMove(const MoveNode &mn)
void assignCopyToPrologEpilog(int cycle, MoveNode &mn, MoveNode &loopMN, const TTAMachine::Bus *prologBus, int prologImmWriteCycle)
bool addJumpGuardIfNeeded(MoveNode &mn, int cycle, bool ignoreGuardWriteCycle=false)
unsigned int ii() const
virtual bool canAssign(int cycle, MoveNode &mn, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1, bool ignoreGWN=false)
void checkPrologDDG(MoveNode &prologEpilogMN)
std::pair< MoveNode *, bool > createCopyForPrologEpilog(MoveNode &mn)
DataDependenceGraph & ddg()
SimpleResourceManager & rm() const
virtual void writeToDotFile(const TCEString &fileName) const
ProgramOperation & sourceOperation() const
Definition MoveNode.cc:453
bool isDestinationOperation() const
std::string toString() const
Definition MoveNode.cc:576
bool isSourceOperation() const
Definition MoveNode.cc:168
ProgramOperation & destinationOperation(unsigned int index=0) const
std::string toString() const
virtual void assign(int cycle, MoveNode &node, const TTAMachine::Bus *bus=NULL, const TTAMachine::FunctionUnit *srcFU=NULL, const TTAMachine::FunctionUnit *dstFU=NULL, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) override
virtual TCEString name() const
int annotationCount(ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID) const
ProgramAnnotation annotation(int index, ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID) const
const TTAMachine::Bus & bus() const
Definition Move.cc:373
ProgramAnnotation::Id id() const

References addJumpGuardIfNeeded(), TTAProgram::AnnotatedInstructionElement::annotation(), TTAProgram::AnnotatedInstructionElement::annotationCount(), assert, SimpleResourceManager::assign(), assignCopyToPrologEpilog(), TTAProgram::Move::bus(), canAssign(), checkPrologDDG(), createCopyForPrologEpilog(), ddg(), MoveNode::destinationOperation(), TTAProgram::ProgramAnnotation::id(), ii(), MoveNode::isDestinationOperation(), MoveNode::isSourceOperation(), MoveNode::move(), TTAMachine::Component::name(), rm(), MoveNode::sourceOperation(), TTAProgram::ProgramAnnotation::stringValue(), MoveNode::toString(), ProgramOperation::toString(), usePrologMove(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().

Referenced by BFLateBypass::operator()(), BFLateBypassGuard::operator()(), BFPushAntidepDown::operator()(), BFPushMoveUp::operator()(), BFScheduleBU::operator()(), BFScheduleExact::operator()(), BFSchedule::operator()(), BFScheduleTD::operator()(), BFShareOperandLate::operator()(), BFShareOperandWithScheduled::operator()(), BFUnscheduleMove::returnOriginal(), BFShareOperandLate::revert(), BFLateBypass::undoOnlyMe(), BFLateBypassGuard::undoOnlyMe(), and BFShareOperandWithScheduled::undoOnlyMe().

Here is the call graph for this function:

◆ assignCopyToPrologEpilog()

void BFOptimization::assignCopyToPrologEpilog ( int  cycle,
MoveNode mn,
MoveNode loopMN,
const TTAMachine::Bus prologBus,
int  prologImmWriteCycle 
)
private

Definition at line 747 of file BFOptimization.cc.

750 {
751
752 const TTAMachine::ImmediateUnit* immu = nullptr;
753 int immRegIndex = -1;
754 if (oldMN.isSourceImmediateRegister()) {
755 immRegIndex = oldMN.move().source().index();
756 immu = &oldMN.move().source().immediateUnit();
757 }
758
759#ifdef DEBUG_LOOP_SCHEDULER
760 std::cerr << "\t\t\t\t\tAssigning copy to prolog: " << cycle
761 << " " << prologMN.toString() <<
762 " prolog cycle: " << cycle + BF2Scheduler::PROLOG_CYCLE_BIAS
763 << std::endl;
764
765 if (!prologRM()->canAssign(
766 BF2Scheduler::PROLOG_CYCLE_BIAS + cycle, prologMN, prologBus,
767 sourceFU(oldMN), destinationFU(oldMN), prologImmWriteCycle,
768 immu, immRegIndex)) {
769 TTAProgram::Move& m = prologMN.move();
770
771 std::cerr << std::endl << "Cannot assign move to prolog! "
772 << prologMN.toString() << std::endl << std::endl;
773 std::cerr << "Preassigned bus: " << m.bus().name() << std::endl;
774 if (prologBus != nullptr) {
775 std::cerr << "prolog bus: " << prologBus->name() << std::endl;
776 }
777 std::cerr << "Cycle: " << cycle << " prolog cycle: "
778 << cycle + BF2Scheduler::PROLOG_CYCLE_BIAS << std::endl;
779
780 if (prologMN.isDestinationOperation()) {
781 std::cerr << "destpo: "
782 << prologMN.destinationOperation().toString()
783 << std::endl;
784 }
785
786 ddg().writeToDotFile("cannot_assign_prolog.dot");
787 prologDDG()->writeToDotFile("prologddg.dot");
788 int sc = prologRM()->smallestCycle();
789 int lc = prologRM()->largestCycle();
790 for (int i = sc; i <= lc; i++) {
791 std::cerr << "\t" << i << "\t"
792 << prologRM()->instruction(i)->toString() << std::endl;
793 }
794
795 assert(false && "Cannot asign copy to prolog");
796 }
797#endif
798
799 prologRM()->assign(
800 BF2Scheduler::PROLOG_CYCLE_BIAS + cycle, prologMN, prologBus,
801 sourceFU(oldMN), destinationFU(oldMN), prologImmWriteCycle,
802 immu, immRegIndex);
803#ifdef DEBUG_BUBBLEFISH_SCHEDULER
804 std::cerr << "\t\tAassigned copy to prolog, original mn: "
805 << oldMN.toString()
806 << " copy: " << prologMN.toString() << std::endl;
807#endif
808}
static const int PROLOG_CYCLE_BIAS
DataDependenceGraph * prologDDG()
const TTAMachine::FunctionUnit * sourceFU(const MoveNode &mn)
const TTAMachine::FunctionUnit * destinationFU(const MoveNode &mn)
SimpleResourceManager * prologRM() const
virtual int smallestCycle() const override
virtual TTAProgram::Instruction * instruction(int cycle) const override
virtual int largestCycle() const override
std::string toString() const
std::string toString() const
Definition Move.cc:436

References assert, SimpleResourceManager::assign(), TTAProgram::Move::bus(), canAssign(), ddg(), destinationFU(), MoveNode::destinationOperation(), TTAProgram::Terminal::immediateUnit(), TTAProgram::Terminal::index(), SimpleResourceManager::instruction(), MoveNode::isDestinationOperation(), MoveNode::isSourceImmediateRegister(), SimpleResourceManager::largestCycle(), MoveNode::move(), TTAMachine::Component::name(), BF2Scheduler::PROLOG_CYCLE_BIAS, prologDDG(), prologRM(), SimpleResourceManager::smallestCycle(), TTAProgram::Move::source(), sourceFU(), TTAProgram::Instruction::toString(), MoveNode::toString(), ProgramOperation::toString(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().

Referenced by assign().

Here is the call graph for this function:

◆ canAssign()

bool BFOptimization::canAssign ( int  cycle,
MoveNode mn,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
const TTAMachine::Bus prologBus = nullptr,
int  immWriteCycle = -1,
int  prologImmWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1,
bool  ignoreGWN = false 
)
protectedvirtual

Definition at line 495 of file BFOptimization.cc.

504 {
505#ifdef DEBUG_BUBBLEFISH_SCHEDULER
506 if (ii()) {
507 std::cerr << "\t\t\t\t\tCalling BFOpt::canassign for: "
508 << mn.toString() << " cycle: " << cycle << std::endl;
509 } else {
510 std::cerr << "\t\t\t\t\tCalling BFOpt::canassign for: "
511 << mn.toString() << " cycle: " << cycle << std::endl;
512 }
513 if (bus) {
514 std::cerr << "\t\t\t\t\t\tBus: " << bus->name() << std::endl;
515 }
516 if (prologBus) {
517 std::cerr << "\t\t\t\t\t\tProlog bus: " << prologBus->name()
518 << std::endl;
519 }
520 if (srcFU) {
521 std::cerr << "\t\t\t\t\t\tSrc FU: " << srcFU->name() << std::endl;
522 }
523 if (dstFU) {
524 std::cerr << "\t\t\t\t\t\tDst FU: " << dstFU->name() << std::endl;
525 }
526 if (mn.isDestinationOperation()) {
527 std::cerr << "\t\t\t\t\t\tDst po: "
528 << mn.destinationOperation().toString() << std::endl;
529 }
530#endif
531 bool addGuard = needJumpGuard(mn, cycle);
532 if (addGuard) {
533#ifdef DEBUG_LOOP_SCHEDULER
534 std::cerr << "\t\t\t\t\t\tNeed jump guard, cycle: " << cycle
535 << "ii: " << ii() << std::endl;
536#endif
537 // cannot add guard if already has guard.
538 if (!mn.move().isUnconditional()) {
539#ifdef DEBUG_LOOP_SCHEDULER
540 std::cerr << "\t\t\t\t\tcanassin over with uncond" << std::endl;
541#endif
542 return false;
543 }
544 if (cycle < jumpGuardAvailableCycle(mn) && !ignoreGuardWriteNode) {
545#ifdef DEBUG_LOOP_SCHEDULER
546 std::cerr << "\t\t\t\t\tjump guard not yet available so"
547 << " cannot scheudle this." << std::endl;
548 std::cerr << "\t\t\t\t\t\tAvailable on cycle: "
549 << jumpGuardAvailableCycle(mn) << std::endl;
550#endif
551 return false;
552 }
553 setJumpGuard(mn);
554 }
555 bool ok = rm().canAssign(
556 cycle, mn, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
557#ifdef DEBUG_LOOP_SCHEDULER
558 if (ii()) {
559 std::cerr << "\t\t\t\t\t for this: " << ok << " , what about prolog?"
560 << std::endl;
561 }
562#endif
563
564 // then test assigning to prolog
565 bool usePrologMN = usePrologMove(mn);
566 if (ok && usePrologMN) {
567 // may not have the added jump guard when duplicating.
568 if (addGuard) unsetJumpGuard(mn);
569 auto a = duplicator().duplicateMoveNode(mn, false, false);
570 if (addGuard) setJumpGuard(mn);
571 MoveNode* prologMN = a.first;
572#ifdef DEBUG_LOOP_SCHEDULER
573 std::cerr << "\t\t\t\t\t\tProlog mn: " << prologMN->toString()
574 << std::endl;
575#endif
576 bool assignedMN = false;
577 if (hasAmbiguousResources(mn)) {
578 rm().assign(cycle, mn, bus, srcFU, dstFU, immWriteCycle, immu,
579 immRegIndex);
580 srcFU = sourceFU(mn);
581 dstFU = destinationFU(mn);
582 if (mn.isSourceImmediateRegister()) {
583 immRegIndex = mn.move().source().index();
584 immu = &mn.move().source().immediateUnit();
585 }
586 assignedMN = true;
587 }
588 ok &= prologRM()->canAssign(
589 BF2Scheduler::PROLOG_CYCLE_BIAS + cycle, *prologMN, prologBus,
590 srcFU, dstFU, prologImmWriteCycle, immu, immRegIndex);
591 if (assignedMN) {
592 rm().unassign(mn);
593 }
594 if (a.second) { //disposePrologCopy) {
595 duplicator().disposeMoveNode(prologMN);
596 }
597 }
598 unsetJumpGuardIfNeeded(mn, cycle);
599
600#ifdef DEBUG_LOOP_SCHEDULER
601 if (ii()) {
602 std::cerr << "\t\t\t\t\tcanassin over:" << ok << std::endl;
603 }
604#else
605#ifdef DEBUG_BUBBLEFISH_SCHEDULER
606 std::cerr << "\t\t\t\t\tcanassin over:" << ok << std::endl;
607#endif
608#endif
609 return ok;
610}
bool hasAmbiguousResources(MoveNode &mn) const
MoveNodeDuplicator & duplicator() const
void unsetJumpGuard(MoveNode &mn)
void unsetJumpGuardIfNeeded(MoveNode &mn, int cycle)
void disposeMoveNode(MoveNode *newMN)
std::pair< MoveNode *, bool > duplicateMoveNode(MoveNode &mn, bool addToDDG, bool ignoreSameBBBackEdges)
bool isSourceImmediateRegister() const
Definition MoveNode.cc:223
virtual void unassign(MoveNode &node) override
virtual bool canAssign(int cycle, MoveNode &node, const TTAMachine::Bus *bus=NULL, const TTAMachine::FunctionUnit *srcFU=NULL, const TTAMachine::FunctionUnit *dstFU=NULL, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
Terminal & source() const
Definition Move.cc:302
virtual int index() const
Definition Terminal.cc:274
virtual const TTAMachine::ImmediateUnit & immediateUnit() const
Definition Terminal.cc:240

References SimpleResourceManager::assign(), SimpleResourceManager::canAssign(), destinationFU(), MoveNode::destinationOperation(), MoveNodeDuplicator::disposeMoveNode(), MoveNodeDuplicator::duplicateMoveNode(), duplicator(), hasAmbiguousResources(), ii(), TTAProgram::Terminal::immediateUnit(), TTAProgram::Terminal::index(), MoveNode::isDestinationOperation(), MoveNode::isSourceImmediateRegister(), TTAProgram::Move::isUnconditional(), jumpGuardAvailableCycle(), MoveNode::move(), TTAMachine::Component::name(), needJumpGuard(), BF2Scheduler::PROLOG_CYCLE_BIAS, prologRM(), rm(), setJumpGuard(), TTAProgram::Move::source(), sourceFU(), MoveNode::toString(), ProgramOperation::toString(), SimpleResourceManager::unassign(), unsetJumpGuard(), unsetJumpGuardIfNeeded(), and usePrologMove().

Referenced by assign(), assignCopyToPrologEpilog(), BFDRELoop::operator()(), BFLateBypassGuard::operator()(), BFPushAntidepDown::operator()(), BFScheduleExact::operator()(), BFSchedule::operator()(), BFShareOperandLate::operator()(), BFAssignToBody::operator()(), BFPostpassLoopDRE::operator()(), BFUnscheduleFromBody::returnOriginal(), BFUnscheduleMove::returnOriginal(), BFShareOperandLate::revert(), BFLateBypass::undoOnlyMe(), BFLateBypassGuard::undoOnlyMe(), BFUnscheduleFromBody::unscheduleOriginal(), and BFUnscheduleMove::unscheduleOriginal().

Here is the call graph for this function:

◆ canBeScheduled()

bool BFOptimization::canBeScheduled ( const MoveNode mn)
protected

Definition at line 1067 of file BFOptimization.cc.

1067 {
1069 return false;
1071 return false;
1072 }
1074 return false;
1075 }
1076 return true;
1077}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
const TTAMachine::RegisterFile * RFReadPortCountPreventsScheduling(const MoveNode &mn)
bool immCountPreventsScheduling(const MoveNode &mn)
static bool canTransportMove(const MoveNode &moveNode, const TTAMachine::Machine &machine, bool ignoreGuard=false)

References MachineConnectivityCheck::canTransportMove(), immCountPreventsScheduling(), machine, RFReadPortCountPreventsScheduling(), and rm().

Referenced by BFScheduleBU::operator()(), BFScheduleExact::operator()(), and BFScheduleTD::operator()().

Here is the call graph for this function:

◆ canBeSpeculated() [1/2]

bool BFOptimization::canBeSpeculated ( const MoveNode mn)
protected

Definition at line 865 of file BFOptimization.cc.

865 {
866 if (!mn.isDestinationOperation()) {
867 return false;
868 }
869 const MoveNode* trig = getSisterTrigger(mn, targetMachine());
870 // operand writes can be always speculated
871 if (&mn != trig && trig != NULL) {
872 return true;
873 }
874 const Operation& op = mn.destinationOperation().operation();
875 return canBeSpeculated(op);
876}
static MoveNode * getSisterTrigger(const MoveNode &mn, const TTAMachine::Machine &mach)
const TTAMachine::Machine & targetMachine() const
bool canBeSpeculated(const Operation &op)
const Operation & operation() const

References canBeSpeculated(), MoveNode::destinationOperation(), getSisterTrigger(), MoveNode::isDestinationOperation(), ProgramOperation::operation(), and targetMachine().

Here is the call graph for this function:

◆ canBeSpeculated() [2/2]

bool BFOptimization::canBeSpeculated ( const Operation op)
protected

Definition at line 857 of file BFOptimization.cc.

857 {
858 return
859 !op.usesMemory() &&
860 !op.hasSideEffects() &&
862 op.affectsCount() == 0;
863}
virtual bool usesMemory() const
Definition Operation.cc:232
virtual bool isControlFlowOperation() const
Definition Operation.cc:294
virtual bool hasSideEffects() const
Definition Operation.cc:272
virtual int affectsCount() const
Definition Operation.cc:402

References Operation::affectsCount(), Operation::hasSideEffects(), Operation::isControlFlowOperation(), and Operation::usesMemory().

Referenced by canBeSpeculated(), needJumpGuard(), BFRemoveGuardsFromSuccs::operator()(), and BFTryRemoveGuard::operator()().

Here is the call graph for this function:

◆ checkPrologDDG()

void BFOptimization::checkPrologDDG ( MoveNode prologEpilogMN)
private

Definition at line 1079 of file BFOptimization.cc.

1079 {
1080 auto oEdges = prologDDG()->outEdges(prologEpilogMN);
1081 auto iEdges = prologDDG()->inEdges(prologEpilogMN);
1082
1083 for (auto e: oEdges) {
1084 if (!e->isRAW())
1085 continue;
1086 MoveNode& head = prologDDG()->headNode(*e);
1087 if (head.isScheduled() && head.cycle() <= prologEpilogMN.cycle()) {
1088 prologDDG()->writeToDotFile("illegal_assign_in_prolog.dot");
1089
1090 ddg().writeToDotFile("mainddg.dot");
1091
1092 std::cerr << "Illegal assign of: " << prologEpilogMN.toString()
1093 << std::endl;
1094 assert(false);
1095 }
1096 }
1097
1098 for (auto e: iEdges) {
1099 if (!e->isRAW())
1100 continue;
1101 MoveNode& tail = prologDDG()->tailNode(*e);
1102 if (tail.isScheduled() && tail.cycle() >= prologEpilogMN.cycle()) {
1103 prologDDG()->writeToDotFile("illegal_assign_in_prolog.dot");
1104
1105 ddg().writeToDotFile("mainddg.dot");
1106
1107 std::cerr << "Illegal assign(2) of: " << prologEpilogMN.toString()
1108 << std::endl;
1109 assert(false);
1110 }
1111 }
1112}
virtual Node & headNode(const Edge &edge) const
virtual EdgeSet outEdges(const Node &node) const
virtual Node & tailNode(const Edge &edge) const
virtual EdgeSet inEdges(const Node &node) const
int cycle() const
Definition MoveNode.cc:421
bool isScheduled() const
Definition MoveNode.cc:409

References assert, MoveNode::cycle(), ddg(), BoostGraph< GraphNode, GraphEdge >::headNode(), BoostGraph< GraphNode, GraphEdge >::inEdges(), MoveNode::isScheduled(), BoostGraph< GraphNode, GraphEdge >::outEdges(), prologDDG(), BoostGraph< GraphNode, GraphEdge >::tailNode(), MoveNode::toString(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().

Referenced by assign().

Here is the call graph for this function:

◆ clearPrologMoves()

void BFOptimization::clearPrologMoves ( )
static

Definition at line 844 of file BFOptimization.cc.

844 {
845 prologMoves_.clear();
846}
static std::map< MoveNode *, MoveNode *, MoveNode::Comparator > prologMoves_

References prologMoves_.

Referenced by BF2Scheduler::handleLoopDDG(), and BF2Scheduler::scheduleDDG().

◆ createCopyForPrologEpilog()

std::pair< MoveNode *, bool > BFOptimization::createCopyForPrologEpilog ( MoveNode mn)
private

Definition at line 674 of file BFOptimization.cc.

675 {
676 auto a = duplicator().duplicateMoveNode(mn, true, true);
677 prologMoves_[&mn] = a.first;
678 return a; //prologMN;
679}

References MoveNodeDuplicator::duplicateMoveNode(), duplicator(), and prologMoves_.

Referenced by assign().

Here is the call graph for this function:

◆ ddg() [1/2]

DataDependenceGraph & BFOptimization::ddg ( )
protected

Definition at line 70 of file BFOptimization.cc.

70{ return sched_.ddg(); }
DataDependenceGraph & ddg()

References BF2Scheduler::ddg(), and sched_.

Referenced by BF2ScheduleFront::allNodesOfSameOperation(), assign(), assignCopyToPrologEpilog(), BFEarlyBypasser::bypassSourceLatestCycle(), BFRemoveLoopChecksAndJump::checkAliveMove(), BFRemoveLoopChecksAndJump::checkAlivePO(), checkPrologDDG(), BFRegCopy::createAntidepsForReg(), BFDRELoop::dreAllowed(), BFPostpassLoopDRE::dreAllowed(), BF2ScheduleFront::getMoveNodeFromFrontBU(), BFPushMoveUp2::isLoopBypass(), BFRenameLiveRange::notifySelector(), BFDREEarly::operator()(), BFDRELate::operator()(), BFDRELoop::operator()(), BFDropPreShared::operator()(), BFEarlyBypasser::operator()(), BFKillNode::operator()(), BFLateBypass::operator()(), BFLateBypasses::operator()(), BFLateBypassGuard::operator()(), BFPushAntidepDown::operator()(), BFPushAntidepsDown::operator()(), BFPushDepsUp::operator()(), BFPushMoveUp::operator()(), BFPushMoveUp2::operator()(), BFRegCopy::operator()(), BFRemoveLoopChecksAndJump::operator()(), BFRenameSource::operator()(), BFRescheduleSuccessorsClose::operator()(), BFScheduleBU::operator()(), BFScheduleExact::operator()(), BFScheduleTD::operator()(), BFShareOperandLate::operator()(), BFShareOperands::operator()(), BFShareOperandsLate::operator()(), BFShareOperandWithScheduled::operator()(), BFConnectNodes::operator()(), BFEarlyBypass::operator()(), BFEarlyGuardBypass::operator()(), BFMergeAndKeepUser::operator()(), BFPostpassBypass::operator()(), BFPostpassBypasser::operator()(), BFPostpassDRE::operator()(), BFPostpassLoopDRE::operator()(), BFRemoveEdge::operator()(), BFRemoveGuard::operator()(), BFRemoveGuardFromSucc::operator()(), BFRemoveGuardsFromSuccs::operator()(), BFRemoveLoopChecksAndJump::removeMoveFromQueue(), BFRemoveLoopChecksAndJump::removePoFromQueue(), BFRenameLiveRange::renameLiveRange(), BFUnscheduleFromBody::returnOriginal(), BFUnscheduleMove::returnOriginal(), BFShareOperandLate::revert(), rootDDG(), BF2ScheduleFront::scheduleFrontFromMove(), BFCopyRegWithOp::splitMove(), BFRegCopyAfter::splitMove(), BFRegCopyBefore::splitMove(), BFPostpassBypasser::tryBypassNode(), BFRegCopy::undoDDG(), BFRenameLiveRange::undoNewAntiDeps(), BFDropPreShared::undoOnlyMe(), BFKillNode::undoOnlyMe(), BFLateBypass::undoOnlyMe(), BFLateBypassGuard::undoOnlyMe(), BFRemoveLoopChecksAndJump::undoOnlyMe(), BFShareOperandWithScheduled::undoOnlyMe(), BFConnectNodes::undoOnlyMe(), BFEarlyGuardBypass::undoOnlyMe(), BFPostpassLoopDRE::undoOnlyMe(), BFRemoveEdge::undoOnlyMe(), BFRenameLiveRange::undoOnlyMe(), BFCopyRegWithOp::undoSplit(), BFUnscheduleFromBody::unscheduleOriginal(), BFUnscheduleMove::unscheduleOriginal(), unsetJumpGuard(), and BFMergeAndKeepUser::updateEdges().

Here is the call graph for this function:

◆ ddg() [2/2]

const DataDependenceGraph & BFOptimization::ddg ( ) const
protected

Definition at line 74 of file BFOptimization.cc.

74{ return sched_.ddg();}

References BF2Scheduler::ddg(), and sched_.

Here is the call graph for this function:

◆ destinationFU()

const TTAMachine::FunctionUnit * BFOptimization::destinationFU ( const MoveNode mn)
private

Definition at line 731 of file BFOptimization.cc.

731 {
732 return fuOfTerminal(mn.move().destination());
733}
const TTAMachine::FunctionUnit * fuOfTerminal(const TTAProgram::Terminal &t)
Terminal & destination() const
Definition Move.cc:323

References TTAProgram::Move::destination(), fuOfTerminal(), and MoveNode::move().

Referenced by assignCopyToPrologEpilog(), canAssign(), rmEC(), and rmLC().

Here is the call graph for this function:

◆ duplicator()

MoveNodeDuplicator & BFOptimization::duplicator ( ) const
protected

◆ fuOfTerminal()

const TTAMachine::FunctionUnit * BFOptimization::fuOfTerminal ( const TTAProgram::Terminal t)
private

Definition at line 736 of file BFOptimization.cc.

736 {
737 if (!t.isFUPort())
738 return NULL;
739 return &t.functionUnit();
740}
virtual const TTAMachine::FunctionUnit & functionUnit() const
Definition Terminal.cc:251
virtual bool isFUPort() const
Definition Terminal.cc:118

References TTAProgram::Terminal::functionUnit(), and TTAProgram::Terminal::isFUPort().

Referenced by destinationFU(), and sourceFU().

Here is the call graph for this function:

◆ getSisterTrigger()

MoveNode * BFOptimization::getSisterTrigger ( const MoveNode mn,
const TTAMachine::Machine mach 
)
static

Definition at line 848 of file BFOptimization.cc.

849 {
850 if (!mn.isDestinationOperation()) {
851 return NULL;
852 }
854 return BasicBlockScheduler::findTrigger(po, mach);
855}
static MoveNode * findTrigger(const ProgramOperation &po, const TTAMachine::Machine &mach)

References MoveNode::destinationOperation(), BasicBlockScheduler::findTrigger(), and MoveNode::isDestinationOperation().

Referenced by canBeSpeculated(), BF2ScheduleFront::getMoveNodeFromFrontBU(), BF2ScheduleFront::getPreferredLimits(), BFDropPreShared::operator()(), and BFShareOperands::operator()().

Here is the call graph for this function:

◆ hasAmbiguousResources()

bool BFOptimization::hasAmbiguousResources ( MoveNode mn) const
private

Definition at line 957 of file BFOptimization.cc.

957 {
958 if (mn.isSourceOperation() &&
959 (mn.move().annotationCount(
961 && (mn.move().annotationCount(
963 return true;
964 }
965 if (mn.isDestinationOperation() &&
966 (mn.move().annotationCount(
968 && (mn.move().annotationCount(
970 return true;
971 }
972 // LIMM unit may be ambiguous resource
973 if (mn.isSourceConstant())
974 return true;
975
976 return false;
977}
bool isSourceConstant() const
Definition MoveNode.cc:238
@ ANN_CONN_CANDIDATE_UNIT_DST
Dst. unit candidate.
@ ANN_CONN_CANDIDATE_UNIT_SRC
Src. unit candidate.
@ ANN_ALLOWED_UNIT_SRC
Candidate units can be passed for resource manager for choosing the source/destination unit of the mo...

References TTAProgram::ProgramAnnotation::ANN_ALLOWED_UNIT_SRC, TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_DST, TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC, TTAProgram::AnnotatedInstructionElement::annotationCount(), MoveNode::isDestinationOperation(), MoveNode::isSourceConstant(), MoveNode::isSourceOperation(), and MoveNode::move().

Referenced by canAssign(), rmEC(), and rmLC().

Here is the call graph for this function:

◆ ii()

unsigned int BFOptimization::ii ( ) const
protected

◆ immCountPreventsScheduling()

bool BFOptimization::immCountPreventsScheduling ( const MoveNode mn)
protected

Definition at line 979 of file BFOptimization.cc.

979 {
980
981 auto& move = mn.move();
982 if (!move.source().isImmediate()) {
983 return false;
984 }
985
986 if (!mn.isDestinationOperation()) {
987 return false;
988 }
989
992
994 for (int i = 0; i < po.inputMoveCount(); i++) {
995 MoveNode& input = po.inputMove(i);
996 auto& inputMove = input.move();
997 if (input.move().destination().isFUPort() && input.isScheduled()) {
998 auto& fu = inputMove.destination().functionUnit();
999 auto hwop = fu.operation(po.operation().name());
1000 auto port = hwop->port(move.destination().operationIndex());
1001 if (!port->noRegister()) {
1002 return false;
1003 }
1004 if (inputMove.source().isImmediate()) {
1005 simmCount--;
1006 }
1007 if (inputMove.source().isImmediateRegister()) {
1008 limmCount--;
1009 }
1010 // all ways to transport immediate used.
1011 if (simmCount + limmCount < 1) {
1012 return true;
1013 }
1014 // needs LIMM but no LIMM available, only too narrow SIMMs available.
1015 if (limmCount < 1 &&
1017 static_cast<TTAProgram::TerminalImmediate&>(
1018 move.source()), *port,
1019 move.isUnconditional()
1020 ? nullptr
1021 : &move.guard().guard())) {
1022 return true;
1023 }
1024 }
1025 }
1026 return false;
1027}
static int maxLIMMCount(const TTAMachine::Machine &targetMachine)
static bool canTransportImmediate(const TTAProgram::TerminalImmediate &immediate, const TTAMachine::BaseRegisterFile &destRF, const TTAMachine::Guard *guard=NULL)
static int maxSIMMCount(const TTAMachine::Machine &targetMachine)
virtual TCEString name() const
Definition Operation.cc:93
int inputMoveCount() const
MoveNode & inputMove(int index) const
virtual HWOperation * operation(const std::string &name) const
virtual FUPort * port(int operand) const

References MachineConnectivityCheck::canTransportImmediate(), TTAProgram::Move::destination(), MoveNode::destinationOperation(), TTAProgram::Terminal::functionUnit(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), MoveNode::isDestinationOperation(), TTAProgram::Terminal::isFUPort(), MoveNode::isScheduled(), MachineConnectivityCheck::maxLIMMCount(), MachineConnectivityCheck::maxSIMMCount(), MoveNode::move(), Operation::name(), ProgramOperation::operation(), TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::port(), and targetMachine().

Referenced by canBeScheduled().

Here is the call graph for this function:

◆ isFinishFront()

virtual bool BFOptimization::isFinishFront ( )
inlinevirtual

Definition at line 81 of file BFOptimization.hh.

81{ return false; }

◆ jumpGuardAvailableCycle()

int BFOptimization::jumpGuardAvailableCycle ( const MoveNode mn)
protected

Definition at line 918 of file BFOptimization.cc.

918 {
919
921#ifdef DEBUG_LOOP_SCHEDULER
922 std::cerr << "jump node is null or guard operation!" << std::endl;
923#endif
924 return INT_MAX;
925 }
926 if (sched_.guardWriteNode() == NULL) {
927#ifdef DEBUG_LOOP_SCHEDULER
928 std::cerr << "Guard write node not known!" << std::endl;
929#endif
930 return INT_MAX;
931 }
932 if (&mn == sched_.guardWriteNode()) {
933#ifdef DEBUG_LOOP_SCHEDULER
934 std::cerr << "I AM guard write node!" << std::endl << std::endl;
935#endif
936 return 0;
937 }
939#ifdef DEBUG_LOOP_SCHEDULER
940 std::cerr << "guardwrite node is null or not sched:"
941 << sched_.guardWriteNode()->toString() << std::endl;
942#endif
943 return INT_MAX;
944 }
945
947 guardLatency()+
949
950 return glat+ sched_.guardWriteNode()->cycle() - ii();
951}
MoveNode * jumpNode()
MoveNode * guardWriteNode()
bool isGuardOperation() const
Definition MoveNode.cc:181
int globalGuardLatency() const
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345
virtual const TTAMachine::RegisterFile & registerFile() const
Definition Terminal.cc:225

References TTAMachine::Machine::controlUnit(), MoveNode::cycle(), TTAProgram::Move::destination(), TTAMachine::ControlUnit::globalGuardLatency(), BF2Scheduler::guardWriteNode(), ii(), MoveNode::isGuardOperation(), MoveNode::isScheduled(), BF2Scheduler::jumpNode(), MoveNode::move(), TTAProgram::Terminal::registerFile(), sched_, targetMachine(), and MoveNode::toString().

Referenced by addJumpGuardIfNeeded(), canAssign(), rmEC(), and rmLC().

Here is the call graph for this function:

◆ mightBeReady()

void BFOptimization::mightBeReady ( MoveNode mn)
virtual

Reimplemented in BF2ScheduleFront.

Definition at line 953 of file BFOptimization.cc.

953 {
955}
void mightBeReady(MoveNode &n) override
BF2ScheduleFront * currentFront()

References BF2Scheduler::currentFront(), BF2ScheduleFront::mightBeReady(), and sched_.

Referenced by BFDREEarly::operator()(), BFDRELate::operator()(), BFLateBypass::operator()(), and BFEarlyBypass::operator()().

Here is the call graph for this function:

◆ needJumpGuard()

bool BFOptimization::needJumpGuard ( const MoveNode mn,
int  cycle 
)
protected

Definition at line 878 of file BFOptimization.cc.

878 {
879 if (cycle >= (int)(ii())) {
880 return false;
881 }
882
883 return !canBeSpeculated(mn);
884}

References canBeSpeculated(), and ii().

Referenced by addJumpGuardIfNeeded(), canAssign(), rmEC(), rmLC(), and unsetJumpGuardIfNeeded().

Here is the call graph for this function:

◆ prologDDG()

DataDependenceGraph * BFOptimization::prologDDG ( )
protected

Definition at line 75 of file BFOptimization.cc.

75{ return sched_.prologDDG();}
DataDependenceGraph * prologDDG()

References BF2Scheduler::prologDDG(), and sched_.

Referenced by assignCopyToPrologEpilog(), checkPrologDDG(), and BFSchedulePreLoopShared::operator()().

Here is the call graph for this function:

◆ prologRM()

SimpleResourceManager * BFOptimization::prologRM ( ) const
protected

◆ putAlsoToPrologEpilog()

bool BFOptimization::putAlsoToPrologEpilog ( int  cycle,
MoveNode mn 
)
protected

◆ RFReadPortCountPreventsScheduling()

const TTAMachine::RegisterFile * BFOptimization::RFReadPortCountPreventsScheduling ( const MoveNode mn)
protected

Definition at line 1030 of file BFOptimization.cc.

1030 {
1031
1032 auto& move = mn.move();
1033 if (!move.source().isGPR()) {
1034 return nullptr;
1035 }
1036
1037 auto& rf = move.source().registerFile();
1038 int freeRFPorts = rf.maxReads();
1039
1040 if (!move.destination().isFUPort() || !mn.isDestinationOperation()) {
1041 return nullptr;
1042 }
1043
1045 for (int i = 0; i < po.inputMoveCount(); i++) {
1046 MoveNode& input = po.inputMove(i);
1047 auto& inputMove = input.move();
1048 if (input.move().destination().isFUPort() && input.isScheduled()) {
1049 auto& fu = inputMove.destination().functionUnit();
1050 auto hwop = fu.operation(po.operation().name());
1051 auto port = hwop->port(move.destination().operationIndex());
1052 if (!port->noRegister()) {
1053 return nullptr;
1054 }
1055 if (inputMove.source().isGPR() &&
1056 &inputMove.source().registerFile() == &rf) {
1057 freeRFPorts--;
1058 if (freeRFPorts < 1) {
1059 return &rf;
1060 }
1061 }
1062 }
1063 }
1064 return nullptr;
1065}
virtual int maxReads() const

References TTAProgram::Move::destination(), MoveNode::destinationOperation(), TTAProgram::Terminal::functionUnit(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), MoveNode::isDestinationOperation(), TTAProgram::Terminal::isFUPort(), MoveNode::isScheduled(), TTAMachine::RegisterFile::maxReads(), MoveNode::move(), Operation::name(), ProgramOperation::operation(), TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::port(), TTAProgram::Terminal::registerFile(), and TTAProgram::Move::source().

Referenced by canBeScheduled(), and BFScheduleBU::operator()().

Here is the call graph for this function:

◆ rm()

SimpleResourceManager & BFOptimization::rm ( ) const
protected

◆ rmEC()

int BFOptimization::rmEC ( int  cycle,
MoveNode mn,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
const TTAMachine::Bus prologBus = nullptr,
int  immWriteCycle = -1,
int  prologImmWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1 
)
protectedvirtual

Definition at line 213 of file BFOptimization.cc.

221 {
222#ifdef DEBUG_LOOP_SCHEDULER
223 if (ii()) {
224 std::cerr << "\t\t\t\t\tbfopt::rmec called, cycle: " << cycle
225 << " mn: " << mn.toString() <<
226 std::endl;
227
228 }
229#else
230#ifdef DEBUG_BUBBLEFISH_SCHEDULER
231 std::cerr << "\t\t\t\t\tCalling rmec for: " << mn.toString()
232 << " cycle: " << cycle << "dispose: "
233 << disposePrologCopy << std::endl;
234#endif
235#endif
236 if (!ii()) {
237 return rm().earliestCycle(
238 cycle, mn, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
239 }
240 // cannot add guard if already has guard. so limit cycle to 2nd round.
241 if (!mn.move().isUnconditional() && needJumpGuard(mn, cycle)) {
242 cycle = ii();
243 }
244
245 MoveNode* prologMN = nullptr;
246 bool createdCopy = false;
247 bool usePrologMN = usePrologMove(mn);
248 if (usePrologMN) {
249 auto a = duplicator().duplicateMoveNode(mn, false, false);
250 prologMN = a.first;
251 createdCopy = a.second;
252 }
253
254 bool setGuard = false;
255 int ec = rm().earliestCycle(
256 cycle, mn, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
257 if (ec == INT_MAX || ec == -1) {
258#ifdef DEBUG_BUBBLEFISH_SCHEDULER
259 std::cerr << "\t\t\t\t\trmec over with -1" << std::endl;
260#endif
261 if (createdCopy) {
262 duplicator().disposeMoveNode(prologMN);
263 }
264 return ec;
265 }
266
267 while (ec < (signed)(2*ii())) {
268 if (needJumpGuard(mn, ec)) {
269 if (ec < jumpGuardAvailableCycle(mn)) {
270 ec++;
271 continue;
272 }
273 if (!setGuard) {
275 setJumpGuard(mn);
276 setGuard = true;
277 continue;
278 }
279 } else { // no longer need jump guard.
280 if (setGuard) {
281 assert(!mn.move().isUnconditional());
282 unsetJumpGuard(mn);
283 setGuard = false;
284 continue;
285 }
286 }
287
288 if (!setGuard) {
289 ec = rm().earliestCycle(
290 ec, mn, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
291 if (ec == -1) {
292 break;
293 }
294 } else {
295 int newEC = rm().earliestCycle(
296 ec, mn, bus, srcFU, dstFU, immWriteCycle);
297 // if set guard, guard may reduce too much..
298 if (newEC > ec) {
299 ec = std::min(newEC, (signed)(ii()));
300 continue;
301 }
302 if (newEC == -1) {
303 ec = -1;
304 break;
305 }
306 }
307 if (ec == INT_MAX) {
308 break;
309 }
310
311
312 if (usePrologMN) {
313 bool assignedMN = false;
314 auto mySrcFU = srcFU;
315 auto myDstFU = dstFU;
316 auto myImmu = immu;
317 auto myImmReg = immRegIndex;
318 if (hasAmbiguousResources(mn)) {
319 rm().assign(ec, mn, bus, srcFU, dstFU, immWriteCycle, immu,
320 immRegIndex);
321 mySrcFU = sourceFU(mn);
322 myDstFU = destinationFU(mn);
323 if (mn.isSourceImmediateRegister()) {
324 myImmReg = mn.move().source().index();
325 myImmu = &mn.move().source().immediateUnit();
326 }
327 assignedMN = true;
328 }
329 bool ok = prologRM()->canAssign(
330 ec + BF2Scheduler::PROLOG_CYCLE_BIAS, *prologMN, prologBus,
331 mySrcFU, myDstFU, prologImmWriteCycle, myImmu, myImmReg);
332 if (assignedMN) {
333 rm().unassign(mn);
334 }
335 if (!ok) {
336 ec++;
337 continue;
338 } else {
339 break;
340 }
341 } else { // no prolog
342 if (createdCopy) {
343 duplicator().disposeMoveNode(prologMN);
344 }
345 if (setGuard) {
346 unsetJumpGuard(mn);
347 }
348 return ec;
349 }
350 }
351 if (createdCopy) {
352 duplicator().disposeMoveNode(prologMN);
353 }
354 if (setGuard) {
355 unsetJumpGuard(mn);
356 }
357#ifdef DEBUG_LOOP_SCHEDULER
358 std::cerr << "\t\t\t\t\trmec over" << std::endl;
359#endif
360 return ec;
361}
virtual int earliestCycle(MoveNode &node, const TTAMachine::Bus *bus=NULL, const TTAMachine::FunctionUnit *srcFU=NULL, const TTAMachine::FunctionUnit *dstFU=NULL, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override

References assert, SimpleResourceManager::assign(), SimpleResourceManager::canAssign(), destinationFU(), MoveNodeDuplicator::disposeMoveNode(), MoveNodeDuplicator::duplicateMoveNode(), duplicator(), SimpleResourceManager::earliestCycle(), hasAmbiguousResources(), ii(), TTAProgram::Terminal::immediateUnit(), TTAProgram::Terminal::index(), MoveNode::isSourceImmediateRegister(), TTAProgram::Move::isUnconditional(), jumpGuardAvailableCycle(), MoveNode::move(), needJumpGuard(), BF2Scheduler::PROLOG_CYCLE_BIAS, prologRM(), rm(), setJumpGuard(), TTAProgram::Move::source(), sourceFU(), MoveNode::toString(), SimpleResourceManager::unassign(), unsetJumpGuard(), and usePrologMove().

Referenced by BFPushAntidepDown::operator()(), and BFScheduleTD::operator()().

Here is the call graph for this function:

◆ rmLC()

int BFOptimization::rmLC ( int  cycle,
MoveNode mn,
const TTAMachine::Bus bus = nullptr,
const TTAMachine::FunctionUnit srcFU = nullptr,
const TTAMachine::FunctionUnit dstFU = nullptr,
const TTAMachine::Bus prologBus = nullptr,
int  immWriteCycle = -1,
int  prologImmWriteCycle = -1,
const TTAMachine::ImmediateUnit immu = nullptr,
int  immRegIndex = -1 
)
protectedvirtual

Definition at line 363 of file BFOptimization.cc.

371 {
372#ifdef DEBUG_LOOP_SCHEDULER
373 if (ii()) {
374 std::cerr << "\t\t\t\t\tbfopt::rmlc called, cycle: " << cycle
375 << " mn: " << mn.toString() << std::endl;
376 }
377#else
378#ifdef DEBUG_BUBBLEFISH_SCHEDULER
379 std::cerr << "\t\t\t\t\tbfopt::rmlc called, cycle: " << cycle
380 << " mn: " << mn.toString() << std::endl;
381#endif
382#endif
383 int lc = cycle;
384 bool setGuard = false;
385 MoveNode* prologMN = NULL;
386 bool createdCopy = false;
387 bool usePrologMN = usePrologMove(mn);
388 if (usePrologMN) {
389 auto a = duplicator().duplicateMoveNode(mn, false, false);
390 prologMN = a.first;
391 createdCopy = a.second;
392 }
393
394 while (lc >= 0) {
395 lc = rm().latestCycle(lc,mn, bus, srcFU, dstFU, immWriteCycle);
396#ifdef DEBUG_LOOP_SCHEDULER
397 if (ii()) {
398 std::cerr << "\t\t\t\t\tgot lc from rm: " << lc << std::endl;
399 }
400#else
401#ifdef DEBUG_BUBBLEFISH_SCHEDULER
402 std::cerr << "\t\t\t\t\tgot lc from rm: " << lc << std::endl;
403#endif
404#endif
405 if (lc == -1) {
406 break;
407 }
408 if (needJumpGuard(mn, lc)) {
409#ifdef DEBUG_LOOP_SCHEDULER
410 std::cerr << "\t\t\t\t\tNeed jump guard for mn: "
411 << mn.toString() << " cycle: " << lc << std::endl;
412#endif
413 if (lc < jumpGuardAvailableCycle(mn)) {
414#ifdef DEBUG_LOOP_SCHEDULER
415 std::cerr << "\t\t\t\t\tjump guard not yet available so "
416 << "cannot schedule this ever" << std::endl;
417#endif
418 if (createdCopy) {
419 duplicator().disposeMoveNode(prologMN);
420 }
421 if (setGuard) {
422 unsetJumpGuard(mn);
423 }
424 return -1;
425 }
426 if (!setGuard) {
427 // cannot add guard if already has guard.
428 if (!mn.move().isUnconditional()) {
429 if (createdCopy) {
430 duplicator().disposeMoveNode(prologMN);
431 }
432 return -1;
433 }
434 setJumpGuard(mn);
435 setGuard = true;
436 continue;
437 }
438 }
439 if (usePrologMN) {
440 // then check that this can be assigned to prolog/epilog
441 // need to use the correct FU - only way to get it is to
442 // assign loop move first
443 bool assignedMN = false;
444 auto mySrcFU = srcFU;
445 auto myDstFU = dstFU;
446 auto myImmu = immu;
447 auto myImmReg = immRegIndex;
448
449 if (hasAmbiguousResources(mn)) {
450 rm().assign(lc, mn, bus, srcFU, dstFU, immWriteCycle);
451 mySrcFU = sourceFU(mn);
452 myDstFU = destinationFU(mn);
453 if (mn.isSourceImmediateRegister()) {
454 myImmReg = mn.move().source().index();
455 myImmu = &mn.move().source().immediateUnit();
456 }
457 assignedMN = true;
458 }
459 bool ok = prologRM()->canAssign(
460 lc + BF2Scheduler::PROLOG_CYCLE_BIAS, *prologMN, prologBus,
461 mySrcFU, myDstFU, prologImmWriteCycle, myImmu, myImmReg);
462 if (assignedMN) {
463 rm().unassign(mn);
464 }
465 if (!ok) {
466#ifdef DEBUG_LOOP_SCHEDULER
467 std::cerr << "prolog RM cannot assign to cycle: "
468 << lc << std::endl;
469 std::cerr << "instr in prolog rm: " <<
471 *prologRM()->instruction(
473#endif
474 lc--;
475 continue;
476 } else {
477 break;
478 }
479 } else { // not in a prolog.
480 if (createdCopy) {
481 duplicator().disposeMoveNode(prologMN);
482 }
483 return lc;
484 }
485 }
486 if (createdCopy) {
487 duplicator().disposeMoveNode(prologMN);
488 }
489 if (setGuard) {
490 unsetJumpGuard(mn);
491 }
492 return lc;
493}
static std::string disassemble(const TTAProgram::Move &move)
virtual int latestCycle(MoveNode &node, const TTAMachine::Bus *bus=NULL, const TTAMachine::FunctionUnit *srcFU=NULL, const TTAMachine::FunctionUnit *dstFU=NULL, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override

References SimpleResourceManager::assign(), SimpleResourceManager::canAssign(), destinationFU(), POMDisassembler::disassemble(), MoveNodeDuplicator::disposeMoveNode(), MoveNodeDuplicator::duplicateMoveNode(), duplicator(), hasAmbiguousResources(), ii(), TTAProgram::Terminal::immediateUnit(), TTAProgram::Terminal::index(), MoveNode::isSourceImmediateRegister(), TTAProgram::Move::isUnconditional(), jumpGuardAvailableCycle(), SimpleResourceManager::latestCycle(), MoveNode::move(), needJumpGuard(), BF2Scheduler::PROLOG_CYCLE_BIAS, prologRM(), rm(), setJumpGuard(), TTAProgram::Move::source(), sourceFU(), MoveNode::toString(), SimpleResourceManager::unassign(), unsetJumpGuard(), and usePrologMove().

Referenced by BFPushAntidepDown::operator()(), BFPushMoveUp::operator()(), and BFScheduleBU::operator()().

Here is the call graph for this function:

◆ rootDDG()

DataDependenceGraph * BFOptimization::rootDDG ( )
protected

Definition at line 71 of file BFOptimization.cc.

71 {
72 return static_cast<DataDependenceGraph*>(ddg().rootGraph());
73}
BoostGraph * rootGraph()

References ddg(), and BoostGraph< GraphNode, GraphEdge >::rootGraph().

Here is the call graph for this function:

◆ selector()

BUMoveNodeSelector & BFOptimization::selector ( )
protected

Definition at line 80 of file BFOptimization.cc.

80{ return sched_.selector(); }
BUMoveNodeSelector & selector()

References sched_, and BF2Scheduler::selector().

Referenced by BF2ScheduleFront::scheduleFrontFromMove().

Here is the call graph for this function:

◆ setJumpGuard()

void BFOptimization::setJumpGuard ( MoveNode mn)
protected

Definition at line 612 of file BFOptimization.cc.

612 {
613#ifdef DEBUG_LOOP_SCHEDULER
614 std::cerr << "\t\t\t\t\tsetting jump guard to: " << mn.toString()
615 << std::endl;
616#endif
617
618 if (!mn.move().isUnconditional()) {
619 std::cerr << "Cannot set jump guard because already conditional: "
620 << mn.toString() << std::endl;
621 }
623
624 assert(!dynamic_cast<const TTAMachine::PortGuard*>(
625 &sched_.jumpGuard()->guard()));
626
628// TTAProgram::CodeGenerator::createInverseGuard(*sched_.jumpGuard());
629
630 mn.move().setGuard(newGuard);
631
632/*
633 TTAMachine::Guard& g = newGuard->guard();
634 TTAMachine::RegisterGuard* rg =
635 dynamic_cast<TTAMachine::RegisterGuard*>(&g);
636
637
638
639
640 TCEString regName;
641 regName << rg->registerFile()->name() << "." <<
642 rg->registerIndex();
643
644 DataDependenceEdge* e = new DataDependenceEdge(
645 DataDependenceEdge::EDGE_REGISTER,
646 DataDependenceEdge::DEP_RAW,
647 regName,
648 true, // guard
649 false, // true_alias mem dep
650 false, // tail pseudo
651 false, // head pseudo
652 1); // loop depth
653 ddg().connectNodes(*sched_.guardWriteNode(), mn,*e);
654
655*/
656#ifdef DEBUG_BUBBLEFISH_SCHEDULER
657 std::cerr << "\t\t\t\t\tset jump guard: " << mn.toString() << std::endl;
658#endif
659
660}
TTAProgram::MoveGuard * jumpGuard()
MoveGuard * copy() const
Definition MoveGuard.cc:96
const TTAMachine::Guard & guard() const
Definition MoveGuard.cc:86
void setGuard(MoveGuard *guard)
Definition Move.cc:360

References assert, TTAProgram::MoveGuard::copy(), TTAProgram::MoveGuard::guard(), TTAProgram::Move::isUnconditional(), BF2Scheduler::jumpGuard(), MoveNode::move(), sched_, TTAProgram::Move::setGuard(), and MoveNode::toString().

Referenced by addJumpGuardIfNeeded(), canAssign(), rmEC(), and rmLC().

Here is the call graph for this function:

◆ setPrologDstFUAnno()

void BFOptimization::setPrologDstFUAnno ( MoveNode prologMN,
MoveNode loopMN 
)
protected

Definition at line 703 of file BFOptimization.cc.

703 {
704 TTAProgram::Move& m = prologMN.move();
705
706 if (loopMN.isDestinationOperation()) {
709 TTAProgram::Terminal& dest = loopMN.move().destination();
710 assert(dest.isFUPort());
711 std::string fuName = dest.functionUnit().name();
712#ifdef DEBUG_LOOP_SCHEDULER
713 std::cerr << "\t\tSetting dst Fu anno, loop MN: "
714 << loopMN.toString() << " prolog MN: "
715 << prologMN.toString() << std::endl;
716#endif
717 //TODO: which is the correct annotation here?
720 fuName);
721 m.setAnnotation(dstUnit);
722 }
723}
void removeAnnotations(ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID)
void setAnnotation(const ProgramAnnotation &annotation)

References TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_DST, assert, TTAProgram::Move::destination(), TTAProgram::Terminal::functionUnit(), MoveNode::isDestinationOperation(), TTAProgram::Terminal::isFUPort(), MoveNode::move(), TTAMachine::Component::name(), TTAProgram::AnnotatedInstructionElement::removeAnnotations(), TTAProgram::AnnotatedInstructionElement::setAnnotation(), and MoveNode::toString().

Referenced by setPrologFUAnnos().

Here is the call graph for this function:

◆ setPrologFUAnnos()

void BFOptimization::setPrologFUAnnos ( MoveNode prologMN,
MoveNode loopMN 
)
private

Definition at line 742 of file BFOptimization.cc.

742 {
743 setPrologSrcFUAnno(prologMN, loopMN);
744 setPrologDstFUAnno(prologMN, loopMN);
745}
void setPrologSrcFUAnno(MoveNode &prologMN, MoveNode &loopMN)
void setPrologDstFUAnno(MoveNode &prologMN, MoveNode &loopMN)

References setPrologDstFUAnno(), and setPrologSrcFUAnno().

Here is the call graph for this function:

◆ setPrologSrcFUAnno()

void BFOptimization::setPrologSrcFUAnno ( MoveNode prologMN,
MoveNode loopMN 
)
protected

Definition at line 681 of file BFOptimization.cc.

681 {
682 TTAProgram::Move& m = prologMN.move();
683
684 if (loopMN.isSourceOperation()) {
687 TTAProgram::Terminal& source = loopMN.move().source();
688 assert(source.isFUPort());
689 std::string fuName = source.functionUnit().name();
690#ifdef DEBUG_LOOP_SCHEDULER
691 std::cerr << "\t\tSetting src Fu anno, loop MN: "
692 << loopMN.toString() << " prolog MN: "
693 << prologMN.toString() << std::endl;
694#endif
695 //TODO: which is the correct annotation here?
698 fuName);
699 m.setAnnotation(srcUnit);
700 }
701}

References TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC, assert, TTAProgram::Terminal::functionUnit(), TTAProgram::Terminal::isFUPort(), MoveNode::isSourceOperation(), MoveNode::move(), TTAMachine::Component::name(), TTAProgram::AnnotatedInstructionElement::removeAnnotations(), TTAProgram::AnnotatedInstructionElement::setAnnotation(), TTAProgram::Move::source(), and MoveNode::toString().

Referenced by setPrologFUAnnos().

Here is the call graph for this function:

◆ sourceFU()

const TTAMachine::FunctionUnit * BFOptimization::sourceFU ( const MoveNode mn)
private

Definition at line 726 of file BFOptimization.cc.

726 {
727 return fuOfTerminal(mn.move().source());
728}

References fuOfTerminal(), MoveNode::move(), and TTAProgram::Move::source().

Referenced by assignCopyToPrologEpilog(), canAssign(), rmEC(), and rmLC().

Here is the call graph for this function:

◆ targetMachine()

const TTAMachine::Machine & BFOptimization::targetMachine ( ) const
protected

◆ unassign()

void BFOptimization::unassign ( MoveNode mn,
bool  disposePrologCopy = true 
)
protectedvirtual

Definition at line 196 of file BFOptimization.cc.

196 {
197#ifdef DEBUG_BUBBLEFISH_SCHEDULER
198 std::cerr << "\t\t\t\t\tUnassigning mn: " << mn.toString()
199 << "dispose: " << disposePrologCopy << std::endl;
200#endif
201 int cycle = mn.cycle();
202 rm().unassign(mn);
203 bool usePrologMN = usePrologMove(mn);
204 if (usePrologMN) {
205 unassignCopyFromPrologEpilog(mn, disposePrologCopy);
206 }
207 unsetJumpGuardIfNeeded(mn, cycle);
208#ifdef DEBUG_BUBBLEFISH_SCHEDULER
209 std::cerr << "\t\t\t\t\tUnassignined mn: " << mn.toString() << std::endl;
210#endif
211}
void unassignCopyFromPrologEpilog(MoveNode &mh, bool disposePrologCopy=true)

References MoveNode::cycle(), rm(), MoveNode::toString(), SimpleResourceManager::unassign(), unassignCopyFromPrologEpilog(), unsetJumpGuardIfNeeded(), and usePrologMove().

Referenced by BFLateBypass::operator()(), BFLateBypassGuard::operator()(), BFShareOperandLate::operator()(), BFShareOperandWithScheduled::operator()(), BFRescheduleMove::undoOnlyMe(), BFScheduleBU::undoOnlyMe(), BFScheduleExact::undoOnlyMe(), BFScheduleMove::undoOnlyMe(), BFScheduleTD::undoOnlyMe(), BFShareOperandLate::undoOnlyMe(), and BFUnscheduleMove::unscheduleOriginal().

Here is the call graph for this function:

◆ unassignCopyFromPrologEpilog()

void BFOptimization::unassignCopyFromPrologEpilog ( MoveNode mh,
bool  disposePrologCopy = true 
)
private

Definition at line 810 of file BFOptimization.cc.

811 {
812#ifdef DEBUG_LOOP_SCHEDULER
813 std::cerr << "\t\tUnassigning copy from prolog, original mn: "
814 << mn.toString() << "dispose: "
815 << disposePrologCopy << std::endl;
816#endif
817 MoveNode* copy = prologMoves_[&mn];
818 if (copy != NULL) {
819 prologRM()->unassign(*copy);
820 prologMoves_.erase(&mn);
821#ifdef DEBUG_LOOP_SCHEDULER
822 std::cerr << "\t\t\tcopy after unassign: " << copy->toString()
823 << std::endl;
824#endif
825 if (disposePrologCopy) {
827 }
828 // TODO: program ops memory leak now
829#ifdef DEBUG_BUBBLEFISH_SCHEDULER
830 } else {
831 std::cerr << "\t\t\tCopy not found." << std::endl;
832#endif
833 }
834#ifdef DEBUG_BUBBLEFISH_SCHEDULER
835 std::cerr << "\t\tUnassigned copy from prolog, original mn: "
836 << mn.toString() << std::endl;
837#endif
838 prologMoves_.erase(&mn);
839}

References MoveNodeDuplicator::disposeMoveNode(), duplicator(), prologMoves_, prologRM(), MoveNode::toString(), and SimpleResourceManager::unassign().

Referenced by unassign().

Here is the call graph for this function:

◆ unsetJumpGuard()

void BFOptimization::unsetJumpGuard ( MoveNode mn)
protected

Definition at line 662 of file BFOptimization.cc.

662 {
663#ifdef DEBUG_LOOP_SCHEDULER
664 std::cerr << "\t\t\t\t\tunsetting jump guard from: "
665 << mn.toString() << std::endl;
666#endif
668 mn.move().setGuard(NULL);
669#ifdef DEBUG_BUBBLEFISH_SCHEDULER
670 std::cerr << "\t\t\t\t\tunset jump guard: " << mn.toString() << std::endl;
671#endif
672}
void removeIncomingGuardEdges(MoveNode &node)

References ddg(), MoveNode::move(), DataDependenceGraph::removeIncomingGuardEdges(), TTAProgram::Move::setGuard(), and MoveNode::toString().

Referenced by canAssign(), rmEC(), rmLC(), and unsetJumpGuardIfNeeded().

Here is the call graph for this function:

◆ unsetJumpGuardIfNeeded()

void BFOptimization::unsetJumpGuardIfNeeded ( MoveNode mn,
int  cycle 
)
private

Definition at line 912 of file BFOptimization.cc.

912 {
913 if (needJumpGuard(mn, cycle)) {
914 unsetJumpGuard(mn);
915 }
916}

References needJumpGuard(), and unsetJumpGuard().

Referenced by canAssign(), and unassign().

Here is the call graph for this function:

◆ usePrologMove()

bool BFOptimization::usePrologMove ( const MoveNode mn)
protected

Definition at line 91 of file BFOptimization.cc.

91 {
92 if (prologRM() == NULL) {
93 return false;
94 }
95 // TODO: better way to no prolog move for lbufc op
96 if (mn.move().isControlFlowMove() &&
97 !mn.move().isJump()) {
98 return false;
99 }
100 return true;
101}
bool isControlFlowMove() const
Definition Move.cc:233
bool isJump() const
Definition Move.cc:164

References TTAProgram::Move::isControlFlowMove(), TTAProgram::Move::isJump(), MoveNode::move(), and prologRM().

Referenced by assign(), canAssign(), rmEC(), rmLC(), and unassign().

Here is the call graph for this function:

Member Data Documentation

◆ prologMoves_

std::map< MoveNode *, MoveNode *, MoveNode::Comparator > BFOptimization::prologMoves_
staticprotected

◆ sched_

BF2Scheduler& BFOptimization::sched_
protected

Definition at line 103 of file BFOptimization.hh.

Referenced by BFSwapOperands::BFSwapOperands(), BFEarlyBypasser::bypassSourceLatestCycle(), BFRegCopy::createAntidepsForReg(), ddg(), ddg(), duplicator(), BF2ScheduleFront::findInducingBypassSource(), BF2ScheduleFront::findInducingBypassSourceFromOperation(), BF2ScheduleFront::getMoveNodeFromFrontBU(), jumpGuardAvailableCycle(), mightBeReady(), BFRenameLiveRange::notifySelector(), BFDREEarly::operator()(), BFDRELate::operator()(), BFDRELoop::operator()(), BFDropPreShared::operator()(), BFEarlyBypasser::operator()(), BFKillNode::operator()(), BFLateBypass::operator()(), BFLateBypasses::operator()(), BFLateBypassGuard::operator()(), BFPushAntidepDown::operator()(), BFPushAntidepsDown::operator()(), BFPushDepsUp::operator()(), BFPushMoveUp::operator()(), BFPushMoveUp2::operator()(), BFRenameLiveRange::operator()(), BFRenameSource::operator()(), BFRescheduleResultClose::operator()(), BFRescheduleResultsClose::operator()(), BFRescheduleSuccessorsClose::operator()(), BFScheduleBU::operator()(), BFScheduleExact::operator()(), BFScheduleTD::operator()(), BFShareOperandLate::operator()(), BFShareOperands::operator()(), BFShareOperandsLate::operator()(), BFShareOperandWithScheduled::operator()(), BFEarlyBypass::operator()(), BFMergeAndKeepUser::operator()(), BFPostpassBypass::operator()(), BFPostpassDRE::operator()(), BFPostpassLoopDRE::operator()(), BFRemoveGuard::operator()(), BFRemoveGuardFromSucc::operator()(), BFRemoveGuardsFromSuccs::operator()(), BFTryRemoveGuard::operator()(), BF2ScheduleFront::printFront(), prologDDG(), prologRM(), BFRenameLiveRange::renameLiveRange(), BFShareOperandLate::revert(), rm(), BF2ScheduleFront::scheduleFrontFromMove(), BF2ScheduleFront::scheduleMove(), selector(), setJumpGuard(), BFRegCopyAfter::splitMove(), BFRegCopyBefore::splitMove(), targetMachine(), BFPostpassBypasser::tryBypassNode(), BF2ScheduleFront::tryRevertEarlierBypass(), BF2ScheduleFront::tryToScheduleMoveOuter(), BFRegCopy::undoDDG(), BFDropPreShared::undoOnlyMe(), BFKillNode::undoOnlyMe(), BFShareOperandWithScheduled::undoOnlyMe(), BFEarlyBypass::undoOnlyMe(), BFPostpassLoopDRE::undoOnlyMe(), BFRenameLiveRange::undoOnlyMe(), and BFMergeAndKeepUser::updateEdges().


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