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

#include <BFDRELoop.hh>

Inheritance diagram for BFDRELoop:
Inheritance graph
Collaboration diagram for BFDRELoop:
Collaboration graph

Public Member Functions

 BFDRELoop (BF2Scheduler &sched, MoveNode &mn, int srcCycle)
 
bool operator() ()
 
void undoOnlyMe ()
 
bool dreAllowed ()
 
- Public Member Functions inherited from BFKillNode
 BFKillNode (BF2Scheduler &sched, MoveNode &mn)
 
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

unsigned int srcCycle_
 
MoveNodeprologMN_
 
bool createdPrologCopy_
 

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 BFKillNode
DataDependenceGraph::EdgeSet createdEdges_
 
MoveNodemn_
 
- 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 46 of file BFDRELoop.hh.

Constructor & Destructor Documentation

◆ BFDRELoop()

BFDRELoop::BFDRELoop ( BF2Scheduler sched,
MoveNode mn,
int  srcCycle 
)
inline

Definition at line 48 of file BFDRELoop.hh.

48 :
49 BFKillNode(sched, mn), srcCycle_(srcCycle), prologMN_(NULL),
50 createdPrologCopy_(false) {}
unsigned int srcCycle_
Definition BFDRELoop.hh:55
bool createdPrologCopy_
Definition BFDRELoop.hh:57
MoveNode * prologMN_
Definition BFDRELoop.hh:56

Member Function Documentation

◆ dreAllowed()

bool BFDRELoop::dreAllowed ( )

Definition at line 107 of file BFDRELoop.cc.

107 {
109 for (auto edge: edges) {
110 if (edge->edgeReason() == DataDependenceEdge::EDGE_OPERATION) {
111 return false;
112 }
113 if ((edge->edgeReason() == DataDependenceEdge::EDGE_REGISTER ||
114 edge->edgeReason() ==DataDependenceEdge::EDGE_RA) &&
115 edge->dependenceType() == DataDependenceEdge::DEP_RAW) {
116 return false;
117 }
118 }
119 return true;
120}
MoveNode & mn_
Definition BFKillNode.hh:52
DataDependenceGraph & ddg()
virtual EdgeSet outEdges(const Node &node) const
std::set< GraphEdge *, typename GraphEdge::Comparator > EdgeSet
Definition Graph.hh:54

References BFOptimization::ddg(), DataDependenceEdge::DEP_RAW, DataDependenceEdge::EDGE_OPERATION, DataDependenceEdge::EDGE_RA, DataDependenceEdge::EDGE_REGISTER, BFKillNode::mn_, and BoostGraph< GraphNode, GraphEdge >::outEdges().

Referenced by operator()().

Here is the call graph for this function:

◆ operator()()

bool BFDRELoop::operator() ( )
virtual

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

Implements Reversible.

Definition at line 46 of file BFDRELoop.cc.

46 {
47 if (!sched_.killDeadResults() || targetMachine().alwaysWriteResults()) {
48 return false;
49 }
50
51 if (srcCycle_ < ii()) {
52#ifdef DEBUG_BUBBLEFISH_SCHEDULER
53 std::cerr << "\t\t\t\tCannot loop-dre due too early result cycle"
54 << std::endl;
55#endif
56 return false;
57 }
58
59 if (!dreAllowed()) {
60 return false;
61 }
62
63 // Create a copy to prolog.
64 auto a = duplicator().duplicateMoveNode(mn_, true, true);
65 prologMN_ = a.first;
66 createdPrologCopy_ = a.second;
67
69 if (prologRM()->canAssign(prologCycle, *prologMN_)) {
70 prologRM()->assign(prologCycle, *prologMN_);
71#ifdef DEBUG_BUBBLEFISH_SCHEDULER
72 std::cerr << "\t\t\t\tAssigned loop-bypassed dead result to"
73 << " epilog, cycle:" << prologCycle << std::endl;
74#endif
75 // TODO: where to add to the epilog DDG?
76 createdEdges_ = ddg().copyDepsOver(mn_, true, false);
77 ddg().dropNode(mn_);
79 return true;
80 } else {
81#ifdef DEBUG_BUBBLEFISH_SCHEDULER
82 std::cerr << "\t\t\t\tProlog cycle assign fail for loop-dre: "
84 << " prolog cycle: " << prologCycle << std::endl;
85#endif
88 }
89 return false;
90 }
91}
bool killDeadResults() const
void nodeKilled(MoveNode &mn)
static const int PROLOG_CYCLE_BIAS
bool dreAllowed()
Definition BFDRELoop.cc:107
DataDependenceGraph::EdgeSet createdEdges_
Definition BFKillNode.hh:51
unsigned int ii() const
BF2Scheduler & sched_
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)
SimpleResourceManager * prologRM() const
const TTAMachine::Machine & targetMachine() const
MoveNodeDuplicator & duplicator() const
virtual void dropNode(Node &node)
EdgeSet copyDepsOver(MoveNode &node, bool anti, bool raw)
void disposeMoveNode(MoveNode *newMN)
std::pair< MoveNode *, bool > duplicateMoveNode(MoveNode &mn, bool addToDDG, bool ignoreSameBBBackEdges)
std::string toString() const
Definition MoveNode.cc:576
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

References SimpleResourceManager::assign(), BFOptimization::canAssign(), DataDependenceGraph::copyDepsOver(), BFKillNode::createdEdges_, createdPrologCopy_, BFOptimization::ddg(), MoveNodeDuplicator::disposeMoveNode(), dreAllowed(), BoostGraph< GraphNode, GraphEdge >::dropNode(), MoveNodeDuplicator::duplicateMoveNode(), BFOptimization::duplicator(), BFOptimization::ii(), BF2Scheduler::killDeadResults(), BFKillNode::mn_, BF2Scheduler::nodeKilled(), BF2Scheduler::PROLOG_CYCLE_BIAS, prologMN_, BFOptimization::prologRM(), BFOptimization::sched_, srcCycle_, BFOptimization::targetMachine(), and MoveNode::toString().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFDRELoop::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 93 of file BFDRELoop.cc.

93 {
94 assert(prologRM()!=NULL);
95 assert(&mn_ != NULL);
98 prologMoves_.erase(&mn_);
101 }
102
103
105}
#define assert(condition)
void undoOnlyMe()
Definition BFKillNode.cc:49
static std::map< MoveNode *, MoveNode *, MoveNode::Comparator > prologMoves_
bool isScheduled() const
Definition MoveNode.cc:409
virtual void unassign(MoveNode &node) override

References assert, createdPrologCopy_, MoveNodeDuplicator::disposeMoveNode(), BFOptimization::duplicator(), MoveNode::isScheduled(), BFKillNode::mn_, prologMN_, BFOptimization::prologMoves_, BFOptimization::prologRM(), SimpleResourceManager::unassign(), and BFKillNode::undoOnlyMe().

Here is the call graph for this function:

Member Data Documentation

◆ createdPrologCopy_

bool BFDRELoop::createdPrologCopy_
private

Definition at line 57 of file BFDRELoop.hh.

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

◆ prologMN_

MoveNode* BFDRELoop::prologMN_
private

Definition at line 56 of file BFDRELoop.hh.

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

◆ srcCycle_

unsigned int BFDRELoop::srcCycle_
private

Definition at line 55 of file BFDRELoop.hh.

Referenced by operator()().


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