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

#include <BFSchedulePreLoopShared.hh>

Inheritance diagram for BFSchedulePreLoopShared:
Inheritance graph
Collaboration diagram for BFSchedulePreLoopShared:
Collaboration graph

Public Member Functions

 BFSchedulePreLoopShared (BF2Scheduler &sched, MoveNode &originalMN)
 
bool operator() ()
 
void undoOnlyMe ()
 
- 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

MoveNodeoriginalMN_
 
MoveNodeprologMN_
 

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 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 38 of file BFSchedulePreLoopShared.hh.

Constructor & Destructor Documentation

◆ BFSchedulePreLoopShared()

BFSchedulePreLoopShared::BFSchedulePreLoopShared ( BF2Scheduler sched,
MoveNode originalMN 
)
inline

Definition at line 40 of file BFSchedulePreLoopShared.hh.

40  :
41  BFOptimization(sched), originalMN_(originalMN) {}

Member Function Documentation

◆ operator()()

bool BFSchedulePreLoopShared::operator() ( )
virtual

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

Implements Reversible.

Definition at line 43 of file BFSchedulePreLoopShared.cc.

43  {
44 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
45  std::cerr << "\tScheduling pre-loop-shared operand: "
47  << std::endl;
48 #endif
49  auto a = duplicator().duplicateMoveNode(originalMN_, true, true);
50  prologMN_ = a.first;
51 
52  // These should always be unconditional. Operand moves have
53  // no side effects, and nobody else uses the FU,
54  // and the value of the guard might change between the iterations
55  if (!prologMN_->move().isUnconditional()) {
56  prologMN_->move().setGuard(NULL);
57  }
58  if (prologMN_ == NULL) {
59 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
60  std::cerr << "\t\tMissing prolog MN for the move. " << std::endl;
61 #endif
62  return false;
63  }
64  int ddgLC = prologDDG()->latestCycle(*prologMN_);
65 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
66  std::cerr << "\tddg lc: " << ddgLC << std::endl;
67 #endif
68  if (ddgLC < 0) {
70  return false;
71  }
72  int lastCycleOfProlog = rm().initiationInterval()-1+
74  int rmlc = prologRM()->latestCycle(
75  std::min(ddgLC, lastCycleOfProlog), *prologMN_);
76 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
77  std::cerr << "\trmlc: " << rmlc << std::endl;
78 #endif
79  if (rmlc < 0) {
81  return false;
82  }
83  prologRM()->assign(rmlc, *prologMN_);
84 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
85  std::cerr << "scheduling of pre-loop opshare ok!"
86  << prologMN_->toString() << std::endl;
87 #endif
88  return true;
89 }

References SimpleResourceManager::assign(), MoveNodeDuplicator::disposeMoveNode(), MoveNodeDuplicator::duplicateMoveNode(), BFOptimization::duplicator(), SimpleResourceManager::initiationInterval(), TTAProgram::Move::isUnconditional(), SimpleResourceManager::latestCycle(), DataDependenceGraph::latestCycle(), MoveNode::move(), originalMN_, BF2Scheduler::PROLOG_CYCLE_BIAS, BFOptimization::prologDDG(), prologMN_, BFOptimization::prologRM(), BFOptimization::rm(), TTAProgram::Move::setGuard(), and MoveNode::toString().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFSchedulePreLoopShared::undoOnlyMe ( )
virtual

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

Reimplemented from Reversible.

Definition at line 91 of file BFSchedulePreLoopShared.cc.

91  {
92 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
93  std::cerr << "undoing scheudle of pre-loop opschare: "
94  << prologMN_->toString() << std::endl;
95 #endif
97 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
98  std::cerr << "unassigned scheudle of pre-loop opschare: "
99  << prologMN_->toString() << std::endl;
100 #endif
101 
103 }

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

Here is the call graph for this function:

Member Data Documentation

◆ originalMN_

MoveNode& BFSchedulePreLoopShared::originalMN_
private

Definition at line 45 of file BFSchedulePreLoopShared.hh.

Referenced by operator()().

◆ prologMN_

MoveNode* BFSchedulePreLoopShared::prologMN_
private

Definition at line 46 of file BFSchedulePreLoopShared.hh.

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


The documentation for this class was generated from the following files:
BFOptimization::duplicator
MoveNodeDuplicator & duplicator() const
Definition: BFOptimization.cc:87
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
TTAProgram::Move::isUnconditional
bool isUnconditional() const
Definition: Move.cc:154
TTAProgram::Move::setGuard
void setGuard(MoveGuard *guard)
Definition: Move.cc:360
SimpleResourceManager::assign
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
Definition: SimpleResourceManager.cc:221
SimpleResourceManager::initiationInterval
virtual unsigned initiationInterval() const
Definition: SimpleResourceManager.hh:135
SimpleResourceManager::unassign
virtual void unassign(MoveNode &node) override
Definition: SimpleResourceManager.cc:252
MoveNodeDuplicator::duplicateMoveNode
std::pair< MoveNode *, bool > duplicateMoveNode(MoveNode &mn, bool addToDDG, bool ignoreSameBBBackEdges)
Definition: MoveNodeDuplicator.cc:106
BFOptimization::prologRM
SimpleResourceManager * prologRM() const
Definition: BFOptimization.cc:77
BFOptimization::prologDDG
DataDependenceGraph * prologDDG()
Definition: BFOptimization.cc:75
MoveNodeDuplicator::disposeMoveNode
void disposeMoveNode(MoveNode *newMN)
Definition: MoveNodeDuplicator.cc:53
BFSchedulePreLoopShared::originalMN_
MoveNode & originalMN_
Definition: BFSchedulePreLoopShared.hh:45
BFOptimization::rm
SimpleResourceManager & rm() const
Definition: BFOptimization.cc:76
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
BF2Scheduler::PROLOG_CYCLE_BIAS
static const int PROLOG_CYCLE_BIAS
Definition: BF2Scheduler.hh:209
MoveNode::move
TTAProgram::Move & move()
SimpleResourceManager::latestCycle
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
Definition: SimpleResourceManager.cc:349
BFSchedulePreLoopShared::prologMN_
MoveNode * prologMN_
Definition: BFSchedulePreLoopShared.hh:46
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