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

#include <BFPushDepsUp.hh>

Inheritance diagram for BFPushDepsUp:
Inheritance graph
Collaboration diagram for BFPushDepsUp:
Collaboration graph

Public Member Functions

 BFPushDepsUp (BF2Scheduler &sched, MoveNode &mn, int prefCycle)
 
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 ()
 

Static Public Attributes

static int recurseCounter_ = 0
 

Private Attributes

MoveNodemn_
 
int prefCycle_
 

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 43 of file BFPushDepsUp.hh.

Constructor & Destructor Documentation

◆ BFPushDepsUp()

BFPushDepsUp::BFPushDepsUp ( BF2Scheduler sched,
MoveNode mn,
int  prefCycle 
)
inline

Definition at line 46 of file BFPushDepsUp.hh.

47  :
48  BFOptimization(sched),
49  mn_(mn), prefCycle_(prefCycle) {}

Member Function Documentation

◆ operator()()

bool BFPushDepsUp::operator() ( )
virtual

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

Implements Reversible.

Definition at line 41 of file BFPushDepsUp.cc.

41  {
42 
43  if (prefCycle_ < 0) {
44  std::cerr << "push deps up prefcycle negative! "
45  << prefCycle_ << " move: " << mn_.toString() << std::endl;
46  assert(false);
47  }
48 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
50  for (int i = 0; i < recurseCounter_*2; i++)
51  std::cerr << "\t";
52  std::cerr << "\tPushing loop deps up: " << mn_.toString() << std::endl;
53 #endif
54 
55  bool pushed = false;
57  for (auto e : inEdges) {
58  MoveNode& loopDepTail = ddg().tailNode(*e);
59  if (loopDepTail.isScheduled()) {
60  int eLat = ddg().edgeLatency(*e, ii(), &loopDepTail, &mn_);
61  int prefTailCycle = prefCycle_ - eLat;
62 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
63  std::cerr << "\t\t\tmy prefcycle is: " << prefCycle_
64  << " latency is: " << eLat
65  << " so preftailcycle is: " << prefTailCycle
66  << std::endl;
67  std::cerr << "\t\t\t\tedge: " <<e->toString() << std::endl;
68 #endif
69  if (loopDepTail.cycle() > prefTailCycle) {
70  if (prefTailCycle < 0) {
71 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
73 #endif
75  return false;
76  }
77  BFOptimization* pushMoveUp;
78  if (loopDepTail.isSourceOperation()) {
79  pushMoveUp =
80  new BFPushMoveUp2(sched_, loopDepTail, prefTailCycle);
81  } else {
82  pushMoveUp =
83  new BFPushMoveUp(sched_, loopDepTail, prefTailCycle);
84  }
85  if (runPreChild(pushMoveUp)) {
86 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
87  for (int i = 0; i < recurseCounter_*2; i++)
88  std::cerr << "\t";
89  std::cerr << "\tpushed up succesfully: "
90  << loopDepTail.toString()
91  << " preChildren size: "
92  << preChildren_.size() << std::endl;
93 #endif
94  pushed = true;
95  } else {
96 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
97  for (int i = 0; i < recurseCounter_*2; i++)
98  std::cerr << "\t";
99  std::cerr << "\t\tpushing up fail: "
100  << loopDepTail.toString()
101  << " preChildren size: "
102  << preChildren_.size() << std::endl;
103 #endif
105 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
106  recurseCounter_--;
107 #endif
108  return false;
109  }
110  }
111  }
112  }
113 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
114  recurseCounter_--;
115 #endif
116 
117  return pushed;
118 }

References assert, MoveNode::cycle(), BFOptimization::ddg(), DataDependenceGraph::edgeLatency(), BFOptimization::ii(), BoostGraph< GraphNode, GraphEdge >::inEdges(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), mn_, Reversible::preChildren_, prefCycle_, recurseCounter_, Reversible::runPreChild(), BFOptimization::sched_, BoostGraph< GraphNode, GraphEdge >::tailNode(), MoveNode::toString(), and Reversible::undoAndRemovePreChildren().

Here is the call graph for this function:

Member Data Documentation

◆ mn_

MoveNode& BFPushDepsUp::mn_
private

Definition at line 52 of file BFPushDepsUp.hh.

Referenced by operator()().

◆ prefCycle_

int BFPushDepsUp::prefCycle_
private

Definition at line 53 of file BFPushDepsUp.hh.

Referenced by operator()().

◆ recurseCounter_

int BFPushDepsUp::recurseCounter_ = 0
static

Definition at line 45 of file BFPushDepsUp.hh.

Referenced by operator()().


The documentation for this class was generated from the following files:
Reversible::undoAndRemovePreChildren
void undoAndRemovePreChildren()
Definition: Reversible.cc:80
BoostGraph::tailNode
virtual Node & tailNode(const Edge &edge) const
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
DataDependenceGraph::edgeLatency
int edgeLatency(const DataDependenceEdge &edge, int ii, const MoveNode *tail, const MoveNode *head) const
Definition: DataDependenceGraph.cc:311
BFOptimization::ii
unsigned int ii() const
Definition: BFOptimization.cc:85
MoveNode
Definition: MoveNode.hh:65
BFOptimization
Definition: BFOptimization.hh:73
Reversible::preChildren_
std::stack< Reversible * > preChildren_
Definition: Reversible.hh:57
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
BFPushMoveUp
Definition: BFPushMoveUp.hh:48
assert
#define assert(condition)
Definition: Application.hh:86
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
BoostGraph< MoveNode, DataDependenceEdge >::EdgeSet
std::set< DataDependenceEdge *, typename DataDependenceEdge ::Comparator > EdgeSet
Definition: BoostGraph.hh:87
MoveNode::isSourceOperation
bool isSourceOperation() const
Definition: MoveNode.cc:168
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
BFPushDepsUp::prefCycle_
int prefCycle_
Definition: BFPushDepsUp.hh:53
BoostGraph::inEdges
virtual EdgeSet inEdges(const Node &node) const
BFPushDepsUp::mn_
MoveNode & mn_
Definition: BFPushDepsUp.hh:52
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
Reversible::runPreChild
bool runPreChild(Reversible *preChild)
Definition: Reversible.cc:127
BFPushMoveUp2
Definition: BFPushMoveUp2.hh:51
MoveNode::isScheduled
bool isScheduled() const
Definition: MoveNode.cc:409
BFPushDepsUp::recurseCounter_
static int recurseCounter_
Definition: BFPushDepsUp.hh:45