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

#include <BFPushAntidepsDown.hh>

Inheritance diagram for BFPushAntidepsDown:
Inheritance graph
Collaboration diagram for BFPushAntidepsDown:
Collaboration graph

Public Member Functions

 BFPushAntidepsDown (BF2Scheduler &sched, MoveNode &adepSrc, int oldLC, int maxLC)
 
bool operator() ()
 
- 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

MoveNodeadepSource_
 
int oldLC_
 
int maxLC_
 

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)
 
virtual void undoOnlyMe ()
 
- 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 44 of file BFPushAntidepsDown.hh.

Constructor & Destructor Documentation

◆ BFPushAntidepsDown()

BFPushAntidepsDown::BFPushAntidepsDown ( BF2Scheduler sched,
MoveNode adepSrc,
int  oldLC,
int  maxLC 
)
inline

Definition at line 46 of file BFPushAntidepsDown.hh.

47  :
48  BFOptimization(sched),
49  adepSource_(adepSrc), oldLC_(oldLC), maxLC_(maxLC) {}

Member Function Documentation

◆ operator()()

bool BFPushAntidepsDown::operator() ( )
virtual

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

Implements Reversible.

Definition at line 46 of file BFPushAntidepsDown.cc.

46  {
47 
49  int newLC = maxLC_;
50 
51  std::list<BFPushAntidepDown*> rescheds;
52 
53  for (auto e: outEdges) {
54  if ((e->edgeReason() == DataDependenceEdge::EDGE_REGISTER ||
55  e->edgeReason() == DataDependenceEdge::EDGE_RA) &&
56  e->isFalseDep()) {
57  MoveNode& aDepHead = ddg().headNode(*e);
58  if (!aDepHead.isScheduled()) {
59  continue;
60  }
61  int cycle = aDepHead.cycle();
62  int lat = 1;
63  if (e->guardUse()) {
64  lat = adepSource_.guardLatency();
65  }
66  if (cycle + lat > maxLC_) {
67  continue;
68  }
69  int dstLC = ddg().latestCycle(aDepHead);
70 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
71  std::cerr << "\t\tShould rescheduling move at: "
72  << aDepHead.toString() << std::endl;
73  std::cerr << "\t\tdstLC: " << dstLC << std::endl;
74 #endif
75  if (dstLC > aDepHead.cycle()) {
76  rescheds.push_back(
77  new BFPushAntidepDown(sched_, aDepHead, lat, newLC));
78  }
79 
80 
81  int curLC = dstLC - lat + 1;
82  if (curLC < newLC) {
83  newLC = curLC;
84  }
85  }
86  }
87  // can we improve the situation at all?
88  if (newLC <= oldLC_) {
89 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
90  std::cerr << "newLC: " << newLC << " old LC: " << oldLC_ << std::endl;
91 #endif
92  for (std::list<BFPushAntidepDown*>::iterator i = rescheds.begin();
93  i != rescheds.end();) {
94  BFPushAntidepDown* bfo = *i;
95  delete bfo;
96  rescheds.erase(i++);
97  }
98 // assert(rescheds.empty());
99  return false;
100  } else {
101 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
102  std::cerr << "\t\t\tCould improve? newLC: " << newLC << std::endl;
103 #endif
104  }
105 
106  for (auto i = rescheds.begin(); i != rescheds.end();) {
107  BFPushAntidepDown* bfo = *i;
108  rescheds.erase(i++);
109  runPostChild(bfo);
110  }
111  return !postChildren_.empty();
112 }

References adepSource_, MoveNode::cycle(), BFOptimization::ddg(), DataDependenceEdge::EDGE_RA, DataDependenceEdge::EDGE_REGISTER, MoveNode::guardLatency(), BoostGraph< GraphNode, GraphEdge >::headNode(), MoveNode::isScheduled(), DataDependenceGraph::latestCycle(), maxLC_, oldLC_, BoostGraph< GraphNode, GraphEdge >::outEdges(), Reversible::postChildren_, Reversible::runPostChild(), BFOptimization::sched_, and MoveNode::toString().

Here is the call graph for this function:

Member Data Documentation

◆ adepSource_

MoveNode& BFPushAntidepsDown::adepSource_
private

Definition at line 52 of file BFPushAntidepsDown.hh.

Referenced by operator()().

◆ maxLC_

int BFPushAntidepsDown::maxLC_
private

Definition at line 54 of file BFPushAntidepsDown.hh.

Referenced by operator()().

◆ oldLC_

int BFPushAntidepsDown::oldLC_
private

Definition at line 53 of file BFPushAntidepsDown.hh.

Referenced by operator()().


The documentation for this class was generated from the following files:
Reversible::postChildren_
std::stack< Reversible * > postChildren_
Definition: Reversible.hh:58
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
BoostGraph::headNode
virtual Node & headNode(const Edge &edge) const
MoveNode
Definition: MoveNode.hh:65
DataDependenceEdge::EDGE_REGISTER
@ EDGE_REGISTER
Definition: DataDependenceEdge.hh:53
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
MoveNode::guardLatency
int guardLatency() const
Definition: MoveNode.cc:779
BoostGraph< MoveNode, DataDependenceEdge >::EdgeSet
std::set< DataDependenceEdge *, typename DataDependenceEdge ::Comparator > EdgeSet
Definition: BoostGraph.hh:87
BFPushAntidepsDown::maxLC_
int maxLC_
Definition: BFPushAntidepsDown.hh:54
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
BFPushAntidepsDown::adepSource_
MoveNode & adepSource_
Definition: BFPushAntidepsDown.hh:52
BoostGraph::outEdges
virtual EdgeSet outEdges(const Node &node) const
BFPushAntidepDown
Definition: BFPushAntidepDown.hh:48
MoveNode::isScheduled
bool isScheduled() const
Definition: MoveNode.cc:409
Reversible::runPostChild
bool runPostChild(Reversible *preChild)
Definition: Reversible.cc:139
DataDependenceEdge::EDGE_RA
@ EDGE_RA
Definition: DataDependenceEdge.hh:57
BFPushAntidepsDown::oldLC_
int oldLC_
Definition: BFPushAntidepsDown.hh:53
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