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

#include <BFScheduleExact.hh>

Inheritance diagram for BFScheduleExact:
Inheritance graph
Collaboration diagram for BFScheduleExact:
Collaboration graph

Public Member Functions

 BFScheduleExact (BF2Scheduler &sched, MoveNode &mn, int c, bool allowRegCopy=true, const TTAMachine::FunctionUnit *srcFU=nullptr)
 
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

bool allowRegCopy_
 
int c_
 
TTAProgram::MovejumpLimitMove_
 
int oldJumpLimit_
 
int oldJumpLimitWidth_
 
bool createdCopy_
 
const TTAMachine::FunctionUnitsrcFU_
 

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 47 of file BFScheduleExact.hh.

Constructor & Destructor Documentation

◆ BFScheduleExact()

BFScheduleExact::BFScheduleExact ( BF2Scheduler sched,
MoveNode mn,
int  c,
bool  allowRegCopy = true,
const TTAMachine::FunctionUnit srcFU = nullptr 
)
inline

Definition at line 50 of file BFScheduleExact.hh.

52  :
53  BFScheduleMove(sched, mn),
54  allowRegCopy_(allowRegCopy),
55  c_(c), jumpLimitMove_(0),
56  createdCopy_(false), srcFU_(srcFU) {}

Member Function Documentation

◆ operator()()

bool BFScheduleExact::operator() ( )
virtual

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

Implements Reversible.

Definition at line 53 of file BFScheduleExact.cc.

53  {
54 
55 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
56  std::cerr << "\t\tScheduling to exact cycle: " << mn_.toString()
57  << " to cycle: " << c_ << std::endl;
58 #endif
59  BFRegCopy* regCopyBefore = NULL;
60  //BFRegCopy* regCopyAfter = NULL;
61  BFRegCopy* regCopy = NULL;
62 
63  if (!mn_.move().isUnconditional() &&
64  mn_.move().guard().guard().parentBus() == nullptr) {
66  std::cerr << "Early guard bypass failed!" << std::endl;
67  return false;
68  }
69  }
70  if (allowRegCopy_ && !canBeScheduled(mn_)) {
71  if (mn_.isSourceOperation()) {
72  // assumes the result read is wanted to the exact cycle.
73  // reg cpy after both splits the move and schedules the copy.
74  // TODO: should it be scheudled TD instead of BU then?
75  regCopy = new BFRegCopyAfter(sched_,mn_, INT_MAX);
76  } else {
77  // this only splits the move. scheduled later.
78  regCopyBefore = regCopy = new BFRegCopyBefore(sched_,mn_, INT_MAX);
79  }
80 
81  if (!runPreChild(regCopy)) {
82  return false;
83  }
84  }
85  int ddglc = ddg().latestCycle(mn_, ii(), false, false);
86  int ddgec = ddg().earliestCycle(mn_, ii(), false, false);
87 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
88  std::cerr << "\t\t\tddg lc: " << ddglc << std::endl;
89  std::cerr << "\t\t\tddg ec: " << ddgec << std::endl;
90 #endif
91  if (ddglc >= c_ && ddgec <= c_ && canAssign(c_, mn_, nullptr, srcFU_)) {
92  createdCopy_ = assign(c_, mn_, nullptr, srcFU_);
93  if (regCopyBefore != NULL) {
94  MoveNode* regCopy = regCopyBefore->getRegCopy();
95  BFScheduleBU* regCopySched =
96  new BFScheduleBU(sched_, *regCopy, c_-1, false, false, false);
97  if (!runPostChild(regCopySched)) {
98  undo();
99  return false;
100  }
101  }
102  return true;
103  } else {
105  return false;
106  }
107 }

References allowRegCopy_, BFOptimization::assign(), c_, BFOptimization::canAssign(), BFOptimization::canBeScheduled(), createdCopy_, BFOptimization::ddg(), DataDependenceGraph::earliestCycle(), BFRegCopy::getRegCopy(), TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), BFOptimization::ii(), MoveNode::isSourceOperation(), TTAProgram::Move::isUnconditional(), DataDependenceGraph::latestCycle(), BFScheduleMove::mn_, MoveNode::move(), TTAMachine::Guard::parentBus(), Reversible::runPostChild(), Reversible::runPreChild(), BFOptimization::sched_, srcFU_, MoveNode::toString(), Reversible::undo(), and Reversible::undoAndRemovePreChildren().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFScheduleExact::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 110 of file BFScheduleExact.cc.

110  {
112  if (jumpLimitMove_) {
116  jumpLimitMove_ = NULL;
117  }
118 }

References createdCopy_, jumpLimitMove_, BFScheduleMove::mn_, oldJumpLimit_, oldJumpLimitWidth_, TTAProgram::Move::setSource(), and BFOptimization::unassign().

Here is the call graph for this function:

Member Data Documentation

◆ allowRegCopy_

bool BFScheduleExact::allowRegCopy_
private

Definition at line 61 of file BFScheduleExact.hh.

Referenced by operator()().

◆ c_

int BFScheduleExact::c_
private

Definition at line 62 of file BFScheduleExact.hh.

Referenced by operator()().

◆ createdCopy_

bool BFScheduleExact::createdCopy_
private

Definition at line 66 of file BFScheduleExact.hh.

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

◆ jumpLimitMove_

TTAProgram::Move* BFScheduleExact::jumpLimitMove_
private

Definition at line 63 of file BFScheduleExact.hh.

Referenced by undoOnlyMe().

◆ oldJumpLimit_

int BFScheduleExact::oldJumpLimit_
private

Definition at line 64 of file BFScheduleExact.hh.

Referenced by undoOnlyMe().

◆ oldJumpLimitWidth_

int BFScheduleExact::oldJumpLimitWidth_
private

Definition at line 65 of file BFScheduleExact.hh.

Referenced by undoOnlyMe().

◆ srcFU_

const TTAMachine::FunctionUnit* BFScheduleExact::srcFU_
private

Definition at line 67 of file BFScheduleExact.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
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::toString
std::string toString() const
Definition: MoveNode.cc:576
BFScheduleExact::oldJumpLimitWidth_
int oldJumpLimitWidth_
Definition: BFScheduleExact.hh:65
BFOptimization::ii
unsigned int ii() const
Definition: BFOptimization.cc:85
TTAProgram::Move::isUnconditional
bool isUnconditional() const
Definition: Move.cc:154
MoveNode
Definition: MoveNode.hh:65
BFScheduleExact::allowRegCopy_
bool allowRegCopy_
Definition: BFScheduleExact.hh:61
BFRegCopy::getRegCopy
MoveNode * getRegCopy()
Definition: BFRegCopy.hh:52
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
SimValue
Definition: SimValue.hh:96
BFRegCopy
Definition: BFRegCopy.hh:47
BFEarlyGuardBypass
Definition: BFEarlyGuardBypass.hh:7
BFRegCopyAfter
Definition: BFRegCopyAfter.hh:44
BFScheduleBU
Definition: BFScheduleBU.hh:45
TTAProgram::Move::guard
MoveGuard & guard() const
Definition: Move.cc:345
Reversible::undo
virtual void undo()
Definition: Reversible.cc:69
MoveNode::isSourceOperation
bool isSourceOperation() const
Definition: MoveNode.cc:168
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
BFScheduleExact::oldJumpLimit_
int oldJumpLimit_
Definition: BFScheduleExact.hh:64
BFOptimization::canBeScheduled
bool canBeScheduled(const MoveNode &mn)
Definition: BFOptimization.cc:1067
DataDependenceGraph::earliestCycle
int earliestCycle(const MoveNode &moveNode, unsigned int ii=UINT_MAX, bool ignoreRegWaRs=false, bool ignoreRegWaWs=false, bool ignoreGuards=false, bool ignoreFUDeps=false, bool ignoreSameOperationEdges=false, bool assumeBypassing=false) const
Definition: DataDependenceGraph.cc:388
BFScheduleMove::BFScheduleMove
BFScheduleMove(BF2Scheduler &sched, MoveNode &mn)
Definition: BFScheduleMove.hh:45
TTAProgram::TerminalImmediate
Definition: TerminalImmediate.hh:44
TTAMachine::Guard::parentBus
virtual Bus * parentBus() const
MoveNode::move
TTAProgram::Move & move()
BFScheduleExact::srcFU_
const TTAMachine::FunctionUnit * srcFU_
Definition: BFScheduleExact.hh:67
BFRegCopyBefore
Definition: BFRegCopyBefore.hh:44
Reversible::runPreChild
bool runPreChild(Reversible *preChild)
Definition: Reversible.cc:127
TTAProgram::MoveGuard::guard
const TTAMachine::Guard & guard() const
Definition: MoveGuard.cc:86
BFScheduleExact::c_
int c_
Definition: BFScheduleExact.hh:62
Reversible::runPostChild
bool runPostChild(Reversible *preChild)
Definition: Reversible.cc:139
BFScheduleMove::mn_
MoveNode & mn_
Definition: BFScheduleMove.hh:50
BFOptimization::canAssign
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)
Definition: BFOptimization.cc:495
TTAProgram::Move::setSource
void setSource(Terminal *src)
Definition: Move.cc:312
BFScheduleExact::createdCopy_
bool createdCopy_
Definition: BFScheduleExact.hh:66
DataDependenceGraph::latestCycle
int latestCycle(const MoveNode &moveNode, unsigned int ii=UINT_MAX, bool ignoreRegAntideps=false, bool ignoreUnscheduledSuccessors=true, bool ignoreGuards=false, bool ignoreFUDeps=false, bool ignoreSameOperationEdges=false) const
Definition: DataDependenceGraph.cc:543
BFScheduleExact::jumpLimitMove_
TTAProgram::Move * jumpLimitMove_
Definition: BFScheduleExact.hh:63