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

#include <BFRemoveGuardFromSucc.hh>

Inheritance diagram for BFRemoveGuardFromSucc:
Inheritance graph
Collaboration diagram for BFRemoveGuardFromSucc:
Collaboration graph

Public Member Functions

 BFRemoveGuardFromSucc (BF2Scheduler &sched, MoveNode &succ)
 
bool operator() () override
 
void undoOnlyMe () override
 
- 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

MoveNodemn_
 
TTAProgram::MoveGuardguard_
 

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 54 of file BFRemoveGuardFromSucc.hh.

Constructor & Destructor Documentation

◆ BFRemoveGuardFromSucc()

BFRemoveGuardFromSucc::BFRemoveGuardFromSucc ( BF2Scheduler sched,
MoveNode succ 
)
inline

Definition at line 56 of file BFRemoveGuardFromSucc.hh.

Member Function Documentation

◆ operator()()

bool BFRemoveGuardFromSucc::operator() ( )
overridevirtual

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

Implements Reversible.

Definition at line 47 of file BFRemoveGuardFromSucc.cc.

47 {
48#ifdef DEBUG_BUBBLEFISH_SCHEDULER
49 std::cerr << "\t\t\tRemoving guard from succ: " << mn_.toString()
50 << std::endl;
51#endif
52 int cycle = mn_.cycle();
54 if (!runPreChild(unsched)) {
55#ifdef DEBUG_BUBBLEFISH_SCHEDULER
56 std::cerr << "\t\t\t\tUnsched failed: " << mn_.toString()
57 << std::endl;
58#endif
59 return false;
60 }
61
62 // Remove the guard edges from the ddg
63 auto inEdges = ddg().inEdges(mn_);
64 for (auto e: inEdges) {
65 if (e->guardUse() && !e->isFalseDep()) {
66 runPreChild(new BFRemoveEdge(sched_, ddg().tailNode(*e), mn_,*e));
67 }
68 }
69 auto outEdges = ddg().outEdges(mn_);
70 for (auto e: outEdges) {
71 if (e->guardUse() &&
72 e->dependenceType() == DataDependenceEdge::DEP_WAR) {
73 runPreChild(new BFRemoveEdge(sched_, mn_,ddg().headNode(*e), *e));
74 }
75 }
76
77 // If the prolog move has already been created, update also it
78 MoveNode* prologMN = ii() ? duplicator().getMoveNode(mn_) : nullptr;
79 if (prologMN != nullptr) {
80 prologMN->move().setGuard(NULL);
81 }
82
83 guard_ = mn_.move().guard().copy();
84 mn_.move().setGuard(NULL);
85 BFOptimization* sched = new BFSchedule(sched_, mn_, cycle);
86 if (runPostChild(sched)) {
87#ifdef DEBUG_BUBBLEFISH_SCHEDULER
88 std::cerr << "\t\t\t\tRe-scheduling ok: " << mn_.toString()
89 << std::endl;
90#endif
91 return true;
92 } else {
93#ifdef DEBUG_BUBBLEFISH_SCHEDULER
94 std::cerr << "\t\t\t\tRe-scheduling failed, undoing..: "
95 << mn_.toString() << std::endl;
96#endif
97 undo();
98 return false;
99 }
100}
unsigned int ii() const
BF2Scheduler & sched_
DataDependenceGraph & ddg()
MoveNodeDuplicator & duplicator() const
TTAProgram::MoveGuard * guard_
virtual EdgeSet outEdges(const Node &node) const
virtual EdgeSet inEdges(const Node &node) const
MoveNode * getMoveNode(MoveNode &mn)
int cycle() const
Definition MoveNode.cc:421
std::string toString() const
Definition MoveNode.cc:576
TTAProgram::Move & move()
bool runPostChild(Reversible *preChild)
virtual void undo()
Definition Reversible.cc:69
bool runPreChild(Reversible *preChild)
MoveGuard * copy() const
Definition MoveGuard.cc:96
MoveGuard & guard() const
Definition Move.cc:345
void setGuard(MoveGuard *guard)
Definition Move.cc:360

References TTAProgram::MoveGuard::copy(), MoveNode::cycle(), BFOptimization::ddg(), DataDependenceEdge::DEP_WAR, BFOptimization::duplicator(), MoveNodeDuplicator::getMoveNode(), TTAProgram::Move::guard(), guard_, BFOptimization::ii(), BoostGraph< GraphNode, GraphEdge >::inEdges(), mn_, MoveNode::move(), BoostGraph< GraphNode, GraphEdge >::outEdges(), Reversible::runPostChild(), Reversible::runPreChild(), BFOptimization::sched_, TTAProgram::Move::setGuard(), MoveNode::toString(), and Reversible::undo().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFRemoveGuardFromSucc::undoOnlyMe ( )
overridevirtual

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 102 of file BFRemoveGuardFromSucc.cc.

102 {
103#ifdef DEBUG_BUBBLEFISH_SCHEDULER
104 std::cerr << "\t\t\tRestoring guard to succ: " << mn_.toString()
105 << std::endl;
106#endif
107
108 // If the prolog move has already been created, update also it
109 MoveNode* prologMN = ii() ? duplicator().getMoveNode(mn_) : nullptr;
110 if (prologMN != nullptr) {
111 prologMN->move().setGuard(guard_->copy());
112 }
113
115#ifdef DEBUG_BUBBLEFISH_SCHEDULER
116 std::cerr << "\t\t\tRestored guard to succ: " << mn_.toString()
117 << std::endl;
118#endif
119
120}

References TTAProgram::MoveGuard::copy(), BFOptimization::duplicator(), MoveNodeDuplicator::getMoveNode(), guard_, BFOptimization::ii(), mn_, MoveNode::move(), TTAProgram::Move::setGuard(), and MoveNode::toString().

Here is the call graph for this function:

Member Data Documentation

◆ guard_

TTAProgram::MoveGuard* BFRemoveGuardFromSucc::guard_
private

Definition at line 63 of file BFRemoveGuardFromSucc.hh.

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

◆ mn_

MoveNode& BFRemoveGuardFromSucc::mn_
private

Definition at line 62 of file BFRemoveGuardFromSucc.hh.

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


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