OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
BFScheduleTD Class Reference

#include <BFScheduleTD.hh>

Inheritance diagram for BFScheduleTD:
Inheritance graph
Collaboration diagram for BFScheduleTD:
Collaboration graph

Public Member Functions

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

Private Attributes

int ec_
 
bool allowLateBypass_
 
bool createdCopy_
 

Additional Inherited Members

- Static Public Member Functions inherited from BFOptimization
static void clearPrologMoves ()
 
static MoveNodegetSisterTrigger (const MoveNode &mn, const TTAMachine::Machine &mach)
 
- Protected Member Functions inherited from BFOptimization
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)
 
- Protected Attributes inherited from BFScheduleMove
MoveNodemn_
 
bool createdPrologMove_
 
- Protected Attributes inherited from BFOptimization
BF2Schedulersched_
 
- Protected Attributes inherited from Reversible
std::stack< Reversible * > preChildren_
 
std::stack< Reversible * > postChildren_
 
- Static Protected Attributes inherited from BFOptimization
static std::map< MoveNode *, MoveNode *, MoveNode::ComparatorprologMoves_
 

Detailed Description

Definition at line 43 of file BFScheduleTD.hh.

Constructor & Destructor Documentation

◆ BFScheduleTD()

BFScheduleTD::BFScheduleTD ( BF2Scheduler sched,
MoveNode mn,
int  ec,
bool  allowLateBypass 
)
inline

Definition at line 46 of file BFScheduleTD.hh.

48  :
49  BFScheduleMove(sched, mn), ec_(ec),
50  allowLateBypass_(allowLateBypass),
51  createdCopy_(false) {}

Member Function Documentation

◆ operator()()

bool BFScheduleTD::operator() ( )
virtual

This performs the operation. Returns true if success, false if fail.

Implements Reversible.

Definition at line 56 of file BFScheduleTD.cc.

56  {
57 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
58  std::cerr << "\tPerforming BFSchduleTD for: " << mn_.toString() <<
59  " ec limit: " << ec_ << std::endl;
60 #endif
63  mn_.move().setBus(UniversalMachine::instance().universalBus());
64  }
65 
68  if (runPreChild(lbp)) {
69  if (lbp->removedSource()) {
70  return true;
71  }
72  }
73  }
74 
75 
76  BFRegCopy* regCopyBefore = NULL;
77  BFRegCopy* regCopyAfter = NULL;
78  if (!canBeScheduled(mn_)) {
79  if (/*isRegCopyAfter_ || */ mn_.isSourceOperation()) {
80  regCopyAfter = new BFRegCopyAfter(sched_,mn_, INT_MAX);
81  } else {
82  regCopyBefore = new BFRegCopyBefore(sched_,mn_, INT_MAX);
83  if (!runPreChild(regCopyBefore)) {
84  return false;
85  }
86  }
87  }
88 
89  int ddglc = std::min(sched_.maximumAllowedCycle(),
90  ddg().latestCycle(mn_, ii(), false, false));
91  int ddgec = std::max(ec_,
92  ddg().earliestCycle(mn_, ii(), false, false));
93  int rmec = rmEC(ddgec, mn_);
94 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
95  std::cerr << "\t\tDDG lc: " << ddglc << std::endl;
96  std::cerr << "\t\tDDG ec: " << ddgec << std::endl;
97  std::cerr << "\t\tRM ec: " << rmec << std::endl;
98 #endif
99  if (rmec != -1 && ddglc >= rmec) {
100  createdCopy_ = assign(rmec, mn_);
101  if (regCopyAfter != NULL) {
102  if (!runPostChild(regCopyAfter)) {
104  return false;
105  }
106  }
107 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
108  std::cerr << "\t\tTD Assigned ok:" << mn_.toString()
109  << " bus: " << mn_.move().bus().name() << std::endl;
110 #endif
111  return true;
112  } else {
114  return false;
115  }
116 }

References allowLateBypass_, assert, BFOptimization::assign(), TTAProgram::Move::bus(), BFOptimization::canBeScheduled(), createdCopy_, BFOptimization::ddg(), ec_, BFOptimization::ii(), UniversalMachine::instance(), MoveNode::isDestinationVariable(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), BF2Scheduler::maximumAllowedCycle(), BFScheduleMove::mn_, MoveNode::move(), TTAMachine::Component::name(), BFLateBypasses::removedSource(), BFOptimization::rmEC(), Reversible::runPostChild(), Reversible::runPreChild(), BFOptimization::sched_, TTAProgram::Move::setBus(), MoveNode::toString(), Reversible::undoAndRemovePreChildren(), and UniversalMachine::universalBus().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFScheduleTD::undoOnlyMe ( )
virtual

Undoes the operations done by this class but not children. This method should be overloaded by most derived classes.

Reimplemented from BFScheduleMove.

Definition at line 119 of file BFScheduleTD.cc.

119  {
120 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
121  std::cerr << "unassign td: " << mn_.toString() << std::endl;
122 #endif
123  if (mn_.isScheduled()) {
125  }
127  mn_.move().setBus(UniversalMachine::instance().universalBus());
128  }
129 }

References TTAProgram::Move::bus(), createdCopy_, UniversalMachine::instance(), MoveNode::isScheduled(), BFScheduleMove::mn_, MoveNode::move(), TTAProgram::Move::setBus(), MoveNode::toString(), BFOptimization::unassign(), and UniversalMachine::universalBus().

Here is the call graph for this function:

Member Data Documentation

◆ allowLateBypass_

bool BFScheduleTD::allowLateBypass_
private

Definition at line 57 of file BFScheduleTD.hh.

Referenced by operator()().

◆ createdCopy_

bool BFScheduleTD::createdCopy_
private

Definition at line 58 of file BFScheduleTD.hh.

Referenced by operator()(), and undoOnlyMe().

◆ ec_

int BFScheduleTD::ec_
private

Definition at line 56 of file BFScheduleTD.hh.

Referenced by operator()().


The documentation for this class was generated from the following files:
BFOptimization::unassign
virtual void unassign(MoveNode &mn, bool disposePrologCopy=true)
Definition: BFOptimization.cc:196
BFScheduleTD::createdCopy_
bool createdCopy_
Definition: BFScheduleTD.hh:58
Reversible::undoAndRemovePreChildren
void undoAndRemovePreChildren()
Definition: Reversible.cc:80
BFOptimization::assign
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)
Definition: BFOptimization.cc:103
MoveNode::isDestinationVariable
bool isDestinationVariable() const
Definition: MoveNode.cc:264
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
BFLateBypasses
Definition: BFLateBypasses.hh:44
BFOptimization::ii
unsigned int ii() const
Definition: BFOptimization.cc:85
UniversalMachine::universalBus
TTAMachine::Bus & universalBus() const
Definition: UniversalMachine.cc:306
UniversalMachine::instance
static UniversalMachine & instance()
Definition: UniversalMachine.cc:73
TTAProgram::Move::bus
const TTAMachine::Bus & bus() const
Definition: Move.cc:373
BFOptimization::rmEC
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)
Definition: BFOptimization.cc:213
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
BFRegCopy
Definition: BFRegCopy.hh:47
assert
#define assert(condition)
Definition: Application.hh:86
BFRegCopyAfter
Definition: BFRegCopyAfter.hh:44
MoveNode::isSourceOperation
bool isSourceOperation() const
Definition: MoveNode.cc:168
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
BFScheduleTD::allowLateBypass_
bool allowLateBypass_
Definition: BFScheduleTD.hh:57
BFOptimization::canBeScheduled
bool canBeScheduled(const MoveNode &mn)
Definition: BFOptimization.cc:1067
BFScheduleMove::BFScheduleMove
BFScheduleMove(BF2Scheduler &sched, MoveNode &mn)
Definition: BFScheduleMove.hh:45
BFScheduleTD::ec_
int ec_
Definition: BFScheduleTD.hh:56
BFLateBypasses::removedSource
bool removedSource()
Definition: BFLateBypasses.hh:49
MoveNode::move
TTAProgram::Move & move()
BFRegCopyBefore
Definition: BFRegCopyBefore.hh:44
Reversible::runPreChild
bool runPreChild(Reversible *preChild)
Definition: Reversible.cc:127
MoveNode::isScheduled
bool isScheduled() const
Definition: MoveNode.cc:409
BF2Scheduler::maximumAllowedCycle
int maximumAllowedCycle() const
Definition: BF2Scheduler.hh:186
Reversible::runPostChild
bool runPostChild(Reversible *preChild)
Definition: Reversible.cc:139
BFScheduleMove::mn_
MoveNode & mn_
Definition: BFScheduleMove.hh:50
TTAProgram::Move::setBus
void setBus(const TTAMachine::Bus &bus)
Definition: Move.cc:383