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

#include <BFPostpassLoopDRE.hh>

Inheritance diagram for BFPostpassLoopDRE:
Inheritance graph
Collaboration diagram for BFPostpassLoopDRE:
Collaboration graph

Public Member Functions

 BFPostpassLoopDRE (BF2Scheduler &sched, MoveNode &mn, int srcCycle)
 
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 Member Functions

bool dreAllowed ()
 

Private Attributes

MoveNodemn_
 
MoveNodeprologMN_
 
int srcCycle_
 

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 46 of file BFPostpassLoopDRE.hh.

Constructor & Destructor Documentation

◆ BFPostpassLoopDRE()

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

Definition at line 48 of file BFPostpassLoopDRE.hh.

48  :
49  BFOptimization(sched), mn_(mn), srcCycle_(srcCycle) {}

Member Function Documentation

◆ dreAllowed()

bool BFPostpassLoopDRE::dreAllowed ( )
private

Definition at line 88 of file BFPostpassLoopDRE.cc.

88  {
90  for (auto edge: edges) {
91  if (edge->edgeReason() == DataDependenceEdge::EDGE_OPERATION) {
92 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
93  std::cerr << "DRE not allowed due op edge: "
94  << edge->toString() << std::endl;
95 #endif
96  return false;
97  }
98  if ((edge->edgeReason() == DataDependenceEdge::EDGE_REGISTER ||
99  edge->edgeReason() ==DataDependenceEdge::EDGE_RA) &&
100  edge->dependenceType() == DataDependenceEdge::DEP_RAW) {
101 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
102  std::cerr << "DRE not allowed due edge: "
103  << edge->toString() << std::endl;
104 #endif
105  return false;
106  }
107  }
108  return true;
109 }

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

Referenced by operator()().

Here is the call graph for this function:

◆ operator()()

bool BFPostpassLoopDRE::operator() ( )
overridevirtual

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

Implements Reversible.

Definition at line 54 of file BFPostpassLoopDRE.cc.

54  {
55  if (!sched_.killDeadResults()) {
56  return false;
57  }
58 
59  if (!dreAllowed()) {
60  return false;
61  }
62 
63  // Create a copy to prolog.
65  if (prologMN_ == NULL) {
66  return false;
67  }
68 
69  int prologCycle = BF2Scheduler::PROLOG_CYCLE_BIAS + srcCycle_;
70  if (prologRM()->canAssign(prologCycle, *prologMN_)) {
71  prologRM()->assign(prologCycle, *prologMN_);
72 
73  // then remove
74  ddg().copyDepsOver(mn_, true, false);
75  ddg().dropNode(mn_);
77  return true;
78 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
79  } else {
80  std::cerr << "\t\t\t\tProlog cycle assign fail for loop-dre: "
81  << prologMN_->toString()
82  << " prolog cycle: " << prologCycle << std::endl;
83 #endif
84  }
85  return false;
86 }

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

Here is the call graph for this function:

◆ undoOnlyMe()

void BFPostpassLoopDRE::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 111 of file BFPostpassLoopDRE.cc.

111  {
115 }

References BFOptimization::ddg(), mn_, BF2Scheduler::nodeResurrected(), prologMN_, BFOptimization::prologRM(), BoostGraph< GraphNode, GraphEdge >::restoreNodeFromParent(), BFOptimization::sched_, and SimpleResourceManager::unassign().

Here is the call graph for this function:

Member Data Documentation

◆ mn_

MoveNode& BFPostpassLoopDRE::mn_
private

Definition at line 55 of file BFPostpassLoopDRE.hh.

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

◆ prologMN_

MoveNode* BFPostpassLoopDRE::prologMN_
private

Definition at line 56 of file BFPostpassLoopDRE.hh.

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

◆ srcCycle_

int BFPostpassLoopDRE::srcCycle_
private

Definition at line 57 of file BFPostpassLoopDRE.hh.

Referenced by operator()().


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
BFPostpassLoopDRE::srcCycle_
int srcCycle_
Definition: BFPostpassLoopDRE.hh:57
BF2Scheduler::killDeadResults
bool killDeadResults() const
Definition: BF2Scheduler.hh:110
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
DataDependenceEdge::EDGE_REGISTER
@ EDGE_REGISTER
Definition: DataDependenceEdge.hh:53
SimpleResourceManager::unassign
virtual void unassign(MoveNode &node) override
Definition: SimpleResourceManager.cc:252
BoostGraph::dropNode
virtual void dropNode(Node &node)
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
BFOptimization::prologRM
SimpleResourceManager * prologRM() const
Definition: BFOptimization.cc:77
BoostGraph< MoveNode, DataDependenceEdge >::EdgeSet
std::set< DataDependenceEdge *, typename DataDependenceEdge ::Comparator > EdgeSet
Definition: BoostGraph.hh:87
DataDependenceEdge::DEP_RAW
@ DEP_RAW
Definition: DataDependenceEdge.hh:47
DataDependenceEdge::EDGE_OPERATION
@ EDGE_OPERATION
Definition: DataDependenceEdge.hh:56
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
BF2Scheduler::PROLOG_CYCLE_BIAS
static const int PROLOG_CYCLE_BIAS
Definition: BF2Scheduler.hh:209
MoveNodeDuplicator::getMoveNode
MoveNode * getMoveNode(MoveNode &mn)
Definition: MoveNodeDuplicator.cc:85
BoostGraph::outEdges
virtual EdgeSet outEdges(const Node &node) const
BF2Scheduler::nodeResurrected
void nodeResurrected(MoveNode &mn)
Definition: BF2Scheduler.cc:811
BFPostpassLoopDRE::prologMN_
MoveNode * prologMN_
Definition: BFPostpassLoopDRE.hh:56
BF2Scheduler::nodeKilled
void nodeKilled(MoveNode &mn)
Definition: BF2Scheduler.cc:807
DataDependenceGraph::copyDepsOver
EdgeSet copyDepsOver(MoveNode &node, bool anti, bool raw)
Definition: DataDependenceGraph.cc:2422
BFPostpassLoopDRE::mn_
MoveNode & mn_
Definition: BFPostpassLoopDRE.hh:55
DataDependenceEdge::EDGE_RA
@ EDGE_RA
Definition: DataDependenceEdge.hh:57
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
BFPostpassLoopDRE::dreAllowed
bool dreAllowed()
Definition: BFPostpassLoopDRE.cc:88
BoostGraph::restoreNodeFromParent
void restoreNodeFromParent(GraphNode &node)